/*
  Pampu homepage styles ("Liquid Glass 2.0": editorial canvas, opaque content cards, restrained motion).
  Everything sits in @layer pages and uses the semantic tokens from site.css, so Light and [data-theme="dark"]
  both work automatically. The cinema (#condo-story) and finale card live in cinema.css.
*/
@layer pages {
  /* -------------------------------------------------------------------------
     Status pill (ochre highlight tag)
  ------------------------------------------------------------------------- */
  .hp-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-pill);
    font-size: var(--fs-label);
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
  }

  .hp-pill--gold {
    background: var(--color-highlight-soft);
    color: var(--color-highlight-ink);
  }

  .hp-pill__dot {
    flex: none;
    inline-size: 0.375rem;
    block-size: 0.375rem;
    border-radius: var(--radius-pill);
    background: var(--color-highlight);
  }

  /* -------------------------------------------------------------------------
     1. Opening editorial teaser hero (#top)
     Plain copy on the alabaster canvas beside the one signature leaf photo.
     Phones: copy first, then the photo; wide screens: copy left, photo right
     with real whitespace and zero overlap.
  ------------------------------------------------------------------------- */
  .teaser {
    display: grid;
    align-items: center;
    min-block-size: 100vh;
    min-block-size: 100svh;
    padding-block: clamp(6.5rem, 10vw, 8.5rem) clamp(2.5rem, 5vw, 4rem);
  }

  .teaser__stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: clamp(2rem, 5vw, 3.5rem);
  }

  @media (max-width: 61.99rem) {
    .teaser__stage {
      max-inline-size: 36rem;
    }
  }

  .teaser__pane {
    position: relative;
  }

  /* The one signature leaf shape on the site */
  .teaser__photo {
    position: relative;
    overflow: clip;
    inline-size: 100%;
    aspect-ratio: 4 / 5;
    max-block-size: 54vh;
    max-block-size: 54svh;
    border-radius: var(--radius-leaf);
    background: var(--sand-2, var(--color-surface));
    box-shadow: 0 20px 44px -22px color-mix(in oklab, var(--espresso, #613D10) 42%, transparent);
  }

  /* <picture> only negotiates WebP vs JPEG; it must not add a box between the frame and the image */
  .teaser__photo > picture {
    display: contents;
  }

  .teaser__img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    /* Keeps the therapist and her kit bag in frame in every crop */
    object-position: 42% 58%;
  }

  @media (min-width: 62rem) {
    .teaser__stage {
      grid-template-columns: minmax(0, 1fr) auto;
      gap: clamp(2.5rem, 5vw, 4.5rem);
    }

    .teaser__pane {
      grid-column: 1;
    }

    .teaser__photo {
      grid-column: 2;
      inline-size: auto;
      block-size: clamp(28rem, calc(100vh - 11rem), 44rem);
      block-size: clamp(28rem, calc(100svh - 11rem), 44rem);
      max-block-size: none;
      aspect-ratio: 3 / 4;
    }
  }

  /* The headline sizes to its column so each line stays whole; 4.5rem stays zoom-friendly */
  .teaser__copy {
    container-type: inline-size;
  }

  .teaser__title {
    margin-block-start: 1.25rem;
    color: var(--color-text);
    font-size: clamp(1.875rem, 1.15rem + 3.4vw, 4.5rem);
    line-height: 1.04;
    letter-spacing: var(--tracking-heading, -0.02em);
  }

  @supports (font-size: 1cqi) {
    .teaser__title {
      font-size: clamp(1.875rem, 11.2cqi, 4.5rem);
    }
  }

  .teaser__title em {
    font-style: normal;
    color: var(--color-accent);
    background: linear-gradient(120deg var(--in-oklab), var(--color-link), var(--color-accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  @media (forced-colors: active) {
    .teaser__title em {
      background: none;
      -webkit-text-fill-color: currentColor;
      color: inherit;
    }
  }

  .teaser__line {
    display: block;
  }

  .teaser__lede {
    max-inline-size: 48ch;
    margin-block-start: 1.25rem;
    color: var(--color-text-secondary);
    font-size: var(--fs-lede);
    line-height: var(--leading-body, 1.6);
    text-wrap: pretty;
  }

  .teaser__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    margin-block-start: clamp(1.5rem, 3vw, 2.25rem);
  }

  .teaser__cue {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-block-size: 2.75rem;
    color: var(--color-text);
    font-weight: 800;
    text-decoration: none;
  }

  .teaser__cue:hover {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.25em;
  }

  .teaser__cue-icon {
    flex: none;
    rotate: 90deg;
  }

  @media (prefers-reduced-motion: no-preference) {
    .teaser__cue {
      transition: color var(--dur-snap, 180ms) var(--ease-snap, cubic-bezier(0.2, 0.8, 0.2, 1));
    }

    .teaser__cue-icon {
      transition: translate var(--dur-snap, 180ms) var(--ease-snap, cubic-bezier(0.2, 0.8, 0.2, 1));
    }

    .teaser__cue:hover .teaser__cue-icon {
      translate: 0 2px;
    }

    .teaser__cue:active .teaser__cue-icon {
      translate: 0 3px;
    }
  }

  /* -------------------------------------------------------------------------
     2. A brief curated glimpse (#glimpse)
     No glass band: whitespace and 1px hairline dividers, copy (7fr) beside
     three opaque surface cards (5fr) on wide screens, stacked on phones.
     When the fixed dusk sky arrives (while the lower half of #glimpse is still
     in view), loose text and hairlines crossfade to the dark-chapter tokens
     while the opaque pillar cards keep their own surface contrast.
  ------------------------------------------------------------------------- */
  .glimpse {
    --dusk-text: #F6EEE3;
    --dusk-text-secondary: #D9C6AE;
    --dusk-hairline: rgba(255, 226, 190, 0.15);
    --dusk-link: #F6B26A;
    --dusk-accent: #F2A85A;
    padding-block: clamp(1.5rem, 4vw, 3rem) clamp(4rem, 8vw, 6.5rem);
  }

  .glimpse__band {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(2.25rem, 4.5vw, 4rem);
    padding-block-start: clamp(3rem, 7vw, 5.5rem);
    border-block-start: 1px solid var(--color-hairline);
  }

  @media (min-width: 64rem) {
    .glimpse__band {
      grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
      align-items: center;
    }
  }

  /* The title sizes to its column so each sentence keeps to one line */
  .glimpse__copy {
    container-type: inline-size;
  }

  .glimpse__title {
    font-size: clamp(1.75rem, 1rem + 3.2vw, 4rem);
    line-height: 1.08;
    letter-spacing: var(--tracking-heading, -0.02em);
  }

  @supports (font-size: 1cqi) {
    .glimpse__title {
      font-size: clamp(1.5rem, 7.5cqi, clamp(1.75rem, 1rem + 3.2vw, 4rem));
    }
  }

  .glimpse__dim,
  .glimpse__warm {
    display: block;
    text-wrap: balance;
  }

  .glimpse__dim {
    color: var(--color-text-secondary);
  }

  .glimpse__warm {
    color: var(--color-link);
    background: linear-gradient(120deg var(--in-oklab), var(--color-link), #9E631D);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  :root[data-theme="dark"] .glimpse__warm {
    background: linear-gradient(120deg var(--in-oklab), #F6B26A, #F29938);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  @media (forced-colors: active) {
    .glimpse__warm {
      background: none;
      -webkit-text-fill-color: currentColor;
      color: inherit;
    }
  }

  .glimpse__lede {
    max-inline-size: 52ch;
    margin-block-start: clamp(1rem, 2vw, 1.25rem);
    color: var(--color-text-secondary);
    font-size: var(--fs-lede);
    line-height: var(--leading-body, 1.6);
    text-wrap: pretty;
  }

  /* Partner link separated from the intro paragraph by a 1px hairline rule */
  .glimpse__partners {
    margin-block-start: 1.75rem;
    padding-block-start: 1.125rem;
    border-block-start: 1px solid var(--color-hairline);
    color: var(--color-text-secondary);
    font-size: var(--fs-small);
    font-weight: 700;
    line-height: var(--leading-body, 1.6);
  }

  /* Padding lifts the inline link to a 44px tap target without breaking the line */
  .glimpse__partners a {
    display: inline-block;
    padding-block: 0.6875rem;
    color: var(--color-link);
    font-weight: 800;
  }

  :root[data-light="dusk"] .glimpse__band {
    border-block-start-color: var(--dusk-hairline);
  }

  :root[data-light="dusk"] .glimpse__copy {
    --color-accent: var(--dusk-accent);
    --focus-ring: var(--dusk-accent);
  }

  :root[data-light="dusk"] .glimpse__warm {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--dusk-text);
  }

  :root[data-light="dusk"] :is(.glimpse__dim, .glimpse__lede, .glimpse__partners) {
    color: var(--dusk-text-secondary);
  }

  :root[data-light="dusk"] .glimpse__partners {
    border-block-start-color: var(--dusk-hairline);
  }

  :root[data-light="dusk"] .glimpse__partners a {
    color: var(--dusk-link);
  }

  /* Editorial proof checklist: whitespace, 1px hairline dividers, and plain leaf-green ticks */
  .glimpse__checklist {
    display: flex;
    flex-direction: column;
  }

  .glimpse__check-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-block: clamp(1.125rem, 2vw, 1.5rem);
    border-block-start: 1px solid var(--color-hairline);
    color: var(--color-text);
    font-family: var(--font-display);
    font-size-adjust: var(--fsa-display);
    font-size: clamp(1.2rem, 1.05rem + 0.55vw, 1.5rem);
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: var(--tracking-heading, -0.02em);
  }

  .glimpse__check-item:last-child {
    border-block-end: 1px solid var(--color-hairline);
  }

  .glimpse__check-icon {
    flex: none;
    color: var(--color-verified);
  }

  :root[data-light="dusk"] .glimpse__check-item {
    color: var(--dusk-text);
    border-color: var(--dusk-hairline);
  }

  :root[data-light="dusk"] .glimpse__check-icon {
    color: var(--night-leaf, #BFE3A9);
  }

  @media (prefers-reduced-motion: no-preference) {
    .glimpse__band,
    .glimpse__partners,
    .glimpse__check-item {
      transition:
        color 1.2s cubic-bezier(0.65, 0, 0.35, 1),
        border-color 1.2s cubic-bezier(0.65, 0, 0.35, 1);
    }

    .glimpse__dim,
    .glimpse__warm,
    .glimpse__lede,
    .glimpse__partners a,
    .glimpse__check-icon {
      transition: color 1.2s cubic-bezier(0.65, 0, 0.35, 1);
    }
  }

  @media (forced-colors: active) {
    .hp-pill {
      border: 1px solid CanvasText;
    }

    .glimpse__check-item {
      border-color: CanvasText;
    }
  }

  /* -------------------------------------------------------------------------
     3. Inside a home wellness visit (#inside), on the bark night chapter
     A few hundred warm beads (pahinga-field.js, a fixed WebGL layer under the page
     content) pour in and pack into the Pampu mark under the title.
     The static mark stands in until the field's first frame, and for reduced
     motion, no WebGL and scripts off.
  ------------------------------------------------------------------------- */
  main {
    position: relative;
    z-index: 1;
  }

  /* The beads' layer (created by pahinga-field.js): fixed under the page content. While #inside rises, the script
     shifts it down with the section (translate), so the mark forms where the still mark sits. */
  .pahinga-field {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 0;
    block-size: 100vh;
    block-size: 100lvh;
    pointer-events: none;
  }

  .pahinga-field canvas {
    display: block;
    inline-size: 100%;
    block-size: 100%;
  }

  .inside {
    /* Espresso dusk night-chapter tokens (used on dusk in both light and dark themes, and when scripts are off) */
    --inside-bark: #24170A;
    --inside-text-dusk: #FFF8EE;
    --inside-ochre-dusk: #F2A85A;
    --inside-accent-dusk: #F2A85A;
    --inside-leaf-dusk: #6FA84E;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2rem;
    min-block-size: 110vh;
    min-block-size: 110svh;
    padding: clamp(6rem, 14vh, 9rem) var(--gutter);
    color: var(--color-text);
    text-align: center;
  }

  .inside__top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .inside__eyebrow {
    color: var(--color-highlight-ink);
  }

  .inside__title {
    max-inline-size: 22ch;
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
    letter-spacing: var(--tracking-heading, -0.02em);
  }

  /* Centred in the free space under the title (nothing else sits below it) */
  .inside__mark {
    display: block;
    flex: none;
    inline-size: 12rem;
    block-size: auto;
    margin-block: auto;
  }

  .inside__bubble {
    fill: var(--logo-bubble, #A96C23);
  }

  .inside__leaf {
    fill: var(--logo-leaf, #5B923E);
  }

  /* Once the stones have drawn their first frame they take the static mark's place (its box stays, so nothing shifts) */
  .has-field .inside__mark {
    visibility: hidden;
    opacity: 0;
  }

  :root[data-light="dusk"] .inside {
    --color-accent: var(--inside-accent-dusk);
    --focus-ring: var(--inside-accent-dusk);
    color: var(--inside-text-dusk);
  }

  :root[data-light="dusk"] .inside__eyebrow {
    color: var(--inside-ochre-dusk);
  }

  :root[data-light="dusk"] .inside__bubble {
    fill: var(--inside-text-dusk);
  }

  :root[data-light="dusk"] .inside__leaf {
    fill: var(--inside-leaf-dusk);
  }

  /* Scripts off: no light script and no stones, so the section carries its own espresso night chapter */
  @media (scripting: none) {
    .inside {
      --color-accent: var(--inside-accent-dusk);
      --focus-ring: var(--inside-accent-dusk);
      background: var(--inside-bark);
      color: var(--inside-text-dusk);
    }

    .inside__eyebrow {
      color: var(--inside-ochre-dusk);
    }

    .inside__bubble {
      fill: var(--inside-text-dusk);
    }

    .inside__leaf {
      fill: var(--inside-leaf-dusk);
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    /* The text and the mark change colour with the sky's 1.2s crossfade */
    .inside,
    .inside__eyebrow {
      transition: color 1.2s cubic-bezier(0.65, 0, 0.35, 1);
    }

    .inside__bubble,
    .inside__leaf {
      transition: fill 1.2s cubic-bezier(0.65, 0, 0.35, 1);
    }

    .inside__mark {
      transition:
        opacity 400ms var(--ease-snap, cubic-bezier(0.2, 0.8, 0.2, 1)),
        visibility 0s linear 400ms;
    }
  }

  /* -------------------------------------------------------------------------
     4. Finale typography inside #closing (low specificity; cinema.css may refine)
  ------------------------------------------------------------------------- */
  :where(.cinema__finale-title) {
    margin-block-start: 0.75rem;
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    line-height: 1.15;
    letter-spacing: var(--tracking-heading, -0.02em);
  }
}
