/* ============================================================
   Priolix v2 — Stripe-docs-inspired, teal accent
   ============================================================ */

@import url('https://rsms.me/inter/inter.css');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Palette */
  --bg:          #ffffff;
  --surface:     #f6f9fc;
  --surface-2:   #f0f4f8;
  --ink:         #0a2540;
  --ink-soft:    #425466;
  --ink-mute:    #697386;
  --border:      #e3e8ee;
  --border-soft: #eef2f6;

  /* Accent — teal */
  --accent:       #0d9488;
  --accent-hover: #0f766e;
  --accent-soft:  #f0fdfa;
  --accent-ink:   #134e4a;
  --accent-glow:  rgba(13, 148, 136, 0.15);

  /* Semantic */
  --success:      #09825d;
  --success-soft: #ecfdf5;
  --warning:      #bb5504;
  --warning-soft: #fff7ed;
  --danger:       #cd3500;
  --danger-soft:  #fef2f2;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* Scale */
  --text-xs:   12px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   16px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;
  --text-3xl:  40px;
  --text-hero: 56px;

  /* Rhythm */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Shape */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(10, 37, 64, 0.05);
  --shadow:    0 1px 3px rgba(10, 37, 64, 0.08), 0 1px 2px rgba(10, 37, 64, 0.04);

  /* Layout */
  --topbar-h:  56px;
  --rail-left: 260px;
  --rail-right: 260px;
  --content-max: 720px;
}

/* ============================================================
   Base
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@supports (font-variation-settings: normal) {
  :root { --font-sans: 'Inter var', -apple-system, sans-serif; }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 120ms ease;
}
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
h1 { font-size: var(--text-3xl); line-height: 1.15; letter-spacing: -0.03em; }
h2 { font-size: var(--text-2xl); line-height: 1.25; }
h3 { font-size: var(--text-xl); line-height: 1.3; font-weight: 600; }
h4 { font-size: var(--text-md); line-height: 1.4; font-weight: 600; }

p { margin: 0 0 var(--space-4); }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  color: var(--ink);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

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

/* ============================================================
   Topbar
   ============================================================ */

.v2-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-6);
}

.v2-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.v2-brand:hover { color: var(--ink); }
.v2-brand-mark {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}

.v2-nav {
  display: flex;
  gap: var(--space-5);
  flex: 1;
}
.v2-nav a {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.v2-nav a:hover { color: var(--ink); }
.v2-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.v2-search {
  position: relative;
  width: 280px;
}
.v2-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink);
  transition: border-color 120ms, box-shadow 120ms;
}
.v2-search input::placeholder { color: var(--ink-mute); }
.v2-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}
.v2-search::before {
  content: '';
  position: absolute;
  left: 12px; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23697386' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center/contain no-repeat;
  pointer-events: none;
}
.v2-search kbd {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  padding: 2px 5px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink-mute);
}

/* ============================================================
   Three-column layout
   ============================================================ */

.v2-shell {
  display: grid;
  grid-template-columns: var(--rail-left) minmax(0, 1fr) var(--rail-right);
  max-width: 1400px;
  margin: 0 auto;
  gap: var(--space-7);
  padding: var(--space-6) var(--space-6) var(--space-8);
}

.v2-rail-left, .v2-rail-right {
  font-size: var(--text-sm);
  line-height: 1.55;
}
.v2-rail-left  { position: sticky; top: calc(var(--topbar-h) + var(--space-5)); align-self: start; max-height: calc(100vh - var(--topbar-h) - var(--space-7)); overflow-y: auto; padding-right: var(--space-2); }
.v2-rail-right { position: sticky; top: calc(var(--topbar-h) + var(--space-5)); align-self: start; max-height: calc(100vh - var(--topbar-h) - var(--space-7)); overflow-y: auto; padding-left: var(--space-2); }

.v2-main {
  min-width: 0;
  max-width: var(--content-max);
}

@media (max-width: 1200px) {
  .v2-shell { grid-template-columns: var(--rail-left) minmax(0, 1fr); }
  .v2-rail-right { display: none; }
}
@media (max-width: 860px) {
  .v2-shell { grid-template-columns: 1fr; padding: var(--space-4); gap: var(--space-5); }
  .v2-rail-left { display: none; }
  .v2-nav { gap: var(--space-4); overflow-x: auto; white-space: nowrap; }
  .v2-search { display: none; }
}

/* ============================================================
   Left rail — entity tree
   ============================================================ */

.v2-tree-group {
  margin-bottom: var(--space-5);
}
.v2-tree-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  font-weight: 600;
  padding: 0 10px var(--space-2);
}
.v2-tree a {
  display: block;
  color: var(--ink-soft);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-weight: 400;
  line-height: 1.45;
}
.v2-tree a:hover { color: var(--ink); background: var(--surface); }
.v2-tree a.active {
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-weight: 500;
}
.v2-tree a.child { padding-left: 22px; }
.v2-tree a.grandchild { padding-left: 34px; font-size: var(--text-xs); color: var(--ink-mute); }

/* ============================================================
   Right rail — TOC + quick facts
   ============================================================ */

.v2-toc-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.v2-toc a {
  display: block;
  color: var(--ink-soft);
  padding: 4px 0;
  font-size: var(--text-sm);
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -14px;
}
.v2-toc a:hover { color: var(--ink); }
.v2-toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 500; }

.v2-facts {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}
.v2-facts-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute); font-weight: 600; margin-bottom: var(--space-3); }
.v2-fact-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 6px 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-soft);
}
.v2-fact-row:last-child { border-bottom: 0; }
.v2-fact-key { color: var(--ink-mute); }
.v2-fact-val { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.v2-fact-val.mono { font-family: var(--font-mono); font-size: var(--text-xs); }

/* ============================================================
   Main content
   ============================================================ */

.v2-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.v2-breadcrumb {
  font-size: var(--text-sm);
  color: var(--ink-mute);
  margin-bottom: var(--space-3);
}
.v2-breadcrumb a { color: var(--ink-mute); }
.v2-breadcrumb a:hover { color: var(--ink); }
.v2-breadcrumb span.sep { margin: 0 6px; color: var(--border); }

.v2-page-header {
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.v2-page-header .aliases {
  margin-top: var(--space-3);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}
.v2-page-header .aliases em { font-style: normal; color: var(--ink); }

.v2-section {
  padding: var(--space-7) 0;
  border-top: 1px solid var(--border-soft);
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}
.v2-section:first-of-type { border-top: 0; padding-top: var(--space-5); }

.v2-section > h2 {
  margin-bottom: var(--space-2);
}
.v2-section > h2 + .v2-section-sub {
  color: var(--ink-soft);
  font-size: var(--text-md);
  margin-bottom: var(--space-5);
}

.v2-prose {
  color: var(--ink);
  font-size: var(--text-md);
  line-height: 1.7;
}
.v2-prose p { margin: 0 0 var(--space-4); }
.v2-prose h3 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  font-size: var(--text-lg);
  color: var(--ink);
}
.v2-prose ul { padding-left: 20px; margin: 0 0 var(--space-4); }
.v2-prose li { margin-bottom: var(--space-2); }
.v2-prose a { border-bottom: 1px solid var(--accent-glow); }
.v2-prose a:hover { border-bottom-color: var(--accent); }

/* ============================================================
   Components
   ============================================================ */

/* Hero stat strip — one line, tabular */
.v2-stat-strip {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}
.v2-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.v2-stat-val {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.v2-stat-val.mono { font-family: var(--font-mono); }
.v2-stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  font-weight: 500;
}

/* Callout box (Key Takeaways etc.) — quiet Stripe-style */
.v2-callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: var(--space-5) 0;
}
.v2-callout h4 {
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.v2-callout ul { margin: 0; padding-left: 18px; }
.v2-callout li { color: var(--ink); font-size: var(--text-sm); line-height: 1.6; margin-bottom: var(--space-1); }

/* Badges / pills */
.v2-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  border: 1px solid var(--border);
  line-height: 1.6;
  white-space: nowrap;
}
.v2-badge.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.v2-badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.v2-badge.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.v2-badge.danger  { background: var(--danger-soft);  color: var(--danger);  border-color: transparent; }
.v2-badge.mono { font-family: var(--font-mono); font-size: 11px; }

/* Tight tabular list (product/source rows) */
.v2-row-list { display: flex; flex-direction: column; border-top: 1px solid var(--border-soft); }
.v2-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--text-sm);
  color: var(--ink);
  min-height: 56px;
}
.v2-row:hover { background: var(--surface); margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.v2-row-thumb {
  width: 40px; height: 40px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--ink-mute);
  font-size: var(--text-xs);
  border: 1px solid var(--border-soft);
}
.v2-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.v2-row-main { flex: 1; min-width: 0; }
.v2-row-title { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-row-sub   { color: var(--ink-mute); font-size: var(--text-xs); margin-top: 2px; }
.v2-row-trail { color: var(--ink-mute); font-size: var(--text-xs); font-variant-numeric: tabular-nums; text-align: right; }

/* Evidence source card — Stripe-style hairline list */
.v2-src {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-soft);
}
.v2-src:last-child { border-bottom: 0; }
.v2-src-head {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-2);
}
.v2-src-tier {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}
.v2-src-tier.a { background: #dcfce7; color: #166534; }
.v2-src-tier.b { background: #dbeafe; color: #1e40af; }
.v2-src-tier.c { background: #fef3c7; color: #92400e; }
.v2-src-tier.d { background: #fee2e2; color: #991b1b; }
.v2-src-title {
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}
.v2-src-meta {
  display: flex;
  gap: var(--space-3);
  color: var(--ink-mute);
  font-size: var(--text-xs);
  flex-wrap: wrap;
  margin-left: 34px;
}
.v2-src-meta .dot { color: var(--border); }
.v2-src-abstract {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  margin: var(--space-2) 0 0 34px;
  line-height: 1.55;
}

/* Filter chips — single consistent style */
.v2-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-4) 0;
}
.v2-chip {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 120ms;
  font-feature-settings: 'tnum';
}
.v2-chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.v2-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.v2-chip .count { margin-left: 4px; opacity: 0.7; }

/* Button */
.v2-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--ink);
  color: #fff !important;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 0;
  cursor: pointer;
  transition: background 120ms;
}
.v2-btn:hover { background: #000; color: #fff; }
.v2-btn.accent { background: var(--accent); }
.v2-btn.accent:hover { background: var(--accent-hover); }
.v2-btn.ghost { background: transparent; color: var(--ink) !important; border: 1px solid var(--border); }
.v2-btn.ghost:hover { border-color: var(--ink); background: var(--surface); }

/* Table */
.v2-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin: var(--space-4) 0;
}
.v2-table th, .v2-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.v2-table th {
  color: var(--ink-mute);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom-color: var(--border);
}
.v2-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Footer */
.v2-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-7) var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-6);
  font-size: var(--text-sm);
}
.v2-footer h5 { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute); margin: 0 0 var(--space-3); font-weight: 600; }
.v2-footer a { display: block; padding: 3px 0; color: var(--ink-soft); }
.v2-footer a:hover { color: var(--ink); }
.v2-footer-brand { font-weight: 600; color: var(--ink); font-size: var(--text-md); margin-bottom: var(--space-2); }
.v2-footer-tag { color: var(--ink-mute); font-size: var(--text-sm); }
.v2-legal { text-align: center; padding: var(--space-4) var(--space-6); color: var(--ink-mute); font-size: var(--text-xs); border-top: 1px solid var(--border-soft); }

@media (max-width: 860px) {
  .v2-footer { grid-template-columns: 1fr 1fr; }
}

/* Citations inline */
.v2-cite {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  text-decoration: none;
  border-bottom: 0 !important;
  vertical-align: baseline;
  margin: 0 1px;
}
.v2-cite:hover { background: var(--accent); color: #fff; }

/* Divider label */
.v2-hr-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  font-weight: 600;
  margin: var(--space-6) 0 var(--space-4);
}
.v2-hr-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================
   Phase 1 additions — skip link, main wrapper, mobile nav,
   social icons, DSHEA strip, cookie banner, a11y
   ============================================================ */

/* Skip link for a11y */
.v2-skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 13px;
  text-decoration: none;
  transition: top 120ms;
}
.v2-skip-link:focus { top: 8px; color: #fff; }

/* Main content wrapper — page content lives inside .v2-shell blocks, but
   pages without the shell (simple markdown, legal pages) use a default. */
.v2-content { min-height: calc(100vh - var(--topbar-h) - 300px); }
.v2-content > .v2-shell { padding-top: 24px; }

/* Page-content fallback for templates that don't use .v2-shell yet */
.v2-content > .page-content,
.v2-content > .content-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Focus rings */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Mobile hamburger (hidden on desktop) */
.v2-nav-toggle-cb { display: none; }
.v2-nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.v2-nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
}

@media (max-width: 860px) {
  .v2-nav-toggle { display: flex; }
  .v2-nav {
    position: absolute;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    flex-direction: column;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: var(--space-4);
    gap: var(--space-3);
    display: none;
  }
  .v2-nav-toggle-cb:checked ~ .v2-nav { display: flex; }
  .v2-nav a { padding: 10px 0; font-size: var(--text-base); min-height: 44px; display: flex; align-items: center; }
}

/* Social icons */
.v2-social {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}
.v2-social-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--ink-mute);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.v2-social-icon:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* DSHEA disclaimer */
.v2-dshea {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-xs);
  color: var(--ink-mute);
  line-height: 1.6;
  border-top: 1px solid var(--border-soft);
}
.v2-dshea strong { color: var(--ink-soft); }

/* Cookie banner — slim top bar (moved from bottom per v2) */
.v2-cookie-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--ink);
  color: #fff;
  font-size: var(--text-sm);
}
.v2-cookie-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.v2-cookie-inner p {
  margin: 0;
  flex: 1;
  min-width: 280px;
  color: #d4e2f0;
}
.v2-cookie-inner a { color: #fff; text-decoration: underline; }
.v2-cookie-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }
.v2-cookie-banner .v2-btn.ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.v2-cookie-banner .v2-btn.ghost:hover { background: rgba(255,255,255,0.1); border-color: #fff; }

/* When cookie banner is visible, push topbar down */
body:has(.v2-cookie-banner[style*="display:none"]) .v2-topbar { top: 0; }
body:has(.v2-cookie-banner:not([style*="display:none"])) .v2-topbar { top: 44px; }

/* Mobile: stack cookie banner */
@media (max-width: 640px) {
  .v2-cookie-inner { padding: 10px var(--space-4); gap: var(--space-3); }
  .v2-cookie-inner p { font-size: var(--text-xs); }
  body:has(.v2-cookie-banner:not([style*="display:none"])) .v2-topbar { top: 72px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Touch target minimums on mobile */
@media (max-width: 860px) {
  .v2-nav a,
  .v2-chip,
  .v2-btn,
  .v2-social-icon {
    min-height: 44px;
  }
}

/* Contrast fix: accent-soft callout header was risky on accent text.
   Darken slightly for AA compliance. */
.v2-callout h4 {
  color: var(--accent-ink);
  font-weight: 700;
}

/* ============================================================
   Partial aliases — let legacy class names from _ai_badge and
   _evidence_legend inherit v2 styling without rewriting callers.
   ============================================================ */

.ai-gen-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-mute);
  padding: 3px 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.ai-gen-badge a { color: inherit; text-decoration: underline; opacity: 0.7; }
.ai-gen-badge a:hover { opacity: 1; }
.ai-gen-icon { font-size: 11px; }

.evidence-legend {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) 0;
  font-size: var(--text-xs);
  color: var(--ink-mute);
}
.ev-legend-item { display: inline-flex; align-items: center; gap: 6px; }

.tier-badge {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.tier-badge.tier-a { background: #dcfce7; color: #166534; }
.tier-badge.tier-b { background: #dbeafe; color: #1e40af; }
.tier-badge.tier-c { background: #fef3c7; color: #854d0e; }
.tier-badge.tier-d { background: #f3f4f6; color: #4b5563; }

/* Error page (404) */
.v2-error-page {
  max-width: 560px;
  margin: 80px auto;
  text-align: center;
  padding: var(--space-7) var(--space-5);
}
.v2-error-page h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
  color: var(--ink);
}
.v2-error-page p { color: var(--ink-soft); margin-bottom: var(--space-3); }
.v2-error-page code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
}

/* Safety callout (product detail) */
.v2-safety-callout {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
}
.v2-safety-score {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
}
.v2-safety-success { background: var(--success-soft); }
.v2-safety-success .v2-safety-score { color: var(--success); }
.v2-safety-warning { background: var(--warning-soft); }
.v2-safety-warning .v2-safety-score { color: var(--warning); }
.v2-safety-danger { background: var(--danger-soft); }
.v2-safety-danger .v2-safety-score { color: var(--danger); }

/* ============================================================
   Home hero
   ============================================================ */
.v2-home-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}
@media (max-width: 860px) {
  .v2-home-wrap { padding: 0 var(--space-4); }
}
.v2-home-hero {
  text-align: center;
  padding: var(--space-10) var(--space-5) var(--space-8);
  max-width: 720px;
  margin: 0 auto;
}
.v2-home-hero h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-3);
}
.v2-home-sub {
  color: var(--ink-soft);
  font-size: var(--text-lg);
  margin-bottom: var(--space-6);
}
.v2-home-search {
  display: flex;
  gap: var(--space-2);
  max-width: 520px;
  margin: 0 auto;
}
.v2-home-search input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  outline: none;
  background: var(--bg);
  color: var(--ink);
}
.v2-home-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.v2-stat-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  transition: background 0.15s;
}
.v2-stat-link:hover { background: var(--surface); }

/* ============================================================
   Category grid (home page)
   ============================================================ */
.v2-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}
.v2-cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-5) var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: center;
}
.v2-cat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.v2-cat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: var(--space-2);
}
.v2-cat-name {
  font-weight: 500;
  font-size: var(--text-sm);
  margin-bottom: 2px;
}
.v2-cat-count {
  font-size: var(--text-xs);
  color: var(--ink-mute);
}
.v2-cat-all {
  border-style: dashed;
}

/* ============================================================
   Input fields (directory search, sort, etc.)
   ============================================================ */
.v2-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  outline: none;
}
.v2-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
select.v2-input {
  cursor: pointer;
  appearance: auto;
}
