/* ==========================================================================
   BASE — reset, typography, primitives
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-on-light);
  background: var(--ink-950);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.skip-link {
  position: absolute; left: var(--s-4); top: -60px; z-index: 200;
  background: var(--white); color: var(--ink-950); padding: 10px 16px; font-weight: 600;
}
.skip-link:focus { top: var(--s-4); }
.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;
}

/* ---- Layout ---- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); position: relative; }
.theme-dark { background: var(--ink-950); color: var(--text-on-dark); }
.theme-navy { background: var(--ink-900); color: var(--text-on-dark); }
.theme-paper { background: var(--paper); color: var(--text-on-light); }
.theme-white { background: var(--white); color: var(--text-on-light); }

/* ---- Type primitives ---- */
.t-mega, .t-display, .t-h1, .t-h2, .t-h3 { font-weight: 600; letter-spacing: var(--track-tight); }
.t-mega { font-size: var(--fs-mega); line-height: 0.86; letter-spacing: -0.06em; }
.t-display { font-size: var(--fs-display); line-height: var(--lh-tight); }
.t-h1 { font-size: var(--fs-h1); line-height: 0.98; }
.t-h2 { font-size: var(--fs-h2); line-height: 1.02; letter-spacing: var(--track-snug); }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); letter-spacing: -0.015em; font-weight: 550; }
.t-lead { font-size: var(--fs-lead); line-height: 1.45; letter-spacing: -0.01em; }
.t-muted { color: var(--text-on-light-muted); }
.theme-dark .t-muted, .theme-navy .t-muted { color: var(--text-on-dark-muted); }
.t-dim { opacity: 0.42; }

/* Mono "instrument" labels — the recurring Novix annotation voice */
.t-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  line-height: 1.4;
  font-weight: 450;
}
.label {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: var(--track-mono); text-transform: uppercase;
}
.label::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: 0.6; }
.label--plain::before { display: none; }

/* ---- Buttons ---- */
.btn {
  --btn-bg: var(--blue); --btn-fg: var(--white);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 52px; padding: 0 26px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 0.95rem; font-weight: 550; letter-spacing: -0.005em;
  border-radius: var(--radius-1);
  overflow: hidden; isolation: isolate;
  transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease-out);
}
/* Press feedback on every pressable: a small scale, never a jump. */
.btn:active { transform: scale(.97); }
.btn .arrow { width: 16px; height: 10px; transition: transform 240ms var(--ease-out); }
.btn--light { --btn-bg: var(--white); --btn-fg: var(--ink-950); }
.btn--dark { --btn-bg: var(--ink-950); --btn-fg: var(--white); }
.btn--ghost { --btn-bg: transparent; --btn-fg: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--blue-hover); }
  .btn:hover .arrow { transform: translateX(4px); }
  .btn--light:hover { background: var(--mist); }
  .btn--dark:hover { background: var(--ink-800); }
  .btn--ghost:hover { background: rgba(127, 140, 190, 0.12); }
}
.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.link-u {
  position: relative; display: inline-flex; align-items: center; gap: 8px; font-weight: 500;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 3px; transition: background-size var(--t-med) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .link-u:hover { background-size: 0% 1px; background-position: 100% 100%; } }

/* ---- Icon button ---- */
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  transition: background-color 200ms ease, transform 160ms var(--ease-out);
}
.icon-btn:active { transform: scale(.92); }
@media (hover: hover) { .icon-btn:hover { background: rgba(255, 255, 255, 0.08); } }
.icon-btn svg { width: 20px; height: 20px; }
.theme-light .icon-btn:hover, .drawer .icon-btn:hover { background: rgba(10, 16, 36, 0.06); }

/* ---- Chips (filter pills) ---- */
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px var(--line-light-strong);
  font-size: 0.875rem; white-space: nowrap;
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease, transform 160ms var(--ease-out);
}
.chip:active, .dose:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .chip:hover { box-shadow: inset 0 0 0 1px var(--text-on-light); } }
.chip[aria-pressed="true"], .chip[aria-checked="true"], .chip.is-active {
  background: var(--ink-950); color: var(--white); box-shadow: none;
}
.chip .count { font-family: var(--font-mono); font-size: 0.68rem; opacity: 0.55; }

/* Dose selector — segmented, squarer than chips */
.dose-set { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.dose {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; text-align: left;
  border-radius: var(--radius-1); box-shadow: inset 0 0 0 1px var(--line-light-strong);
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease, transform 160ms var(--ease-out);
}
.dose__mg { font-size: .98rem; font-weight: 600; letter-spacing: -0.01em; }
.dose__price { font: .72rem var(--font-mono); letter-spacing: .02em; opacity: .7; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .dose:hover { box-shadow: inset 0 0 0 1px var(--text-on-light); } }
.dose[aria-checked="true"] { background: var(--ink-950); color: var(--white); box-shadow: none; }
.dose[aria-checked="true"] .dose__price { opacity: .8; }

/* ---- Hairline rule with measurement ticks (signature motif) ---- */
.ruler {
  height: 12px; width: 100%;
  background:
    linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 10%) 0 100% / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 2%) 0 100% / 100% 5px no-repeat;
  opacity: 0.28;
}

/* ---- Placeholder flagging (toggled from the prototype bar) ---- */
body.show-ph [data-ph] { outline: 1px dashed #ff8a3d; outline-offset: 2px; position: relative; }
body.show-ph [data-ph]::after {
  content: "PLACEHOLDER · " attr(data-ph);
  position: absolute; left: 0; top: 0; transform: translateY(-100%); z-index: 5;
  background: #ff8a3d; color: #160800; font: 600 9.5px/1 var(--font-mono);
  letter-spacing: 0.06em; padding: 4px 6px; white-space: nowrap; pointer-events: none;
}

/* ---- Reveal (JS adds .is-in; without JS/motion everything is visible) ---- */
.js-motion [data-reveal] { opacity: 0; transform: translateY(28px); }
.js-motion [data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .js-motion [data-reveal] { opacity: 1; transform: none; }
}

.proto, .i-draft { display: none !important; }
.buy__addon { margin: 4px 0 14px; }
