/* Ester Index — LEDGER direction
   Display: Anton · Body: Archivo · Labels: Martian Mono
   Scale ratio 1.333 (perfect fourth) */

:root {
  --paper: #F2EDE3;
  --ink: #211A12;
  --amber: #C87F2F;
  --amber-ink: #8F5A1B; /* amber darkened to pass 4.5:1 on cane paper as text */
  --funk: #6B8F3D;
  --copper: #B87333;
  /* fixed pair — cotton stays cotton in both schemes so the button reads the
     same. #F2EDE3 on #3F5A22 = 6.5:1; hover #4E6E2A = 4.9:1. */
  --cotton: #F2EDE3;
  --btn-green: #3F5A22;
  --btn-green-hi: #4E6E2A;
  /* marque-strip band fills — darkened from --copper/--funk so the 8px segments
     clear WCAG 1.4.11 (3:1 non-text) at .85 opacity. The raw --copper only
     reaches 3.0:1 at 94% opacity, which leaves no margin. */
  --band-jam: #9A5A22;  /* 3.58:1 on cane paper at .85 */
  --band-int: #4E6B28;  /* 3.88:1 on cane paper at .85 */
  /* semantic mapping — base material families */
  --base-molasses: #6E3F1C; /* deep copper-brown */
  --base-cane: #4FA32E;     /* grassy green — fresh cane juice */
  --base-syrup: #C08A2D;    /* cane syrup gold */
  /* fermentation heat map: hours (cool gold) → weeks of muck & dunder (fiery red) */
  --heat-cool: #EAC94F;
  --heat-warm: #DE9530;
  --heat-hot: #C2531F;
  --heat-max: #8F1D1D;
  --rule: color-mix(in srgb, var(--ink) 24%, transparent);
  /* The glossary popover sits on --ink, i.e. the inverse of the page. Its amber
     accent therefore has to invert too, or it lands light-on-light in dark mode
     (raw --amber is only 2.76:1 on #F2EDE3). */
  --amber-on-ink: #C87F2F; /* 5.35:1 on molasses */
  --display: "Anton", sans-serif;
  --body: "Archivo", sans-serif;
  --mono: "Martian Mono", monospace;
  /* linear zone (0–1600) occupies this share of the track; rest is compressed */
  --wall-pct: 88.888%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #211A12;
    --ink: #F2EDE3;
    --amber-ink: #DFA55C; /* amber lightened to pass 4.5:1 on molasses as text */
    --rule: color-mix(in srgb, var(--ink) 30%, transparent);
    --base-molasses: #A5622C; /* lifted so the swatch reads on dark paper */
    --base-cane: #6FBF4A;
    --band-jam: #D99A5C;  /* 5.53:1 on molasses at .85 */
    --band-int: #93C05E;  /* 6.22:1 on molasses at .85 */
    --amber-on-ink: #8F5A1B; /* popover bg is cane paper here — 4.94:1 */
    /* the deep green fill only reaches 2.2:1 against molasses paper, so the
       button's boundary comes from a lifted green rim (7.9:1) instead */
    --btn-edge: #8FBE4E;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
}
main, .masthead { position: relative; z-index: 1; }

/* The card stack now carries a glossary trigger on most fields, so the tab
   path through the masthead to the slider is worth skipping. */
.skip-link {
  position: absolute; left: .75rem; top: -100%; z-index: 80;
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: .75rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  padding: .7rem 1rem; text-decoration: none;
}
.skip-link:focus { top: .75rem; outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- hogo haze (whimsy #1) ---------- */
.haze { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.haze-blob {
  position: absolute; width: 55vmax; height: 55vmax; border-radius: 50%;
  filter: blur(90px); opacity: 0; transform: scale(.6);
  transition: opacity .6s ease, transform .9s ease;
}
.haze-a { background: var(--amber); top: -20vmax; right: -15vmax; }
.haze-b { background: var(--funk); bottom: -25vmax; left: -15vmax; }
@media (prefers-reduced-motion: reduce) {
  .haze-blob { transition: none; transform: none; filter: blur(120px); }
}

/* ---------- masthead ---------- */
/* Horizontal padding lives on the copy, not the header, so the illustration
   can run edge to edge without negative margins fighting it. */
.masthead {
  padding: 3rem 0 1rem;
  max-width: 68rem; margin: 0 auto;
  border-bottom: 3px solid var(--ink);
}
.masthead-copy { padding: 0 1.5rem; }
/* The cane illustration is its own block below the copy, not a background
   behind it — `cover` on the masthead scaled the artwork up past whatever
   padding we reserved and ran it through the standfirst on narrow screens.
   As a sibling element it cannot overlap text at any width.
   Height is set directly: aspect-ratio + max-height transfers the clamp back
   through the ratio and narrows the box, which left a bare strip on the right. */
.masthead-art { display: none; }
@media (prefers-color-scheme: light) {
  .masthead { padding-bottom: 0; }
  .masthead-art {
    display: block;
    margin-top: 2.5rem;
    height: clamp(10rem, 22vw, 17rem);
    background: url("img/hero.webp") center bottom / cover no-repeat;
  }
}
.kicker {
  font-family: var(--mono); font-size: .75rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; margin: 0 0 .75rem;
  color: var(--amber-ink);
}
h1 {
  font-family: var(--display);
  font-size: clamp(2.75rem, 8vw + 1rem, 7rem);
  line-height: .95; letter-spacing: -.02em; text-transform: uppercase;
  margin: 0;
}
/* the one sentence a first-time visitor needs before anything else */
.definition {
  max-width: 52ch; margin: 1rem 0 0;
  font-size: clamp(1.125rem, 1.4vw + .9rem, 1.375rem); line-height: 1.45;
  border-left: 4px solid var(--amber); padding-left: .875rem;
}
.standfirst {
  max-width: 60ch; margin: .75rem 0 1.25rem; font-size: 1rem;
  color: color-mix(in srgb, var(--ink) 76%, transparent);
}

/* ---------- readout ---------- */
.readout-block { max-width: 68rem; margin: 0 auto; padding: 2rem 1.5rem 0; }
.readout { display: flex; align-items: baseline; gap: .75rem; border-bottom: 1px solid var(--rule); }
#readout-value {
  font-family: var(--display);
  font-size: clamp(3.5rem, 10vw, 8rem);
  line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.readout-unit { font-family: var(--mono); font-size: .875rem; letter-spacing: .12em; }
.readout-class {
  font-family: var(--mono); font-size: 1rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; margin: .5rem 0 0;
}
.readout-class.tick { animation: pulse .12s ease-out; }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .readout-class.tick { animation: none; } }

/* ---------- track ---------- */
.scale { max-width: 68rem; margin: 1.5rem auto 0; padding: 0 1.5rem; }
.track { position: relative; height: 72px; }
.track-classes { position: absolute; inset: 0 0 28px 0; display: block; border: 1px solid var(--ink); }
.tc-band {
  position: absolute; top: 0; bottom: 0;
  border-right: 1px solid var(--ink);
  background: color-mix(in srgb, var(--amber) var(--band-heat, 0%), transparent);
}
.tc-band.gap { background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--rule) 6px 7px); }
.tc-band.active { outline: 3px solid var(--ink); outline-offset: -3px; z-index: 1; }
.tc-band.beyond { background: repeating-linear-gradient(90deg, transparent 0 4px, color-mix(in srgb, var(--funk) 40%, transparent) 4px 8px); }
.track-marques { position: absolute; left: 0; right: 0; bottom: 16px; height: 8px; }
.tm-seg { position: absolute; top: 0; bottom: 0; background: var(--band-jam); opacity: .85; }
/* international marques: funk-green, distinct from Jamaican copper */
.tm-seg.tm-int { background: var(--band-int); opacity: .85; }
/* Grand Arôme GI floor: open-ended band fading toward the wall.
   Holds full band-int for the first 40% so the readable portion clears 3:1
   before the fade begins. */
.tm-seg.tm-open { background: linear-gradient(90deg, var(--band-int) 0%, var(--band-int) 40%, transparent 96%); opacity: .85; }
/* single lab measurement: a point tick, not a band */
.tm-seg.tm-point { opacity: 1; min-width: 4px; }
.track-wall {
  position: absolute; left: var(--wall-pct); top: -6px; bottom: 22px;
  border-left: 3px double var(--ink); z-index: 2; pointer-events: none;
}
.track-wall span {
  position: absolute; top: -2.1em; left: -1px; transform: translateX(-100%);
  font-family: var(--mono); font-size: .625rem; font-weight: 700;
  letter-spacing: .1em; white-space: nowrap; padding: 0 .5em .15em 0;
  background: var(--paper);
}
.track-labels { display: none; }
.track-scale-notes {
  display: flex; justify-content: space-between; gap: 1rem;
  font-family: var(--mono); font-size: .625rem; letter-spacing: .1em;
  text-transform: uppercase; margin-top: .25rem; color: color-mix(in srgb, var(--ink) 80%, var(--paper));
}
.track-scale-notes span { white-space: nowrap; }
@media (max-width: 40rem) { .tsn-mid { display: none; } }

/* legend for the marque coverage strip under the track */
.track-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem;
  margin-top: .5rem;
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .08em;
  text-transform: uppercase; color: color-mix(in srgb, var(--ink) 70%, var(--paper));
}
.tl-title { font-weight: 700; }
.tl-item { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
/* swatches mirror .tm-seg exactly — same token, same opacity, same 8px height —
   so the legend and the strip it explains cannot drift apart */
.tl-sw { width: 18px; height: 8px; flex: none; }
.tl-sw.tl-jam { background: var(--band-jam); opacity: .85; }
.tl-sw.tl-int { background: var(--band-int); opacity: .85; }
.tl-sw.tl-point { width: 4px; background: var(--band-jam); opacity: 1; }

/* the real range input sits over the whole track */
#ester-slider {
  position: absolute; inset: -8px 0 12px 0; width: 100%; height: auto;
  appearance: none; -webkit-appearance: none; background: transparent;
  margin: 0; cursor: ew-resize; z-index: 3; touch-action: pan-y;
}
/* Tap target: the input itself spans the full track (100% wide, ~72px tall),
   so the grab area is never bound to the visual thumb — it is already well past
   the 44px touch minimum. The thumb stays 26px so it does not occlude the ester
   band it is pointing at; three grip notches supply the drag affordance that
   width alone was being asked to carry. */
#ester-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 72px; border-radius: 0;
  background:
    linear-gradient(90deg,
      transparent 0 7px, var(--paper) 7px 9px, transparent 9px 12px,
      var(--paper) 12px 14px, transparent 14px 17px,
      var(--paper) 17px 19px, transparent 19px 26px)
    center / 26px 20px no-repeat,
    var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
}
#ester-slider::-moz-range-thumb {
  width: 26px; height: 72px; border-radius: 0;
  background:
    linear-gradient(90deg,
      transparent 0 7px, var(--paper) 7px 9px, transparent 9px 12px,
      var(--paper) 12px 14px, transparent 14px 17px,
      var(--paper) 17px 19px, transparent 19px 26px)
    center / 26px 20px no-repeat,
    var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
}
#ester-slider:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }

/* ---------- first-touch affordances (all retire on body.touched) ---------- */

/* 1 · calibration pulse: thumb shifts ±2px until first input */
@keyframes calibrate {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}
/* Blink won't animate the thumb pseudo — but the input paints ONLY the thumb
   (its track is transparent), so pulsing the input moves just the visible thumb. */
body:not(.touched) #ester-slider { animation: calibrate 1.6s ease-in-out infinite; }

/* 2 · phosphor sweep: a faint highlight runs 0 → current value; thumb stays still */
.track-sweep {
  position: absolute; inset: 0 0 28px 0; width: var(--sweep-w, 8.5%);
  overflow: hidden; pointer-events: none; z-index: 2;
}
.track-sweep::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 45%;
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--amber) 55%, transparent), transparent);
  transform: translateX(-110%);
  animation: sweep 2.2s ease-in-out infinite;
}
@keyframes sweep { to { transform: translateX(290%); } }
body.touched .track-sweep { display: none; }

/* 3 · terminal prompt: block cursor after the standfirst, 800ms blink */
.tcursor {
  display: inline-block; width: .55em; height: 1em; margin-left: .18em;
  vertical-align: text-bottom; background: var(--ink);
  animation: blink .8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
body.touched .tcursor { display: none; }

@media (prefers-reduced-motion: reduce) {
  body:not(.touched) #ester-slider { animation: none; }
  .track-sweep { display: none; }
  .tcursor { animation: none; } /* solid cursor until touched, no blink */
}

/* ---------- cards ---------- */
.cards { max-width: 68rem; margin: 2rem auto 0; padding: 0 1.5rem; }
/* One control panel: search + toggle are both inputs, so they share a surface.
   .card-switcher is deliberately left outside it — that is contextual output
   about the current value, not a control, and belongs with the card. */
.card-tools {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem 1.5rem; flex-wrap: wrap; margin-bottom: 1rem;
  padding: .875rem 1rem;
  border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
}
@media (max-width: 40rem) { .card-tools { align-items: stretch; flex-direction: column; } }

/* searchable marque dropdown */
.marque-search { position: relative; flex: 1 1 16rem; max-width: 26rem; }
/* Stacking the tools flips the flex axis, so `flex: 1 1 16rem` resolves 16rem
   against HEIGHT — a 256px-tall empty box that pushed the dropdown (top: 100%)
   far below the input. Must come after the base rule to win. */
@media (max-width: 40rem) {
  .marque-search { flex: 0 0 auto; max-width: none; }
}
.ms-input {
  width: 100%; font-family: var(--mono); font-size: .8125rem;
  padding: .5rem .75rem; border: 1px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink);
}
.ms-input::placeholder { color: color-mix(in srgb, var(--ink) 62%, var(--paper)); }
.ms-input:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.ms-panel {
  position: absolute; z-index: 4; top: 100%; left: 0; right: 0;
  margin: .25rem 0 0; background: var(--paper); border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--ink) 20%, transparent);
}
/* left/right:0 already sizes the panel to the (now full-width) search box.
   The old `width: calc(100vw - 3rem)` ignored .card-tools' own 1rem padding
   and hung 2rem off the right edge. Cap the height so it can't run off-screen. */
@media (max-width: 40rem) {
  .ms-panel { max-height: 70vh; overflow-y: auto; overscroll-behavior: contain; }
  /* .ms-panel prefix so this outranks the later `.ms-list { max-height: 13rem }`
     — the panel owns the scroll on mobile, not the list. */
  .ms-panel .ms-list { max-height: none; }
}
.ms-filters { padding: .5rem .75rem 0; border-bottom: 1px dotted var(--rule); }
.msf-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem; margin-bottom: .5rem; }
.msf-label {
  font-family: var(--mono); font-size: .5625rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; margin-right: .2rem;
  color: color-mix(in srgb, var(--ink) 70%, var(--paper)); flex: 0 0 4.5rem;
}
.msf-chip, .msf-clear {
  font-family: var(--mono); font-size: .625rem; font-weight: 400;
  letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  padding: .2rem .5rem; border-radius: 0;
}
.msf-chip:hover { border-color: var(--ink); }
.msf-chip[aria-pressed="true"] {
  background: color-mix(in srgb, var(--amber) 22%, var(--paper));
  border-color: var(--ink); box-shadow: inset 0 -2px 0 var(--amber);
}
.msf-chip:focus-visible, .msf-clear:focus-visible, .ms-sort:focus-visible { outline: 3px solid var(--amber); outline-offset: 1px; }
.msf-clear { border-style: dashed; margin-bottom: .5rem; color: var(--amber-ink); }
.ms-sortbar {
  display: flex; align-items: center; gap: .5rem; justify-content: flex-end;
  padding: .4rem .75rem; border-bottom: 1px dotted var(--rule);
}
.ms-sort-label { font-family: var(--mono); font-size: .5625rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: color-mix(in srgb, var(--ink) 70%, var(--paper)); }
.ms-sort {
  font-family: var(--mono); font-size: .6875rem; font-weight: 700;
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule);
  padding: .2rem .3rem; border-radius: 0;
}
.ms-list {
  margin: 0; padding: 0; list-style: none;
  max-height: 13rem; overflow: auto;
}
.ms-opt {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: .45rem .75rem; cursor: pointer; border-bottom: 1px dotted var(--rule);
}
.ms-opt:last-child { border-bottom: 0; }
.ms-opt:hover, .ms-opt.active { background: color-mix(in srgb, var(--amber) 18%, var(--paper)); }
.ms-marque { font-family: var(--mono); font-size: .8125rem; font-weight: 700; letter-spacing: .06em; }
.ms-meta { font-family: var(--mono); font-size: .625rem; font-weight: 400; letter-spacing: .02em; text-align: right; color: color-mix(in srgb, var(--ink) 70%, var(--paper)); }
.ms-none { padding: .45rem .75rem; font-family: var(--mono); font-size: .6875rem; color: color-mix(in srgb, var(--ink) 70%, var(--paper)); }
.unbottled-toggle {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font-family: var(--mono); font-size: .6875rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 65%, var(--paper));
}
.unbottled-toggle:hover { color: var(--ink); }
.unbottled-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ut-box {
  position: relative; flex: none; width: 34px; height: 18px;
  border: 1px solid var(--ink); background: var(--paper);
}
.ut-box::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  background: color-mix(in srgb, var(--ink) 45%, var(--paper));
  transition: left .12s ease, background .12s ease;
}
.unbottled-toggle input:checked + .ut-box { background: color-mix(in srgb, var(--amber) 18%, var(--paper)); }
.unbottled-toggle input:checked + .ut-box::after { left: 18px; background: var(--amber-ink); }
.unbottled-toggle input:focus-visible + .ut-box { outline: 3px solid var(--amber); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .ut-box::after { transition: none; } }
.card-switcher {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 1rem; margin-bottom: .75rem;
}
.card-switcher:empty { display: none; }
.cnav-current {
  font-family: var(--mono); font-size: .875rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; text-align: center;
  white-space: nowrap;
  box-shadow: inset 0 -3px 0 var(--amber); padding-bottom: .2rem;
}
.cnav-side {
  min-height: 44px; min-width: 0; width: 100%;
  padding: 0; background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: .75rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 55%, var(--paper));
  white-space: nowrap; overflow: hidden; border-radius: 0;
  /* fade both ends so any clip against the center label reads as intentional */
  mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
}
.cnav-side.prev { text-align: left; }
.cnav-side.next { text-align: right; }
@media (max-width: 40rem) {
  .card-switcher { gap: .5rem; }
  .cnav-side { font-size: .6875rem; }
}
.cnav-side:hover { color: var(--ink); mask-image: none; }
.cnav-side:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; mask-image: none; }

.marque-card {
  position: relative;
  border: 1px solid var(--ink); border-top: 6px solid var(--amber);
  padding: 1.25rem 1.5rem 1.5rem;
  background: var(--paper); /* opaque — guarantees text contrast over the haze */
  animation: slide-in .25s ease-out;
}
.mc-plate {
  /* anchored cornerpiece: bleeds to the card's top-right frame */
  float: right; width: 120px; height: 120px; object-fit: cover; aspect-ratio: 1;
  margin: -1.25rem -1.5rem 1rem 1.25rem;
  border: 0; border-left: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  background: var(--paper);
}
@media (max-width: 40rem) { .mc-plate { width: 84px; height: 84px; } }
@media (prefers-color-scheme: dark) { .mc-plate { filter: sepia(.15) brightness(.92); } }
.marque-card.is-class { border-top-color: var(--funk); }
@keyframes slide-in { from { opacity: 0; transform: translateY(14px); } }
.marque-card.from-right { animation: slide-r .22s ease-out; }
.marque-card.from-left { animation: slide-l .22s ease-out; }
@keyframes slide-r { from { opacity: 0; transform: translateX(36px); } }
@keyframes slide-l { from { opacity: 0; transform: translateX(-36px); } }
@media (prefers-reduced-motion: reduce) {
  .marque-card, .marque-card.from-right, .marque-card.from-left { animation: none; }
}

.mc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; border-bottom: 1px solid var(--rule); padding-bottom: .5rem; }
.mc-marque { font-family: var(--display); font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; letter-spacing: -.01em; margin: 0; text-transform: uppercase; }
.mc-band { font-family: var(--mono); font-size: 1rem; font-weight: 700; color: var(--amber-ink); }
.mc-sub { font-family: var(--mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; width: 100%; margin: .25rem 0 0; }
/* country tag: muted per-country accent (set as --origin inline); text stays ink */
.mc-origin {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .6875rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--origin, var(--funk)); color: var(--ink);
  background: color-mix(in srgb, var(--origin, var(--funk)) 18%, transparent);
  padding: .1rem .5rem; align-self: center;
}
/* stencil flag: cargo-stamp tint — origin accent pulled toward ink so it
   reads as a stamp, not a sticker, in both color schemes */
.mc-flag {
  width: 18px; height: 12px; flex: none;
  color: color-mix(in srgb, var(--origin, var(--funk)) 60%, var(--ink));
}
.mc-flag .fp { fill: var(--paper); }
.marque-card.is-int { border-top-color: var(--funk); }

.mc-specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .25rem 3rem; margin: 1rem 0 0; }
.mc-specs > div {
  display: grid; grid-template-columns: max-content 1fr; align-items: baseline;
  gap: 1.25rem; border-bottom: 1px dotted var(--rule); padding: .3rem 0;
}
.mc-specs dt { font-family: var(--mono); font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 0; }
.mc-specs dd { margin: 0; text-align: right; font-size: .9375rem; overflow-wrap: break-word; min-width: 0; }
.mc-flavor-block { margin: 1.25rem 0 0; }
.mc-flavor-block .kicker { margin-bottom: .5rem; }
.mc-flavors {
  list-style: none; display: flex; flex-wrap: wrap; gap: .5rem;
  margin: 0; padding: 0;
}
/* icon-first tiles: the image carries the meaning, the caption is a whisper */
.flavor-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: .35rem; width: 76px; text-align: center;
  border: 1px solid var(--rule); padding: .5rem .25rem .4rem;
  background: color-mix(in srgb, var(--amber) 7%, var(--paper));
}
.flavor-chip img {
  width: 48px; height: 48px; object-fit: cover;
  border: 1px solid var(--rule);
}
.fc-label {
  font-family: var(--mono); font-size: .5625rem; font-weight: 500;
  letter-spacing: .09em; text-transform: uppercase; line-height: 1.25;
  /* measured against the chip's amber-tinted bg (#EFE5D6), not plain paper —
     62% only reached 4.29:1 there */
  color: color-mix(in srgb, var(--ink) 72%, var(--paper));
}
.flavor-chip.no-img { justify-content: center; min-height: 76px; }
.flavor-chip.no-img .fc-label { font-size: .6875rem; color: var(--ink); }
@media (prefers-color-scheme: dark) { .flavor-chip img { filter: sepia(.15) brightness(.92); } }

/* ---------- process badges (dunder / cane acid / muck) ---------- */
.process-badges {
  list-style: none; display: flex; gap: .75rem;
  margin: 1rem 0 0; padding: 0;
}
.pbadge {
  flex: 1 1 0; max-width: 11rem;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  border: 1px solid var(--rule); padding: .6rem .5rem .5rem;
  text-align: center;
}
.pb-ic { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pb-label { font-family: var(--mono); font-size: .625rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.pb-qual { font-family: var(--mono); font-size: .625rem; letter-spacing: .06em; text-transform: uppercase; color: color-mix(in srgb, var(--ink) 70%, var(--paper)); }
/* Static readouts, NOT controls. Deliberately share no treatment with
   .msf-chip[aria-pressed] — no fill, no inset underline, no pointer, no hover.
   State is carried by border weight, icon weight and the visible qualifier. */
.pbadge { cursor: default; }
/* State is carried by border and icon only. Container opacity is deliberately
   NOT used: it multiplies down onto the label and qualifier too, which dragged
   the "no" / "not specified" text to 2.1–2.3:1. Dim the mark, never the word. */
.pbadge.is-on { border-color: var(--ink); }
.pbadge.is-on .pb-ic { stroke-width: 2; }
.pbadge.is-part { border-style: dashed; }
.pbadge.is-part .pb-ic { opacity: .7; }
.pbadge.is-off .pb-ic { opacity: .45; stroke-dasharray: 2 2; }
.pbadge.is-na { border-style: dotted; }
.pbadge.is-na .pb-ic { opacity: .35; }
.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- fermentation range bar ---------- */
.mc-ferm {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: max-content 1fr; align-items: baseline;
  gap: 1.25rem; border-bottom: 1px dotted var(--rule); padding: .3rem 0;
}
.mc-ferm dd {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: .25rem .6rem; margin: 0; min-width: 0;
}
.ferm-days { grid-column: 1 / -1; text-align: right; font-size: .9375rem; }
.ferm-bar {
  position: relative; display: block; height: 8px;
  border: 1px solid var(--rule);
}
/* full-scale heat gradient; the marque's range is a clip-path window onto it,
   so a 2-day ferment shows cool gold and a 4-week one lands in the reds */
.ferm-bar .ferm-heat {
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    var(--heat-cool) 0%, var(--heat-warm) 30%, var(--heat-hot) 65%, var(--heat-max) 100%);
}
.ferm-bar::after { /* week ticks stay on top of the fill */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 6 - 1px), var(--rule) calc(100% / 6 - 1px) calc(100% / 6));
}
.ferm-cap { font-family: var(--mono); font-size: .5625rem; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--ink) 60%, var(--paper)); }

/* ---------- base material swatch ---------- */
.dd-base { display: inline-flex; align-items: center; justify-content: flex-end; gap: .45rem; }
.base-swatch {
  width: 11px; height: 11px; flex: none;
  border: 1px solid color-mix(in srgb, var(--ink) 40%, transparent);
}
.base-swatch.is-molasses { background: var(--base-molasses); }
.base-swatch.is-cane { background: var(--base-cane); }
.base-swatch.is-syrup { background: var(--base-syrup); }

/* ---------- still icons ---------- */
.dd-still { display: inline-flex; align-items: center; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
.still-icons { display: inline-flex; gap: .25rem; flex: none; }
.still-ic { width: 22px; height: 22px; fill: none; stroke: var(--amber-ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- flavor radar ---------- */
.mc-flavor-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; }
@media (max-width: 40rem) { .mc-flavor-grid { grid-template-columns: 1fr; justify-items: center; } }
.mc-radar {
  width: clamp(220px, 26vw, 268px); height: auto;
  aspect-ratio: 236 / 206; flex: none; overflow: visible;
}
.mc-radar .rr { fill: none; stroke: var(--rule); }
.mc-radar .ra { stroke: var(--rule); }
.mc-radar .rs {
  fill: color-mix(in srgb, var(--amber) 30%, transparent);
  stroke: var(--amber-ink); stroke-width: 1.5; stroke-linejoin: round;
}
/* 9px in a 200-unit box rendered at 190px was ~8.5 effective px. 11px in a
   236-unit box at 240px renders ~11.2px — a 31% lift. */
.mc-radar .rl { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .08em; fill: var(--ink); }

.mc-aroma { margin: 1rem 0 0; font-size: 1.0625rem; }
.mc-notes { margin: .5rem 0 0; font-size: .9375rem; color: color-mix(in srgb, var(--ink) 78%, transparent); }

.mc-bottle { margin-top: 1.25rem; border: 1px solid var(--rule); padding: .875rem 1rem; }
.mc-bottle.is-empty {
  display: flex; align-items: center; gap: .75rem;
  border-style: dashed; opacity: .5; padding: .6rem 1rem;
}
.mc-bottle.is-empty .kicker { margin: 0; }
.bottle-ic { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.mc-bottle .kicker { margin-bottom: .25rem; }
.mc-bottle-name { font-family: var(--body); font-weight: 500; font-size: 1.125rem; margin: 0; }
.mc-bottle-why { font-size: .9375rem; margin: .25rem 0 .75rem; }
.mc-buy {
  display: inline-block; font-family: var(--mono); font-size: .8125rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  border: 2px solid var(--ink); padding: .55rem .9rem; color: var(--ink); border-radius: 0;
}
.mc-buy:hover { background: var(--ink); color: var(--paper); }
.mc-buy[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.mc-buy:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- glossary triggers + popover ----------
   Triggers are dotted-underlined inline buttons that inherit the type around
   them, so a definition never costs the surrounding layout anything. */
.gt {
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
  background: none; border: 0; padding: 0; margin: 0; cursor: help;
  text-decoration: underline dotted currentColor;
  text-underline-offset: .22em; text-decoration-thickness: 1px;
}
.gt:hover, .gt[aria-expanded="true"] {
  color: var(--amber-ink); text-decoration-style: solid;
}
.gt:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.gt-icon {
  display: inline-flex; vertical-align: middle; margin-left: .4rem;
  text-decoration: none; color: var(--amber-ink);
}
.gt-icon svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round;
}
.gt-icon svg .dot { fill: currentColor; stroke-width: 2.5; }
.gt-icon:hover { color: var(--ink); }

.gtip {
  position: fixed; z-index: 60; width: min(20rem, calc(100vw - 2rem));
  background: var(--ink); color: var(--paper);
  border-left: 4px solid var(--amber-on-ink);
  padding: .7rem .85rem; pointer-events: none;
  opacity: 0; transform: translateY(3px);
  transition: opacity .12s ease, transform .12s ease;
  box-shadow: 0 8px 24px color-mix(in srgb, #000 28%, transparent);
}
.gtip.show { opacity: 1; transform: none; }
.gtip::after {
  content: ""; position: absolute; left: var(--arrow-x, 50%);
  bottom: -5px; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--ink); border-bottom: 0;
}
.gtip.below::after { bottom: auto; top: -5px; border-top: 0; border-bottom: 5px solid var(--ink); }
.gtip-label {
  margin: 0 0 .3rem; font-family: var(--mono); font-size: .625rem;
  font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--amber-on-ink);
}
.gtip-body { margin: 0; font-size: .875rem; line-height: 1.45; }
.gtip-more {
  margin: .5rem 0 0; font-size: .8125rem; line-height: 1.45;
  color: color-mix(in srgb, var(--paper) 68%, transparent);
}
@media (prefers-reduced-motion: reduce) { .gtip { transition: none; } }

/* ---------- how to drink it ---------- */
.mc-use {
  margin-top: 1.25rem; padding: 1.15rem 1.15rem .35rem;
  border: 1px solid var(--rule); border-top: 3px solid var(--funk);
  background: color-mix(in srgb, var(--funk) 5%, transparent);
}
/* the seasoning tier is a warning as much as a suggestion — mark it */
.mc-use.is-seasoning {
  border-top-color: var(--heat-hot);
  background: color-mix(in srgb, var(--heat-hot) 6%, transparent);
}
.use-headline {
  margin: .15rem 0 .4rem; font-family: var(--display);
  font-size: 1.375rem; line-height: 1.15; text-transform: uppercase;
  letter-spacing: -.01em;
}
.use-hedge {
  margin: 0 0 .5rem; font-size: .8125rem; line-height: 1.5;
  font-style: italic; color: color-mix(in srgb, var(--ink) 68%, transparent);
}
.use-role { margin: 0; font-size: .9375rem; line-height: 1.55; }
.use-pour {
  margin: .6rem 0 0; font-size: .875rem;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem;
}
.up-label {
  font-family: var(--mono); font-size: .625rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--amber-ink);
}
/* The solid left bar is reserved for the caution and nothing else — the moment
   a recipe borrows it, the warning stops reading as a warning. */
.use-caution {
  margin: .9rem 0 0; padding: .6rem .8rem; font-size: .875rem; line-height: 1.5;
  border-left: 4px solid var(--heat-hot);
  background: color-mix(in srgb, var(--heat-hot) 9%, transparent);
}
.uc-label {
  display: block; margin-bottom: .2rem;
  font-family: var(--mono); font-size: .625rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--heat-hot);
}
.ck-list { list-style: none; margin: 1.4rem 0 0; padding: 0; display: block; }
.ck-drink > details { border-top: 1px solid var(--rule); }
/* `display:flex` on a <summary> suppresses the native disclosure triangle in
   Chrome and Safari, so the row needs an explicit signifier. A mono [+]/[–]
   plate reads as a control at a glance and matches the ledger type. */
.ck-drink summary {
  cursor: pointer; padding: 1.15rem 0; display: flex; flex-wrap: wrap;
  align-items: baseline; gap: .25rem .6rem;
  list-style: none; /* normalize the marker away in Firefox too */
}
.ck-drink summary::-webkit-details-marker { display: none; }
.ck-drink summary::after {
  content: '+';
  margin-left: auto; flex: 0 0 auto; align-self: center;
  width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .9375rem; font-weight: 700; line-height: 1;
  color: var(--amber-ink);
  border: 1px solid color-mix(in srgb, var(--amber-ink) 45%, transparent);
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  transition: background-color .15s ease, border-color .15s ease;
}
.ck-drink details[open] > summary::after { content: '–'; }
.ck-drink summary:hover::after {
  border-color: var(--amber-ink);
  background: color-mix(in srgb, var(--amber) 18%, transparent);
}
.ck-drink summary:hover .ck-name { text-decoration: underline; text-underline-offset: 3px; }
.ck-drink details[open] > summary { padding-bottom: .65rem; }
.ck-drink summary:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .ck-drink summary::after { transition: none; } }
.ck-name { font-weight: 500; font-size: .9375rem; }
.ck-origin {
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .04em;
  /* 62% lands at 4.49:1 over the tinted use-block background — just under AA */
  color: color-mix(in srgb, var(--ink) 66%, transparent);
}
.ck-body { padding-bottom: 1.25rem; }
/* Recipes get an inset panel and a dotted edge instead of the caution's bar. */
.ck-spec {
  list-style: none; margin: 0 0 .8rem; padding: .6rem .8rem;
  border: 1px dotted color-mix(in srgb, var(--ink) 32%, transparent);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  font-family: var(--mono); font-size: .75rem; line-height: 1.5;
  font-variant-numeric: tabular-nums;
  display: grid; grid-template-columns: max-content 1fr; gap: .35rem .9rem;
}
.ck-spec > li { display: contents; }
.ck-spec > li.ck-plain {
  display: block; grid-column: 1 / -1;
  color: color-mix(in srgb, var(--ink) 74%, transparent);
}
.ck-qty { text-align: right; white-space: nowrap; font-weight: 700; }
.ck-ing { min-width: 0; }
/* Linked ingredients sit inside a dense mono block, so a conventional
   underlined link would stripe the whole recipe. A dotted underline in amber
   marks them as actionable without competing with the measures. */
.ck-buy {
  color: inherit; text-decoration: underline dotted;
  text-decoration-color: var(--amber-ink); text-underline-offset: 3px;
  text-decoration-thickness: 1px; cursor: pointer;
}
.ck-buy:hover, .ck-buy:focus-visible {
  color: var(--amber-ink); text-decoration-style: solid;
}
.ck-buy:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
/* the marque line is the one the whole card is about — let it carry weight */
.ck-buy.is-marque { font-weight: 700; text-decoration-style: solid; }
/* placeholder URLs are not yet clickable, and must not pretend to be */
.ck-buy.is-soon { cursor: default; text-decoration-style: dotted; opacity: .85; }
.ck-buy.is-soon:hover { color: inherit; text-decoration-style: dotted; }
.ck-disclosure {
  margin: 1.1rem 0 0; padding-top: .7rem; border-top: 1px solid var(--rule);
  font-size: .6875rem; line-height: 1.5;
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}
.ck-method { margin: 0; font-size: .875rem; }
.ck-note {
  margin: .5rem 0 0; font-size: .8125rem; line-height: 1.5;
  color: color-mix(in srgb, var(--ink) 74%, transparent);
}

/* ---------- primer strip (beginner layer, above the slider) ---------- */
.primer {
  max-width: 68rem; margin: 1.5rem auto 0; padding: .75rem 1.5rem;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem 1.5rem; justify-content: space-between;
  border-bottom: 1px solid var(--rule);
}
.primer-lead { margin: 0; font-size: .9375rem; }
.primer-tag {
  font-family: var(--mono); font-size: .6875rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--amber-ink);
  margin-right: .5rem;
}
.primer .fig-info-btn { border: 2px solid var(--amber-ink); padding: .4rem .7rem; }
.primer .fig-info-btn:hover { background: var(--amber-ink); color: var(--paper); border-color: var(--amber-ink); }

/* ---------- fine print → info button + dialog ---------- */
.fine-print { max-width: 68rem; margin: 2.5rem auto 3rem; padding: 0 1.5rem; }
.fp-note {
  margin: 0; font-family: var(--mono); font-size: .75rem;
  letter-spacing: .06em; color: color-mix(in srgb, var(--ink) 62%, transparent);
}
.fig-info-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: none; border: 0; padding: .25rem 0; cursor: pointer;
  font-family: var(--mono); font-size: .75rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: var(--amber-ink);
}
.fig-info-btn svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round;
}
.fig-info-btn svg .dot { fill: currentColor; stroke-width: 2; }
.fig-info-btn:hover { color: var(--ink); }
.fig-info-btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.fig-dialog {
  max-width: min(34rem, calc(100vw - 3rem));
  background: var(--paper); color: var(--ink);
  /* --amber-ink, not --amber: it is the exact color of the .kicker header this
     border ties to, and raw --amber is only 2.76:1 on cane paper */
  border: 2px solid var(--amber-ink); border-top: 6px solid var(--amber-ink);
  padding: 1.25rem 1.5rem 1.5rem;
  box-shadow: 0 18px 48px -12px rgba(33, 26, 18, .55),
              0 2px 8px rgba(33, 26, 18, .25);
}
/* blur the cane illustration rather than flatten it under grey; the tint is
   molasses, not black, so the art keeps its warmth behind the glass */
.fig-dialog::backdrop {
  background: color-mix(in srgb, #2A1E12 62%, transparent);
  backdrop-filter: blur(6px) saturate(.9);
  -webkit-backdrop-filter: blur(6px) saturate(.9);
}
.fig-dialog p:not(.kicker) { font-size: .9375rem; margin: 0 0 1rem; }

/* scannable mini-glossary — label rail + definition, not one dense block */
.fig-gloss { margin: .5rem 0 1.5rem; }
.fig-gloss dt {
  font-family: var(--mono); font-size: .6875rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--amber-ink);
}
.fig-gloss dd {
  margin: .2rem 0 0; padding: 0 0 .9rem;
  font-size: .9375rem; line-height: 1.5;
}
.fig-gloss dd + dt {
  padding-top: .9rem; border-top: 1px solid var(--rule);
}
.fig-gloss dd:last-of-type { padding-bottom: 0; }

.fig-close {
  font-family: var(--mono); font-size: .8125rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
  background: var(--btn-green); border: 2px solid var(--btn-edge, var(--btn-green));
  color: var(--cotton);
  padding: .55rem 1.1rem; border-radius: 0;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.fig-close:hover { background: var(--btn-green-hi); border-color: var(--btn-edge, var(--btn-green-hi)); transform: translateY(-1px); }
.fig-close:active { transform: translateY(0); }
.fig-close:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .fig-close { transition: none; }
  .fig-close:hover { transform: none; }
}

/* ---------- wall flash (whimsy #3) ---------- */
.wall-flash {
  position: fixed; inset: 0; z-index: 5; display: grid; place-items: center;
  pointer-events: none; opacity: 0;
}
.wall-flash .wall-img {
  position: absolute; width: min(56vmin, 480px); mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) { .wall-flash .wall-img { display: none; } }
.wall-flash span {
  position: relative;
  font-family: var(--display); text-transform: uppercase; text-align: center;
  font-size: clamp(3rem, 14vw, 11rem); line-height: .9; letter-spacing: -.02em;
  color: var(--funk); -webkit-text-stroke: 2px var(--ink);
}
.wall-flash.fire { animation: wall 1.6s ease-out forwards; }
@keyframes wall {
  0% { opacity: 0; transform: scale(.92); }
  12% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) { .wall-flash.fire { animation: none; opacity: 0; } }

/* corbet-footer retheme (tokens only — component untouched).
   Verified with the footer's contrast.js: light 4.77:1, dark 5.29:1 composited. */
.cf {
  --cf-bg: var(--paper);
  --cf-ink: var(--ink);
  --cf-accent: var(--funk);
  --cf-muted: #56513F;
}
@media (prefers-color-scheme: dark) {
  .cf { --cf-muted: #A9A294; }
}
