/*
  Bella Fiore Beauty: the one stylesheet.

  Concept: a fashion magazine whose cover models are the figurine tweezers. The boldness is
  spent on the cover hero and the cast cards; everything else is white pages, ink text and
  flat tinted tiles. See DESIGN.md.

  Layers, lowest priority first. Anything in a later layer wins without specificity fights.
*/
@layer reset, tokens, base, layout, components, pages, motion;

@font-face {
  font-family: "Bodoni Moda";
  src: url("/assets/fonts/bodoni-moda-latin-opsz-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bodoni Moda";
  src: url("/assets/fonts/bodoni-moda-latin-opsz-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/assets/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
  ul, ol { padding: 0; list-style: none; }
  img, svg { display: block; max-inline-size: 100%; }
  picture { display: contents; }
  button, input { font: inherit; color: inherit; }
  summary { cursor: pointer; }
}

@layer tokens {
  :root {
    /* Colour. Ink is the only text colour on tiles and colour blocks. */
    --ink: #24102e;
    --paper: #fff;
    --hibiscus: #ff3d8b;
    --mango: #ffc233;
    --lagoon: #19c3b2;
    --orchid: #b9a2ff;
    --petal: #ffd9e6;
    --butter: #ffefb8;
    --mint: #c9f2ea;
    --lilac: #e4daff;
    --shell: #f3eeea;
    --ink-soft: color-mix(in srgb, var(--ink) 72%, var(--paper));

    --font-display: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
    --font-text: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* Fluid type scale. */
    --text: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem);
    --text-small: 0.9375rem;
    --text-large: clamp(1.1875rem, 1.05rem + 0.6vw, 1.4375rem);
    --title-3: clamp(1.375rem, 1.2rem + 0.8vw, 1.875rem);
    --title-2: clamp(2.125rem, 1.4rem + 3vw, 3.75rem);
    --title-1: clamp(2.75rem, 1.5rem + 5.6vw, 6.25rem);

    --radius: 20px;          /* tiles */
    --radius-small: 10px;    /* inputs and small controls */
    --gutter: clamp(16px, 4vw, 48px);
    --content: 1360px;
    --section: clamp(56px, 8vw, 120px);
    --rule: 1.5px solid var(--ink);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --focus: var(--ink);
    --button-hover: var(--hibiscus);
  }
}

@layer base {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-block-start: 24px; }
  body {
    font-family: var(--font-text);
    font-size: var(--text);
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.015em;
    text-wrap: balance;
  }
  p { max-inline-size: 68ch; text-wrap: pretty; }
  a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
  a:hover { text-decoration-thickness: 2.5px; }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

  .visually-hidden {
    position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .skip-link {
    position: absolute; inset-block-start: 8px; inset-inline-start: 8px; z-index: 100;
    padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--paper);
    transform: translateY(-200%);
    &:focus { transform: none; }
  }
}

@layer layout {
  .wrap { inline-size: min(100% - 2 * var(--gutter), var(--content)); max-inline-size: none; margin-inline: auto; }
  .section { margin-block-start: var(--section); }
  .section--flush { margin-block-start: 0; }
  main > :is(.section, .missing):last-child { margin-block-end: var(--section); }   /* pages that do not end in a colour band */
  .section__head {
    display: flex; flex-wrap: wrap; align-items: end; gap: 12px 32px;
    margin-block-end: clamp(24px, 3vw, 40px);
  }
  .section__title { font-size: var(--title-2); }
  .section__title--small { font-size: var(--title-3); margin-block-end: clamp(20px, 2.4vw, 32px); }
  .section__title--small:has(+ .section__count) { margin-block-end: 4px; }
  .section__count { color: var(--ink-soft); font-size: var(--text-small); margin-block-end: clamp(20px, 2.4vw, 32px); }
  .section__lede { font-size: var(--text-large); flex: 1 1 24ch; }
  .section__more { margin-block-start: 32px; }

  /* Card grids respond to the width of their own box, not the viewport. */
  .grid { container-type: inline-size; }
  .grid__list {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px;
    @container (min-width: 620px) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 24px; }
    @container (min-width: 940px) { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 48px 24px; }
  }
  .grid--collections .grid__list {
    @container (min-width: 520px) { gap: 40px 24px; }
    @container (min-width: 900px) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px 24px; }
  }
  /* Long grids below the fold skip rendering until they are near the viewport. */
  .grid--deferred { content-visibility: auto; contain-intrinsic-size: auto 900px; }

  .page-head { padding-block: clamp(36px, 6vw, 88px) clamp(28px, 4vw, 56px); }
  .page-head__title { font-size: var(--title-1); line-height: 0.95; letter-spacing: -0.025em; }
  .page-head__lede { font-size: var(--text-large); margin-block-start: clamp(16px, 2vw, 28px); max-inline-size: 46ch; }
}

@layer components {
  /* Flat colour backgrounds: tints for tiles, full strength for blocks. */
  .bg-petal { background: var(--petal); }
  .bg-butter { background: var(--butter); }
  .bg-mint { background: var(--mint); }
  .bg-lilac { background: var(--lilac); }
  .bg-shell { background: var(--shell); }
  .bg-hibiscus { background: var(--hibiscus); --button-hover: var(--mango); }
  .bg-mango { background: var(--mango); --button-hover: var(--paper); }
  .bg-lagoon { background: var(--lagoon); --button-hover: var(--paper); }
  .bg-orchid { background: var(--orchid); --button-hover: var(--paper); }

  /* Buttons and chips are full pills. */
  .button {
    display: inline-flex; align-items: center; justify-content: center;
    min-block-size: 52px; padding: 0 28px; border: 2px solid var(--ink); border-radius: 999px;
    background: var(--ink); color: var(--paper);
    font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    &:hover, &[aria-current] { background: var(--button-hover); color: var(--ink); }
  }
  .button--outline {
    background: transparent; color: var(--ink);
    &:hover { background: var(--ink); color: var(--paper); }
  }
  .button--small { min-block-size: 44px; padding: 0 20px; font-size: var(--text-small); }

  .chips__list { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: clamp(20px, 3vw, 36px); }
  .chip {
    display: inline-flex; align-items: center; min-block-size: 44px; padding: 0 18px;
    border: var(--rule); border-radius: 999px; font-weight: 500; text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    &:hover, &[aria-current] { background: var(--ink); color: var(--paper); }
  }

  /*
    The tile: a flat tinted box that holds one product photo, letterboxed, never cropped.
    Photos shot on white (.photo--light) are multiplied onto the tint, so the white backdrop
    disappears and the product reads like a die-cut sticker. --w and --h are the photo's real
    pixel size (set by the picture() helper); the max sizes stop a small photo from being
    shown at more than 1.5x, so the tile may be bigger than the picture but never blurs it.
  */
  .tile {
    position: relative; display: block; aspect-ratio: 3 / 4;
    border-radius: var(--radius); overflow: clip; isolation: isolate;
  }
  .tile--wide { aspect-ratio: 4 / 3; }
  .tile--square { aspect-ratio: 1; }
  .tile--tall { aspect-ratio: 3 / 5; }
  .tile--cover { aspect-ratio: 4 / 5; }
  .tile .photo {
    position: absolute; inset: 0; margin: auto;
    inline-size: 84%; block-size: 86%;
    max-inline-size: calc(var(--w) * 1.5px); max-block-size: calc(var(--h) * 1.5px);
    object-fit: contain;
  }
  .photo--light { mix-blend-mode: multiply; }
  /* A cut-out whose artwork stops short of the tweezer tips (the hula girls): it stands on the
     bottom edge of the tile, so the tile crops it where the picture ends. */
  .tile .photo--standing { inset-block: auto 0; margin-block: 0; block-size: 93%; object-position: 50% 100%; }

  /* Product card. The link wraps tile, name and meta; swatches follow as their own links. */
  .card__link { display: grid; text-decoration: none; }
  .card__name {
    margin-block-start: 14px;
    font-family: var(--font-display); font-weight: 550; font-size: clamp(1.1875rem, 1rem + 0.6vw, 1.4375rem);
    line-height: 1.15; letter-spacing: -0.01em;
  }
  .card__meta { color: var(--ink-soft); font-size: var(--text-small); font-variant-numeric: tabular-nums; margin-block-start: 2px; }
  .card__meta--count { color: var(--ink); font-weight: 500; }
  .card__swatches { display: flex; align-items: center; margin-inline-start: -6px; }
  .card__swatches li:not(.card__more) { flex: 0 1 32px; }   /* swatches squeeze a little on narrow cards */
  .card__more { flex: none; font-size: var(--text-small); color: var(--ink-soft); padding-inline-start: 4px; }
  .swatch {
    display: grid; place-items: center; block-size: 44px;
    &::before {
      content: ""; inline-size: 20px; block-size: 20px; border-radius: 50%;
      background: var(--swatch); border: var(--rule);
      transition: scale 0.15s var(--ease);
    }
    &:hover::before, &:focus-visible::before { scale: 1.25; }
  }
  .card--collection .card__name { font-size: var(--title-3); }
  /* Phones: two compact columns (name and count only), so 43 collections stay scannable. */
  @container (max-width: 519px) {
    .card--collection .card__name { font-size: 1.125rem; margin-block-start: 10px; }
    .card--collection .card__meta:not(.card__meta--count) { display: none; }
  }

  .crumbs ol { display: flex; flex-wrap: wrap; font-size: var(--text-small); font-weight: 500; }
  .crumbs li + li::before { content: "/"; margin-inline: 10px; }
  .crumbs a { display: inline-block; padding-block: 12px; }

  .facts {
    list-style: disc; padding-inline-start: 1.15em; max-inline-size: 60ch;
    li + li { margin-block-start: 4px; }
  }
  .code { font-size: var(--text-small); }
  .code__value { font-weight: 700; font-variant-numeric: tabular-nums; }

  .flower { inline-size: 0.8em; block-size: 0.8em; color: var(--hibiscus); flex: none; }

  /* Header */
  .site-header { --header: var(--paper); position: relative; z-index: 20; background: var(--header); }
  .site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-block-size: 76px; }
  .wordmark {
    display: inline-flex; align-items: center; min-block-size: 44px;
    font-family: var(--font-display); font-weight: 500; font-size: 1.875rem; letter-spacing: -0.02em;
    text-decoration: none; white-space: nowrap;
  }
  .site-nav__list { display: flex; align-items: center; gap: clamp(20px, 2.6vw, 36px); }
  .site-nav__link {
    display: inline-flex; align-items: center; min-block-size: 44px; font-weight: 500; text-decoration: none;
    &:hover, &[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; }
  }
  .menu { display: none; }
  .menu__toggle {
    display: inline-flex; align-items: center; min-block-size: 44px; padding: 0 20px;
    border: 2px solid var(--ink); border-radius: 999px; font-weight: 700; font-size: var(--text-small);
    list-style: none;
    &::-webkit-details-marker { display: none; }
  }
  .menu[open] .menu__when-closed, .menu:not([open]) .menu__when-open { display: none; }
  .menu[open] .menu__toggle { background: var(--ink); color: var(--paper); }
  .menu__panel {
    position: absolute; inset-inline: 0; inset-block-start: 100%;
    padding: 8px var(--gutter) 32px; background: var(--header); border-block-end: var(--rule);
  }
  .menu__list a {
    display: block; padding-block: 9px;
    font-family: var(--font-display); font-size: 1.875rem; font-weight: 500; line-height: 1.1; letter-spacing: -0.015em;
    text-decoration: none;
    &[aria-current] { font-style: italic; }
  }
  @media (max-width: 719px) {
    .site-nav { display: none; }
    .menu { display: block; }
    .site-header__inner { min-block-size: 64px; }
  }

  /* Footer: ink block, paper text, the wordmark set huge and cropped by the bottom edge. */
  .site-footer {
    --focus: var(--paper);
    background: var(--ink); color: var(--paper); overflow: clip;
    padding-block-start: clamp(48px, 7vw, 96px);
  }
  .site-footer__inner { display: grid; gap: 36px 24px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .site-footer__heading { font-style: italic; font-size: 1.5rem; margin-block-end: 10px; }
  .site-footer__group li { padding-block: 10px; }
  .site-footer__group a { display: inline-block; margin-block: -10px; padding-block: 10px; text-decoration: none; &:hover { text-decoration: underline; } }
  .site-footer__legal { margin-block-start: clamp(40px, 6vw, 72px); font-size: var(--text-small); color: color-mix(in srgb, var(--paper) 72%, var(--ink)); }
  .site-footer__wordmark {
    max-inline-size: none; margin-block-start: 0.04em; translate: 0 0.16em;      /* pushed down so the footer edge crops the letters */
    font-family: var(--font-display); font-weight: 500; font-size: 19.6vw; line-height: 0.8; letter-spacing: -0.035em;
    text-align: center; white-space: nowrap; user-select: none;
  }

  /* Full-bleed colour band with one sentence and one action. */
  .band { margin-block-start: var(--section); padding-block: clamp(48px, 7vw, 104px); }
  .band__inner { display: grid; gap: 20px; justify-items: start; }
  .band__title { font-size: var(--title-2); }
  .band__text { font-size: var(--text-large); }
  @media (min-width: 860px) {
    .band__inner { grid-template-columns: 1fr auto; align-items: center; column-gap: 48px; }
    .band .button { grid-row: 1 / span 2; grid-column: 2; }
  }
}

@layer pages {
  /* ---------- Cover (home hero) ----------
     Proportions are tied to the viewport width through --u so the cover keeps its composition
     at every size, like a printed cover; it stops growing at 1680px. */
  .page-home .site-header { --header: var(--hibiscus); }
  .page-home .wordmark { visibility: hidden; }   /* the masthead right below is the wordmark here */
  .cover { --u: min(1vw, 16.8px); --button-hover: var(--mango); background: var(--hibiscus); overflow: clip; }
  .cover__inner {
    display: grid; grid-template-columns: minmax(0, 1fr); position: relative;
    inline-size: min(100% - 2 * var(--gutter), 1680px); margin-inline: auto;
  }
  .cover__strap {
    display: flex; justify-content: space-between; gap: 16px; max-inline-size: none;
    padding-block: 4px 10px; border-block-start: var(--rule);
    font-size: clamp(0.75rem, 3.2vw, 0.9375rem); font-weight: 500; white-space: nowrap;
  }
  .masthead {
    display: flex; flex-direction: column; align-items: center;
    font-size: calc(29.5 * var(--u)); line-height: 0.82; letter-spacing: -0.03em;
    text-transform: uppercase; white-space: nowrap; user-select: none;
  }
  .masthead__word { display: flex; }
  .masthead__letter { display: block; }

  .lineup {
    display: flex; justify-content: center; align-items: flex-end; gap: calc(7 * var(--u));
    margin-block-start: calc(-17 * var(--u)); position: relative; z-index: 1;
    clip-path: inset(-100vh -100vw 0);     /* only the bottom edge clips: figures rise from behind it */
  }
  .lineup__figure { flex: none; rotate: var(--tilt, 0deg); transform-origin: 50% 100%; }
  .lineup__figure a { display: block; border-radius: 4px; }
  .lineup__photo { block-size: calc(var(--tall, 1) * 108 * var(--u)); inline-size: auto; max-inline-size: none; }
  .lineup__figure:nth-child(1) { --tall: 0.93; --tilt: -3deg; }
  .lineup__figure:nth-child(2) { --tall: 0.98; --tilt: 2deg; }
  .lineup__figure:nth-child(3) { --tall: 0.95; --tilt: -1.5deg; }
  .lineup__figure:nth-child(4) { --tall: 1.04; }
  .lineup__figure:nth-child(5) { --tall: 0.9; --tilt: 2deg; }
  .lineup__figure:nth-child(6) { --tall: 0.97; --tilt: -2deg; }
  .lineup__figure:nth-child(7) { --tall: 0.93; --tilt: 3deg; }
  .lineup__figure--wide-only { display: none; }

  .cover__lines { position: relative; z-index: 2; }
  .cover__lines--left { border-block-start: var(--rule); }
  .cover__lines--right { padding-block-end: 32px; }
  .cover-lines li { border-block-end: var(--rule); }
  .cover-line { display: block; padding-block: 14px 16px; text-decoration: none; }
  .cover-line__name {
    display: block; font-family: var(--font-display); font-style: italic; font-weight: 500;
    font-size: clamp(1.625rem, 2.35 * var(--u), 2.5rem); line-height: 1.05; letter-spacing: -0.015em;
  }
  .cover-line__text { display: block; margin-block-start: 6px; font-size: var(--text-small); font-weight: 500; line-height: 1.35; }
  .cover-line:hover .cover-line__name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.12em; }
  .cover__action { margin-block-start: 24px; }

  /* From tablet width: the masthead on one line and all seven figures; cover lines sit in a row below. */
  @media (min-width: 760px) {
    .cover__inner { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: calc(3 * var(--u)); }
    .cover__strap, .masthead, .lineup { grid-column: 1 / -1; }
    .masthead { flex-direction: row; justify-content: center; gap: 0.2em; font-size: calc(14.7 * var(--u)); line-height: 0.86; }
    .lineup { gap: calc(2.6 * var(--u)); margin-block-start: calc(-10.4 * var(--u)); }
    .lineup__photo { block-size: calc(var(--tall, 1) * 50 * var(--u)); }
    .lineup__figure--wide-only { display: block; }
    .cover__lines--left { grid-column: span 2; }
    .cover__lines--left .cover-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: calc(3 * var(--u)); }
    .cover__lines--right { border-block-start: var(--rule); }
    .cover-lines li { border-block-end: 0; }
    .cover__lines { padding-block-end: 28px; }
    .cover__action { margin-block-start: 12px; padding-inline: clamp(14px, 2.2vw, 28px); }
  }
  /* Desktop: the classic cover. Cover lines move up beside the line-up, left and right. */
  @media (min-width: 1280px) {
    .cover__inner { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: calc(2 * var(--u)); }
    .lineup { grid-column: 2; grid-row: 3; gap: calc(1.3 * var(--u)); }
    .lineup__photo { block-size: calc(var(--tall, 1) * 46 * var(--u)); }
    .cover__lines { grid-row: 3; align-self: end; padding-block-end: calc(3.2 * var(--u)); border: 0; }
    .cover__lines--left { grid-column: 1; max-inline-size: 300px; }
    .cover__lines--left .cover-lines { display: block; }
    .cover__lines--right { grid-column: 3; justify-self: end; max-inline-size: 300px; text-align: end; }
    .cover__lines--right .cover-line__text { max-inline-size: 22ch; margin-inline-start: auto; }
    .cover-lines li + li { margin-block-start: calc(1.2 * var(--u)); }
    .cover-line { padding: 0; }
    .cover__action { margin-block-start: 24px; }
  }

  /* ---------- Marquee of series names ---------- */
  .marquee { display: flex; border-block-end: var(--rule); }
  .marquee__window { flex: 1; min-inline-size: 0; overflow-x: auto; }
  .marquee__track { display: flex; inline-size: max-content; }
  .marquee__list { display: flex; flex: none; }
  .marquee__list[aria-hidden] { display: none; }   /* the second copy only exists for the loop */
  .marquee__list li { display: flex; align-items: center; gap: clamp(20px, 2.4vw, 36px); padding-inline-start: clamp(20px, 2.4vw, 36px); }
  .marquee__list a {
    padding-block: 16px; font-family: var(--font-display); font-style: italic; font-weight: 500;
    font-size: clamp(1.5rem, 1rem + 1.8vw, 2.375rem); letter-spacing: -0.01em;
    white-space: nowrap; text-decoration: none;
    &:hover { text-decoration: underline; text-decoration-thickness: 2px; }
  }
  .marquee__pause { display: none; }

  /* ---------- The cast ---------- */
  .rail {
    --edge: max(var(--gutter), (100vw - var(--content)) / 2);
    display: flex; gap: clamp(12px, 1.6vw, 20px);
    overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--edge);
    padding: 14px var(--edge) 22px;        /* room for the sticker lift and its shadow */
    scrollbar-width: thin; scrollbar-color: var(--ink) transparent;
  }
  .rail > li { flex: none; inline-size: clamp(210px, 60vw, 272px); scroll-snap-align: start; }
  .rail-nav { display: flex; gap: 8px; margin-inline-start: auto; }
  .rail-nav[hidden] { display: none; }
  @media (max-width: 699px) { .rail-nav { display: none; } }   /* phones swipe */
  .cast-card__name {
    /* Physical offsets: the vertical writing mode would turn logical ones sideways. */
    position: absolute; top: 18px; left: 10px; z-index: 1;
    writing-mode: vertical-rl; rotate: 180deg;
    font-family: var(--font-display); font-style: italic; font-weight: 500;
    font-size: clamp(2.75rem, 2rem + 2.4vw, 3.75rem); line-height: 1; letter-spacing: -0.02em; white-space: nowrap;
  }
  .cast-card .tile .photo { inset-inline: 30% 6%; inline-size: 64%; block-size: 90%; }
  .cast-card__meta {
    display: flex; justify-content: space-between; gap: 12px; margin-block-start: 12px;
    font-size: var(--text-small); font-weight: 500;
  }

  /* ---------- Shop by family ----------
     Each tile sizes its type, padding and photos from its own width (container units), so the
     same rules hold from a 290px phone column to a 660px desktop half. */
  .families { display: grid; gap: 16px; }
  .families__item { container-type: inline-size; }
  .family-tile {
    display: grid; grid-template: "name" auto "count" auto "photos" 1fr / minmax(0, 1fr);
    block-size: 100%; min-block-size: clamp(230px, 60cqi, 400px); padding: clamp(18px, 6cqi, 32px);
    border-radius: var(--radius); overflow: clip; text-decoration: none;
  }
  .family-tile__name { grid-area: name; font-size: clamp(1.75rem, 10cqi, 3.75rem); }
  .family-tile__count { grid-area: count; margin-block-start: 8px; font-weight: 500; font-size: var(--text-small); }
  .family-tile__blurb { grid-area: blurb; display: none; align-self: end; max-inline-size: 22ch; line-height: 1.4; font-weight: 500; }
  .family-tile__photos { grid-area: photos; display: flex; align-self: end; justify-self: end; margin-block-start: 20px; }
  .family-tile__chip {
    position: relative; inline-size: clamp(60px, 24cqi, 136px); aspect-ratio: 3 / 4;
    background: var(--paper); border-radius: var(--radius); overflow: clip;
    &:nth-child(1) { rotate: -7deg; translate: 14px 6px; }
    &:nth-child(2) { z-index: 1; translate: 0 -8px; }
    &:nth-child(3) { rotate: 7deg; translate: -14px 6px; }
    .photo {
      position: absolute; inset: 0; margin: auto; inline-size: 80%; block-size: 84%;
      max-inline-size: calc(var(--w) * 1.5px); max-block-size: calc(var(--h) * 1.5px); object-fit: contain;
    }
  }
  .family-tile:hover .family-tile__name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.1em; }
  /* A wide tile has room for the family blurb beside the photos. */
  @container (min-width: 560px) {
    .family-tile { grid-template: "name name" auto "count count" auto "blurb photos" 1fr / minmax(0, 1fr) auto; column-gap: 24px; }
    .family-tile__blurb { display: block; }
    .family-tile__chip { inline-size: clamp(84px, 19cqi, 136px); }
  }
  @media (min-width: 640px) {
    .families { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .families__item:first-child { grid-column: 1 / -1; }
  }
  @media (min-width: 1100px) {
    .families { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .families__item { grid-column: span 2; }
    .families__item:nth-child(-n + 2) { grid-column: span 3; }
  }

  /* ---------- Featured collections: one lead story, then three smaller ones ---------- */
  .features { display: grid; gap: 16px; }
  .feature {
    display: grid; grid-template-rows: auto 1fr; block-size: 100%;
    border-radius: var(--radius); overflow: clip; isolation: isolate; text-decoration: none;
  }
  .feature__photo {
    position: relative; aspect-ratio: 4 / 3;
    .photo {
      position: absolute; inset: 0; margin: auto; inline-size: 84%; block-size: 84%;
      max-inline-size: calc(var(--w) * 1.5px); max-block-size: calc(var(--h) * 1.5px); object-fit: contain;
    }
    /* A photo with its own backdrop fills the space instead of floating as a box on the tint. */
    .photo:not(.photo--light) { inline-size: 100%; block-size: 100%; object-fit: cover; }
  }
  .feature__text { display: grid; gap: 10px; align-content: start; padding: clamp(20px, 2.4vw, 32px); }
  .feature__name { font-size: var(--title-3); line-height: 1.05; }
  .feature__description { max-inline-size: 52ch; }
  .feature__count { font-size: var(--text-small); font-weight: 700; }
  .feature:hover .feature__name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.1em; }
  @media (min-width: 700px) {
    .features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .features > li:first-child { grid-column: 1 / -1; }
    .features > li:first-child .feature { grid-template: 1fr / minmax(0, 1.2fr) minmax(0, 1fr); }
    .features > li:first-child .feature__photo { aspect-ratio: 3 / 2; }
    .features > li:first-child .feature__text { align-content: center; padding: clamp(24px, 4vw, 64px); }
    .features > li:first-child .feature__name { font-size: var(--title-2); }
    .features > li:first-child .feature__tagline { font-size: var(--text-large); }
    .features > li:not(:first-child) .feature__photo { aspect-ratio: 1; }
  }

  /* ---------- Lookbooks teaser ---------- */
  .teaser { display: grid; border-radius: var(--radius); overflow: clip; }
  .teaser__text { display: grid; gap: 16px; justify-items: start; align-content: center; padding: clamp(24px, 4vw, 56px); }
  .teaser__title { font-size: var(--title-2); }
  .teaser__lede { font-size: var(--text-large); max-inline-size: 26ch; }
  .teaser__fan { position: relative; min-block-size: clamp(190px, 34vw, 440px); }
  .teaser__cover {
    position: absolute; inset-block-end: -18%; inset-inline-start: 50%;
    inline-size: clamp(130px, 19vw, 250px);
    translate: -50% 0; rotate: calc(var(--i) * 11deg); transform-origin: 50% 160%;
    transition: rotate 0.35s var(--ease);
    &:nth-child(1) { --i: -2; }
    &:nth-child(2) { --i: -1; }
    &:nth-child(3) { --i: 0; }
    &:nth-child(4) { --i: 1; }
    &:nth-child(5) { --i: 2; }
    .photo { inline-size: 100%; block-size: auto; border: var(--rule); }
  }
  @media (min-width: 760px) {
    .teaser { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  }

  /* ---------- Shop ---------- */
  .family { margin-block-start: clamp(40px, 6vw, 88px); scroll-margin-block-start: 24px; }
  .page-head + .family { margin-block-start: 0; }
  .family__head {
    display: grid; gap: 6px 32px; align-items: end; padding-block-start: 20px; border-block-start: var(--rule);
    margin-block-end: clamp(24px, 3vw, 40px);
  }
  .family__title { font-size: var(--title-2); a { text-decoration: none; } a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.1em; } }
  .family__count { font-size: var(--text-small); font-weight: 500; }
  @media (min-width: 760px) {
    .family__head { grid-template-columns: auto 1fr auto; }
    .family__blurb { padding-block-end: 4px; }
    .family__count { padding-block-end: 6px; }
  }

  /* ---------- Collection ---------- */
  .collection-head { padding-block: 8px clamp(36px, 5vw, 72px); isolation: isolate; }
  .collection-head__inner { display: grid; gap: 32px clamp(32px, 5vw, 80px); align-items: center; }
  .collection-head__title { margin-block-start: clamp(8px, 2vw, 28px); font-size: var(--title-1); line-height: 0.95; letter-spacing: -0.025em; }
  .collection-head__tagline {
    margin-block-start: 16px; font-family: var(--font-display); font-style: italic; font-weight: 500;
    font-size: var(--title-3); line-height: 1.15;
  }
  .collection-head__description { margin-block: 24px 16px; }
  .collection-head .code { margin-block-start: 20px; }
  .collection-head__photo .photo {
    margin-inline: auto; inline-size: auto; block-size: auto;
    max-inline-size: min(100%, calc(var(--w) * 1.5px)); max-block-size: min(540px, calc(var(--h) * 1.5px));
    object-fit: contain;
  }
  .collection-head__photo .photo:not(.photo--light) { border-radius: var(--radius); }
  @media (min-width: 900px) {
    .collection-head__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  }
  .gallery { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

  /* ---------- Product ---------- */
  .product { display: grid; gap: 28px; padding-block-start: 8px; }
  .stage__tile { inline-size: 100%; max-block-size: min(780px, 100svh - 150px); }
  .stage__thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 12px; }
  .thumb {
    inline-size: 72px; aspect-ratio: 1; border-radius: var(--radius-small);
    &[aria-current] { outline: 2px solid var(--ink); outline-offset: 2px; }
  }
  .product__name { margin-block: 4px 12px; font-size: clamp(2.5rem, 1.6rem + 4vw, 5rem); line-height: 0.95; letter-spacing: -0.025em; }
  .picker { margin-block-start: 28px; }
  .picker__label { font-weight: 500; margin-block-end: 10px; }
  .picker__chosen { font-weight: 700; }
  .picker__options { display: flex; flex-wrap: wrap; gap: 8px; }
  .option {
    display: inline-flex; align-items: center; gap: 8px; min-block-size: 44px; padding: 0 16px 0 10px;
    border: var(--rule); border-radius: 999px; font-size: var(--text-small); font-weight: 500; text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    &:hover { background: var(--shell); }
    &[aria-current] { background: var(--ink); color: var(--paper); }
  }
  .option__dot { flex: none; inline-size: 22px; block-size: 22px; border-radius: 50%; background: var(--swatch); border: var(--rule); }
  .option[aria-current] .option__dot { border-color: var(--paper); }
  .product__description { margin-block-start: 28px; font-size: var(--text-large); }
  .product__line { margin-block: 20px 12px; }
  .product__action { margin-block-start: 32px; }
  .product__note { margin-block-start: 10px; font-size: var(--text-small); color: var(--ink-soft); }
  @media (min-width: 900px) {
    .product { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
    .stage { position: sticky; inset-block-start: 20px; }
    .product__details { padding-block-start: 12px; }
  }
  .pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-block-start: var(--section); }
  .pager__link {
    display: grid; gap: 4px; padding-block: 16px 4px; border-block-start: var(--rule); text-decoration: none;
    &:hover .pager__name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.1em; }
  }
  .pager__link--next { grid-column: 2; text-align: end; }
  .pager__label { font-size: var(--text-small); font-weight: 500; }
  .pager__name { font-family: var(--font-display); font-weight: 500; font-size: var(--title-3); line-height: 1.1; }

  /* ---------- Lookbooks ---------- */
  .lookbooks { display: grid; gap: 44px 24px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
  .lookbook { display: grid; text-decoration: none; }
  .lookbook .tile .photo { inline-size: 76%; block-size: 80%; }
  .lookbook__title { margin-block-start: 14px; font-family: var(--font-display); font-weight: 500; font-size: var(--title-3); line-height: 1.1; letter-spacing: -0.01em; }
  .lookbook__meta { margin-block-start: 4px; color: var(--ink-soft); font-size: var(--text-small); }
  .lookbook__action { margin-block-start: 8px; font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
  .lookbook:hover .lookbook__action { text-decoration-thickness: 2.5px; }

  /* ---------- About ---------- */
  .prose p { font-family: var(--font-display); font-size: clamp(1.5rem, 1.1rem + 1.9vw, 2.625rem); line-height: 1.15; letter-spacing: -0.015em; max-inline-size: 30ch; }
  .prose p + p { margin-block-start: 1em; font-family: var(--font-text); font-size: var(--text-large); line-height: 1.5; letter-spacing: 0; max-inline-size: 52ch; }
  .quotes { display: grid; gap: 16px; margin-block-start: var(--section); grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
  .quote { display: grid; align-content: space-between; gap: 32px; padding: clamp(24px, 3.4vw, 48px); border-radius: var(--radius); }
  .quote blockquote p { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.375rem); line-height: 1.12; letter-spacing: -0.01em; max-inline-size: 22ch; }
  .quote figcaption { font-size: var(--text-small); font-weight: 500; }
  .plain-links { border-block-start: var(--rule); }
  .plain-links a {
    display: grid; gap: 2px 32px; padding-block: 18px; border-block-end: var(--rule); text-decoration: none;
    &:hover .plain-links__name { font-style: italic; }
  }
  .plain-links__name { font-family: var(--font-display); font-weight: 500; font-size: var(--title-3); line-height: 1.1; }
  @media (min-width: 700px) {
    .plain-links a { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: baseline; }
  }

  /* ---------- Wholesale ---------- */
  .contact { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
  .contact__card { display: grid; gap: 12px; justify-items: start; align-content: start; padding: clamp(24px, 3.4vw, 48px); border-radius: var(--radius); container-type: inline-size; }
  .contact__title { font-size: var(--title-3); font-style: italic; }
  .contact__big {
    /* Sized from the card's width so the email address always fits on one line. */
    font-family: var(--font-display); font-weight: 500; font-size: clamp(1rem, 7.2cqi, 2.5rem); line-height: 1.1; letter-spacing: -0.02em;
    font-variant-numeric: lining-nums; white-space: nowrap; text-decoration-thickness: 2px;
  }
  .contact .button { margin-block-start: 12px; }
  .steps { display: grid; gap: 28px 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
  .steps li { padding-block-start: 16px; border-block-start: var(--rule); }
  .steps__number { display: block; font-family: var(--font-display); font-weight: 500; font-size: clamp(3.5rem, 2.5rem + 3vw, 5.5rem); line-height: 0.9; font-variant-numeric: lining-nums; }
  .steps__title { margin-block: 16px 6px; font-size: var(--title-3); }

  /* ---------- 404 ---------- */
  .missing { display: grid; justify-items: start; gap: 20px; padding-block: clamp(32px, 6vw, 96px) var(--section); }
  .missing__number { font-family: var(--font-display); font-weight: 500; font-size: clamp(7rem, 4rem + 22vw, 22rem); line-height: 0.8; letter-spacing: -0.04em; color: var(--hibiscus); font-variant-numeric: lining-nums; max-inline-size: none; }
  .missing__title { font-size: var(--title-2); }
  .missing__text { font-size: var(--text-large); max-inline-size: 44ch; }
  .missing__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 8px; }
}

@layer motion {
  /*
    The sticker lift: the response to pointing at or focusing a card. The tile shows a tight
    ink shadow for everyone; it also rises and tilts when motion is welcome.
  */
  .card__link .tile { transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease); }
  .card__link:hover .tile, .card__link:focus-visible .tile, .lookbook:hover .tile, .lookbook:focus-visible .tile {
    box-shadow: 4px 5px 0 var(--ink);
  }
  .lookbook .tile { transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease); }

  @media (prefers-reduced-motion: no-preference) {
    .card__link:hover .tile, .card__link:focus-visible .tile, .lookbook:hover .tile, .lookbook:focus-visible .tile {
      transform: translateY(-6px) rotate(var(--lift-tilt, 2deg));
    }
    li:nth-child(even) > .card, li:nth-child(even) > .cast-card, li:nth-child(even) > .lookbook { --lift-tilt: -2deg; }

    .lineup__photo { transition: translate 0.3s var(--ease); }
    .lineup__figure a:hover .lineup__photo, .lineup__figure a:focus-visible .lineup__photo { translate: 0 calc(-1.2 * var(--u)); }
    .teaser:hover .teaser__cover { rotate: calc(var(--i) * 14deg); }
    .family-tile__chip { transition: translate 0.3s var(--ease), rotate 0.3s var(--ease); }
    .family-tile:hover .family-tile__chip:nth-child(1) { rotate: -12deg; translate: 6px 2px; }
    .family-tile:hover .family-tile__chip:nth-child(3) { rotate: 12deg; translate: -6px 2px; }

    /* The one orchestrated moment: the cover on first load. Letters settle, the figures rise
       from below the fold line, then the cover lines fade in. About 1.2s, runs once. Every
       animation fills backwards only, so the resting state is the normal, visible page. */
    .masthead__letter { animation: settle 0.55s var(--ease) backwards; animation-delay: calc(var(--n) * 28ms); }
    .masthead__word:nth-child(2) .masthead__letter { animation-delay: calc(140ms + var(--n) * 28ms); }
    .masthead__letter:nth-child(1) { --n: 0; }
    .masthead__letter:nth-child(2) { --n: 1; }
    .masthead__letter:nth-child(3) { --n: 2; }
    .masthead__letter:nth-child(4) { --n: 3; }
    .masthead__letter:nth-child(5) { --n: 4; }
    .lineup__figure a { animation: rise 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.12) backwards; animation-delay: calc(380ms + var(--order, 0) * 65ms); }
    .lineup__figure:nth-child(4) a { --order: 0; }
    .lineup__figure:nth-child(3) a, .lineup__figure:nth-child(5) a { --order: 1; }
    .lineup__figure:nth-child(2) a, .lineup__figure:nth-child(6) a { --order: 2; }
    .lineup__figure:nth-child(1) a, .lineup__figure:nth-child(7) a { --order: 3; }
    .cover__strap, .cover__lines { animation: appear 0.35s ease-out 0.9s backwards; }

    /* Marquee: two copies of the list slide by half the track, so the loop is seamless.
       It pauses on hover, on keyboard focus and with the Pause switch. */
    .marquee__window { overflow: clip; }
    .marquee__list[aria-hidden] { display: flex; }
    .marquee__track { animation: marquee 48s linear infinite; }
    .marquee:hover .marquee__track, .marquee:focus-within .marquee__track, .marquee:has(:checked) .marquee__track { animation-play-state: paused; }
    .marquee__pause {
      display: flex; align-items: center; flex: none; cursor: pointer;
      padding-inline: clamp(12px, 2vw, 24px) var(--gutter); border-inline-start: var(--rule);
      input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }
      span {
        display: inline-flex; align-items: center; min-block-size: 44px; padding: 0 18px;
        border: var(--rule); border-radius: 999px; font-size: var(--text-small); font-weight: 700;
      }
      &:has(:checked) span { background: var(--ink); color: var(--paper); }
      &:has(:focus-visible) span { outline: 3px solid var(--focus); outline-offset: 3px; }
    }

    /* Menu and other disclosures ease open and closed where the browser can animate them. */
    /* Opacity only on ::details-content: a transform there would become the panel's containing
       block and shrink the full-width panel to the width of the Menu button. */
    .menu::details-content { opacity: 0; transition: opacity 0.22s ease-out, content-visibility 0.22s allow-discrete; }
    .menu[open]::details-content { opacity: 1; }
    .menu__list { transition: translate 0.3s var(--ease); }
    .menu:not([open]) .menu__list { translate: 0 -12px; }

    /* Page transitions (cross-document view transitions; browsers without them just navigate).
       Header and footer keep their own names so they stay put while the page cross-fades, and
       the product tile morphs between its card and the product-page stage (see layout.php). */
    .site-header { view-transition-name: site-header; }
    .site-footer { view-transition-name: site-footer; }
    .stage__tile { view-transition-name: product-photo; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }
    ::view-transition-group(product-photo) { animation-duration: 0.42s; animation-timing-function: var(--ease); }

    /* Scroll-linked, sparingly: the line-up drifts up against the masthead as the cover scrolls away. */
    @supports (animation-timeline: scroll()) {
      .lineup { animation: drift linear both; animation-timeline: scroll(root block); animation-range: 0 90vh; }
    }
  }

  /* Movement only, no fade: the masthead is the largest thing on the cover, and it should
     count as painted from the first frame. */
  @keyframes settle { from { transform: translateY(0.3em) rotate(-5deg); } }
  @keyframes rise { from { transform: translateY(112%); } }
  @keyframes appear { from { opacity: 0; } }
  @keyframes marquee { to { transform: translateX(-50%); } }
  @keyframes drift { to { transform: translateY(calc(-3.5 * var(--u))); } }
}

/* Opting in to cross-document view transitions has to sit outside the layers. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
