/*
 * About only (docs/design/components.md): the hero collage, the feeling
 * cards, the story timeline and the team, moved out of blocks.css, plus
 * their motion moved out of motion.css. Linked in the head by
 * site/snippets/layout.php only on pages whose markup has these classes
 * (peanut_scoped_css(); today About), right after the motion files, so the
 * cascade is the same as before the split. The carousel is in carousel.css.
 * Static styles in the "blocks" layer, movement in the "motion" layer (both declared in
 * tokens.css). The shared icon colors (.ic-fill and friends) for the story
 * and feeling icons stay in blocks.css with the icon cards.
 */

@layer blocks {
  /* Hero collage (hero layout "collage", About): the photo in a rounded frame
     with a mint, a peach and a small gold shape behind it and a round badge on
     it. The shapes are absolutely positioned inside the media column, so they
     take no layout; the frame's box comes from the image's width and height.
     The padding is the 4.5rem the frame's `sizes` subtracts. Soft parallax
     and float live in motion.css. Ink on the butter badge is 13.4:1; the
     gold disc is decoration only, no text on it. */

  .hero__media--collage {
    position: relative;
    width: 100%;
    max-width: 36rem;
    margin-inline: auto;
    padding: var(--space-3) 1rem var(--space-4);
  }

  .collage__shapes {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
  }

  .collage__shape {
    position: absolute;
    aspect-ratio: 1;
  }

  .collage__shape--mint {
    top: -4%;
    right: -6%;
    width: 46%;
    border-radius: 50%;
    background: var(--color-brand);
  }

  .collage__shape--peach {
    bottom: -2%;
    left: -5%;
    width: 30%;
    border-radius: 38% 62% 55% 45% / 48% 40% 60% 52%;
    background: var(--color-accent-2);
    rotate: 14deg;
  }

  .collage__shape--gold {
    top: 4%;
    left: 2%;
    width: 15%;
    border-radius: 50%;
    background: var(--color-gold-soft);
  }

  /* No outline: no other hero photo has one (design review 2026-10-22, #35) */
  .collage__frame {
    position: relative;
    z-index: 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--color-paper);
  }

  .collage__frame .hero__image {
    border-radius: inherit;
  }

  .collage__badge {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 7.5rem;
    height: 7.5rem;
    margin: 0;
    padding: 0.75rem;
    border: var(--border);
    border-radius: 50%;
    background: var(--color-butter);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: var(--weight-strong);
    line-height: 1.3;
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
    rotate: -10deg;
  }

  @media (min-width: 40rem) {
    .collage__badge {
      width: 8.5rem;
      height: 8.5rem;
      padding: 1.125rem;
    }
  }

  @media (min-width: 60rem) {
    .hero--has-collage .hero__body {
      grid-column: 2;
      padding-inline-end: var(--space-5);
    }

    .hero--has-collage .hero__media {
      grid-column: 3;
      max-width: none;
      padding: var(--space-4) var(--space-3) var(--space-5) var(--space-5);
    }
  }

  /* ---------- Feeling cards (cards block, feelings style; About) ---------- */

  /* Three playful cards in the pale brand tints (ink on them is 15.0, 13.5
     and 16.5:1), a hard ink shadow, a big icon on a white disc in the full
     color. They lift and tilt on hover, the icon wiggles (motion.css). */
  .feel-cards {
    margin: 0;
    padding: 0;
    list-style: none;
    gap: var(--space-4);
  }

  .feel-card {
    --accent: var(--color-brand);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    border: var(--border);
    border-radius: var(--radius-sm);
    background: var(--color-mint-pale);
    box-shadow: var(--shadow-hard);
    color: var(--color-ink);
  }

  .feel-card:nth-child(3n + 2) {
    --accent: var(--color-accent-2);
    background: var(--color-peach-pale);
  }

  /* The third color is butter with soft gold icon accents (yellow retired) */
  .feel-card:nth-child(3n) {
    --accent: var(--color-gold-soft);
    background: var(--color-butter);
  }

  .feel-card__icon {
    display: grid;
    place-items: center;
    width: 5rem;
    height: 5rem;
    border: var(--border);
    border-radius: 50%;
    background: var(--color-white);
  }

  .feel-card__icon svg {
    display: block;
    width: 3.25rem;
    height: 3.25rem;
  }

  .feel-card__title {
    margin: 0;
    font-size: var(--step-1);
    font-weight: var(--weight-heading-sm);
    line-height: var(--leading-heading);
  }

  /* ---------- Story timeline (story block, About) ---------- */

  /* A vertical ink line through one icon disc per chapter; the cards sit to
     the right on phones and alternate left and right from 64rem. ::before is
     the faint track, ::after the fill that motion.css ties to the scroll
     (complete without JS). Icon accents cycle mint, peach, gold. */
  /* the cards slide in sideways (motion.css): never a horizontal scroll */
  .block-story {
    overflow-x: clip;
  }

  .story {
    max-width: 64rem;
    margin-inline: auto;
    scroll-margin-top: var(--header-height);
  }

  .story__list {
    --line-x: 1.75rem;
    position: relative;
    display: grid;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .story__list::before,
  .story__list::after {
    content: "";
    position: absolute;
    top: 1.75rem;
    bottom: 1.75rem;
    left: calc(var(--line-x) - 0.5px);
    width: 1px;
    background: var(--color-ink);
  }

  .story__list::before {
    opacity: 0.2;
  }

  .story__list::after {
    transform-origin: 50% 0;
  }

  .story__chapter {
    position: relative;
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: var(--space-3);
    align-items: start;
  }

  .story__icon {
    --accent: var(--color-brand);
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border: var(--border);
    border-radius: 50%;
    background: var(--color-white);
  }

  .story__chapter:nth-child(3n + 2) .story__icon {
    --accent: var(--color-accent-2);
  }

  .story__chapter:nth-child(3n) .story__icon {
    --accent: var(--color-gold-soft);
  }

  .story__icon svg {
    display: block;
    width: 2.25rem;
    height: 2.25rem;
  }

  .story__card {
    padding: var(--space-4);
    border: var(--border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
  }

  .story__num {
    margin: 0;
  }

  .story__title {
    margin: var(--space-1) 0 0;
    font-size: var(--step-2);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .story__text {
    margin-block-start: var(--space-2);
  }

  .story__text > :first-child {
    margin-block-start: 0;
  }

  .story__text > :last-child {
    margin-block-end: 0;
  }

  .story__outro {
    max-width: var(--measure);
    margin: var(--space-6) auto 0;
  }

  @media (min-width: 64rem) {
    .story__list {
      --line-x: 50%;
      gap: var(--space-2);
    }

    .story__chapter {
      grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr);
      gap: var(--space-4);
    }

    .story__icon {
      grid-row: 1;
      grid-column: 2;
    }

    .story__card {
      grid-row: 1;
      grid-column: 3;
    }

    .story__chapter:nth-child(odd) .story__card {
      grid-column: 1;
    }
  }

  /* ---------- Team (About: the featured member, then polaroid cards) ---------- */

  /* Featured member: the cutout photo is never cropped. It stands on a soft
     mint ground (an ellipse under its rounded bottom edge), with three
     offset rings in the brand colors behind it (they drift in motion.css),
     so no part of it ends in a straight cut. Photo left, text right from
     48rem, as before. */
  /* The ground ellipse and the rings reach past the photo column on
     purpose; the section clips them so they never widen the page (a 390 px
     screen scrolled sideways by 10 px, and print shrank to fit). clip, not
     hidden: no scroll container, so sticky and focus outlines still work. */
  .block-team {
    overflow-x: clip;
  }

  /* The row: smaller heading, polaroid cards. Phones: a swipeable row
     (scroll snap; the row scrolls, the page does not; the next card peeks
     in as the cue). From 40rem: a grid, two by two. From 72rem: four
     across. Cards in a row are equally tall (the row stretches them).

     Each card sits slightly rotated (-2, 1.5, -1.2, 1.8 degrees in turn;
     it straightens on hover or focus, motion.css). A card w wide and h tall
     turned by a grows its box by about h * sin(a) across (w * sin(a) in
     height). The tallest card, about 700 px (the narrowest four-across
     column, 246 px, flipped to the long bio), grows 24 px at 2 degrees, so
     two neighbours need less than 24 px between them: the gaps are 32 px
     on phones and 40 px from 40rem (they hold for any card up to 900 and
     1100 px tall). Rows are 48 px apart; a card grows at most 11 px in
     height. The eyebrow pill sticks out 12 px above a card and 8 px past
     its right edge (24 px of top padding in the phone row, so the scroll
     row never clips it). */
  .team__title {
    margin: 0 0 var(--space-5);
    font-size: var(--step-3);
    font-weight: var(--weight-heading);
    text-align: center;
  }

  /* A grid that flows into columns, not a flex row: Chrome drops most of the
     page when it prints (or saves as PDF) a flex scroll row, while the same
     row as a column-flow grid prints in full, as the carousel does */
  .team-row {
    display: grid;
    grid-auto-columns: min(18rem, 78vw);
    grid-auto-flow: column;
    gap: var(--space-4);
    margin: 0 calc(-1 * var(--gutter));
    padding: var(--space-3) var(--gutter) var(--space-4);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: thin;
    list-style: none;
  }

  /* One grid cell holds the polaroid (.team-card__inner, stretched to the
     row's height) and the eyebrow pill on top of it, so the pill needs no
     absolute positioning: an absolutely positioned element inside the
     phone swipe row made Chrome drop half the page when printing or
     saving the screen as a PDF */
  .team-card {
    --tilt: -2deg;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    transform: rotate(var(--tilt));
    perspective: 1400px;
    scroll-margin-top: var(--header-height);
    scroll-snap-align: start;
  }

  .team-card:nth-child(4n + 2) {
    --tilt: 1.5deg;
  }

  .team-card:nth-child(4n + 3) {
    --tilt: -1.2deg;
  }

  .team-card:nth-child(4n) {
    --tilt: 1.8deg;
  }

  @media (min-width: 40rem) {
    .team-row {
      display: grid;
      grid-auto-flow: row;
      grid-template-columns: repeat(2, minmax(0, 19rem));
      justify-content: center;
      gap: var(--space-5) 2.5rem;
      margin: 0;
      padding: 0;
      overflow: visible;
    }
  }

  @media (min-width: 72rem) {
    .team-row {
      grid-template-columns: repeat(4, minmax(0, 19rem));
    }
  }

  /* Print: no swipeable row (its hidden cards would be lost and its width
     made Chrome shrink the page); a plain grid of upright cards */
  @media print {
    .team-row {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
      gap: var(--space-4);
      margin: 0;
      padding: 0;
      overflow: visible;
    }

    .team-card {
      transform: none;
    }
  }

  .team-card__inner {
    grid-area: 1 / 1;
  }

  /* The eyebrow pill on the card's top right corner (where the staging
     tag used to sit), over both faces: it is outside the flipping part,
     so it stays put and visible through the flip. Its color is the
     avatar's. Ink on mint 12.6:1, peach 9.4:1, butter 13.4:1, the
     gradient 9.4 to 12.6:1. */
  .team-card__pill {
    position: relative;
    z-index: 3;
    grid-area: 1 / 1;
    align-self: start;
    justify-self: end;
    max-width: calc(100% - 1rem);
    margin: -0.75rem -0.5rem 0 0;
    padding: 0.25em 0.75em;
    border: var(--border);
    border-radius: var(--radius-pill);
    background: var(--color-brand);
    color: var(--color-ink);
    font-size: var(--pill-font-size);
    font-weight: var(--pill-weight);
    line-height: 1.4;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  .team-card__pill--peach {
    background: var(--color-accent-2);
  }

  .team-card__pill--butter {
    background: var(--color-butter);
  }

  .team-card__pill--gradient {
    background: linear-gradient(135deg, var(--color-brand) 10%, var(--color-accent-2) 90%);
  }

  /* One polaroid without JS: both sides in a column on one white card */
  .team-card__inner,
  .team-row.is-flippable .team-card__face {
    border: 1px solid var(--color-ink-line-faint);
    background: var(--color-white);
    box-shadow: 0 16px 32px -20px var(--color-shadow-photo);
  }

  .team-card__face {
    display: flex;
    flex-direction: column;
    padding: 0.875rem 0.875rem var(--space-3);
  }

  .team-card__back {
    padding-block-start: 0;
  }

  .team-card__face > * {
    margin-block: 0;
  }

  .team-card__face > * + * {
    margin-block-start: var(--space-2);
  }

  .team-card__photo {
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--color-paper);
  }

  .team-card__photo img,
  .team-card__photo svg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .team-card__name {
    font-size: var(--step-2);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .team-card__face > .team-card__role {
    margin-block-start: var(--space-1);
  }

  .team-card__short,
  .team-card__bio {
    margin-block-end: 0;
    font-size: 0.9375rem;
  }

  /* "On your project" (final uplift 3.6): one line under the role, its label
     in the body face at 500, a hairline above it so it reads as its own fact */
  .team-card__project {
    padding-block-start: var(--space-2);
    border-block-start: 1px solid var(--color-ink-line-faint);
    font-size: 0.9375rem;
  }

  .team-card__project-label {
    font-weight: 500;
  }

  .team-card__bio > * {
    margin: 0;
  }

  .team-card__bio > * + * {
    margin-block-start: var(--space-1);
  }

  .team-card__askme {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: var(--space-1) 0 0;
    padding: 0;
    list-style: none;
  }

  .team-card__askme li {
    padding: 0.3em 0.85em;
    border: var(--border);
    border-radius: var(--radius-pill);
    background: var(--color-paper);
    font-size: var(--step--1);
    font-weight: 500;
  }

  .team-card__flip {
    align-self: flex-start;
    margin-block-start: auto;
    padding-block-start: var(--space-2);
  }

  /* With motion.js (is-flippable): both sides share one grid cell, so the
     card is as tall as its taller side from the start (no shift on flip),
     and the back is turned away. The flip itself is a transform (the
     transition is in motion.css; instant under reduced motion). */
  .team-row.is-flippable .team-card__inner {
    display: grid;
    border: 0;
    background: none;
    box-shadow: none;
    transform-style: preserve-3d;
  }

  .team-row.is-flippable .team-card__face {
    grid-area: 1 / 1;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  .team-row.is-flippable .team-card__back {
    padding-block-start: var(--space-3);
    transform: rotateY(180deg);
  }

  .team-row.is-flippable .team-card.is-flipped .team-card__inner {
    transform: rotateY(180deg);
  }

  /* Generated avatar: a soft blob in mint, peach or butter, or a mint to
     peach gradient (an SVG paint set on the path, so no fill here), with
     the initials in Trirong Thin. Ink on mint 12.6:1, peach 9.4:1, butter
     13.4:1; on the gradient 9.4 to 12.6:1 (10.6:1 at its middle, under the
     initials). */
  .team-avatar--mint .team-avatar__blob {
    fill: var(--color-brand);
  }

  .team-avatar--peach .team-avatar__blob {
    fill: var(--color-accent-2);
  }

  .team-avatar--butter .team-avatar__blob {
    fill: var(--color-butter);
  }

  .team-avatar__stop--mint {
    stop-color: var(--color-brand);
  }

  .team-avatar__stop--peach {
    stop-color: var(--color-accent-2);
  }

  .team-avatar__initials {
    font-family: var(--font-heading);
    font-size: 72px;
    font-weight: var(--weight-display);
    letter-spacing: 0.02em;
    fill: var(--color-ink);
  }

  /* ---------- Final home pass, part 3 (2026-11-30): About layout only ---------- */

  /* "15-minute" never breaks at its hyphen (templates/about.php wraps it) */
  .about-nowrap {
    white-space: nowrap;
  }

  /* The quote band (the statement on ink) centered on desktop: the short rule,
     the sentence and the call */
  @media (min-width: 64rem) {
    .template-about .block-statement .statement {
      margin-inline: auto;
      text-align: center;
    }

    .template-about .block-statement .statement::before {
      margin-inline: auto;
    }

    .template-about .block-statement .statement__actions {
      justify-content: center;
    }
  }

  /* The founder photo's 1px outline (blocks/founder.php, About size only),
     along the photo's own edge: the clip is the box cut by an ellipse
     (founder.css), so the top and sides are a bordered box down to where the
     ellipse meets the sides (75.2% of the height) and the curve is an arc.
     The box sits half a pixel out so its border lines up with the arc's
     centered stroke. Over the photo, under the coral line's front arc. */
  .founder__outline {
    position: absolute;
    z-index: 2;
    inset: -0.5px -0.5px 24.8% -0.5px;
    border: var(--border);
    border-bottom: 0;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    pointer-events: none;
  }

  .founder__outline-arc {
    position: absolute;
    z-index: 2;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    fill: none;
    stroke: var(--color-line);
    stroke-width: 1;
    pointer-events: none;
  }

  .founder__outline-arc path {
    vector-effect: non-scaling-stroke;
  }

  /* In short: the labelled row of links under the text, inside the box
     (blocks/inshort.php, launch decisions A5, 2026-12-01): the shared
     button's link style, wrapping on phones, after a faint hairline */
  .inshort__links {
    margin-block-start: var(--space-3);
    padding-block-start: var(--space-2);
    border-block-start: 1px solid var(--color-ink-line-faint);
  }

  .inshort__links-label {
    margin: 0 0 var(--space-1);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    letter-spacing: var(--label-tracking);
    text-transform: uppercase;
  }

  .inshort__links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
  }
}

@layer motion {
  @media screen and (prefers-reduced-motion: no-preference) {
    /* fx:enter ---- The collage badge pops in after the hero (the rest is in motion-core.css) */
    html[data-fx~="enter"] .collage__badge {
      animation: enter-badge 700ms var(--ease-pop) 520ms both;
    }
    /* /fx:enter */

    /* fx:layers ---- The collage shapes' float and drift settings and the team rings
       (the shared float and drift rules are in motion-core.css) */
    .collage__shape--mint {
      --drift: -4rem;
    }

    .collage__shape--peach {
      --float: 15s;
      --float-at: -5s;
      --float-dir: reverse;
      --drift: 3rem;
    }

    .collage__shape--gold {
      --float: 9s;
      --float-at: -2s;
      --drift: -7rem;
    }

    /* Four loops at most on About (docs/design/performance-budget.md; audit P1):
       the press marquee, the collage mint and gold floats and the closing
       band's peach turn keep running. The collage peach only drifts with the
       scroll (one pass, scroll-driven); the band's mint, gold and ring stay
       still here (the band follows the team section on About). */
    html[data-fx~="layers"] .collage__shape--peach {
      animation: none;
    }

    @supports (animation-timeline: scroll()) {
      html[data-fx~="layers"] .collage__shape--peach {
        animation: layers-drift linear both;
        animation-timeline: scroll(root);
        animation-range: 0 100vh;
      }
    }

    html[data-fx~="layers"] .block-team ~ .cta-band .cta-shape:not(.cta-shape--peach) {
      animation: none;
    }
    /* /fx:layers */

    /* fx:timeline ---- About's story: discs pop and the cards slide in from their side as
       their chapter reveals; the line fills with the scroll where scroll-driven animations
       exist (the tier timeline is in motion-tiers.css). Only under html.js-motion. */
    html[data-fx~="timeline"] .story__icon {
      transition: transform var(--motion-reveal) var(--ease-pop);
      transition-delay: calc(var(--i, 0) * var(--motion-stagger) + 120ms);
    }

    html[data-fx~="timeline"] .story__card {
      transition: transform var(--motion-reveal) var(--ease-out);
    }

    html.js-motion[data-fx~="timeline"] .story__chapter[data-reveal]:not(.is-in) .story__icon {
      transform: scale(0.5) rotate(-12deg);
    }

    html.js-motion[data-fx~="timeline"] .story__chapter[data-reveal]:not(.is-in) .story__card {
      transform: translateX(28px);
    }

    @media (min-width: 64rem) {
      html.js-motion[data-fx~="timeline"] .story__chapter:nth-child(odd)[data-reveal]:not(.is-in) .story__card {
        transform: translateX(-28px);
      }
    }

    @supports (animation-timeline: view()) {
      html[data-fx~="timeline"] .story__list {
        view-timeline: --story block;
      }

      html.js-motion[data-fx~="timeline"] .story__list::after {
        animation: tl-fill-y linear both;
        animation-timeline: --story;
        animation-range: cover 40vh cover calc(100% - 50vh);
      }
    }
    /* /fx:timeline */
  }

  @keyframes enter-badge {
    from {
      opacity: 0;
      transform: scale(0.6) rotate(-24deg);
    }
  }
}
