/* ===== Fonts ===== */
@import url('https://api.fontshare.com/v2/css?f[]=zodiak@400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@300..700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== Design Tokens ===== */
:root,
[data-theme='light'] {
  /* Surfaces — warm parchment / apothecary paper */
  --color-bg: #f6efe0;
  --color-surface: #fbf6ea;
  --color-surface-2: #ffffff;
  --color-surface-offset: #eee2c4;
  --color-surface-offset-2: #e6d7ae;
  --color-surface-dynamic: #ddc98f;
  --color-divider: #ddcda3;
  --color-border: #cbb583;

  /* Text — ink brown */
  --color-text: #2d2313;
  --color-text-muted: #6f5f42;
  --color-text-faint: #a9987a;
  --color-text-inverse: #fbf6ea;

  /* Primary accent — gentian gold */
  --color-primary: #9c6b0e;
  --color-primary-hover: #7d5509;
  --color-primary-active: #603f06;
  --color-primary-highlight: #ecdcb0;

  /* Warning — terracotta (used for infeasible-ABV states) */
  --color-warning: #a24a1f;
  --color-warning-hover: #7e3714;
  --color-warning-active: #5c270e;
  --color-warning-highlight: #e8d2c2;

  /* Error */
  --color-error: #8f2540;
  --color-error-hover: #711d33;
  --color-error-active: #521526;
  --color-error-highlight: #ddc3cb;

  /* Success — herbal green (feasible / balanced states) */
  --color-success: #3f6b34;
  --color-success-hover: #2e5024;
  --color-success-active: #203818;
  --color-success-highlight: #cddbc7;

  /* Meter colors (data viz only) */
  --meter-bitter: #9c6b0e;
  --meter-sweet: #97466f;
  --meter-earthy: #3f6b34;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-sm: 0 1px 2px oklch(0.25 0.04 70 / 0.1);
  --shadow-md: 0 6px 16px oklch(0.25 0.04 70 / 0.12);
  --shadow-lg: 0 16px 40px oklch(0.25 0.04 70 / 0.16);

  --content-narrow: 640px;
  --content-default: 980px;
  --content-wide: 1220px;

  --font-display: 'Zodiak', 'Georgia', serif;
  --font-body: 'Work Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;
}

[data-theme='dark'] {
  --color-bg: #17130c;
  --color-surface: #1d1811;
  --color-surface-2: #221c14;
  --color-surface-offset: #241e15;
  --color-surface-offset-2: #2b2318;
  --color-surface-dynamic: #362c1d;
  --color-divider: #2b2318;
  --color-border: #453824;
  --color-text: #ecdfc4;
  --color-text-muted: #a89877;
  --color-text-faint: #766650;
  --color-text-inverse: #221c14;

  --color-primary: #d9a63f;
  --color-primary-hover: #e8ba5e;
  --color-primary-active: #f0c977;
  --color-primary-highlight: #4a3c22;

  --color-warning: #d97a4a;
  --color-warning-hover: #e39468;
  --color-warning-active: #ecab86;
  --color-warning-highlight: #4a3226;

  --color-error: #d9678f;
  --color-error-hover: #e389a8;
  --color-error-active: #ecabc0;
  --color-error-highlight: #4a2934;

  --color-success: #7fb26a;
  --color-success-hover: #97c186;
  --color-success-active: #aecfa0;
  --color-success-highlight: #2c3d26;

  --meter-bitter: #d9a63f;
  --meter-sweet: #c98fb2;
  --meter-earthy: #7fb26a;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.35);
  --shadow-md: 0 6px 16px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #17130c;
    --color-surface: #1d1811;
    --color-surface-2: #221c14;
    --color-surface-offset: #241e15;
    --color-surface-offset-2: #2b2318;
    --color-surface-dynamic: #362c1d;
    --color-divider: #2b2318;
    --color-border: #453824;
    --color-text: #ecdfc4;
    --color-text-muted: #a89877;
    --color-text-faint: #766650;
    --color-text-inverse: #221c14;
    --color-primary: #d9a63f;
    --color-primary-hover: #e8ba5e;
    --color-primary-active: #f0c977;
    --color-primary-highlight: #4a3c22;
    --color-warning: #d97a4a;
    --color-warning-hover: #e39468;
    --color-warning-active: #ecab86;
    --color-warning-highlight: #4a3226;
    --color-error: #d9678f;
    --color-success: #7fb26a;
    --meter-bitter: #d9a63f;
    --meter-sweet: #c98fb2;
    --meter-earthy: #7fb26a;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.35);
    --shadow-md: 0 6px 16px oklch(0 0 0 / 0.4);
    --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.5);
  }
}

/* Type scale */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  --text-3xl: clamp(2.25rem, 1rem + 3.5vw, 4rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
}

/* ===== Layout shell ===== */
body {
  background-image: radial-gradient(
      circle at 15% 0%,
      oklch(from var(--color-primary) l c h / 0.08),
      transparent 45%
    ),
    radial-gradient(circle at 100% 20%, oklch(from var(--color-success) l c h / 0.06), transparent 40%);
}

.wrap {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

/* ===== Header ===== */
header.site-header {
  padding-block: var(--space-6) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  position: sticky;
  top: 0;
  z-index: 20;
  background: oklch(from var(--color-bg) l c h / 0.9);
  backdrop-filter: blur(10px);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.brand svg {
  width: 40px;
  height: 40px;
  color: var(--color-primary);
  flex-shrink: 0;
}
.brand-text h1 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.brand-text p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--color-surface-offset);
  border-color: var(--color-primary);
}

/* ===== Hero intro ===== */
.hero {
  padding-block: var(--space-10) var(--space-8);
}
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: var(--space-4);
}
.hero h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  max-width: 18ch;
  margin-bottom: var(--space-4);
}
.hero p {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  max-width: 62ch;
}
.hero .disclaimer {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  max-width: 62ch;
}

/* ===== Presets ===== */
.presets {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-6);
}
.preset-btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.preset-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-highlight);
}
.preset-btn svg {
  width: 16px;
  height: 16px;
}

/* ===== Calculator grid ===== */
.calculator {
  padding-block: var(--space-8) var(--space-12);
}
.calc-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 900px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.panel-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.panel-header h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}
.panel-body {
  padding: var(--space-6);
}

/* Batch size segmented control */
.segmented {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 3px;
  background: var(--color-surface-offset);
}
.segmented button {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
.segmented button[aria-pressed='true'] {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

/* Slider control */
.control {
  margin-bottom: var(--space-6);
}
.control:last-child {
  margin-bottom: 0;
}
.control-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-1);
  gap: var(--space-2);
}
.control-label .name {
  font-weight: 600;
  font-size: var(--text-sm);
}
.control-label .value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: 600;
  white-space: nowrap;
  min-width: 5ch;
  text-align: right;
}
.control-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

input[type='range'] {
  width: 100%;
  height: 28px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    90deg,
    var(--color-primary) 0%,
    var(--color-primary) var(--fill, 50%),
    var(--color-surface-dynamic) var(--fill, 50%),
    var(--color-surface-dynamic) 100%
  );
}
input[type='range']::-moz-range-track {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-surface-dynamic);
}
input[type='range']::-moz-range-progress {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 3px solid var(--color-primary);
  margin-top: -7px;
  box-shadow: var(--shadow-sm);
}
input[type='range']::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 3px solid var(--color-primary);
  box-shadow: var(--shadow-sm);
}
input[type='range']:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.range-ticks {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

/* ===== Output panel ===== */
.abv-badge {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-primary-highlight);
  margin-bottom: var(--space-5);
}
.abv-badge .abv-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-primary-active);
  line-height: 1;
}
.abv-badge .abv-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
[data-theme='dark'] .abv-badge .abv-value {
  color: var(--color-primary);
}

.status-banner {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
}
.status-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}
.status-banner.ok {
  background: var(--color-success-highlight);
  color: var(--color-success-active);
}
[data-theme='dark'] .status-banner.ok {
  color: var(--color-success);
}
.status-banner.warn {
  background: var(--color-warning-highlight);
  color: var(--color-warning-active);
}
[data-theme='dark'] .status-banner.warn {
  color: var(--color-warning);
}

/* Recipe table */
.recipe-table {
  width: 100%;
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}
.recipe-table tr {
  border-bottom: 1px solid var(--color-divider);
}
.recipe-table tr:last-child {
  border-bottom: none;
  border-top: 2px solid var(--color-border);
  font-weight: 700;
}
.recipe-table td {
  padding: var(--space-3) 0;
}
.recipe-table td:first-child {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.recipe-table .swatch {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.recipe-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.recipe-table .ingredient-note {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* Meters */
.meters {
  display: grid;
  gap: var(--space-4);
}
.meter-row .meter-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.meter-track {
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  overflow: hidden;
  position: relative;
}
.meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
.meter-fill.bitter {
  background: var(--meter-bitter);
}
.meter-fill.sweet {
  background: var(--meter-sweet);
}
.meter-fill.earthy {
  background: var(--meter-earthy);
}
.meter-tag {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

/* ===== Sections below ===== */
.section {
  padding-block: var(--space-12);
  border-top: 1px solid var(--color-divider);
}
.section-head {
  margin-bottom: var(--space-8);
  max-width: 62ch;
}
.section-head .eyebrow {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.section-head p {
  color: var(--color-text-muted);
}

/* Method steps */
.method-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}
@media (max-width: 800px) {
  .method-steps {
    grid-template-columns: 1fr;
  }
}
.step-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.step-card .step-num {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}
.step-card h4 {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.step-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Taste guide cards */
.taste-guide {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
.taste-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}
.taste-card h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.taste-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
@media (max-width: 800px) {
  .tips-grid {
    grid-template-columns: 1fr;
  }
}
.tip-card {
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface-offset);
}
.tip-card h5 {
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.tip-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.tip-card .fix {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary-active);
}
[data-theme='dark'] .tip-card .fix {
  color: var(--color-primary);
}

/* Cocktail cards */
.cocktails {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}
@media (max-width: 900px) {
  .cocktails {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 620px) {
  .cocktails {
    grid-template-columns: 1fr;
  }
}
.cocktail-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.cocktail-card h4 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}
.cocktail-card ul {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: grid;
  gap: var(--space-1);
}
.cocktail-card ul li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  border-bottom: 1px dashed var(--color-divider);
  padding-bottom: var(--space-1);
}
.cocktail-card .method {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: auto;
  padding-top: var(--space-2);
}

/* Footer */
footer {
  padding-block: var(--space-10);
  border-top: 1px solid var(--color-divider);
}
footer .foot-grid {
  display: flex;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
footer h5 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
footer ul {
  display: grid;
  gap: var(--space-2);
  font-size: var(--text-xs);
}
footer a {
  color: var(--color-text-muted);
}
footer a:hover {
  color: var(--color-primary);
}
footer .fine-print {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-5);
  max-width: 72ch;
}
</content>
