/* ==========================================================================
   Bourgogne Blanc - A Terroir Atlas
   base.css: design tokens, reset, typography, layout, shared components.
   Module styles live in their own files (map.css, slope.css, climate.css,
   villages.css, finder.css) and must only use the tokens defined here.
   ========================================================================== */

/* ---------- Tokens: light ("limestone paper") ---------- */
:root {
  color-scheme: light;
  --paper: #f3eee4;          /* page background */
  --paper-2: #ebe4d6;        /* recessed areas, table stripes */
  --surface: #fbf8f2;        /* cards, panels */
  --surface-2: #f6f1e7;      /* hover, secondary surface */
  --ink: #1f1b16;            /* primary text */
  --ink-2: #4a433b;          /* secondary text */
  --muted: #6f665b;          /* captions, labels (AA on paper) */
  --faint: #a0978a;          /* decorative text, never for body copy */
  --rule: #d8cfbf;           /* hairlines */
  --rule-strong: #bfb4a1;
  --contour: #8c806d;        /* topographic lines */

  /* Appellation levels (map fills, badges, charts). Data only: chrome uses --gilt or --accent. */
  /* Validated with the dataviz palette checker (all pairs, Machado 2009 CVD):
     light CVD dE 9.1, normal dE 16.5. Dark (grand cru lifted to #c2890e, 2026-09-26)
     CVD dE 8.8, normal dE 15.4, on --surface #1b1916. */
  --lvl-gc: #af8a1c;         /* Grand Cru - gilt */
  --lvl-gc-soft: rgba(175, 138, 28, 0.17);
  --lvl-pc: #883504;         /* Premier Cru - rust copper */
  --lvl-pc-soft: rgba(136, 53, 4, 0.13);
  --lvl-vl: #3f7c45;         /* Village - vine green */
  --lvl-vl-soft: rgba(63, 124, 69, 0.13);
  --lvl-rg: #5e7bbc;         /* Regional Bourgogne - slate */
  --lvl-rg-soft: rgba(94, 123, 188, 0.13);
  --gilt: #a67c12;           /* gilt for display text (brand, hero), not for data */
  --gilt-text: #86630c;      /* gilt for small text, 4.8:1 on paper */
  --gilt-soft: rgba(166, 124, 18, 0.18); /* gilt wash for chrome: selection, highlights */
  --lvl-none: #c9c0b1;       /* outside any AOC */

  /* Accents */
  --accent: #7a2e2a;         /* oxblood ink for links and focus */
  --accent-soft: rgba(122, 46, 42, 0.1);
  --slate: #34505e;          /* Kimmeridgian slate, data highlights */
  --warm: #b4462b;           /* warming, heat */
  --cool: #3f6f8f;           /* cooling, frost */

  --shadow-1: 0 1px 2px rgba(31, 27, 22, 0.06), 0 2px 8px rgba(31, 27, 22, 0.05);
  --shadow-2: 0 2px 6px rgba(31, 27, 22, 0.08), 0 12px 32px rgba(31, 27, 22, 0.1);
  --scrim: rgba(243, 238, 228, 0.86);

  /* Type */
  --font-display: "Cormorant", "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --font-ui: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-tick: 0.625rem;       /* 10px: chart ticks and axis labels */
  --fs-2xs: 0.6875rem;       /* 11px: mono micro labels, badges, legends */
  --fs-xs: 0.75rem;          /* 12px: eyebrows, captions */
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  --fs-hero: clamp(3.25rem, 1.6rem + 7.5vw, 8.5rem);

  /* Space and shape */
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1240px;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 56px;
}

/* ---------- Tokens: dark ("cellar") ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #13110f; --paper-2: #0e0d0b; --surface: #1b1916; --surface-2: #23201c;
    --ink: #ede6d9; --ink-2: #cfc6b6; --muted: #a39a8b; --faint: #6d665c;
    --rule: #2f2b26; --rule-strong: #443e36; --contour: #6d6454;
    --lvl-gc: #c2890e; --lvl-gc-soft: rgba(194, 137, 14, 0.24);
    --lvl-pc: #a03b1f; --lvl-pc-soft: rgba(160, 59, 31, 0.26);
    --lvl-vl: #56aa70; --lvl-vl-soft: rgba(86, 170, 112, 0.2);
    --lvl-rg: #7784c6; --lvl-rg-soft: rgba(119, 132, 198, 0.22);
    --gilt: #e2bf55; --gilt-text: #e2bf55; --gilt-soft: rgba(226, 191, 85, 0.2);
    --lvl-none: #3a352f;
    --accent: #e3a08f; --accent-soft: rgba(227, 160, 143, 0.12);
    --slate: #8fb3c4; --warm: #e5795a; --cool: #7fb0d3;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.45), 0 16px 40px rgba(0, 0, 0, 0.45);
    --scrim: rgba(19, 17, 15, 0.86);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #13110f; --paper-2: #0e0d0b; --surface: #1b1916; --surface-2: #23201c;
  --ink: #ede6d9; --ink-2: #cfc6b6; --muted: #a39a8b; --faint: #6d665c;
  --rule: #2f2b26; --rule-strong: #443e36; --contour: #6d6454;
  --lvl-gc: #c2890e; --lvl-gc-soft: rgba(194, 137, 14, 0.24);
  --lvl-pc: #a03b1f; --lvl-pc-soft: rgba(160, 59, 31, 0.26);
  --lvl-vl: #56aa70; --lvl-vl-soft: rgba(86, 170, 112, 0.2);
  --lvl-rg: #7784c6; --lvl-rg-soft: rgba(119, 132, 198, 0.22);
  --gilt: #e2bf55; --gilt-text: #e2bf55; --gilt-soft: rgba(226, 191, 85, 0.2);
  --lvl-none: #3a352f;
  --accent: #e3a08f; --accent-soft: rgba(227, 160, 143, 0.12);
  --slate: #8fb3c4; --warm: #e5795a; --cool: #7fb0d3;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.45), 0 16px 40px rgba(0, 0, 0, 0.45);
  --scrim: rgba(19, 17, 15, 0.86);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--gilt-soft); }

/* Paper grain: a very faint noise so flat areas feel like printed stock */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.45  0 0 0 0 0.4  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
main, header, footer { position: relative; z-index: 1; }

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.05; text-wrap: balance; }
/* Cormorant defaults to old-style figures. Display numbers use lining figures so they match
   the IBM Plex Mono data beside them. Add .display-num to any other number set in the display face. */
h1, h2, h3, .lede { font-variant-numeric: lining-nums; }
.display-num, .hero-stats .v { font-variant-numeric: lining-nums tabular-nums; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); line-height: 1.15; }
h4 { font-family: var(--font-ui); font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.02em; }
p { max-width: 68ch; }
.lede { font-size: var(--fs-lg); color: var(--ink-2); line-height: 1.6; }
.small { font-size: var(--fs-sm); }
.caption { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-feature-settings: "tnum" 1; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.italic-display { font-family: var(--font-display); font-style: italic; font-weight: 500; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.plate { padding-block: clamp(56px, 8vw, 112px); border-top: 1px solid var(--rule); }
.plate-head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px clamp(24px, 5vw, 72px);
  align-items: end;
  margin-bottom: clamp(24px, 4vw, 44px);
}
.plate-head .plate-no {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 14px;
  max-width: none;
}
.plate-head .plate-no::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.plate-head h2 { grid-column: 1; }
.plate-head .lede { grid-column: 2; }
@media (max-width: 860px) {
  .plate-head { grid-template-columns: 1fr; }
  .plate-head h2, .plate-head .lede { grid-column: 1; }
}

/* ---------- Navigation ---------- */
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--r-sm);
}
.skip-link:focus { top: 12px; }
.site-nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: var(--scrim);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.site-nav.scrolled { border-bottom-color: var(--rule); }
.site-nav .container { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand {
  font-family: var(--font-display); font-weight: 600; font-size: 1.35rem;
  color: var(--ink); text-decoration: none; white-space: nowrap; letter-spacing: -0.01em;
}
.brand em { color: var(--gilt-text); font-style: italic; }
.site-nav nav { min-width: 0; margin-left: auto; }
/* The strip scrolls sideways on narrow screens. Its 4px padding (cancelled by the negative margin)
   keeps the focus ring inside the scroll box, which would otherwise clip it. */
.nav-links {
  display: flex; gap: 2px; margin: -4px 0 -4px auto; padding: 4px; list-style: none;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.nav-links::-webkit-scrollbar { display: none; }
/* Scroll cue, set by main.js when links sit beyond an edge (same fade as the map's region control) */
.nav-links.can-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px); mask-image: linear-gradient(90deg, transparent, #000 28px); }
.nav-links.can-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.nav-links.can-l.can-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
.nav-links a {
  display: block; padding: 6px 10px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.nav-links a:hover { background: var(--surface-2); color: var(--ink); }
.nav-links a[aria-current="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.theme-toggle {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%; background: transparent; color: var(--ink-2);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--rule-strong); }
.theme-toggle svg { width: 18px; height: 18px; }
@media (max-width: 720px) {
  .site-nav .container { gap: 10px; }
  .brand { font-size: 1.15rem; }
  .brand .brand-sub { display: none; }
  .nav-links a { padding: 6px 7px; font-size: var(--fs-xs); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(92vh, 900px);
  display: flex; align-items: flex-end;
  padding-block: clamp(96px, 14vh, 160px) clamp(40px, 7vh, 72px);
  overflow: hidden;
  isolation: isolate;
}
.hero-art { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero-art span {
  position: absolute; inset: -2% -2% -2% 8%;
  -webkit-mask-size: cover; mask-size: cover;
  -webkit-mask-position: 62% 50%; mask-position: 62% 50%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.hero-art .contours { background: var(--contour); opacity: 0.55; -webkit-mask-image: url("../assets/hero-contours.svg"); mask-image: url("../assets/hero-contours.svg"); }
.hero-art .climats { background: var(--lvl-pc); opacity: 0.55; -webkit-mask-image: url("../assets/hero-climats.svg"); mask-image: url("../assets/hero-climats.svg"); }
.hero-art .crus { background: var(--gilt); opacity: 0.95; -webkit-mask-image: url("../assets/hero-crus.svg"); mask-image: url("../assets/hero-crus.svg"); }
.hero-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--paper) 0%, color-mix(in srgb, var(--paper) 88%, transparent) 34%, color-mix(in srgb, var(--paper) 20%, transparent) 70%, transparent 100%),
              linear-gradient(0deg, var(--paper) 0%, transparent 30%);
}
.hero-art .legend {
  position: absolute; right: var(--gutter); top: calc(var(--nav-h) + 16px);
  font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--muted); text-align: right; line-height: 1.6;
  text-shadow: 0 0 3px var(--paper), 0 0 6px var(--paper), 0 0 10px var(--paper);
}
.hero-inner { position: relative; }
.hero .eyebrow { margin-bottom: 18px; }
.hero h1 {
  font-size: var(--fs-hero);
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: -0.025em;
}
.hero h1 .blanc { display: block; font-style: italic; font-weight: 500; color: var(--gilt); padding-left: 0.38em; }
.hero .lede { margin-top: 26px; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.hero .btn-ghost { background: var(--scrim); }
.hero-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  margin-top: clamp(40px, 7vh, 72px);
  border-top: 1px solid var(--rule-strong);
  max-width: 880px;
}
.hero-stats div { padding: 14px 16px 0 0; }
.hero-stats div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.hero-stats .v { font-family: var(--font-display); font-size: clamp(1.8rem, 1.2rem + 2vw, 2.6rem); font-weight: 600; line-height: 1; display: block; }
.hero-stats .k { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; display: block; line-height: 1.35; }
@media (max-width: 640px) {
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats div:nth-child(3) { padding-left: 0; border-left: 0; }
  /* Phones: the art moves into the upper band, beside the title, and the lede, buttons and
     figures below sit on clean paper. */
  .hero-art span { inset: 4% -36% 50% 26%; }
  .hero-art .crus { opacity: 0.6; }
  .hero-art .legend { top: 16px; }
  .hero .eyebrow { text-shadow: 0 0 3px var(--paper), 0 0 8px var(--paper); }
  .hero-art::after {
    background: linear-gradient(90deg, var(--paper) 0%, color-mix(in srgb, var(--paper) 70%, transparent) 30%, transparent 70%),
                linear-gradient(0deg, var(--paper) 42%, transparent 72%);
  }
}
@media (max-width: 360px) {
  .hero-art span { inset: 4% -44% 50% 34%; }
}

/* ---------- Buttons and controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  font-size: var(--fs-sm); font-weight: 500; text-decoration: none; line-height: 1.2;
  transition: transform 0.2s var(--ease), background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: 6px 12px; font-size: var(--fs-xs); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; font-size: inherit; }

/* Segmented control: <div class="seg" role="tablist|radiogroup"><button aria-pressed|aria-selected> */
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--surface);
}
.seg button {
  border: 0; background: transparent; color: var(--ink-2);
  padding: 6px 14px; border-radius: 999px; font-size: var(--fs-sm); white-space: nowrap;
}
.seg button:hover { color: var(--ink); background: var(--surface-2); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"], .seg button[aria-checked="true"] {
  background: var(--ink); color: var(--paper);
}

/* Disclosure, one pattern for every "show more" and "show as table" control:
   <details class="disclosure"><summary>Table of yearly values</summary>...</details>
   or a toggle button: <button class="disclosure-btn" type="button" aria-expanded="false">...</button> */
.disclosure > summary, .disclosure-btn {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content;
  padding: 4px 0; border: 0; background: none; cursor: pointer; list-style: none;
  font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before, .disclosure-btn::before {
  content: ""; flex: none; width: 7px; height: 7px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.2s var(--ease);
}
.disclosure[open] > summary::before, .disclosure-btn[aria-expanded="true"]::before { transform: rotate(45deg) translate(-2px, -2px); }
.disclosure > summary:hover, .disclosure > summary:focus-visible,
.disclosure-btn:hover, .disclosure-btn:focus-visible { color: var(--accent); }

/* Figure heading, the plate number's little sibling. Figures are numbered by plate (Fig. III.2):
   <div class="fig-head"><p class="fig-no">Fig. III.2</p><h3>Spring frost</h3></div> */
.fig-head { display: grid; gap: 8px; margin-bottom: 14px; }
.fig-head .fig-no {
  display: flex; align-items: center; gap: 14px; max-width: none;
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.fig-head .fig-no::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.fig-head h3 { font-size: var(--fs-xl); }

/* Chips, tags */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--rule);
  font-size: var(--fs-xs); color: var(--ink-2); background: var(--surface); line-height: 1.5;
}
button.chip:hover { border-color: var(--rule-strong); color: var(--ink); }
button.chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }

/* Level badges: <span class="badge" data-level="grand-cru">Grand Cru</span> */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--r-sm); line-height: 1.6; white-space: nowrap;
  color: var(--ink-2); background: var(--paper-2);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
/* Text stays in ink for AA contrast. The level colour sits on the dot and the tint. */
.badge[data-level] { color: var(--ink); }
.badge[data-level="grand-cru"] { background: var(--lvl-gc-soft); }
.badge[data-level="grand-cru"]::before { background: var(--lvl-gc); }
.badge[data-level="premier-cru"] { background: var(--lvl-pc-soft); }
.badge[data-level="premier-cru"]::before { background: var(--lvl-pc); }
.badge[data-level="village"] { background: var(--lvl-vl-soft); }
.badge[data-level="village"]::before { background: var(--lvl-vl); }
.badge[data-level="regional"] { background: var(--lvl-rg-soft); }
.badge[data-level="regional"]::before { background: var(--lvl-rg); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.swatch[data-level="grand-cru"] { background: var(--lvl-gc); }
.swatch[data-level="premier-cru"] { background: var(--lvl-pc); }
.swatch[data-level="village"] { background: var(--lvl-vl); }
.swatch[data-level="regional"] { background: var(--lvl-rg); }
.swatch[data-level="none"] { background: var(--lvl-none); }

/* Panels and cards */
.panel {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 18px; }
.facts dt { font-size: var(--fs-xs); color: var(--muted); }
.facts dd { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink); margin: 2px 0 0; font-variant-numeric: tabular-nums; }

/* Form controls */
.field { display: grid; gap: 6px; font-size: var(--fs-sm); }
.field label, .field .label { font-size: var(--fs-xs); color: var(--muted); }
.input, select.input {
  width: 100%; padding: 9px 12px; border-radius: var(--r-md);
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
}
.input::placeholder { color: var(--faint); }
input[type="range"] { accent-color: var(--gilt); }

/* Tooltip used by charts: position with JS, content via textContent */
.tip {
  position: fixed; z-index: 80; pointer-events: none;
  background: var(--ink); color: var(--paper);
  font-size: var(--fs-xs); line-height: 1.45; padding: 7px 10px; border-radius: var(--r-sm);
  box-shadow: var(--shadow-2); max-width: 260px;
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s;
}
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 600; }

/* Notes, caveats */
.note {
  font-size: var(--fs-sm); color: var(--ink-2);
  border-left: 2px solid var(--gilt); padding: 2px 0 2px 14px;
}
.caveat { font-size: var(--fs-xs); color: var(--muted); }
.loading { color: var(--muted); font-size: var(--fs-sm); padding: 24px 0; }
.error-box { color: var(--ink-2); font-size: var(--fs-sm); padding: 16px; border: 1px dashed var(--rule-strong); border-radius: var(--r-md); }

/* ---------- Static editorial sections ---------- */
.bottle-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bottle {
  position: relative; padding: 22px 22px 20px; border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--surface);
}
.bottle .label {
  border: 1px solid var(--rule-strong); border-radius: 3px; padding: 16px 12px; text-align: center; margin-bottom: 16px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.bottle .label .producer { font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.bottle .label .wine { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1.1; margin-top: 6px; }
.bottle p { font-size: var(--fs-sm); color: var(--ink-2); }
@media (max-width: 900px) { .bottle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .bottle-grid { grid-template-columns: 1fr; } }

.reading { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; border-top: 1px solid var(--rule); }
@media (max-width: 900px) { .reading { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .reading { grid-template-columns: 1fr; } }
.reading a {
  display: block; padding: 18px 18px 20px 0; text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.reading a:hover h3 { color: var(--accent); }
.reading .eyebrow { margin-bottom: 6px; }
.reading h3 { font-size: 1.25rem; margin-bottom: 6px; }
.reading a > p:not(.eyebrow) { font-size: var(--fs-sm); color: var(--ink-2); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding-block: clamp(40px, 6vw, 72px) 48px; }
.foot-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 32px;
  padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--rule-strong);
}
.site-footer .foot-brand {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  line-height: 0.95; letter-spacing: -0.02em; color: var(--ink); max-width: none;
}
.foot-brand em { color: var(--gilt); font-style: italic; font-weight: 500; }
.foot-plates ol { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }
.foot-plates a { font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.foot-plates a:hover { color: var(--accent); text-decoration: underline; }
.foot-plates .n { font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: 0.1em; color: var(--muted); margin-right: 6px; }
.foot-top { font-size: var(--fs-sm); white-space: nowrap; }
.foot-body { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer p { font-size: var(--fs-xs); color: var(--muted); max-width: 72ch; }

/* One-line note for a link the atlas could not follow (main.js) */
.link-note {
  position: fixed; z-index: 90; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 2 * var(--gutter));
  padding: 10px 16px; border-radius: var(--r-md);
  background: var(--ink); color: var(--paper); font-size: var(--fs-sm); box-shadow: var(--shadow-2);
  transition: opacity 0.3s var(--ease);
}
.link-note[hidden] { display: none; }
.link-note.is-out { opacity: 0; }

/* ---------- Motion ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.hero .rise { opacity: 0; transform: translateY(18px); animation: rise 0.9s var(--ease) forwards; }
.hero .rise:nth-child(2) { animation-delay: 0.08s; }
.hero .rise:nth-child(3) { animation-delay: 0.16s; }
.hero .rise:nth-child(4) { animation-delay: 0.24s; }
.hero .rise:nth-child(5) { animation-delay: 0.32s; }
@keyframes rise { to { opacity: 1; transform: none; } }
/* Forced colours drop backgrounds and box shadows, so selected and current states need a system colour */
@media (forced-colors: active) {
  .seg button[aria-pressed="true"], .seg button[aria-selected="true"], .seg button[aria-checked="true"] {
    forced-color-adjust: none; background: Highlight; color: HighlightText;
  }
  .nav-links a[aria-current="true"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal, .hero .rise { opacity: 1; transform: none; }
}

/* Wider container for full-bleed tools such as the map */
.container.container-wide { max-width: 1480px; }
.bottle .bottle-link { margin-top: 12px; font-size: var(--fs-sm); }

/* Keep level dots and swatches visible in Windows forced-colours mode */
@media (forced-colors: active) { .badge::before, .swatch { forced-color-adjust: none; } }

/* Tablet widths: keep the grand cru art clear of the title and lede */
@media (min-width: 641px) and (max-width: 1100px) {
  .hero-art span { inset: -2% -40% -2% 36%; }
}
@media (min-width: 641px) and (max-width: 900px) {
  .hero-art span { inset: 2% -24% 50% 24%; }
}
