/* Section layout (one block per Figma landing-page section, 01 → 22). */

@layer sections {
  /* 01 Navigation -------------------------------------------------------- */
  .site-nav {
    position: sticky;
    inset-block-start: 0;
    z-index: 50;
    padding: var(--v2-space-24) var(--nav-edge-gutter);
  }

  .site-nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--v2-space-20);
  }

  /* 02 Hero ---------------------------------------------------------------- */
  .hero {
    position: relative;
    display: grid;
    place-items: center;
    min-block-size: min(50.625rem, 100svh - var(--nav-height)); /* 810 */
    padding: var(--v2-space-96) var(--v2-page-gutter);
    overflow: clip;
    isolation: isolate;
  }

  .hero__bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
  }

  .hero__copy {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-24);
    max-inline-size: var(--v2-reading-width);
    text-align: center;
  }

  .hero__title {
    color: var(--v2-cyan);
  }

  .hero .presented-by {
    margin-block-start: calc(var(--v2-space-16) - var(--v2-space-24));
  }

  /* 03 / 18 Letters -------------------------------------------------------- */
  .letter,
  .closing {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-64);
  }

  /* 05 Sector and study -------------------------------------------------- */
  .sector {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-48);
    padding-block: var(--v2-space-96);

    & h2 {
      color: var(--v2-navy);
    }

    & > .frame {
      --stack-gap: var(--v2-space-48);
    }
  }

  .sector__title,
  .sector__intro,
  .sector__outro {
    max-inline-size: var(--v2-reading-width);
  }

  /* 07 Executive summary ---------------------------------------------------- */
  .questions {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-48);
  }

  .question {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-16);
  }

  .question__num {
    color: var(--v2-teal);
  }

  /* 08 Statistics ----------------------------------------------------------- */
  .stats {
    padding: var(--v2-space-96) var(--v2-page-gutter);
  }

  /* Values never wrap; on the narrowest phones they shrink to fit the
     2 × 2 grid ("3 IN 10" is the widest). */
  .stats .stat__value {
    font-size: min(var(--v2-statistic-size), 12.5vw);
    white-space: nowrap;
  }

  .stat--light .stat__value {
    color: var(--v2-white);
  }

  .stats__row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--v2-space-32);

    /* 1px navy dividers between columns (desktop). */
    @media (width > 64rem) {
      column-gap: 0;

      & > li {
        padding-inline: var(--v2-space-16);
      }

      & > li + li {
        border-inline-start: 1px solid var(--v2-navy);
      }
    }

    /* Tablet + mobile: 2 × 2 grid. A full-width navy rule between the rows,
       and a vertical rule between the columns that stops short of it. */
    @media (width <= 64rem) {
      --stat-pad: var(--v2-space-24);
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0;

      & > li {
        position: relative;
        padding: var(--stat-pad) var(--v2-space-12);
      }

      & > li:nth-child(-n + 2) {
        padding-block-start: 0;
        border-block-end: 1px solid var(--v2-navy);
      }

      & > li:nth-child(n + 3) {
        padding-block-end: 0;
      }

      & > li:nth-child(even)::before {
        content: "";
        position: absolute;
        inset-inline-start: 0;
        inset-block: 0 var(--stat-pad);
        border-inline-start: 1px solid var(--v2-navy);
      }

      & > li:nth-child(4)::before {
        inset-block: var(--stat-pad) 0;
      }
    }

    @media (width <= 30rem) {
      & > li {
        padding-inline: 0.25rem;
      }
    }
  }

  /* 10 / 16 Chapters --------------------------------------------------------- */
  .chapters__title {
    max-inline-size: var(--v2-reading-width);
    color: var(--v2-cyan);
  }

  .chapters--tiles {
    padding-block: var(--v2-space-96);
  }

  .chapters--sky .chapters__title {
    color: var(--v2-navy);
  }

  /* 11 Methodology ----------------------------------------------------------- */
  .methodology .colchart,
  .methodology .parish-map {
    margin-block-start: 0;
  }

  /* 14 Key findings summary ------------------------------------------------ */
  .findings-summary__intro {
    --stack-gap: var(--v2-space-24);
    max-inline-size: var(--v2-reading-width);
  }

  .findings-summary {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-32);
    padding: 4.5rem var(--v2-page-gutter); /* 72 */
  }

  /* 21 Acknowledgements -------------------------------------------------- */
  .ack-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--v2-space-40);
  }

  /* 22 Footer ------------------------------------------------------------- */
  .site-footer {
    padding: var(--v2-space-48) var(--v2-page-gutter);
  }

  .site-footer__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--v2-space-24);
  }

  .site-footer__row--top {
    align-items: flex-start;
  }

  .site-footer__title {
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-8);
    max-inline-size: var(--v2-feature-reading-width);
  }

  .site-footer__row--partners {
    align-items: flex-end;

    & .presented-by {
      justify-content: flex-start;
    }
  }

  .site-footer a.text-link:hover {
    color: var(--v2-yellow);
  }

  .site-footer__lsuno {
    inline-size: 7rem; /* 112 */
    block-size: auto;
  }

  /* Responsive ------------------------------------------------------------
     Tablet frame (1024) and mobile frame (393) from Figma. */
  @media (width <= 64rem) {
    .ack-columns {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .feature-split__text {
      padding: var(--v2-space-96) var(--v2-space-64);
    }

    /* Tablet brand split (Figma 1024 frame): 320px panel, 64px text
       padding, a 304.64 × 587 chevron hanging 32px off the left edge. */
    .brand-split__art {
      min-block-size: 20rem;
    }

    .brand-split__text {
      padding: var(--v2-space-64);
    }

    .brand-split__chevron {
      inset-inline-start: -2rem;
      inline-size: 19.04rem; /* 304.64 */
    }

    .lens__reading {
      padding: var(--v2-space-40);
    }

    .lens__scroll-hint {
      inset-inline-start: var(--v2-space-40);
      inset-block-end: var(--v2-space-12);
    }
  }

  @media (width <= 48rem) {
    /* Footer partner logos (BCM, LSU Health): much smaller on mobile. */
    .site-footer__row--partners :is(.presented-by img, .site-footer__lsuno) {
      inline-size: 4rem; /* 64, down from 112 */
    }

    /* Mobile nav (Figma 393 frame): logo above the button, both centred. */
    .site-nav {
      padding: var(--v2-space-24) var(--v2-space-16);
    }

    .site-nav__inner {
      flex-direction: column;
      justify-content: center;
    }

    .site-nav .logo {
      inline-size: 16.25rem; /* 260 */
    }

    /* Brand and feature splits stack (image above copy). */
    .brand-split,
    .feature-split {
      grid-template-columns: 1fr;
    }

    /* Mobile brand split (Figma 393 frame): 160px panel above the copy,
       a 220 × 424 chevron at the left of a centred 237.527-wide box. */
    .brand-split__art {
      min-block-size: 10rem;
    }

    .brand-split__chevron {
      inset-inline-start: calc(50% - 7.4227rem); /* 237.527 / 2 */
      inline-size: 13.75rem; /* 220 */
    }

    .brand-split__text {
      padding: var(--v2-space-48) var(--v2-space-24);
    }

    .feature-split__text {
      padding: var(--v2-space-64) var(--v2-page-gutter);
    }

    .feature-split__media {
      order: -1;
      min-block-size: 16rem;
    }

    /* Lens: photo above copy, reading area grows to content. */
    .lens {
      --lens-viewport: 18rem;
    }

    /* Photo, then the thumbnail strip directly under it, then the copy. */
    .lens {
      display: flex;
      flex-direction: column;
    }

    .lens__story {
      display: contents;
    }

    .lens__tabs {
      order: 1;
    }

    .lens__reading {
      order: 2;
    }

    .lens__photo {
      block-size: 14rem;
    }

    .lens__reading {
      padding: var(--v2-space-24);
    }

    .lens__scroll-hint {
      position: static;
    }

    /* Mobile Lens selector: scrollable strip, 48px closed / 112px selected. */
    .lens__tabs {
      overflow-x: auto;
      scrollbar-width: none;
    }

    /* Tabs grow to fill the strip when it is wider than they need (keeping
       the 48:112 ratio) and scroll when it is narrower. */
    .lens__tab {
      flex: 1 0 3rem;

      &[aria-selected="true"] {
        flex: 2.3333 0 7rem;
      }
    }

    .lens__indicator {
      display: none;
    }

    .lens__tab[aria-selected="true"]::after {
      content: "";
      position: absolute;
      inset: auto 0 0;
      block-size: 4px;
      background: var(--v2-yellow);
    }

    .peek-carousel {
      --peek-offset: 2rem;
    }

    .peek-slide.is-prev,
    .peek-slide.is-next {
      opacity: 0;
    }

    .ack-columns {
      grid-template-columns: 1fr;
    }

    .site-footer__row {
      flex-direction: column;
      align-items: flex-start;
    }

  }
}
