/* ==========================================================================
   Base: reset, typography, layout primitives, buttons, forms, utilities
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
  background: var(--bg);
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  padding-bottom: var(--bottom-nav-h);
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"], .list-reset { list-style: none; padding: 0; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

/* Theme switch: smooth colour transition (added briefly by theme.js) */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color var(--theme-dur) var(--ease-in-out),
              color var(--theme-dur) var(--ease-in-out),
              border-color var(--theme-dur) var(--ease-in-out),
              fill var(--theme-dur) var(--ease-in-out),
              stroke var(--theme-dur) var(--ease-in-out),
              box-shadow var(--theme-dur) var(--ease-in-out) !important;
}
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ── Print-paper grain ── */
.grain {
  position: fixed;
  inset: -50%;
  z-index: var(--z-cursor);
  pointer-events: none;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* ── Focus: visible mint ring everywhere ── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 6px;
}
.skip-link {
  position: fixed;
  left: 16px;
  top: -100px;
  z-index: calc(var(--z-toast) + 1);
  padding: .75rem 1.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-pill);
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

::selection { background: var(--accent); color: var(--accent-ink); }

/* ── Typography ── */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}
h1, .h1 { font-size: var(--fs-h1); }
h2, .h2 { font-size: var(--fs-2xl); }
h3, .h3 { font-size: var(--fs-xl); line-height: 1.1; }
h4, .h4 { font-size: var(--fs-lg); font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow::before { content: ""; width: 1.75em; height: 1px; background: currentColor; }
.lead { font-size: var(--fs-md); color: var(--text-muted); max-width: 60ch; }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.accent-text { color: var(--accent-text); }
.price { font-weight: 800; font-variant-numeric: tabular-nums; }
.strike { text-decoration: line-through; color: var(--text-muted); font-weight: 500; }
.prose { max-width: 72ch; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: var(--fs-xl); margin-top: 1.6em; }
.prose h3 { font-size: var(--fs-lg); margin-top: 1.4em; }
.prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: .35em; }
.prose ul.ticks { list-style: none; padding: 0; }

/* ── Layout ── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: 880px; }
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-5);
}
.section { padding-block: var(--section-y); position: relative; }
.section--alt { background: var(--bg-alt); }
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: clamp(1.5rem, 1rem + 2vw, 3rem);
}
.section__title { font-size: var(--fs-2xl); }
.section__title em { font-style: normal; color: var(--accent-text); }
.stack > * + * { margin-top: var(--stack, 1rem); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--cluster-gap, .75rem); align-items: center; }
.flow-row { display: flex; align-items: center; gap: .5rem; }
.spacer { flex: 1; }

/* ── Icons ── */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--fill { fill: currentColor; stroke: none; }

/* ── Buttons ── */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  min-height: 44px;
  padding: .75rem 1.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: .02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--text-muted); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
  --btn-bd: var(--accent);
}
.btn--primary:hover { box-shadow: var(--glow); border-color: var(--accent); }
.btn--ghost { --btn-bg: transparent; }
.btn--mint { --btn-bg: var(--mint); --btn-fg: var(--accent-ink); --btn-bd: var(--mint); }
[data-theme="light"] .btn--mint { --btn-fg: var(--surface-2); }
.btn--sm { min-height: 36px; padding: .5rem .95rem; font-size: var(--fs-xs); }
.btn--lg { min-height: 56px; padding: 1rem 2rem; font-size: var(--fs-base); }
.btn--block { width: 100%; }
.btn--icon { width: 44px; height: 44px; padding: 0; }
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: currentColor;
  opacity: .25;
  pointer-events: none;
  z-index: -1;
  animation: ripple 600ms var(--ease-out) forwards;
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  color: var(--text);
  transition: background-color var(--dur) var(--ease-out), color var(--dur);
}
.icon-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }

.link {
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.link-arrow { display: inline-flex; align-items: center; gap: .4em; font-weight: 700; color: var(--accent-text); }
.link-arrow .icon { transition: transform var(--dur) var(--ease-out); }
.link-arrow:hover .icon { transform: translateX(4px); }

/* ── Forms ── */
.field { display: grid; gap: .4rem; }
.field__label { font-size: var(--fs-sm); font-weight: 600; }
.field__hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field__error { font-size: var(--fs-xs); color: var(--danger-text); font-weight: 600; }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: .75rem 1rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); opacity: .85; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 30%, transparent);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 120px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.5rem; }
.checkbox { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; min-height: 44px; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ── Badges & chips ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding: .3rem .6rem;
  border-radius: var(--radius-pill);
  font-size: .6875rem;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}
.badge--bestseller { background: var(--badge-best-bg); color: var(--badge-best-fg); }
.badge--new { background: var(--badge-new-bg); color: var(--badge-new-fg); }
.badge--trending { background: var(--badge-trend-bg); color: var(--badge-trend-fg); }
.badge--off { background: transparent; color: var(--mint-text); padding-inline: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 40px;
  padding: .5rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--dur), border-color var(--dur), color var(--dur);
}
.chip[aria-pressed="true"], .chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1), var(--ring-inner);
}

/* ── Utilities ── */
.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.w-full { width: 100%; }
.nowrap { white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hide-mobile { display: none; }
@media (min-width: 768px) {
  .hide-mobile { display: revert; }
  .hide-desktop { display: none !important; }
}

/* ── Skeletons ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Scroll reveal (JS adds .is-in; without JS everything is visible) ── */
.js [data-reveal] { opacity: 0; transform: translate3d(0, 28px, 0); transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal="clip"] { transform: none; clip-path: inset(0 0 100% 0); transition: opacity 600ms var(--ease-out), clip-path 900ms var(--ease-out); }
.js [data-reveal="clip"].is-in { clip-path: inset(0 0 0 0); }

/* ── Lenis ── */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ── Reduced motion: opacity fades only ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal], .js [data-reveal="clip"] { transform: none; clip-path: none; transition: opacity 400ms linear; }
  .btn:active { transform: none; }
}
