/*
 * Healthier Essex — phone layout (Figma section "Phone": start / mission /
 * menu / accessibility, 390 × 844). Applies at ≤ 640 px; between 641 and
 * 900 px the desktop rules already stack columns and the fluid clamp()
 * type scale carries the sizes down.
 */

@media (max-width: 640px) {
  :root {
    --margin: 20px;
    --section-pad: 40px;
    --chapter-pad-right: 20px;
  }

  /* ---------- Type (phone values from the Phone frames) ---------- */
  .t-title { font-size: 40px; line-height: 40px; letter-spacing: -0.02em; }
  .t-h1    { font-size: 32px; line-height: 34px; }
  .t-strap { font-size: 28px; line-height: 32px; }
  .t-h2, .t-quote { font-size: 20px; line-height: 24px; }
  .t-h3    { font-size: 20px; line-height: 24px; }
  .t-body  { font-size: 16px; line-height: 20px; letter-spacing: -0.01em; }
  .t-xs, body { font-size: 16px; line-height: 20px; letter-spacing: -0.01em; }
  .t-spec  { font-size: 12px; line-height: 14px; }

  /* ---------- Chrome ---------- */
  .wrap.pad { padding-top: 24px; }
  .topbar { height: 36px; }

  /* ---------- Hero (start / phone) ---------- */
  .hero {
    min-height: 0;
    height: 100svh;
    max-height: 900px;
  }
  .hero__inner {
    inset: 24px 20px 48px;
  }
  .hero__titles {
    top: 45%;
  }
  .clip--sub .t-strap {
    font-weight: 300;
    font-size: 20px;
    line-height: 24px;
  }
  .hero__info {
    gap: 4px;
  }
  .hero__info-row .btn-circle {
    display: none;            /* phone: the settings button lives in the footer */
  }
  .hero__cta {
    max-width: 260px;
    font-size: 16px;
    line-height: 20px;
  }
  .hero__cta .link-essex {
    color: var(--accent-text);
  }
  .hero__credit {
    border-top: 1px solid var(--fg-muted);
    padding-top: 6px;
    font-weight: 300;
  }
  .hero__credit a {
    color: var(--accent-text);
  }

  /* ---------- Landing chapters ---------- */
  .insights__col {
    width: 100%;
    gap: 40px;
  }
  .chapter-block {
    gap: 80px;
  }
  .chapter-block__group {
    gap: 40px;
  }
  .obesity {
    padding-block: 24px;
    gap: 24px;
  }
  .obesity__titles {
    width: 100%;
  }
  .obesity__clusters {
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
  }
  .dots {
    zoom: 0.85;
  }
  .obesity__legends {
    flex-direction: column;
    gap: 12px;
  }
  .districts {
    gap: 12px 20px;
  }
  .chart {
    grid-template-columns: 1fr;
  }
  .chart__ylabel {
    display: none;
  }

  /* ---------- Footer (phone) ---------- */
  .site-footer {
    padding: 40px 20px;
  }
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer__client {
    width: 120px;
    height: 29px;
  }
  .footer__main {
    min-height: 0;
    gap: 32px;
  }
  .footer__top {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer__contact .footer__block + .footer__block {
    margin-top: 24px;
  }
  .footer__contact p + p {
    margin-top: 8px;
  }
  .footer__settings {
    padding: 0;
    gap: 12px;
    align-items: flex-start;
    max-width: 320px;
  }
  .footer__settings .btn-circle {
    width: 28px;
    height: 28px;
  }
  .footer__bottom {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .footer__bottom > :first-child {
    display: none;            /* phone footer: cookie preferences + copyright only */
  }
  .footer__bottom > :last-child {
    order: -1;
  }

  /* ---------- Menu overlay (menu / phone) ---------- */
  .overlay--menu .overlay__panel {
    padding: 24px 24px 40px;
    gap: 32px;
  }
  .menu__body {
    display: contents;        /* lets the photo sit between the links and the details */
  }
  .menu__links {
    order: 2;
    font-size: 28px;
    line-height: 32px;
    letter-spacing: -0.02em;
  }
  .menu__photo {
    display: block;
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    order: 3;
    width: 100%;
    height: 220px;
    flex: 0 0 220px;
  }
  .menu__foot {
    order: 4;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    padding-top: 0;
  }
  .menu__contact .footer__block + .footer__block {
    margin-top: 24px;
  }
  .menu__contact p + p {
    margin-top: 6px;
  }
  .menu__brand {
    padding-top: 16px;
  }
  .menu__brand img {
    width: 120px;
    height: 28px;
  }

  /* ---------- Admin overlay ---------- */
  .overlay--admin .overlay__panel {
    padding: 24px 20px 40px;
  }

  /* ---------- Site settings (accessibility / phone) ---------- */
  .overlay--settings .overlay__panel {
    padding: 40px 20px;
    max-height: 100svh;
    overflow: auto;
  }
  .settings {
    flex-direction: column;
    position: relative;
  }
  .settings > .btn-circle {
    position: absolute;
    top: -20px;
    right: 0;
  }
  .settings__grid {
    flex-direction: column;
    gap: 28px;
    padding: 0;
  }
  .settings__intro {
    min-height: 0;
    gap: 16px;
    padding-right: 48px;
  }
  .settings__intro .t-h2 {
    font-size: 28px;
    line-height: 32px;
  }
  .settings__intro .t-xs {
    font-size: 16px;
    line-height: 20px;
  }
  .settings__options {
    min-height: 0;
    gap: 24px;
    padding-top: 28px;
    border-top: 1px solid var(--fg-muted);
  }
  .toggle {
    align-items: flex-start;
    padding-right: 42px;
  }
  .toggle__switch {
    margin-top: 1px;
  }

  /* ---------- Mission (mission / phone): stacked sticky cards ---------- */
  .mission {
    padding: 16px 20px 48px;
    gap: 32px;
  }
  .mission__intro {
    width: 100%;
    font-weight: 300;
  }
  .mission__list {
    gap: 0;
  }
  .mission__row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 20px;
    border-radius: 2px;
    background: var(--bg-alt);
    position: sticky;
    top: 0;
  }
  .mission__row > .t-quote:first-child {
    font-weight: 500;
    font-size: 32px;
    line-height: 34px;
    color: var(--accent-text);
  }
  .mission__row h2 {
    font-weight: 500;
    font-size: 20px;
    line-height: 24px;
  }
  .mission__row .t-body {
    max-width: none;
    font-size: 16px;
    line-height: 20px;
  }

  /* ---------- Explore ---------- */
  .explore {
    padding-top: 64px;
    gap: 64px;
  }
  .theme {
    padding: 20px;
  }
  .theme__text {
    margin-top: 24px;
  }
}
