:root {
  --paper: #F4F0EA;
  --paper-sunk: #EAE4DB;
  --line: #D9D1C5;
  --ink: #2A2725;
  --ink-2: #5C5550;
  --on-dark: #F4F0EA;

  /* Shade hexes from HAT-SPEC-001 Issue 5, section 09 */
  --sw-ecru: #E8E3DA;
  --sw-light-beige: #DDD3C2;
  --sw-oatmeal: #C4B7A2;
  --sw-light-grey: #C8C6C1;
  --sw-shaela: #8A8A87;
  --sw-moorit: #8C7561;
  --sw-near-black: #3A3733;
  --sw-sky: #BFD8E6;
  --sw-eucalypt: #C3D4C4;

  --font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 12px;
  --r-sm: 8px;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1440px;
  --section: clamp(72px, 9vw, 132px);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);      /* gentle ease-out for fades */
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);     /* even cross-fades */
  --speed: 1;

  --z-sticky: 10;
  --z-popover: 20;
  --z-lab: 30;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; } /* anchors and focus land below the sticky header (73px), ring included */
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 500; text-wrap: balance; }
p { text-wrap: pretty; }
svg.i { width: 1.25rem; height: 1.25rem; flex: none; fill: currentColor; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--ink-2); color: var(--on-dark); } /* ink-2, not ink, so it also shows on the ink footer */

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.h2 { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.08; letter-spacing: -0.022em; }
.lede { font-size: 1.125rem; color: var(--ink-2); max-width: 46ch; }
.muted { color: var(--ink-2); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: 0 1.5rem;
  border-radius: 999px; border: 1px solid var(--ink);
  font: 500 1rem/1 var(--font); text-decoration: none; cursor: pointer;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink); color: var(--on-dark); }
.btn-primary:hover { background: #45403C; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--on-dark); }
.btn-light { background: var(--on-dark); color: var(--ink); border-color: var(--on-dark); }
.btn-light:hover { background: #fff; }
.link-arrow {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px;
  font-weight: 500; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.link-arrow svg { transition: transform 180ms var(--ease-out); }
.link-arrow:hover svg { transform: translateX(3px); }

/* Announcement */
.announce {
  background: var(--ink); color: var(--on-dark);
  font-size: .875rem; text-align: center; padding: .6rem var(--gutter);
}

/* Header */
.header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 72px;
}
.logo {
  font-weight: 600; font-size: 1.375rem; letter-spacing: .16em;
  text-decoration: none; justify-self: start;
}
.nav { display: flex; gap: 2rem; }
.nav a { text-decoration: none; font-weight: 500; padding-block: .5rem; }
.nav a:hover, .nav a[aria-current] { text-decoration: underline; text-underline-offset: 6px; }
.tools { display: flex; gap: .25rem; justify-self: end; align-items: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; background: none; color: inherit; border-radius: 999px; cursor: pointer; position: relative;
  text-decoration: none;
}
.icon-btn:hover { background: var(--paper-sunk); }
.icon-btn svg.i { width: 1.375rem; height: 1.375rem; }
.menu-btn { display: none; }
#menu {
  inset: 0 auto 0 0; margin: 0; width: min(88vw, 360px); height: 100dvh; max-height: none;
  border: 0; padding: 1.25rem var(--gutter); background: var(--paper); color: var(--ink);
}
#menu::backdrop { background: rgb(42 39 37 / .4); }
#menu nav { display: grid; margin-top: 1.5rem; }
#menu nav a { font-size: 1.5rem; text-decoration: none; padding: .75rem 0; border-bottom: 1px solid var(--line); }

/* Hero */
.hero { padding-block: clamp(16px, 2.5vw, 32px) var(--section); }
.hero-grid {
  display: grid; grid-template-columns: 5fr 6fr; gap: clamp(24px, 4vw, 64px);
  min-height: min(calc(100svh - 140px), 820px);
}
.hero-copy { align-self: end; padding-bottom: clamp(8px, 3vw, 48px); }
.hero h1 {
  font-size: clamp(2.75rem, 5.6vw, 5.25rem); line-height: 1.02; letter-spacing: -0.032em;
  margin-bottom: 1.5rem;
}
.hero .lede { margin-bottom: 2rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.assurances {
  display: flex; flex-wrap: wrap; gap: .5rem 1.75rem;
  margin: 2.5rem 0 0; padding: 1.25rem 0 0; list-style: none;
  border-top: 1px solid var(--line); font-size: .9375rem; color: var(--ink-2);
}
.assurances li { display: flex; align-items: center; gap: .5rem; }
.hero-media { border-radius: var(--r); overflow: hidden; background: var(--paper-sunk); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }

/* Collections */
.sec-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem;
  margin-bottom: clamp(28px, 3.5vw, 48px);
}
.collections { padding-bottom: var(--section); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 1.5vw, 20px); }
.tile { text-decoration: none; display: block; }
.tile-media { border-radius: var(--r); overflow: hidden; aspect-ratio: 4 / 5; background: var(--paper-sunk); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; }
.tile-label { margin-top: .875rem; }
.tile-label span { display: block; margin-top: .125rem; }
.tile-label h3 { font-size: 1.25rem; }
.tile-label span { color: var(--ink-2); font-size: .9375rem; }

/* Bestsellers */
.bestsellers { padding-bottom: var(--section); }
.products { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(28px, 3vw, 40px) clamp(12px, 1.5vw, 20px); }
.card { position: relative; }
.card-media { position: relative; border-radius: var(--r); overflow: hidden; aspect-ratio: 3 / 4; background: var(--paper-sunk); }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-media img + img { opacity: 0; transition: opacity 240ms var(--ease-out); }
.card:hover .card-media img + img { opacity: 1; }
.card-title { font-size: 1rem; font-weight: 500; margin-top: .875rem; }
.card-title a { text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.card-sub { color: var(--ink-2); font-size: .9375rem; }
.card-meta { display: grid; gap: .5rem; justify-items: start; margin-top: .375rem; }
.price { font-weight: 500; }
.swatches { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.swatches li { width: 14px; height: 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgb(42 39 37 / .18); }
.quick-add {
  position: absolute; right: 12px; bottom: 12px; z-index: 1;
  width: 44px; height: 44px; border-radius: 999px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--paper); color: var(--ink);
  transition: transform 120ms var(--ease-out), background-color 180ms var(--ease-out);
}
.quick-add:hover { background: #fff; }
.quick-add:active { transform: scale(0.94); }

/* Colours */
.colours { background: var(--paper-sunk); padding-block: var(--section); }
.colours-grid { display: grid; grid-template-columns: 6fr 5fr; gap: clamp(32px, 5vw, 96px); align-items: center; }
.colour-stage { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r); overflow: hidden; background: var(--line); }
.colour-stage img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 280ms var(--ease-out);
}
.colour-stage img[data-c="moorit"] { opacity: 1; filter: none; }
/* button names the picked shade; names share one grid cell so the button never jumps */
.shade-names { display: inline-grid; }
.shade-names > span { grid-area: 1 / 1; opacity: 0; visibility: hidden; }
.colours:has(input:checked) .colour-stage img { opacity: 0; }
.colours:has(#c-light-beige:checked) [data-c="light-beige"],
.colours:has(#c-moorit:checked) [data-c="moorit"],
.colours:has(#c-near-black:checked) [data-c="near-black"],
.colours:has(#c-shaela:checked) [data-c="shaela"],
.colours:has(#c-eucalypt:checked) [data-c="eucalypt"],
.colours:has(#c-sky:checked) [data-c="sky"] { opacity: 1; filter: none; transform: none; visibility: visible; }
.colours .lede { margin-block: 1.25rem 2.5rem; }
.picker { border: 0; margin: 0; padding: 0; }
.picker legend { font-weight: 500; margin-bottom: 1rem; }
.picker-group { margin-bottom: 1.75rem; }
.picker-group > span { display: block; font-size: .875rem; color: var(--ink-2); margin-bottom: .625rem; }
.picker-opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt label {
  display: inline-flex; align-items: center; gap: .625rem;
  min-height: 44px; padding: 0 1rem 0 .5rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); cursor: pointer;
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
.opt label::before {
  content: ""; width: 26px; height: 26px; border-radius: 999px; background: var(--sw);
  box-shadow: inset 0 0 0 1px rgb(42 39 37 / .15);
}
.opt label:hover { border-color: var(--ink-2); }
.opt input:checked + label { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt input:focus-visible + label { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Why */
.why { padding-block: var(--section); }
.why-grid { display: grid; grid-template-columns: 5fr 7fr; align-items: start; gap: clamp(32px, 6vw, 112px); }
.why-intro .lede { margin-top: 1.25rem; }
.benefits { list-style: none; margin: 0; padding: 0; align-self: start; }
.benefits li {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .5rem clamp(16px, 3vw, 40px);
  padding-block: clamp(28px, 3.5vw, 52px); border-bottom: 1px solid var(--line); align-items: baseline;
}
.benefits li:first-child { padding-top: 0; }
.benefits h3 { font-size: clamp(1.25rem, 1.8vw, 1.5rem); letter-spacing: -0.01em; line-height: 1.2; }
.benefits p { color: var(--ink-2); max-width: 52ch; }

/* Materials */
.materials { padding-bottom: var(--section); }
.compare { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.compare .col-label { width: 22%; }
.compare th, .compare td { text-align: left; vertical-align: top; font-weight: 400; padding: 1.125rem 0 1.125rem clamp(12px, 2vw, 32px); }
.compare :is(th, td):first-child { padding-left: 0; }
.compare thead th { padding-top: 0; padding-bottom: 1.75rem; vertical-align: bottom; }
.compare thead img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r); margin-bottom: 1.25rem; }
.compare thead h3 { font-size: 1.5rem; }
.compare thead .link-arrow { margin-top: .5rem; font-size: .9375rem; }
.compare tbody tr { border-top: 1px solid var(--line); }
.compare tbody th { color: var(--ink-2); }

/* Guide banner */
.guide { padding-bottom: var(--section); }
.guide-card {
  border-radius: var(--r); overflow: hidden; color: var(--on-dark); background: var(--ink);
  display: grid; grid-template-columns: 1fr 1fr; min-height: clamp(460px, 44vw, 620px);
}
.guide-card img { order: 2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.guide-copy { align-self: end; padding: clamp(28px, 5vw, 72px); max-width: 620px; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.5rem; margin: 0 0 2rem; font-variant-numeric: tabular-nums; }
.specs dt { color: rgb(244 240 234 / .6); }
.specs dd { margin: 0; }
.guide-copy p { color: rgb(244 240 234 / .86); font-size: 1.125rem; margin-block: 1rem 2rem; max-width: 42ch; }

/* Footer */
.footer { background: var(--ink); color: var(--on-dark); padding-block: clamp(56px, 7vw, 96px) 28px; }
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
.footer-top { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(40px, 6vw, 112px); }
.signup h2 { font-size: clamp(1.75rem, 2.6vw, 2.25rem); letter-spacing: -0.015em; line-height: 1.15; }
.signup p { color: rgb(244 240 234 / .72); margin-block: .75rem 1.5rem; }
.signup label { display: block; font-size: .875rem; margin-bottom: .5rem; }
.field { display: flex; gap: .5rem; max-width: 460px; }
.field input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 1rem;
  border-radius: 999px; border: 1px solid rgb(244 240 234 / .35); background: transparent; color: var(--on-dark);
  font: inherit;
}
.field input::placeholder { color: rgb(244 240 234 / .6); }
.field input:focus-visible { outline: 2px solid var(--on-dark); outline-offset: 2px; }
:is(.announce, .guide-card, .footer) :focus-visible { outline-color: var(--on-dark); } /* an ink ring vanishes on ink */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
.cols h3 { font-size: .9375rem; font-weight: 500; color: rgb(244 240 234 / .6); margin-bottom: 1rem; }
.cols ul { list-style: none; margin: -.625rem 0; padding: 0; display: grid; }
.cols a { display: inline-block; padding-block: .625rem; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem;
  margin-top: clamp(56px, 7vw, 96px); padding-top: 24px; border-top: 1px solid rgb(244 240 234 / .16);
  font-size: .875rem; color: rgb(244 240 234 / .6);
}
.footer-mark small { display: block; font-size: .22em; letter-spacing: .3em; margin-bottom: .35em; }
.footer-mark { font-weight: 600; letter-spacing: .16em; font-size: clamp(min(3rem, 18vw), 12vw, 10rem); line-height: .8; color: var(--on-dark); } /* the 18vw floor fits a phone at 200% text */

/* Pre-order (reuses the hero layout) */
.pay-note { margin-top: .75rem; font-size: .875rem; color: var(--ink-2); }
.terms { margin: 2.5rem 0 0; max-width: 560px; border-top: 1px solid var(--line); }
.terms > div {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .25rem clamp(16px, 2vw, 32px);
  padding-block: .875rem; border-bottom: 1px solid var(--line);
}
.terms dt { font-weight: 500; }
.terms dd { margin: 0; color: var(--ink-2); }
@media (max-width: 520px) { .terms > div { grid-template-columns: 1fr; } }

/* Motion
   Every rule here needs an .m-* flag on <html>, set by the script in <head>.
   No JS, ?static or prefers-reduced-motion means no flags: the page renders finished.
   All timings multiply by --speed (1 = default; the ?lab slider changes it). */
@keyframes settle { from { opacity: 0; transform: scale(1.04); } }
@keyframes fade { from { opacity: 0; } }

/* 1 Hero entrance */
.m-hero .hero-media img { animation: settle calc(1800ms * var(--speed)) var(--ease-soft) both; }
.m-hero .hero-copy > * { animation: fade calc(1100ms * var(--speed)) var(--ease-soft) both; }
.m-hero .hero-copy > :nth-child(1) { animation-delay: calc(200ms * var(--speed)); }
.m-hero .hero-copy > :nth-child(2) { animation-delay: calc(320ms * var(--speed)); }
.m-hero .hero-copy > :nth-child(3) { animation-delay: calc(440ms * var(--speed)); }
.m-hero .hero-copy > :nth-child(4) { animation-delay: calc(560ms * var(--speed)); }
.m-hero .hero-copy > :nth-child(5) { animation-delay: calc(680ms * var(--speed)); }

/* 2 Section reveal, 3 Card stagger (--i is set per child by the script) */
.m-reveal [data-reveal], .m-stagger [data-stagger] > * {
  opacity: 0;
  transition: opacity calc(1000ms * var(--speed)) var(--ease-soft);
  transition-delay: calc(var(--i, 0) * (100ms * var(--speed)));
}
.m-stagger .compare tbody > * { transition-delay: calc(var(--i, 0) * (70ms * var(--speed))); }
.m-reveal [data-reveal].is-in, .m-stagger [data-stagger].is-in > * { opacity: 1; }

/* 4 Image load fade (animation, so it never overrides an image's own transitions) */
.m-imgfade img.is-loading { opacity: 0; }
.m-imgfade img.is-loaded { animation: fade calc(700ms * var(--speed)) var(--ease-soft); }

/* 5 Card hover */
@media (hover: hover) {
  .m-hover :is(.tile-media, .card-media) img { transition: transform calc(900ms * var(--speed)) var(--ease-soft), opacity calc(400ms * var(--speed)) var(--ease-soft); }
  .m-hover :is(.tile:hover .tile-media, .card:hover .card-media) img { transform: scale(1.03); }
  .m-hover .quick-add { opacity: 0; transition: opacity calc(300ms * var(--speed)) var(--ease-out), transform calc(300ms * var(--speed)) var(--ease-out), background-color calc(180ms * var(--speed)) var(--ease-out); }
  .m-hover .card:is(:hover, :focus-within) .quick-add { opacity: 1; }
  .m-hover .card .quick-add:active { transform: scale(0.94); }
}

/* 6 Colour switch: incoming shade sharpens from a slight blur */
.m-colour .colour-stage img {
  filter: blur(4px); transform: scale(1.03);
  transition: opacity calc(700ms * var(--speed)) var(--ease-in-out), filter calc(700ms * var(--speed)) var(--ease-in-out), transform calc(1000ms * var(--speed)) var(--ease-soft);
}
.m-colour .shade-names > span {
  transition: opacity calc(500ms * var(--speed)) var(--ease-in-out), visibility calc(500ms * var(--speed));
}
.m-colour .opt label::before { transition: transform calc(300ms * var(--speed)) var(--ease-out); }
.m-colour .opt input:checked + label::before { transform: scale(1.1); }

/* 7 Header on scroll */
.m-header .header { border-bottom-color: transparent; transition: transform calc(400ms * var(--speed)) var(--ease-out), border-color calc(400ms * var(--speed)) var(--ease-out); }
.m-header .header.is-scrolled { border-bottom-color: var(--line); }
.m-header .header.is-hidden { transform: translateY(-100%); }

/* 8 Mobile menu: calc(280ms * var(--speed)) in, calc(180ms * var(--speed)) out */
.m-menu #menu, .m-menu #menu::backdrop {
  transition: transform calc(260ms * var(--speed)) var(--ease-out), opacity calc(260ms * var(--speed)) var(--ease-out), overlay calc(260ms * var(--speed)) allow-discrete, display calc(260ms * var(--speed)) allow-discrete;
}
.m-menu #menu { transform: translateX(-100%); }
.m-menu #menu::backdrop { opacity: 0; }
.m-menu #menu:popover-open { transform: none; transition-duration: calc(400ms * var(--speed)); }
.m-menu #menu:popover-open::backdrop { opacity: 1; transition-duration: calc(400ms * var(--speed)); }
@starting-style {
  .m-menu #menu:popover-open { transform: translateX(-100%); }
  .m-menu #menu:popover-open::backdrop { opacity: 0; }
}

/* 9 Slow photo fade on the two large feature photos */
.m-curtain [data-curtain] { opacity: 0; transition: opacity calc(1300ms * var(--speed)) var(--ease-soft); }
.m-curtain [data-curtain].is-in { opacity: 1; }

/* 11 Footer wordmark, letter by letter */
.m-wordmark [data-wordmark] > span { display: inline-block; }
.m-wordmark [data-wordmark] > :is(small, span) {
  opacity: 0;
  transition: opacity calc(1000ms * var(--speed)) var(--ease-soft);
  transition-delay: calc(var(--i, 0) * (110ms * var(--speed)));
}
.m-wordmark [data-wordmark].is-in > :is(small, span) { opacity: 1; }

/* ?lab toggle panel */
.lab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: var(--z-lab);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: .75rem 1rem; font-size: .875rem; max-height: 70vh; overflow: auto;
}
.lab legend { font-weight: 500; padding: 0; margin-bottom: .5rem; }
.lab fieldset { border: 0; margin: 0; padding: 0; }
.lab label { display: flex; align-items: center; gap: .5rem; min-height: 32px; cursor: pointer; }
.lab-speed { margin-top: .5rem; font-variant-numeric: tabular-nums; }
.lab-speed input { width: 90px; }
.lab button { margin-top: .5rem; min-height: 36px; padding: 0 1rem; font-size: .875rem; }

/* Responsive */
@media (max-width: 1080px) {
  .nav { display: none; }
  .menu-btn { display: inline-grid; }
  /* minmax(0, …) and a vw cap on the wordmark keep the cart button on screen at 200% text */
  .header-inner { grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem; }
  .logo { justify-self: center; grid-column: 2; font-size: min(1.375rem, 6vw); }
  .menu-btn { grid-column: 1; grid-row: 1; }
  .products { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .hero-grid, .colours-grid, .why-grid { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: minmax(0, 1fr); } /* else the email field's own width props it open at 200% text */
  .hero-grid { min-height: 0; }
  .hero-media { order: -1; aspect-ratio: 4 / 5; }
  .benefits li { grid-template-columns: 1fr; }
  .colour-stage { aspect-ratio: 4 / 3; }
  .compare .col-label { width: 26%; }
  .compare th, .compare td { padding-block: .875rem; font-size: .9375rem; }
  .compare thead h3 { font-size: 1.125rem; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tiles .tile:first-child { grid-column: 1 / -1; }
  .tiles .tile:first-child .tile-media { aspect-ratio: 4 / 3; }
  .guide-card { grid-template-columns: 1fr; }
  .guide-card img { order: -1; aspect-ratio: 4 / 3; }
}
@media (max-width: 520px) {
  .cols { grid-template-columns: 1fr 1fr; }
  .field { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; }
  .btn:active, .quick-add:active { transform: none; }
}

/* Shop: header cart count, cart drawer and product pages (all built by shop.js).
   Motion follows the rules above: every animated rule needs its .m-* flag, so ?static and
   reduced motion render finished. Nothing rises: the drawer slides sideways, photos fade. */
:root { --error: #9A3B2B; }

.cart-count {
  position: absolute; top: 2px; right: 0;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--ink); color: var(--on-dark);
  font-size: .6875rem; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}

#cart {
  --pad: clamp(16px, 4vw, 28px);
  inset: 0 0 0 auto; margin: 0; width: min(100%, 440px); height: 100dvh; max-height: none;
  border: 0; padding: 0; overflow: hidden; background: var(--paper); color: var(--ink);
  flex-direction: column;
}
#cart:popover-open { display: flex; }
#cart::backdrop { background: rgb(42 39 37 / .4); }
#cart [tabindex="-1"]:focus { outline: none; }
.cart-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 72px; padding-inline: var(--pad); border-bottom: 1px solid var(--line);
}
.cart-head h2 { font-size: 1.25rem; letter-spacing: -0.01em; }
.cart-head .icon-btn { margin-inline-end: -11px; } /* the cross lines up with the prices below it */
.cart-head .icon-btn:focus-visible { border-radius: 999px; outline-offset: -3px; } /* inside the drawer edge */
.cart-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-inline: var(--pad);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.cart-empty { padding-block: 2rem; }
.cart-empty p { color: var(--ink-2); margin-bottom: 1.25rem; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 0 1rem; align-items: start;
  padding-block: 1.25rem; border-bottom: 1px solid var(--line);
}
.cart-line img { width: 64px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-sm); background: var(--paper-sunk); }
.cart-line-name { font-weight: 500; line-height: 1.35; }
.cart-line-meta { margin-top: .125rem; font-size: .9375rem; color: var(--ink-2); }
.cart-line-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .625rem; }
.cart-line-price { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.stepper button {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 999px; background: none; color: inherit; cursor: pointer;
  transition: background-color 180ms var(--ease-out);
}
.stepper button:hover { background: var(--paper-sunk); }
.stepper button:focus-visible { border-radius: 999px; outline-offset: -3px; }
.stepper button[aria-disabled="true"] { opacity: .35; background: none; cursor: default; }
.stepper svg.i { width: 1rem; height: 1rem; }
.cart-qty { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.cart-remove {
  min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: .9375rem; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.cart-remove:hover { color: var(--ink); }
.cart-foot { padding: 1.25rem var(--pad) calc(1.25rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.cart-sum { margin: 0 0 1.25rem; font-variant-numeric: tabular-nums; }
.cart-sum > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.cart-sum dd { margin: 0; }
.cart-sum > div:first-child { color: var(--ink-2); }
.cart-sum-deposit { margin-top: .25rem; font-size: 1.125rem; font-weight: 500; }
.cart-error { color: var(--error); font-size: .9375rem; }
.cart-error:not(:empty) { margin-bottom: 1rem; }
.cart-reserve { width: 100%; }
.cart-reserve[aria-disabled="true"] { cursor: progress; }
/* Short screens (phones held sideways, 400% zoom, large text): the whole drawer scrolls instead of the
   list alone, so every line and Reserve stay in reach. Taller screens keep the pinned footer. */
@media (max-height: 30em) {
  #cart { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .cart-body { flex: 1 0 auto; overflow: visible; }
}

.product { padding-block: clamp(16px, 2.5vw, 32px) var(--section); }
.product:not(:has(.wrap)) { min-height: 100svh; } /* until shop.js fills it, so the footer doesn't flash up */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 64px); align-items: start; }
.product-main { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r); overflow: hidden; background: var(--paper-sunk); }
.product-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.product-shown-in {
  position: absolute; left: 12px; bottom: 12px;
  padding: .375rem .75rem; border-radius: 999px; background: var(--paper); font-size: .875rem;
}
.product-thumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.product-thumbs button {
  position: relative; width: clamp(64px, 7vw, 88px); aspect-ratio: 3 / 4; padding: 0;
  border: 0; border-radius: var(--r-sm); overflow: hidden; background: var(--paper-sunk); cursor: pointer;
}
.product-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.product-thumbs img:not([src]) { opacity: 0; } /* waiting for the main photo: a plain tile, no alt text or broken icon */
.product-thumbs button::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(42 39 37 / .12); transition: box-shadow 180ms var(--ease-out);
}
.product-thumbs button:hover::after { box-shadow: inset 0 0 0 1px var(--ink-2); }
.product-thumbs button[aria-current="true"]::after { box-shadow: inset 0 0 0 2px var(--ink); }
.product-thumbs button:focus-visible { border-radius: var(--r-sm); }
.product-details { max-width: 560px; }
.product-material { margin-top: .5rem; color: var(--ink-2); }
.product-price { margin-top: 1.5rem; font-size: 1.25rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.product-deposit { color: var(--ink-2); }
.product-tentative { margin-top: .75rem; font-size: .9375rem; color: var(--ink-2); }
.product-form { margin-top: 2rem; }
.product-form legend { padding: 0; }
.product-form .picker + .picker { margin-top: 1.75rem; }
.product-colour-name { margin-left: .375rem; font-weight: 400; color: var(--ink-2); }
.product-sizes .opt label { gap: .5rem; padding: 0 1rem; }
.product-sizes .opt label::before { content: none; }
.opt-fit { color: var(--ink-2); }
.option-error { color: var(--error); font-size: .9375rem; }
.option-error:not(:empty) { margin-top: .75rem; }
.add-to-cart { width: 100%; }
.picker + .add-to-cart { margin-top: 2rem; }
.product-description { margin-top: 2.5rem; max-width: 60ch; color: var(--ink-2); }
.product-details .terms { margin-top: 2rem; }
.product-missing { padding-block: clamp(48px, 8vw, 120px); }
.product-missing h1 { margin-bottom: 1.5rem; }
@media (max-width: 860px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-main { width: 100%; max-height: max(62svh, 360px); } /* tablets crop the photo so the name shows; phones keep 3:4 */
  .product-details { max-width: none; }
}

/* Shop motion. Product entrance (hero flag), photo cross-fade (colour flag), drawer (menu flag). */
@keyframes sharpen { from { opacity: 0; filter: blur(4px); transform: scale(1.03); } }
.m-hero .product-details { animation: fade calc(1100ms * var(--speed)) var(--ease-soft) both; }
.m-colour .product-main img + img { animation: sharpen calc(700ms * var(--speed)) var(--ease-in-out) both; }
.m-colour .product-shown-in { animation: fade calc(500ms * var(--speed)) var(--ease-in-out) both; }
.m-menu #cart, .m-menu #cart::backdrop {
  transition: transform calc(260ms * var(--speed)) var(--ease-out), opacity calc(260ms * var(--speed)) var(--ease-out), overlay calc(260ms * var(--speed)) allow-discrete, display calc(260ms * var(--speed)) allow-discrete;
}
.m-menu #cart { transform: translateX(100%); }
.m-menu #cart::backdrop { opacity: 0; }
.m-menu #cart:popover-open { transform: none; transition-duration: calc(400ms * var(--speed)); }
.m-menu #cart:popover-open::backdrop { opacity: 1; transition-duration: calc(400ms * var(--speed)); }
@starting-style {
  .m-menu #cart:popover-open { transform: translateX(100%); }
  .m-menu #cart:popover-open::backdrop { opacity: 0; }
}
