/* =============================================================================
   Pepvela main site V3 -- converted educational pages (peptide, biomarker, goal
   and research pages, the guides and the legal pages).
   Their own page CSS is kept, scoped to .v3-legacy and recolored onto the V3
   semantic tokens by scripts/v3/convert.js. This file adds the inverse-panel
   tokens and the shared V3 treatment: the page hero, type, labels, links,
   tables, disclaimer strips and the "continue" block. Light and dark both come
   from the tokens in css/v3-site.css.
   ============================================================================= */
:root { --inverse-bg: var(--pv-night); --inverse-text: var(--pv-text-light); --inverse-muted: rgba(var(--pv-fg-rgb), 0.74); }

body.v3 .v3-legacy { color: var(--text-primary); font-family: var(--font-ui); line-height: 1.65; }
body.v3 .v3-legacy h1, body.v3 .v3-legacy h2, body.v3 .v3-legacy h3, body.v3 .v3-legacy h4 { font-family: var(--font-ui); letter-spacing: -0.02em; color: var(--text-primary); }
body.v3 .v3-legacy p, body.v3 .v3-legacy li { color: inherit; }
body.v3 .v3-legacy h1, body.v3 .v3-legacy h2 { font-weight: 700; }
body.v3 .v3-legacy h3, body.v3 .v3-legacy h4 { font-weight: 650; }
body.v3 .v3-legacy button, body.v3 .v3-legacy input, body.v3 .v3-legacy select, body.v3 .v3-legacy textarea { font-family: var(--font-ui); }
body.v3 .v3-legacy a { color: var(--accent-text); }
body.v3 .v3-legacy img { max-width: 100%; height: auto; }

/* ---- the page hero: V2 photo bands become a calm, theme-aware V3 header ---- */
body.v3 .v3-legacy .hero,
body.v3 .v3-legacy .art-header,
body.v3 .v3-legacy .quiz-hero,
body.v3 .v3-legacy .results-header {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 0; color: var(--text-primary); text-align: left;
  padding: clamp(56px, 9vh, 104px) var(--gutter) clamp(36px, 6vh, 64px);
  background: radial-gradient(52% 70% at 88% 20%, var(--scene-a), transparent 70%),
              radial-gradient(40% 60% at 70% 90%, var(--scene-b), transparent 72%), var(--bg);
  border-bottom: 1px solid var(--border-soft);
}
body.v3 .v3-legacy .hero::after,
body.v3 .v3-legacy .art-header::after { content: ""; position: absolute; inset: auto 0 0 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent-line), transparent); }
body.v3 .v3-legacy .hero-inner, body.v3 .v3-legacy .hero .container, body.v3 .v3-legacy .art-header .container { max-width: 860px; margin: 0 auto; padding: 0 24px; }
body.v3 .v3-legacy .hero h1, body.v3 .v3-legacy .art-header h1 { color: var(--text-primary); font-size: clamp(32px, 4.4vw, 52px); font-weight: 700; line-height: 1.08; letter-spacing: -0.03em; margin-bottom: 16px; }
body.v3 .v3-legacy .hero p, body.v3 .v3-legacy .hero .hero-sub, body.v3 .v3-legacy .art-header .art-subtitle { color: var(--text-secondary); font-size: clamp(16px, 1.4vw, 18.5px); line-height: 1.65; max-width: 64ch; }
body.v3 .v3-legacy .hero .hero-disclaimer, body.v3 .v3-legacy .hero .last-reviewed, body.v3 .v3-legacy .art-header .art-metaline { color: var(--text-muted); font-size: 13px; font-style: normal; }
body.v3 .v3-legacy .breadcrumb, body.v3 .v3-legacy .breadcrumb a, body.v3 .v3-legacy .breadcrumb span { color: var(--text-muted); font-size: 13px; text-decoration: none; }
body.v3 .v3-legacy .breadcrumb a:hover { color: var(--accent-text); }
body.v3 .v3-legacy .hero-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
/* V2 heroes were centered on a photo; the V3 header reads left-aligned */
body.v3 .v3-legacy :is(.hero, .quiz-hero, .results-header) :is(h1, p, [class*="title"], [class*="sub"], [class*="eyebrow"]) { margin-left: 0; margin-right: 0; text-align: left; }
body.v3 .v3-legacy :is(.hero, .quiz-hero, .results-header) { text-align: left; }
body.v3 .v3-legacy :is(.hero, .quiz-hero, .results-header) :is([class*="badges"], [class*="stats"], [class*="pills"], [class*="tags"], [class*="meta"], [class*="actions"], [class*="buttons"]) { justify-content: flex-start; margin-left: 0; margin-right: 0; }
body.v3 .v3-legacy :is(.quiz-hero, .results-header) .container { max-width: 860px; margin: 0 auto; }
body.v3 .v3-legacy :is(.quiz-hero, .results-header) em { color: var(--accent-text); font-style: normal; }
body.v3 .v3-legacy .section-label { display: inline-flex; width: auto; }
body.v3 .v3-legacy .category-pill, body.v3 .v3-legacy .art-badge, body.v3 .v3-legacy .hero__badge, body.v3 .v3-legacy .hero .tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 650;
  background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-line);
}
body.v3 .v3-legacy .hero .btn-primary, body.v3 .v3-legacy .btn-primary { background: var(--accent); color: var(--text-on-accent); border-radius: 999px; }
body.v3 .v3-legacy .btn-secondary { border-radius: 999px; }

/* ---- section rhythm ---- */
body.v3 .v3-legacy .section-label { background: var(--accent-soft); color: var(--accent-text); letter-spacing: 0.14em; }
body.v3 .v3-legacy .section h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; }
body.v3 .v3-legacy .container { max-width: 860px; }
body.v3 .v3-legacy hr { border: 0; height: 1px; background: var(--border-soft); }

/* ---- tables, details, quotes ---- */
body.v3 .v3-legacy table { border-collapse: collapse; width: 100%; }
body.v3 .v3-legacy th { background: var(--surface-soft); color: var(--text-primary); }
body.v3 .v3-legacy th, body.v3 .v3-legacy td { border-color: var(--border-soft); }
body.v3 .v3-legacy .table-wrap, body.v3 .v3-legacy .table-scroll { overflow-x: auto; }
body.v3 .v3-legacy blockquote { border-left: 3px solid var(--accent-line); color: var(--text-secondary); }
body.v3 .v3-legacy summary { cursor: pointer; }

/* ---- disclaimer strips ---- */
body.v3 .v3-legacy .disclaimer-strip { background: var(--surface-sunken); color: var(--text-muted); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
body.v3 .v3-legacy .disclaimer-strip p, body.v3 .v3-legacy .disclaimer-strip a { color: var(--text-muted); }

/* ---- inverse panels (V2 deep-indigo blocks stay deep in both themes) ---- */
body.v3 .v3-legacy [style*="var(--inverse-bg)"] { color: var(--inverse-text); }
body.v3 .v3-legacy [style*="var(--inverse-bg)"] h2, body.v3 .v3-legacy [style*="var(--inverse-bg)"] h3 { color: var(--inverse-text); }

/* ---- the V3 continue block (replaces the V2 call-to-action bands) ---- */
.v3-continue { padding-block: clamp(48px, 7vw, 88px) 0; }
.v3-continue__title { font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; color: var(--text-primary); }
.v3-continue__links { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.v3-continue__links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; border-bottom: 1px solid var(--border-soft); color: var(--text-primary); font-weight: 650; text-decoration: none; }
.v3-continue__links li:first-child a { border-top: 1px solid var(--border-soft); }
.v3-continue__links a:hover { color: var(--accent-text); }
.v3-continue__links a:hover .v3-arrow { transform: translateX(3px); }
.v3-continue__links .v3-arrow { transition: transform 0.2s var(--ease); color: var(--accent-text); }

/* evidence rating under editorial review (docs/EVIDENCE-AUDIT.md): a neutral status, never a level */
body.v3 .v3-legacy .badge--review { background: var(--surface-sunken); color: var(--text-secondary); border: 1px dashed var(--border-strong); }

@media (max-width: 760px) {
  /* wide data tables scroll inside themselves, never the page */
  body.v3 .v3-legacy table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 420px) {
  /* long lab-range values wrap on the narrowest phones instead of widening the page */
  body.v3 .v3-legacy li > span:is(:first-child, :last-child, :only-child), body.v3 .v3-legacy [class*="range"] [class], body.v3 .v3-legacy [class*="range"] { white-space: normal; min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 640px) {
  body.v3 .v3-legacy table { font-size: 14px; }
  body.v3 .v3-legacy .hero, body.v3 .v3-legacy .art-header { padding-inline: var(--gutter); }
}

/* ---- research articles: header aligned with the /research library cards (2026-10-09) ----
   CSS only; the article markup and copy are unchanged. */
body.v3-doc--research .v3-legacy .art-header .breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 22px; }
body.v3-doc--research .v3-legacy .art-header .breadcrumb span[style] { color: var(--text-secondary) !important; }
body.v3-doc--research .v3-legacy .art-header .art-badge { margin: 0 6px 16px 0; letter-spacing: 0.01em; }
body.v3-doc--research .v3-legacy .art-header h1 { margin-top: 2px; max-width: 24ch; }
body.v3-doc--research .v3-legacy .art-header .art-metaline { margin-top: 14px; font-weight: 600; }
body.v3-doc--research .v3-legacy .art-header .regulatory-status { margin-top: 6px; }
