/* micro-duck.store
   Layout: a two-column story (copy left, sticky 3D stage right) that collapses
   to a sticky top stage on phones; full-width sections after it. The whole page
   tints itself to the colourway the visitor picks. */

:root {
  /* product colours */
  --cw-cream: #F7E6CB;
  --cw-graphite: #6C6A68;
  --cw-lavender: #BFA9CF;
  --cw-sky: #A9DBE8;
  --orange: #FF671F;
  --yellow: #F4AF23;

  /* live theme, defaults = Graphite (overridden by JS per colourway) */
  --bg: #3B3A39;
  --bg-2: #4A4847;
  --card: #4E4C4A;
  --fg: #F2EEE7;
  --fg-2: #C2BCB3;
  --line: rgba(242, 238, 231, .16);
  --line-strong: rgba(242, 238, 231, .42);
  --accent: #F4AF23;
  --accent-fg: #1B1A19;
  --accent-2: #FF671F;
  --shadow: #000000;

  --font-display: "Bricolage Grotesque", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --wrap: 1360px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --radius: 6px;
  --bar-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --tint-ease: 650ms var(--ease);
  color-scheme: light;
}
:root[data-cw="graphite"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--tint-ease), color var(--tint-ease);
  overflow-x: clip;
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-fg); }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.mono { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.tnum { font-variant-numeric: tabular-nums; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; line-height: .96; margin: 0; text-wrap: balance; font-variation-settings: "opsz" 96; }
h1 { font-size: clamp(2.75rem, 7.2vw, 6.6rem); }
h2 { font-size: clamp(2.1rem, 4.6vw, 3.9rem); }
h3 { font-size: clamp(1.35rem, 2.2vw, 1.75rem); font-variation-settings: "opsz" 40; letter-spacing: -.01em; line-height: 1.05; }
p { margin: 0; }
.lede { font-size: clamp(1.1rem, 1.5vw, 1.35rem); line-height: 1.45; max-width: 36em; color: var(--fg); }
.muted { color: var(--fg-2); }
.eyebrow { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 48px; padding: 0 1.25rem; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .18s var(--ease), background-color .25s, color .25s, border-color .25s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--fg); }
.btn-ghost:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.btn-small { min-height: 40px; padding: 0 1rem; font-size: .95rem; }
.btn .price { font-family: var(--font-mono); font-weight: 500; font-size: .9em; opacity: .85; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40; height: var(--bar-h);
  display: flex; align-items: center;
  transition: background-color .3s, box-shadow .3s;
}
.topbar .wrap { width: 100%; display: flex; align-items: center; gap: 1rem; }
.topbar.is-scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--line); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; font-family: var(--font-mono); font-weight: 500; font-size: .95rem; letter-spacing: -.01em; }
.brand-mark { display: block; width: 52px; height: 36px; flex: none; overflow: visible; }
.brand-mark path, .brand-mark circle { transition: fill var(--tint-ease); }
.badge { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; padding: .32em .6em; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--fg-2); white-space: nowrap; }
.nav { margin-left: auto; display: flex; gap: 1.4rem; font-size: .95rem; font-weight: 500; }
.nav a { text-decoration: none; opacity: .85; }
.nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: .25em; }
.cart-btn { margin-left: auto; display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: 0 .9rem; border-radius: 999px; border: 1.5px solid var(--line-strong); background: transparent; cursor: pointer; font-weight: 600; font-size: .95rem; }
.nav + .cart-btn { margin-left: 0; }
.cart-btn .count { font-family: var(--font-mono); font-size: .8rem; min-width: 1.6em; height: 1.6em; display: inline-grid; place-items: center; border-radius: 999px; background: var(--fg); color: var(--bg); }
.cart-btn .count:empty { display: none; }
.menu-toggle, .menu-close { align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: transparent; color: var(--fg); cursor: pointer; }
.menu-toggle { display: none; }
.menu-close { display: inline-flex; }
.menu-toggle:hover, .menu-close:hover { background: var(--bg-2); }
@media (max-width: 900px) {
  .nav, .badge { display: none; }
  .topbar .wrap { gap: 8px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .menu-toggle { display: inline-flex; }
  .brand { flex: 1; min-width: 0; gap: 6px; font-size: .8rem; }
  .brand-mark { width: 36px; height: 28px; }
  .brand-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cart-btn { flex: none; min-height: 44px; padding-inline: .65rem; }
}

/* Native modal keeps focus inside the right mobile navigation panel. */
html.menu-open, html.menu-open body { overflow: hidden; }
.mobile-menu {
  position: fixed; inset: 0 0 0 auto; margin: 0; border: 0; border-left: 1px solid var(--line);
  width: min(340px, calc(100vw - 48px)); max-width: none; height: 100dvh; max-height: none;
  padding: calc(20px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
  background: var(--bg); color: var(--fg); overflow-y: auto; overscroll-behavior: contain;
  box-shadow: -20px 0 60px -30px rgba(0,0,0,.4);
}
.mobile-menu[open] { display: flex; flex-direction: column; animation: menu-enter .28s var(--ease); }
.mobile-menu::backdrop { background: rgba(10,12,14,.48); }
.mobile-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 24px; }
.mobile-menu-head h2 { font-size: 1.35rem; line-height: 1.1; }
.mobile-menu-links { display: grid; }
.mobile-menu-links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 1.3rem; font-weight: 600; }
.mobile-menu-links a::after { content: '→'; color: var(--accent); }
.mobile-menu-links a:hover { color: var(--accent); }
.mobile-menu-note { margin-top: auto; padding-top: 32px; font: .8rem/1.8 var(--font-mono); }
.mobile-menu-note span { color: var(--fg-2); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
@keyframes menu-enter { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* ---------- story: copy + sticky stage ---------- */
.story {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  column-gap: clamp(24px, 4vw, 72px);
  align-items: start;
  padding-top: var(--bar-h);
}
.copy { min-width: 0; grid-column: 1; grid-row: 1; }
.stage-col { min-width: 0; grid-column: 2; grid-row: 1; align-self: stretch; }
.stage {
  position: sticky; top: var(--bar-h); height: calc(100svh - var(--bar-h)); min-height: 520px;
  display: grid; place-items: stretch;
  overflow: hidden;
}
.stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: pan-y; cursor: grab; }
.stage canvas:focus-visible { outline: 2px solid var(--fg); outline-offset: -5px; }
.stage.is-dragging canvas { cursor: grabbing; }
.stage-ph {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  transition: opacity .5s;
}
.stage-ph .blob { width: 34%; aspect-ratio: .62; border-radius: 48% 48% 40% 40% / 40% 40% 50% 50%; background: color-mix(in srgb, var(--fg) 10%, transparent); animation: breathe 2.4s ease-in-out infinite; }
.stage-ph .label { position: absolute; bottom: 18%; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); }
.stage[data-state="ready"] .stage-ph { opacity: 0; }
.stage[data-state="failed"] .stage-ph .blob { display: none; }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.04); opacity: 1; } }

.stage-ui { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 0 clamp(12px, 2vw, 24px) clamp(12px, 2vw, 24px); display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; pointer-events: none; }
.stage-ui > * { pointer-events: auto; }
.telemetry {
  font-family: var(--font-mono); font-size: .66rem; line-height: 1.5; letter-spacing: .02em;
  color: var(--fg-2); display: grid; grid-template-columns: auto auto; column-gap: 1.2em; row-gap: 0;
  font-variant-numeric: tabular-nums; min-width: 15em;
}
.telemetry .k { opacity: .8; }
.telemetry .v { text-align: right; color: var(--fg); }
.telemetry .v.hot { color: var(--accent); }
.telemetry[hidden] { display: none; }
.tele-head { grid-column: 1 / -1; margin-bottom: .4em; display: flex; align-items: center; gap: .5em; text-transform: uppercase; letter-spacing: .08em; }
.rec { width: 7px; height: 7px; border-radius: 50%; background: #e3342f; box-shadow: 0 0 0 2px color-mix(in srgb, #e3342f 25%, transparent); animation: rec 1.6s steps(2, jump-none) infinite; }
@keyframes rec { 50% { opacity: .25; } }
.stage-hint { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-2); text-align: right; }
.stage-hint b { color: var(--fg); font-weight: 500; }
.tele-toggle { display: none; }

@media (max-width: 900px) {
  .story { display: block; padding-top: 0; }
  .stage-col { position: sticky; top: 0; z-index: 2; }
  .stage { position: relative; top: 0; height: 52svh; min-height: 300px; background: var(--bg); transition: background-color var(--tint-ease); }
  .stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 48px; background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; transition: background var(--tint-ease); }
  .stage-ui { padding-bottom: 10px; }
  .telemetry { display: none; }
  .telemetry.is-open { display: grid; }
  .tele-toggle { display: inline-flex; }
  .stage-hint { display: block; font-size: .55rem; max-width: 20em; }
  .telemetry.is-open ~ .stage-hint { display: none; }
  .copy { position: relative; z-index: 1; }
}

/* ---------- hero ---------- */
.hero { min-height: calc(100svh - var(--bar-h)); display: flex; flex-direction: column; justify-content: center; gap: clamp(1.2rem, 2.4vw, 2rem); padding-block: clamp(2rem, 6vh, 5rem) clamp(3rem, 8vh, 7rem); }
.hero .eyebrow { display: flex; flex-wrap: wrap; gap: .4em 1.2em; }
.hero .eyebrow span + span::before { content: "·"; margin-right: 1.2em; opacity: .5; }
.hero .cta { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; }
.hero .fine { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-2); display: flex; flex-wrap: wrap; gap: .3em 1em; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem 1.5rem; border-top: 1px solid var(--line); padding-top: 1.2rem; max-width: 36rem; }
.stat b { display: block; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.5rem, 2.4vw, 2.1rem); letter-spacing: -.02em; line-height: 1; font-variation-settings: "opsz" 40; }
.stat span { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); }
@media (max-width: 900px) {
  .hero { min-height: 0; padding-block: 1.4rem 3.5rem; }
}

/* ---------- section common ---------- */
.section { padding-block: clamp(3.5rem, 9vh, 8rem); scroll-margin-top: calc(var(--bar-h) + 12px); }
.section-head { display: grid; gap: 1rem; margin-bottom: clamp(1.8rem, 4vh, 3rem); max-width: 44rem; }
.section-head .eyebrow { display: flex; gap: 1em; }
.story .section { padding-block: clamp(2.5rem, 8vh, 6rem); }
@media (max-width: 900px) { .story .section { scroll-margin-top: calc(max(300px, 52svh) + 12px); } }

/* ---------- colours ---------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.swatch {
  display: grid; gap: .55rem; padding: .7rem; border-radius: 10px; border: 1.5px solid var(--line); background: transparent;
  cursor: pointer; text-align: left; transition: border-color .25s, background-color .25s, transform .2s var(--ease);
}
.swatch:hover { transform: translateY(-2px); }
.swatch[aria-pressed="true"] { border-color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.swatch .chip { height: 64px; border-radius: 6px; position: relative; overflow: hidden; }
.swatch .chip::after { content: ""; position: absolute; right: 10px; bottom: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--trim); box-shadow: 0 0 0 3px rgba(255,255,255,.45); }
.swatch .name { font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.swatch .name small { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-2); font-weight: 500; }
.swatch-note { margin-top: 1rem; font-size: .95rem; color: var(--fg-2); max-width: 34em; }

/* ---------- specs ---------- */
.spec-table { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
.spec-row { display: grid; grid-template-columns: minmax(9em, 12em) 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.spec-row dt { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-2); margin: 0; }
.spec-row dd { margin: 0; font-size: 1rem; }
.spec-row dd small { display: block; color: var(--fg-2); font-size: .85rem; }
.explode { display: grid; gap: .6rem; margin-top: 1.6rem; padding: 1rem 1.1rem; border: 1.5px solid var(--line); border-radius: 10px; }
.explode label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.explode label span { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-2); font-weight: 500; }
.explode input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.provisional { margin-top: 1rem; font-size: .9rem; color: var(--fg-2); max-width: 40em; }
@media (max-width: 520px) { .spec-row { grid-template-columns: 1fr; gap: .2rem; } }

/* ---------- packs ---------- */
.packs { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.pack {
  grid-column: span 3; display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); min-width: 0;
  transition: background-color var(--tint-ease), border-color var(--tint-ease);
}
.pack.pack-main { grid-column: span 6; grid-row: span 2; }
.pack.pack-wide { grid-column: span 6; }
.pack-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.pack-head .price { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 500; white-space: nowrap; }
.pack-head .eyebrow { margin-bottom: .35rem; }
.pack ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; font-size: .97rem; color: var(--fg); }
.pack ul li { padding-left: 1.1em; position: relative; }
.pack ul li::before { content: ""; position: absolute; left: 0; top: .62em; width: .45em; height: .45em; border-radius: 50%; background: var(--accent); }
.pack .foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.pack .note { font-size: .85rem; color: var(--fg-2); }
.preorder-choice { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 1fr); gap: 1rem; align-items: center; }
.preorder-preview { position: relative; height: 220px; overflow: hidden; border-radius: 10px; background: var(--bg-2); transition: background-color var(--tint-ease); }
.preorder-preview canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: pan-y; cursor: grab; }
.preorder-preview.is-dragging canvas { cursor: grabbing; }
.preorder-preview canvas:focus-visible { outline-offset: -4px; }
.preview-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center; color: var(--fg-2); font-size: .85rem; pointer-events: none; }
.preorder-preview[data-state="ready"] .preview-status { display: none; }
.preview-caption { margin-top: .5rem; text-align: center; font-size: .75rem; color: var(--fg-2); }
@media (max-width: 380px) { .preorder-choice { grid-template-columns: 1fr; } .preorder-preview { height: 210px; } }
.colour-select { display: flex; flex-wrap: wrap; gap: .5rem; }
.colour-select button {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: 0 .8rem 0 .5rem; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; cursor: pointer; font-weight: 500; font-size: .92rem;
}
.colour-select button[aria-pressed="true"] { border-color: var(--fg); }
.colour-select .dot { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.qty button { width: 40px; height: 40px; border: 0; background: transparent; cursor: pointer; font-size: 1.1rem; }
.qty output { min-width: 2em; text-align: center; font-family: var(--font-mono); font-size: .95rem; }
@media (max-width: 1000px) { .pack { grid-column: span 6; } .pack.pack-main { grid-column: span 12; grid-row: auto; } .pack.pack-wide { grid-column: span 12; } }
@media (max-width: 620px) { .pack { grid-column: span 12; } }
.stage[data-state="failed"] { background: url("../assets/poster.jpg") center / contain no-repeat; }

/* ---------- open source ---------- */
.open-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.terminal { background: #15171A; color: #E8E6E1; border-radius: 10px; padding: 1.1rem 1.2rem; font-family: var(--font-mono); font-size: .82rem; line-height: 1.7; overflow-x: auto; box-shadow: 0 20px 50px -30px var(--shadow); }
.terminal .c { color: #8A9099; }
.terminal .p { color: #F4AF23; }
.terminal .o { color: #9BC6D4; }
.terminal pre { margin: 0; white-space: pre; }
.open-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.open-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.4rem; }
@media (max-width: 900px) { .open-grid { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq { max-width: 52rem; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 1.1rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-weight: 600; font-size: 1.08rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); font-size: 1.2rem; color: var(--fg-2); transition: transform .25s var(--ease); flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .a { padding: 0 0 1.2rem; max-width: 42em; color: var(--fg); }
.faq .a p + p { margin-top: .6rem; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 2.5rem 7rem; font-size: .9rem; color: var(--fg-2); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer h4 { margin: 0 0 .6rem; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); font-weight: 500; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.footer a { text-decoration-thickness: 1px; text-underline-offset: .2em; }
.footer .legal { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .8rem; line-height: 1.6; max-width: 70em; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- sticky buy bar (phones) ---------- */
.buybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  display: none; align-items: center; gap: .8rem;
  padding: .6rem var(--gutter-r) calc(.6rem + env(safe-area-inset-bottom, 0px)) var(--gutter);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  transform: translateY(110%); transition: transform .35s var(--ease);
}
.buybar.is-visible { transform: none; }
.buybar .who { display: grid; line-height: 1.2; min-width: 0; }
.buybar .who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buybar .who span { font-family: var(--font-mono); font-size: .72rem; color: var(--fg-2); }
.buybar .btn { margin-left: auto; }
@media (max-width: 900px) { .buybar { display: flex; } }

/* ---------- cart drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 14, .42); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(440px, 100%);
  background: var(--bg); color: var(--fg); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .38s var(--ease); box-shadow: -20px 0 60px -30px rgba(0,0,0,.4);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem var(--gutter-r) 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 1.25rem; }
.drawer-close { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: transparent; cursor: pointer; font-size: 1.1rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: grid; gap: .8rem; align-content: start; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.cart-line .t { font-weight: 600; }
.cart-line .s { font-size: .85rem; color: var(--fg-2); grid-column: 1; }
.cart-line .p { font-family: var(--font-mono); font-size: .95rem; text-align: right; }
.cart-line .ctl { grid-column: 1 / -1; display: flex; align-items: center; gap: .8rem; margin-top: .3rem; }
.cart-line .rm { border: 0; background: transparent; cursor: pointer; font-size: .85rem; color: var(--fg-2); text-decoration: underline; text-underline-offset: .2em; padding: 0; }
.cart-empty { color: var(--fg-2); padding: 2rem 0; }
.drawer-foot { padding: 1rem 1.25rem 1.25rem; border-top: 1px solid var(--line); display: grid; gap: .8rem; }
.subtotal { display: flex; justify-content: space-between; font-weight: 600; }
.subtotal .v { font-family: var(--font-mono); }
.drawer-foot .fine { font-size: .82rem; color: var(--fg-2); }
.checkout-note { display: none; font-size: .9rem; padding: .8rem; border: 1px dashed var(--line-strong); border-radius: 8px; }
.checkout-note.is-visible { display: block; }
.checkout-note code { font-family: var(--font-mono); font-size: .85em; user-select: all; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); z-index: 60; background: var(--fg); color: var(--bg); padding: .7rem 1rem; border-radius: 999px; font-weight: 600; font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease); white-space: nowrap; max-width: calc(100vw - 32px); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 901px) { .toast { bottom: 28px; } }

/* debug overlay (only with ?debug) */
.dbg { position: fixed; left: 8px; bottom: 8px; z-index: 100; background: rgba(0,0,0,.72); color: #fff; font: 11px/1.4 var(--font-mono); padding: 8px; border-radius: 6px; display: grid; grid-template-columns: 9em 1fr 3.5em; gap: 2px 6px; max-height: 80vh; overflow: auto; width: 320px; }
.dbg input { width: 100%; }
.dbg .row { display: contents; }
.dbg .btns { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.dbg .btns button { font: inherit; padding: 2px 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
