/* ============================================================
   The World of Vinegar — styles
   ============================================================ */

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

:root {
  --topbar-h: 58px;
  --sidebar-w: 264px;
  --bg: #faf6ee;
  --bg-alt: #f2ebdc;
  --surface: #fffdf8;
  --text: #2b2016;
  --muted: #7c6c59;
  --accent: #a05a1e;
  --accent-deep: #7a3f10;
  --wine: #722f37;
  --gold: #c89b3c;
  --line: #e6dbc5;
  --shadow: 0 1px 3px rgba(60, 40, 15, .08), 0 8px 28px rgba(60, 40, 15, .07);
  --radius: 14px;
}

html[data-theme="dark"] {
  --bg: #171210;
  --bg-alt: #1e1713;
  --surface: #251d16;
  --text: #efe6d7;
  --muted: #b4a38e;
  --accent: #dd9439;
  --accent-deep: #b06a1d;
  --wine: #c47a84;
  --gold: #d9b25f;
  --line: #3b3026;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .stat-line, .foot-brand {
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.15;
  margin: 0;
}

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  background: var(--bg-alt);
  padding: .1em .35em;
  border-radius: 5px;
  font-size: .88em;
}
img, svg { vertical-align: middle; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

/* ---------- skip link ---------- */
.skip-link {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
  background: var(--accent); color: #fff;
  padding: 10px 16px; border-radius: 0 0 10px 0;
  z-index: 100; text-decoration: none; font-weight: 600;
}
.skip-link:focus {
  left: 0; top: 0; width: auto; height: auto;
  outline: 2px solid var(--gold); outline-offset: 2px;
}

/* ---------- progress bar ---------- */
.progress-bar {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 90;
  background: transparent;
}
.progress-bar span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--accent), var(--wine));
  transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- topbar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 80;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600; font-size: 1.05rem; letter-spacing: .01em;
  color: var(--text);
}
.brand svg { color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav-toggle, .theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text);
  cursor: pointer;
}
.nav-toggle:hover, .theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle { margin-left: auto; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }
html:not([data-theme="dark"]) .icon-sun { display: none; }
html:not([data-theme="dark"]) .icon-moon { display: block; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; z-index: 70;
  top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  padding: 22px 18px 30px;
  overflow-y: auto;
  background: var(--bg-alt);
  border-right: 1px solid var(--line);
}
.side-home {
  display: block; margin: 0 0 6px 12px;
  font-weight: 600; font-size: .95rem;
}
.side-title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin: 0 0 12px 12px; font-weight: 700;
}
.side-list { list-style: none; margin: 0; padding: 0; counter-reset: ch; }
.side-list li { margin: 2px 0; }
.side-list a {
  counter-increment: ch;
  display: flex; gap: 10px; align-items: baseline;
  padding: 7px 12px; border-radius: 9px;
  color: var(--text); font-size: .92rem; font-weight: 500;
}
.side-list a::before {
  content: counter(ch, decimal-leading-zero);
  font-size: .72rem; color: var(--muted); font-weight: 600;
  min-width: 1.6em;
}
.side-list a:hover { background: var(--surface); text-decoration: none; }
.side-list a.active { background: var(--surface); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.nav-overlay {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(20, 12, 5, .45);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: calc(var(--topbar-h) + clamp(48px, 9vh, 96px)) 0 clamp(44px, 7vh, 76px);
  background:
    radial-gradient(900px 420px at 85% -10%, color-mix(in srgb, var(--wine) 26%, transparent), transparent 62%),
    radial-gradient(760px 400px at -10% 20%, color-mix(in srgb, var(--gold) 30%, transparent), transparent 60%),
    radial-gradient(600px 500px at 55% 115%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 65%),
    var(--bg);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.kicker {
  text-transform: uppercase; letter-spacing: .22em; font-weight: 700;
  font-size: .78rem; color: var(--accent); margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 640;
  letter-spacing: -.02em;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.lede {
  max-width: 620px;
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  color: var(--muted);
  margin: 20px 0 24px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 36px; }
.chip {
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}

/* ---------- stats ---------- */
.stat-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-num, .stat-line {
  display: block; font-size: 1.55rem; font-weight: 640; color: var(--accent-deep);
}
html[data-theme="dark"] .stat-num, html[data-theme="dark"] .stat-line { color: var(--gold); }
.stat-label { display: block; margin-top: 4px; font-size: .82rem; color: var(--muted); }

/* ---------- layout & sections ---------- */
.layout { padding-top: clamp(40px, 7vh, 80px); padding-bottom: 40px; }
.section { padding: clamp(40px, 7vh, 72px) 0; scroll-margin-top: calc(var(--topbar-h) + 14px); }
.section.alt { background: var(--bg-alt); border-block: 1px solid var(--line); }

.section-head { max-width: 780px; margin-bottom: 34px; }
.chapter-no {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic; font-size: .95rem; color: var(--accent);
  margin: 0 0 8px;
}
.section-head h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); font-weight: 620; letter-spacing: -.01em; }
.section-lede { margin-top: 14px; color: var(--muted); font-size: 1.04rem; }
.sub-head {
  font-size: 1.28rem; font-weight: 620; margin: 34px 0 16px;
  padding-left: 14px; border-left: 3px solid var(--gold);
}
.region-name {
  font-size: 1.18rem; font-weight: 620; margin: 30px 0 12px; color: var(--text);
}
.note { font-size: .92rem; color: var(--muted); }

/* ---------- cards ---------- */
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 18px 0 8px; }
.card-grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card-grid.three { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px;
}
.card h4 { font-size: 1.05rem; margin-bottom: 8px; }
.card p:last-child { margin-bottom: 0; }
.step-card { border-top: 3px solid var(--gold); }
.step-badge {
  display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.formula {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  background: var(--bg-alt); border-radius: 8px; padding: 10px 14px;
  font-size: .95rem; margin: 12px 0 0;
}
.tier-stack { display: grid; gap: 14px; margin: 16px 0; }
.tier-card { border-left: 4px solid var(--wine); }
.method-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 16px; }
.method-card { position: relative; padding-top: 26px; }
.method-card.wide { grid-column: 1 / -1; }
.m-letter {
  position: absolute; top: -14px; left: 18px; margin: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-family: "Fraunces", serif; font-weight: 700; font-size: 1rem;
}
.m-tag {
  font-size: .76rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--gold); margin: 2px 0 10px;
}
.src-card ul { margin: 8px 0 0; padding-left: 18px; }
.src-card li { margin-bottom: 8px; font-size: .93rem; }

/* ---------- flow diagram ---------- */
.flow {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px;
  margin: 18px 0 10px;
}
.flow-step {
  flex: 1 1 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.flow-step span {
  display: block; font-family: "Fraunces", serif; font-weight: 640; font-size: 1.02rem;
  color: var(--accent-deep); margin-bottom: 6px;
}
html[data-theme="dark"] .flow-step span { color: var(--gold); }
.flow-step small { color: var(--muted); font-size: .83rem; line-height: 1.45; display: block; }
.flow-arrow {
  align-self: center; font-size: 1.5rem; color: var(--accent); font-weight: 700;
}

/* ---------- lists ---------- */
.dash-list { list-style: none; padding: 0; margin: 12px 0; }
.dash-list li { position: relative; padding-left: 22px; margin-bottom: 10px; }
.dash-list li::before {
  content: ""; position: absolute; left: 2px; top: .68em;
  width: 9px; height: 2px; background: var(--accent);
}
.cross-list { list-style: none; padding: 0; }
.cross-list li { position: relative; padding-left: 30px; margin-bottom: 10px; }
.cross-list li::before {
  content: "\00D7"; position: absolute; left: 4px; top: 0;
  color: var(--wine); font-weight: 800; font-size: 1.15rem;
}
.step-list { counter-reset: step; list-style: none; padding: 0; margin: 14px 0; }
.step-list li {
  counter-increment: step; position: relative;
  padding: 12px 16px 12px 52px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.step-list li::before {
  content: counter(step);
  position: absolute; left: 14px; top: 12px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold); color: #fff; font-weight: 700; font-size: .85rem;
}
.fact-list li { margin-bottom: 12px; }

/* ---------- callouts ---------- */
.callout {
  border-radius: var(--radius); padding: 16px 20px; margin: 22px 0;
  border: 1px solid var(--line); background: var(--surface);
  border-left-width: 4px;
}
.callout.info { border-left-color: var(--gold); }
.callout.warn { border-left-color: var(--wine); background: color-mix(in srgb, var(--wine) 7%, var(--surface)); }
.callout.verdict { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.callout p:last-child { margin-bottom: 0; }

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto; margin: 16px 0 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 560px; }
thead th {
  text-align: left; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
  padding: 13px 16px; border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-alt) 55%, transparent); }
tbody tr:hover { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.no-results { color: var(--muted); font-style: italic; padding: 8px 4px; }

.filter-row { margin: 4px 0 14px; max-width: 420px; }
.filter-input {
  width: 100%; padding: 11px 15px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .95rem;
}
.filter-input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .07em; white-space: nowrap;
}
.badge.pdo { background: color-mix(in srgb, var(--wine) 16%, transparent); color: var(--wine); border: 1px solid color-mix(in srgb, var(--wine) 40%, transparent); }
.badge.pgi { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--accent-deep); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
html[data-theme="dark"] .badge.pgi { color: var(--gold); }
.badge.gi { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---------- timeline ---------- */
.timeline { position: relative; margin: 10px 0 0; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(var(--gold), var(--accent), var(--wine));
  opacity: .55;
}
.tl-era {
  font-family: "Fraunces", serif; font-style: italic; font-weight: 620;
  font-size: 1.02rem; color: var(--accent); margin: 26px 0 12px;
}
.tl-item { position: relative; margin-bottom: 18px; }
.tl-dot {
  position: absolute; left: -26px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
}
.tl-body {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
}
.tl-date {
  display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 4px;
}
.tl-body h4 { font-size: 1.02rem; margin: 0 0 6px; }
.tl-body p { margin: 0; font-size: .94rem; color: var(--muted); }

/* ---------- tabs ---------- */
.tabs { margin-top: 8px; }
.tab-list {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px;
}
.tab-btn {
  padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.tab-btn:hover { border-color: var(--accent); color: var(--accent); }
.tab-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tab-btn.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.tab-panel { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
html:not(.js) .tab-panel[hidden] { display: block; }

/* ---------- accordion ---------- */
.trouble {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 10px; overflow: hidden;
}
.trouble summary {
  cursor: pointer; padding: 13px 18px; font-weight: 600; list-style-position: inside;
}
.trouble summary::marker { color: var(--accent); }
.trouble[open] summary { border-bottom: 1px dashed var(--line); color: var(--accent); }
.trouble p { margin: 12px 18px; font-size: .95rem; }

/* ---------- glossary ---------- */
.term-list { margin: 6px 0 0; }
.g-term {
  display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 4px 20px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.g-term dt { font-weight: 700; color: var(--accent-deep); }
html[data-theme="dark"] .g-term dt { color: var(--gold); }
.g-term dd { margin: 0; color: var(--muted); }
@media (max-width: 560px) { .g-term { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.site-footer {
  margin-left: 0; border-top: 1px solid var(--line);
  background: var(--bg-alt);
}
.footer-inner { padding: 36px 0 46px; text-align: center; }
.foot-brand { font-size: 1.3rem; font-weight: 640; color: var(--accent); margin-bottom: 8px; }
.footer-inner p { color: var(--muted); font-size: .92rem; margin-bottom: 6px; }
.foot-meta { font-size: .8rem !important; }

/* ---------- back to top ---------- */
.back-to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--accent);
  box-shadow: var(--shadow); cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top:hover { border-color: var(--accent); }

/* ---------- reveal animations ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in { opacity: 1; transform: none; }
html:not(.js) .reveal { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
body { padding-top: var(--topbar-h); }
main { margin-left: var(--sidebar-w); }
.hero .container { padding-left: clamp(16px, 4vw, 48px); }

@media (max-width: 1100px) {
  main { margin-left: 0; }
  .sidebar {
    transform: translateX(-105%);
    transition: transform .28s ease;
    box-shadow: none;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.25); }
}
@media (min-width: 1101px) {
  .nav-toggle { display: none; }
  .nav-overlay { display: none; }
}
@media (max-width: 640px) {
  .brand span { display: none; }
  .flow-arrow { display: none; }
}

/* ---------- page head (chapter pages) ---------- */
.page-head {
  padding: 6px 0 26px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 640;
  letter-spacing: -.015em;
}
.page-head .lede { margin: 14px 0 0; max-width: 700px; }

/* ---------- pager ---------- */
.pager {
  display: flex; gap: 14px; justify-content: space-between;
  margin: 46px 0 10px;
}
.pager-link {
  flex: 1 1 0;
  display: block;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  color: var(--text);
}
.pager-link:hover { text-decoration: none; border-color: var(--accent); }
.pager-link span {
  display: block; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); margin-bottom: 4px;
}
.pager-link strong { font-family: "Fraunces", Georgia, serif; font-weight: 620; }
.pager-link.next { text-align: right; }
@media (max-width: 560px) { .pager { flex-direction: column; } .pager-link.next { text-align: left; } }

/* ---------- home TOC grid ---------- */
.toc-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  margin-top: 22px;
}
.toc-card {
  display: block;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px 18px;
  color: var(--text);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.toc-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); }
.toc-num {
  font-family: "Fraunces", Georgia, serif; font-style: italic;
  font-size: .95rem; color: var(--gold);
}
.toc-card h3 { font-size: 1.14rem; font-weight: 620; margin: 6px 0 8px; }
.toc-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.section-cta { margin-top: 34px; }

/* ---------- brine calculator ---------- */
.calc-card { border-top: 3px solid var(--accent); }
.calc-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 16px 0; }
.calc-field label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.calc-field input, .calc-field select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; }
.calc-field input:focus, .calc-field select:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.calc-result { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 12px; }
.calc-result strong { font-family: "Fraunces", serif; font-size: 1.35rem; color: var(--accent-deep); }
.calc-result .safe { color: #1a7a3a; font-weight: 700; }
.calc-result .unsafe { color: var(--wine); font-weight: 700; }
.calc-note { font-size: .84rem; color: var(--muted); margin-top: 8px; }

/* ---------- sensory wheel ---------- */
.wheel-wrap { display: grid; gap: 20px; grid-template-columns: 320px 1fr; align-items: start; margin: 18px 0; }
@media (max-width: 760px) { .wheel-wrap { grid-template-columns: 1fr; } }
.wheel-svg { width: 100%; max-width: 320px; aspect-ratio: 1; display: block; margin: 0 auto; }
.wheel-legend { display: grid; gap: 10px; }
.legend-group { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.legend-group h4 { font-size: .9rem; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.legend-group ul { margin: 0; padding-left: 18px; font-size: .88rem; color: var(--muted); }
.legend-group li { margin-bottom: 3px; }
.score-sheet { margin-top: 16px; }
.score-sheet table { min-width: 0; }
.score-sheet th, .score-sheet td { font-size: .88rem; }
.score-sheet input[type="number"], .score-sheet input[type="text"] { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--text); font: inherit; }
@media print { .wheel-wrap { grid-template-columns: 320px 1fr; } }

/* ---------- drinks ---------- */
.drink-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 16px 0; }
.drink-card h4 { display: flex; align-items: center; gap: 8px; }
.drink-tag { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--accent); padding: 3px 8px; border-radius: 999px; }

/* ---------- acid atlas ---------- */
.acid-chooser { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 16px 0; }
.acid-chooser-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.acid-chooser-row label { font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.acid-chooser-row select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; min-width: 220px; }
.acid-result { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.acid-result h4 { margin: 0 0 8px; }
.pka-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.pka-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent), var(--wine)); border-radius: 999px; }

/* ---------- sustainability ---------- */
.sus-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 16px 0; }
.sus-stat { text-align: center; padding: 16px; }
.sus-stat strong { display: block; font-family: "Fraunces", serif; font-size: 1.6rem; color: var(--accent); }

/* ---------- recipes & guides ---------- */
.recipe-card { position: relative; overflow: hidden; }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 8px 0 12px; font-size: .84rem; color: var(--muted); }
.recipe-meta span { display: inline-flex; align-items: center; gap: 6px; }
.recipe-meta strong { color: var(--text); }
.recipe-columns { display: grid; gap: 18px; grid-template-columns: 260px 1fr; margin-top: 12px; }
@media (max-width: 760px) { .recipe-columns { grid-template-columns: 1fr; } }
.ing-list { list-style: none; padding: 0; margin: 0; }
.ing-list li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; display: flex; justify-content: space-between; gap: 10px; }
.ing-list li:last-child { border-bottom: none; }
.ing-qty { font-weight: 700; color: var(--accent-deep); white-space: nowrap; }
html[data-theme="dark"] .ing-qty { color: var(--gold); }
.recipe-steps { counter-reset: recipe; list-style: none; padding: 0; margin: 0; }
.recipe-steps li { counter-increment: recipe; position: relative; padding: 10px 0 10px 44px; border-bottom: 1px solid var(--line); font-size: .93rem; }
.recipe-steps li:last-child { border-bottom: none; }
.recipe-steps li::before { content: counter(recipe); position: absolute; left: 0; top: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.recipe-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.recipe-actions button { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.recipe-actions button:hover { border-color: var(--accent); color: var(--accent); }
.yield-scaler { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; }
.yield-scaler button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; }
.yield-scaler input { width: 52px; text-align: center; border: none; background: transparent; font: inherit; font-weight: 700; }
.guide-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.guide-toc a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .84rem; font-weight: 600; color: var(--text); }
.guide-toc a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- video ---------- */
.video-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin: 18px 0; }
.video-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-caption { padding: 12px 16px; }
.video-caption h4 { font-size: .95rem; margin: 0 0 6px; }
.video-caption p { margin: 0; font-size: .85rem; color: var(--muted); }

/* ---------- print ---------- */
@media print {
  .topbar, .sidebar, .progress-bar, .back-to-top, .filter-row, .nav-overlay { display: none !important; }
  main { margin: 0; }
  body { padding: 0; background: #fff; color: #111; }
  .section.alt { background: #fff; border: none; }
  .card, .tl-body, .table-wrap, .stat { box-shadow: none; }
  details.trouble { break-inside: avoid; }
  details.trouble:not([open]) > *:not(summary) { display: block; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
