/*
 * sourdoughy.com — UI polish layer.
 * Loads AFTER tokens.css and any legacy CSS so it can override stale values.
 *
 * Scope: site-wide refinement of header, buttons, inputs, calculator UI,
 * article reading, dark mode, mobile. References only var(--*) from tokens.css.
 */

/* ---------- 1. base typography ---------- */

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01", "cv11", "cv02";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, .display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  color: var(--ink);
}
h1 { font-size: var(--text-3xl); letter-spacing: -0.025em; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); letter-spacing: -0.015em; }
@media (min-width: 720px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
}
p, li, dd { line-height: var(--lh-body); color: var(--ink); }

/* numeric weights, recipe tables, code: monospace tabular */
.mono, .nums, code, kbd, samp,
.recipe-stats .stat-value,
.ingredients-list .ing-amount,
.hero-recipe-table td,
.recipe-card .recipe-stats {
  font-family: var(--font-mono);
  font-feature-settings: "tnum", "zero";
  font-variant-numeric: tabular-nums slashed-zero;
}

/* warm artisanal background veil (subtle paper texture) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--accent-soft), transparent 60%),
    var(--bg);
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}
[data-theme="dark"] body::before { opacity: 0.45; }

/* ---------- 2. focus ring ---------- */

:where(button, [role="button"], input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-halo);
}
:where(a):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---------- 3. unified floating header ---------- */

.floating-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--glass-bg);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter:         saturate(160%) blur(18px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-out),
              background var(--dur) var(--ease-in-out),
              border-color var(--dur) var(--ease-in-out);
}
.floating-header.is-scrolled { box-shadow: var(--shadow-md); }
.floating-header.visible { transform: translateY(0); opacity: 1; }
.floating-header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  height: var(--header-h);
  padding: 0 var(--space-4);
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}
.floating-header-left,
.floating-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.floating-header-right { justify-content: flex-end; }

.floating-logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: -0.015em;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--dur) var(--ease-out);
}
.floating-logo .logo-img { height: 22px; width: 22px; vertical-align: middle; border-radius: 6px; }
.floating-logo:hover { color: var(--accent); }

/* Replace old absolute centring */
.floating-header .header-spacer { display: none; }

/* Header action controls: unit toggle, lang, theme */
.hdr-control,
.hdr-control select,
.hdr-control button {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--ink);
}
.hdr-control { display: inline-flex; align-items: center; gap: var(--space-1); }
.hdr-control select,
.hdr-control .hdr-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out);
}
.hdr-control select:hover,
.hdr-control .hdr-btn:hover {
  background: var(--accent-soft);
  border-color: var(--border-strong);
}
.hdr-control .hdr-btn[aria-pressed="true"],
.hdr-control .hdr-btn.active { color: var(--accent); border-color: var(--accent); }

/* g/oz segmented unit toggle (bread builder uses .unit-toggle id, others their own) */
.unit-toggle {
  display: inline-flex;
  background: var(--bg-veil);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-muted);
  height: 32px;
  align-items: center;
  gap: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
}
.unit-toggle .unit-active,
.unit-toggle .unit-inactive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.unit-toggle[data-unit="g"] .unit-active   { background: var(--accent); color: var(--ink-inverse); }
.unit-toggle[data-unit="g"] .unit-inactive { color: var(--ink-soft); }
.unit-toggle[data-unit="oz"] .unit-inactive{ background: var(--accent); color: var(--ink-inverse); }
.unit-toggle[data-unit="oz"] .unit-active  { color: var(--ink-soft); }

/* Theme toggle — animated sun ↔ moon */
.theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out);
}
.theme-toggle:hover { background: var(--accent-soft); border-color: var(--border-strong); }
.theme-toggle:active { transform: scale(0.94); }

/* Burger button (matches the round visual idiom) */
.burger-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  padding: 0;
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.burger-btn:hover { background: var(--accent-soft); border-color: var(--border-strong); }
.burger-line { width: 16px; height: 1.6px; background: var(--ink); border-radius: 1px; transition: transform var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out); }
.burger-btn[aria-expanded="true"] .burger-line:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.burger-btn[aria-expanded="true"] .burger-line:nth-child(2) { opacity: 0; }
.burger-btn[aria-expanded="true"] .burger-line:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* Burger menu drawer */
.burger-menu {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4) var(--space-4) var(--space-5);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  z-index: 999;
  /* multi-column on desktop */
}
.burger-menu.open { display: grid; gap: var(--space-3) var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .burger-menu.open { grid-template-columns: repeat(3, 1fr); }
}
.burger-section-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: var(--space-2) 0 var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.burger-section-label:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.burger-menu .burger-link {
  display: block;
  padding: 10px 8px;
  margin: 0 -8px;
  color: var(--ink);
  font-weight: 500;
  font-size: var(--text-sm);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
}
.burger-menu .burger-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
}

/* When header is rendered, push content down so it isn't clipped */
body.has-floating-header { padding-top: var(--header-h); }

/* Anchor targets get scroll-margin so they aren't hidden behind sticky header */
:target { scroll-margin-top: calc(var(--header-h) + 16px); }
h1[id], h2[id], h3[id], h4[id], section[id], article[id], aside[id],
#main, #wizardStart, #recipeCard {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

/* ---------- 4. skip link ---------- */

.skip-link {
  position: fixed;
  top: -100px; left: var(--space-4);
  z-index: 10001;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--ink-inverse);
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: calc(var(--header-h) + 6px); }

/* ---------- 5. buttons ---------- */

.btn,
button.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--ink-inverse);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-link, .btn-tertiary {
  background: transparent;
  color: var(--accent);
  padding: 6px 8px;
  min-height: 36px;
  text-decoration: none;
  border: none;
  font-weight: 600;
}
.btn-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: var(--text-xs); }

/* ---------- 6. forms & inputs ---------- */

input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
textarea,
select {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-height: 44px;
  transition: border-color var(--dur) var(--ease-out),
              box-shadow    var(--dur) var(--ease-out),
              background    var(--dur) var(--ease-in-out);
}
input[type="number"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-halo);
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val,50%), var(--border-strong) var(--val,50%), var(--border-strong) 100%);
  border: none;
  border-radius: 999px;
  outline: none;
  padding: 0;
  min-height: auto;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-sm), 0 0 0 0 var(--focus-halo);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.08); }
input[type="range"]:active::-webkit-slider-thumb,
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--shadow-md), 0 0 0 6px var(--focus-halo); }

/* select chevron */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239c968e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* ---------- 7. recipe / calculator output card ---------- */

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-5) var(--space-5);
  margin-top: var(--space-4);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.recipe-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
}
.recipe-card .recipe-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  margin: 0 0 var(--space-1);
}
.recipe-card .recipe-meta {
  color: var(--ink-muted);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-4);
}
.recipe-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.ingredients-list { list-style: none; padding: 0; margin: 0 0 var(--space-4); border-top: 1px solid var(--border); }
.ingredients-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
}
.ingredients-list .ing-name { color: var(--ink); }
.ingredients-list .ing-amount {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.recipe-actions {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* ---------- 8. options (wizard cards) — refine without breaking layout ---------- */

.option {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease-out),
              background  var(--dur) var(--ease-out),
              box-shadow  var(--dur) var(--ease-out),
              transform   var(--dur-fast) var(--ease-out);
}
.option:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.option-icon { color: var(--accent); }

/* Glossary popover refinements */
.glossary-popover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  color: var(--ink);
}

/* ---------- 9. hero (homepage) ---------- */

.hero {
  padding: var(--space-7) var(--space-4) var(--space-6);
  max-width: 1100px;
  margin: 0 auto;
}
.hero-inner {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 880px) {
  .hero { padding: var(--space-8) var(--space-5) var(--space-7); }
  .hero-inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--space-7); }
}
.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, var(--text-4xl));
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 var(--space-3);
  color: var(--ink);
}
.hero-sub {
  font-size: var(--text-md);
  color: var(--ink-muted);
  max-width: 36ch;
  margin: 0 0 var(--space-3);
}
.hero-explainer {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  max-width: 48ch;
  margin: 0 0 var(--space-5);
  line-height: var(--lh-loose);
}
.hero-cta-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.hero-cta {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all var(--dur) var(--ease-out);
}
.hero-cta-primary { background: var(--accent); color: var(--ink-inverse); box-shadow: var(--shadow-md); }
.hero-cta-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.hero-cta-link { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.hero-cta-link:hover { color: var(--accent); border-color: var(--accent); }

.hero-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}
.hero-preview-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-4);
  color: var(--ink);
}
.hero-preview-grid {
  display: grid; gap: var(--space-3);
  grid-template-columns: 1fr 1fr;
  margin-bottom: var(--space-3);
}
@media (max-width: 480px) { .hero-preview-grid { grid-template-columns: 1fr; } }
.hero-slider { display: flex; flex-direction: column; gap: 6px; }
.hero-slider-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero-slider-label output {
  color: var(--accent);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.hero-recipe-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-3);
}
.hero-recipe-table th,
.hero-recipe-table td {
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  text-align: left;
}
.hero-recipe-table td {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
}
.hero-recipe-table th { color: var(--ink-muted); font-weight: 500; }
.hero-recipe-table tr:first-child th, .hero-recipe-table tr:first-child td { border-top: none; }
.hero-preview-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
}
.hero-preview-deep { color: var(--accent); text-decoration: none; }
.hero-preview-deep:hover { text-decoration: underline; text-underline-offset: 4px; }
.hero-preview-share { color: var(--ink-muted); text-decoration: none; }
.hero-preview-share:hover { color: var(--accent); }

/* Pro Mode panel */
.pro-mode-panel {
  margin: var(--space-6) auto 0;
  max-width: 1100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}
.pro-mode-title { font-family: var(--font-display); font-size: var(--text-2xl); margin: 0 0 var(--space-1); }
.pro-mode-sub { color: var(--ink-muted); margin: 0 0 var(--space-4); font-size: var(--text-sm); }
.pro-mode-form fieldset {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-4);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}
.pro-mode-form legend {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: var(--space-2);
  grid-column: 1 / -1;
}
.pro-mode-form label { display: flex; flex-direction: column; gap: 4px; }
.pro-mode-form label > span { font-size: var(--text-xs); color: var(--ink-muted); font-weight: 500; }

/* ---------- 10. site footer ---------- */

.site-footer {
  margin-top: var(--space-7);
  padding: var(--space-6) var(--space-4);
  border-top: 1px solid var(--border);
  text-align: center;
  background: transparent;
}
.site-footer-links {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-3);
}
.site-footer-links a {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}
.site-footer-links a::after {
  content: '';
  position: absolute; bottom: 0; left: 0;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
}
.site-footer-links a:hover { color: var(--accent); }
.site-footer-links a:hover::after { transform: scaleX(1); }
.site-footer-copyright { color: var(--ink-soft); font-size: var(--text-sm); }

/* ---------- 11. article reading view ---------- */

.guide-article, .guide-content, article.article-content {
  max-width: var(--content-w-article);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
  font-size: 1.0625rem;
  line-height: var(--lh-loose);
  color: var(--ink);
}
.guide-article h1, .guide-content h1, article.article-content h1 {
  font-size: clamp(1.875rem, 3.5vw, var(--text-4xl));
  margin: 0 0 var(--space-3);
  letter-spacing: -0.025em;
}
.guide-article h2, .guide-content h2, article.article-content h2 {
  margin-top: var(--space-7);
  margin-bottom: var(--space-3);
  border-top: 1px solid var(--border);
  padding-top: var(--space-5);
}
.guide-article h3, .guide-content h3, article.article-content h3 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}
.guide-article p, .guide-content p, article.article-content p { margin: 0 0 var(--space-4); }

/* drop cap on first paragraph */
.guide-article > p:first-of-type::first-letter,
.guide-content > p:first-of-type::first-letter,
article.article-content > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 3.6em;
  line-height: 0.85;
  float: left;
  padding: 6px 10px 0 0;
  color: var(--accent);
}

.guide-article blockquote, .guide-content blockquote, article.article-content blockquote {
  margin: var(--space-5) 0;
  padding: var(--space-2) var(--space-4);
  border-left: 3px solid var(--accent);
  background: var(--surface-tinted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-style: italic;
  color: var(--ink);
}

/* recipe / schedule monospace blocks */
.guide-article pre, .guide-content pre, article.article-content pre,
.recipe-block, .schedule-block {
  background: var(--surface-tinted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-x: auto;
  line-height: var(--lh-snug);
  margin: var(--space-4) 0;
}

.guide-last-updated {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--ink-muted);
  font-family: var(--font-body);
}
.guide-last-updated time { font-weight: 600; color: var(--ink); }
.guide-last-updated .guide-byline a { color: var(--ink-muted); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.guide-last-updated .guide-byline a:hover { color: var(--accent); border-color: var(--accent); }

.author-card {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.author-card-photo {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--accent-soft);
}
.author-card-byline { margin: 0 0 6px; font-size: var(--text-sm); color: var(--ink-muted); }
.author-card-byline strong { color: var(--ink); font-weight: 600; }
.author-card-bio { margin: 0 0 6px; color: var(--ink); font-size: var(--text-sm); }
.author-card-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.author-card-link a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* sticky table of contents */
.guide-toc {
  display: none;
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--text-sm);
  align-self: start;
}
.guide-toc-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  margin: 0 0 var(--space-2);
  color: var(--ink);
}
.guide-toc-list { list-style: none; padding: 0; margin: 0; }
.guide-toc-list li { margin: 2px 0; }
.guide-toc-list .toc-sub { padding-left: var(--space-3); font-size: var(--text-xs); }
.guide-toc a {
  display: block;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  border-left: 2px solid transparent;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--dur) var(--ease-out),
              background var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
}
.guide-toc a:hover { color: var(--accent); }
.guide-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
@media (min-width: 1024px) {
  body:has(.guide-toc) main,
  body.has-toc main {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: var(--space-6);
    max-width: 1080px;
    margin: 0 auto;
    padding-top: var(--space-4);
  }
  .guide-toc { display: block; }
}

/* ---------- 12. cookie banner refinement ---------- */

.cookie-consent {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  color: var(--ink);
  font-family: var(--font-body);
}
.cookie-consent-inner { padding: var(--space-4); }
.cookie-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius);
  padding: 10px 16px;
}
.cookie-btn-accept { background: var(--accent); color: var(--ink-inverse); border: 1px solid var(--accent); }
.cookie-btn-accept:hover { background: var(--accent-hover); }
.cookie-btn-reject { background: transparent; color: var(--ink); border: 1px solid var(--border-strong); }
.cookie-btn-reject:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- 13. accessibility & motion ---------- */

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

/* ---------- 14. dark mode finishing touches ---------- */

[data-theme="dark"] .recipe-card { box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(245,241,234,0.04); }
[data-theme="dark"] .hero-preview { box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(245,241,234,0.04); }
[data-theme="dark"] .floating-header { box-shadow: var(--shadow-sm), inset 0 -1px 0 rgba(245,241,234,0.04); }
[data-theme="dark"] .author-card { box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(245,241,234,0.04); }
[data-theme="dark"] body::before { opacity: 0.35; }

/* welcome-hero (homepage wizard image) — dim slightly in dark */
[data-theme="dark"] .welcome-hero img { filter: brightness(0.92) contrast(1.04); }

/* ensure recipe stats card surfaces look good */
.recipe-stats > div { background: var(--surface-tinted); border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--border); }
.recipe-stats .stat-label { font-size: var(--text-xs); color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.recipe-stats .stat-value { font-family: var(--font-mono); font-size: var(--text-md); font-weight: 600; color: var(--ink); margin-top: 4px; display: block; }

/* keep custom adjust panel polished */
.recipe-adjust-panel .adjust-tile { background: var(--surface-tinted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.recipe-adjust-panel .adjust-tile-val { font-family: var(--font-mono); color: var(--accent); font-weight: 500; }

/* affiliate cards */
.affiliate-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); }
.affiliate-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: var(--space-3);
  background: var(--surface-tinted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-xs);
  transition: all var(--dur) var(--ease-out);
}
.affiliate-card:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: var(--shadow-sm); color: var(--ink); }
.affiliate-icon { font-size: 1.6rem; }
.affiliate-desc { color: var(--ink-muted); }
.affiliate-card:hover .affiliate-desc { color: var(--ink); }

/* ---------- 15. scroll polish ---------- */
@media (min-width: 720px) {
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid var(--bg); }
  ::-webkit-scrollbar-thumb:hover { background: var(--accent); }
}

/* ---------- 16. mobile burger drawer override ---------- */
@media (max-width: 720px) {
  .burger-menu.open {
    grid-template-columns: 1fr;
    max-height: calc(100vh - var(--header-h));
    padding-bottom: var(--space-7);
  }
}

/* ---------- 17. homepage path-picker (replaces old wizard welcome) ---------- */
.step-pathpicker {
  padding-top: var(--space-3);
}
.step-title-compact {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-2);
  color: var(--ink);
  line-height: 1.3;
}
.step-pathpicker .step-desc {
  font-size: var(--text-sm, 0.9375rem);
  color: var(--ink-muted);
  margin-bottom: var(--space-4);
}
.step-pathpicker .options-two .option {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: var(--space-4) var(--space-4);
  transition: border-color 0.18s var(--ease-out, ease), transform 0.18s var(--ease-out, ease), box-shadow 0.18s var(--ease-out, ease);
}
.step-pathpicker .options-two .option:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
}

/* ---------- 18. homepage "Other dough calculators" section ---------- */
.other-calculators-section {
  max-width: var(--content-w, 1080px);
  margin: var(--space-7, 56px) auto var(--space-5, 32px);
  padding: var(--space-6) clamp(16px, 4vw, 32px);
  border-top: 1px solid var(--border);
}
.other-calculators-heading-h2 {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-size: clamp(1.25rem, 2.6vw, 1.625rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-align: center;
  margin: 0 0 var(--space-5);
}
.other-calculators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3, 16px);
}
.other-calc-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2, 8px);
  padding: var(--space-4) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
  transition: transform 0.18s var(--ease-out, ease), border-color 0.18s var(--ease-out, ease), box-shadow 0.18s var(--ease-out, ease);
  min-height: 140px;
}
.other-calc-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 6px 18px -8px rgba(0,0,0,0.18));
  color: var(--ink);
}
.other-calc-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.other-calc-icon {
  font-size: 1.75rem;
  line-height: 1;
}
.other-calc-name {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.other-calc-meta {
  font-size: var(--text-sm, 0.9rem);
  color: var(--ink-muted);
  line-height: 1.45;
}
[data-theme="dark"] .other-calc-card {
  background: var(--surface);
  box-shadow: none;
  border-color: var(--border);
}
[data-theme="dark"] .other-calc-card:hover {
  background: var(--surface-elev, var(--surface));
}

/* ---------- 19. unit-toggle divider polish ---------- */
.unit-toggle { gap: 0.05rem; }
