/* DrugAlt — "same drug, different label."
   The pharmacy label is the main visual device; a pharmacist's pen strikes out the brand name.
   Fraunces (display) + Atkinson Hyperlegible (UI/body) + Atkinson Mono (NDCs). See docs/BRAND.md. */

:root {
  --ink: #1c2230;
  --muted: #4b5162;
  --faint: #6f6a5d;
  --bg: #f7f4ec;
  --paper: #fffdf7;
  --card: #ffffff;
  --line: #ddd7ca;
  --line-strong: #8a8578;
  --primary: #2e3f9e;
  --primary-dark: #1f2b70;
  --on-primary: #ffffff;
  --route: #b3ad9f;           /* the "usual route" in the logo */
  --pen: #2e3f9e;
  --accent: #0a5e3f;
  --accent-tint: #e4f3ea;
  --accent-line: #b9dcc7;
  --warn: #7a4f00;
  --warn-tint: #fbefd3;
  --focus: #2e3f9e;
  --shadow-label: 0 1px 0 rgba(28, 34, 48, 0.05), 0 18px 32px -18px rgba(28, 34, 48, 0.28);

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #efece4; --muted: #b0b4bf; --faint: #9a9ea8; --bg: #11141a; --paper: #1b1f28; --card: #1b1f28;
    --line: #2d3340; --line-strong: #6b7282; --primary: #a9b4ff; --primary-dark: #c7ceff; --on-primary: #11141a;
    --route: #6a6f80; --pen: #a9b4ff; --accent: #5fd39b; --accent-tint: #10291f; --accent-line: #1d4a36;
    --warn: #f0c05a; --warn-tint: #2b2413; --focus: #a9b4ff; --shadow-label: 0 18px 32px -18px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #efece4; --muted: #b0b4bf; --faint: #9a9ea8; --bg: #11141a; --paper: #1b1f28; --card: #1b1f28;
  --line: #2d3340; --line-strong: #6b7282; --primary: #a9b4ff; --primary-dark: #c7ceff; --on-primary: #11141a;
  --route: #6a6f80; --pen: #a9b4ff; --accent: #5fd39b; --accent-tint: #10291f; --accent-line: #1d4a36;
  --warn: #f0c05a; --warn-tint: #2b2413; --focus: #a9b4ff; --shadow-label: 0 18px 32px -18px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.125rem/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--primary); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--primary-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.wrap { max-width: 42rem; margin: 0 auto; padding-inline: 1.25rem; }
.wrap.wide { max-width: 70rem; }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 620; line-height: 1.06; letter-spacing: -0.022em; font-variation-settings: "SOFT" 50; }
h1 { font-size: clamp(2.3rem, 10vw, 4rem); overflow-wrap: break-word; hyphens: manual; }
h1 em, h2 em { font-style: italic; font-weight: 500; color: var(--primary); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 5.5vw, 2rem); line-height: 1.12; }
p { margin: 0 0 1rem; }
.lede { font-size: 1.1875rem; color: var(--muted); margin-top: 1.1rem; max-width: 34rem; }
.eyebrow { font: 700 0.8125rem/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin: 0 0 0.7rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9375rem; }
section { margin-top: 3.75rem; }
section > h2 { margin-bottom: 1.1rem; }

/* ---------- header / logo ---------- */
.site-header { padding-block: calc(0.75rem + env(safe-area-inset-top, 0px)) 0.25rem; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
/* Lockup: the mark is exactly as tall as the "d" and sits on the text baseline. */
.logo { display: inline-flex; align-items: baseline; gap: 0.19em; font-size: 1.75rem; color: var(--primary); text-decoration: none; min-height: 52px; padding-top: 0.2em; }
.logo svg { width: 1.195em; height: 1.195em; position: relative; top: 0.224em; flex: none; }
.wordmark {
  font-family: var(--display); font-weight: 660; font-size: 1em; line-height: 1; letter-spacing: -0.035em;
  color: var(--ink); font-variation-settings: "SOFT" 50; padding-bottom: 0.1em;
}
.wordmark i { font-style: italic; font-weight: 540; color: var(--primary); letter-spacing: -0.015em; }
.header-link {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 46px; padding-inline: 0.95rem;
  font-weight: 700; font-size: 1rem; text-decoration: none; color: var(--primary);
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--card);
}
.header-link:hover { border-color: var(--primary); }
.header-link svg { width: 18px; height: 18px; }

/* ---------- pen strike: the brand name gets crossed out ---------- */
.struck { position: relative; display: inline-block; white-space: nowrap; }
.struck .pen { position: absolute; left: -5%; top: 52%; width: 110%; height: 0.5em; transform: translateY(-50%); overflow: visible; pointer-events: none; }
.struck .pen path { fill: none; stroke: var(--pen); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
/* Reveal the pen line left to right by un-clipping it. (Not stroke-dash tricks: Safari leaves a stray
   dash visible before the animation when the SVG is stretched with a non-scaling stroke.) */
@media (prefers-reduced-motion: no-preference) {
  .struck .pen {
    -webkit-clip-path: inset(-60% 110% -60% -10%); clip-path: inset(-60% 110% -60% -10%);
    animation: strike 0.6s 0.4s cubic-bezier(.6, .1, .3, 1) forwards;
  }
}
@keyframes strike { to { -webkit-clip-path: inset(-60% -10% -60% -10%); clip-path: inset(-60% -10% -60% -10%); } }

/* ---------- home hero ---------- */
.hero { padding-block: 1.5rem 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; }
@media (min-width: 60rem) { .hero { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); align-items: center; padding-top: 3.5rem; gap: 4.5rem; } }

/* ---------- search ---------- */
.search { position: relative; margin-top: 1.9rem; }
.search label { display: block; font-weight: 700; margin-bottom: 0.55rem; }
.search-row { position: relative; }
.search-row > svg { position: absolute; left: 1.05rem; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); color: var(--primary); pointer-events: none; }
.search input {
  width: 100%; min-height: 62px; padding: 0.75rem 3rem 0.75rem 3.1rem;
  font: 500 1.1875rem/1.2 var(--sans); color: var(--ink);
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--line); appearance: none; transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--faint); opacity: 1; }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 4px 4px 0 color-mix(in srgb, var(--primary) 30%, transparent); }
.search .clear {
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; background: none; color: var(--muted); border-radius: 50%; cursor: pointer; display: grid; place-items: center;
}
.search .clear svg { width: 20px; height: 20px; }
.search .hint { font-size: 0.9375rem; color: var(--muted); margin: 0.8rem 0 0; }

.results { list-style: none; margin: 0.75rem 0 0; padding: 0; background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); box-shadow: 4px 4px 0 var(--line); overflow: hidden; }
.results li + li { border-top: 1px solid var(--line); }
.results .opt {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; min-height: 62px; padding: 0.7rem 1rem;
  text-align: left; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-decoration: none;
}
.results .opt[aria-selected="true"], .results .opt:hover { background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
.results .name { display: block; font-family: var(--display); font-weight: 620; font-size: 1.2rem; line-height: 1.2; font-variation-settings: "SOFT" 50; }
.results .sub { font-size: 0.9375rem; color: var(--muted); line-height: 1.35; margin-top: 0.1rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.results .best { display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--primary); margin-bottom: 0.2rem; }
.results .status { padding: 0.9rem 1rem; color: var(--muted); font-size: 0.9375rem; }

.badge { flex: none; font-size: 0.8125rem; font-weight: 700; line-height: 1; padding: 0.42rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.badge.yes { color: var(--accent); background: var(--accent-tint); }
.badge.maybe { color: var(--warn); background: var(--warn-tint); }
.badge.no { color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); }

.try { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1rem; margin: 0.9rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 1rem; }
.try button {
  min-height: 44px; padding: 0; font: 700 1.0625rem var(--sans); color: var(--primary); background: none; border: 0; cursor: pointer;
  text-decoration: underline 2px color-mix(in srgb, var(--primary) 30%, transparent); text-underline-offset: 0.3em;
}
.try button:hover { text-decoration-color: var(--primary); }

/* ---------- the Rx label ---------- */
.rx { position: relative; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-label); }
.rx-top {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 1.1rem; background: var(--primary); color: var(--on-primary);
  border-radius: 10px 10px 0 0; font: 700 0.8125rem/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
}
.rx-top .rx-sym { font: italic 600 1.4rem/1 var(--display); letter-spacing: 0; text-transform: none; }
.rx-top .rx-state { margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.rx-top .rx-state svg { width: 16px; height: 16px; }
.rx.brand .rx-top, .rx.gone .rx-top { background: color-mix(in srgb, var(--muted) 85%, var(--ink)); }
.rx.none .rx-top { background: var(--faint); }
.rx-body { padding: 1rem 1.1rem 0.35rem; }
.rx-brand { margin: 0 0 0.25rem; font: 620 1.6rem/1.15 var(--display); font-variation-settings: "SOFT" 50; letter-spacing: -0.015em; }
.rx-brand.long { font-size: 1.25rem; line-height: 1.25; }
.rx-generic { margin: 0 0 1rem; color: var(--muted); }
.rx-row { margin: 0 0 0.85rem; }
.rx-row .k { display: block; font: 700 0.75rem/1.2 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 0.2rem; }
.rx-tear { position: relative; height: 0; margin-top: 0.5rem; border-top: 1.5px dashed var(--line-strong); }
.rx-tear::before, .rx-tear::after { content: ""; position: absolute; top: -9px; width: 17px; height: 17px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--ink); }
.rx-tear::before { left: -10px; clip-path: inset(0 0 0 50%); }
.rx-tear::after { right: -10px; clip-path: inset(0 50% 0 0); }
.rx-foot { padding: 0.75rem 1.1rem 0.85rem; font-size: 0.875rem; color: var(--muted); }
.rx-foot p { margin: 0; }

/* hero illustration: brand label behind, authorized generic in front */
.pair { margin: 0; padding: 0.5rem 0.4rem 0.25rem; max-width: 30rem; }
.pair .rx.back { transform: rotate(-2.4deg); margin-right: 2.25rem; }
.pair .rx.back .rx-brand { color: var(--faint); }
.pair .rx.back .rx-body { padding-bottom: 2.4rem; }
.pair .rx.front { transform: rotate(1.3deg); margin: -1.9rem 0 0 1.6rem; }
.pair .ndc { font-size: clamp(1.1rem, 5vw, 1.35rem); }
.pair figcaption { margin-top: 1.25rem; font-size: 0.9375rem; color: var(--muted); padding-left: 1.6rem; }
@media (prefers-reduced-motion: no-preference) {
  .pair .rx.front { animation: settle 0.6s 1s cubic-bezier(.2, .8, .3, 1) both; }
}
@keyframes settle { from { opacity: 0; transform: translateY(14px) rotate(3.5deg); } }

/* ---------- strengths + NDC rows ---------- */
.strengths { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.strengths button {
  min-height: 50px; min-width: 5.25rem; padding: 0.45rem 0.95rem; font: 700 1.0625rem var(--sans); color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer;
}
.strengths button small { display: block; font-weight: 500; font-size: 0.8125rem; color: var(--muted); }
.strengths button:hover { border-color: var(--ink); }
.strengths button[aria-pressed="true"] { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
.strengths button[aria-pressed="true"] small { color: var(--on-primary); opacity: 0.85; }
.choose { margin: 0.9rem 0 0.6rem; padding: 0.85rem 1rem; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 1rem; }

.products { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.product { padding: 0.75rem 0 0.25rem; }
.product + .product { border-top: 1px solid var(--line); }
.product-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.1rem 0.5rem; }
.strength { font-weight: 700; font-size: 1.125rem; }
.form, .by { color: var(--muted); font-size: 0.9375rem; }
.by { flex-basis: 100%; font-weight: 700; color: var(--ink); }
.by::before { content: "by "; font-weight: 400; color: var(--muted); }
.pkgs { list-style: none; margin: 0; padding: 0; }
.pkg { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0; }
.pkg > div { min-width: 0; }
.pkg + .pkg { border-top: 1px dashed var(--line); }
.ndc-label { display: block; font: 700 0.75rem/1.2 var(--sans); letter-spacing: 0.1em; color: var(--faint); }
.ndc {
  display: block; font-family: var(--mono); font-weight: 600; font-size: clamp(1.15rem, 5.4vw, 1.65rem); letter-spacing: 0.01em; line-height: 1.2; white-space: nowrap;
  font-variant-numeric: tabular-nums slashed-zero; user-select: all; -webkit-user-select: all; color: var(--ink);
}
.ndc11 { display: block; font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); white-space: nowrap; }
.pkg-desc { display: block; font-size: 0.9375rem; color: var(--muted); }
.copy {
  flex: none; min-width: 76px; min-height: 48px; padding: 0 0.9rem; border-radius: var(--radius-sm);
  font: 700 1rem var(--sans); color: var(--on-primary); background: var(--primary); border: 0; cursor: pointer;
}
.copy:hover { background: var(--primary-dark); }
.copy.done { background: var(--accent); color: var(--paper); }

/* ---------- what to say ---------- */
.say {
  margin: 0; padding: 1.3rem 1.4rem; background: var(--card); border: 1.5px solid var(--line); border-radius: 20px 20px 20px 4px;
  font: italic 450 1.35rem/1.45 var(--display); font-variation-settings: "SOFT" 50;
}
.say .ndc-inline { font: normal 600 1.05rem var(--mono); white-space: nowrap; font-variant-numeric: slashed-zero; color: var(--primary); }

/* ---------- steps, comparison, facts, FAQ ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.4rem; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 2.5rem 1fr; gap: 0.85rem; align-items: baseline; }
.steps li::before { content: counter(s); font: italic 500 2.5rem/1 var(--display); color: var(--primary); }
.steps strong { display: block; font-size: 1.125rem; }
.steps span { color: var(--muted); }
@media (min-width: 48rem) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
  .steps li { grid-template-columns: 1fr; gap: 0.5rem; }
}

.compare-wrap { overflow-x: auto; }
.compare { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 1rem; background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.compare th, .compare td { padding: 0.8rem 0.85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.compare tr:last-child > * { border-bottom: 0; }
.compare thead th { font: 620 1.1rem/1.2 var(--display); font-variation-settings: "SOFT" 50; background: var(--paper); }
.compare thead th.ag { color: var(--accent); }
.compare tbody th { font: 700 0.75rem/1.35 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); width: 28%; }
.compare .ag { background: color-mix(in srgb, var(--accent-tint) 60%, transparent); }
.compare-note { font-size: 0.9375rem; color: var(--muted); margin-top: 0.85rem; }

.facts { padding-left: 1.2rem; margin: 0; }
.facts li { margin-bottom: 0.6rem; }
.facts li::marker { color: var(--primary); }

details { border-top: 1px solid var(--line); }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font: 620 1.2rem/1.3 var(--display); font-variation-settings: "SOFT" 50; min-height: 60px; display: flex; align-items: center; gap: 0.75rem; list-style: none; padding-block: 0.55rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; margin-left: auto; font: 400 1.7rem/1 var(--sans); color: var(--primary); }
details[open] summary::after { content: "–"; }
details > p, details > .table-wrap { color: var(--muted); }

.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
table.plain { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
table.plain th, table.plain td { text-align: left; padding: 0.5rem 0.6rem 0.5rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plain th { font-weight: 700; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 56px; padding: 0 1.4rem;
  font: 700 1.0625rem var(--sans); color: var(--on-primary); background: var(--primary); border: 0; border-radius: var(--radius-sm); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--primary-dark); color: var(--on-primary); }
.btn.secondary { color: var(--primary); background: var(--card); border: 1.5px solid var(--primary); }
.btn svg { width: 18px; height: 18px; }

.also { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.5rem; }
.also a { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; min-height: 54px; padding: 0.6rem 1rem; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm); font: 620 1.15rem var(--display); text-decoration: none; }
.also a:hover { border-color: var(--primary); }

.answer-panel { margin-top: 1.4rem; }
.source { font-size: 0.9375rem; color: var(--muted); }
.source p { margin-bottom: 0.5rem; }

/* ---------- footer ---------- */
.site-footer { margin-top: 5rem; padding-block: 2.25rem calc(2.5rem + env(safe-area-inset-bottom, 0px)); border-top: 1.5px solid var(--ink); color: var(--muted); font-size: 0.9375rem; }
.site-footer .logo { font-size: 1.4rem; min-height: 0; }
.site-footer p { margin: 0 0 0.75rem; max-width: 40rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 0.5rem 0 0.75rem; }
.site-footer nav a { font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .site-header .header-link, .search, .copy, .strengths, .site-footer nav { display: none !important; }
  body { background: #fff; }
  .product[hidden] { display: block !important; }
}
