/* ── SCBG Design tokens ── */
:root {
  /* Palette A — Warm Earth (default) */
  --ink: #1B1410;
  --ink-2: #3B2614;
  --paper: #F5EFE4;
  --cream: #E8DCC4;
  --cream-2: #EFE6D3;
  --accent: #C26B2D;      /* terracotta — primary */
  --accent-ink: #8A4718;
  --olive: #6B7A3A;
  --clay: #A83223;
  --clay-on-ink: #E2553F; /* AA-readable dried-cherry for text/graphics on the ink surface */
  --gold: #E8A04A;
  --muted: #5A4B3C;       /* darkened from #685848 — ≥ 4.5:1 on paper for AA */
  --fairtrade: #8A6D4F;
  --line: rgba(27, 20, 16, 0.12);
  --line-strong: rgba(27, 20, 16, 0.28);
  --btn-primary-bg: #A85A22; /* darker terracotta — keeps white button text ≥ AA */

  /* Paper tints layered on the ink surface. -soft is the AA floor for small text. */
  --on-ink-strong: rgba(245, 239, 228, 0.9);
  --on-ink: rgba(245, 239, 228, 0.72);
  --on-ink-soft: rgba(245, 239, 228, 0.62);
  --on-ink-dim: rgba(245, 239, 228, 0.65);  /* bumped from 0.55 — AA contrast for chart labels on ink */
  --on-ink-faint: rgba(245, 239, 228, 0.25);
  --on-ink-line: rgba(245, 239, 228, 0.1);
  --on-ink-grid: rgba(245, 239, 228, 0.06);

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;

  --serif: 'Instrument Serif', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Geist Variable', 'Geist', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --container: 1280px;
  --gutter: 32px;

  /* Semantic tokens — level / price-tier badges */
  --badge-legal-text: var(--accent);            /* Legal / Basic tier — terracotta text */
  --badge-legal-bg: rgba(194, 107, 45, 0.18);   /* terracotta at 18% — chip background */
  --badge-living-text: var(--gold);             /* Living-wage tier — honey amber text */
  --badge-living-bg: rgba(232, 160, 74, 0.18);  /* gold at 18% — chip background */

  /* Device-mock / WhatsApp UI palette (Material: the messenger interface producers use) */
  --mock-wa-green: #0B5C4B;     /* WhatsApp forest-green — header, send-button, mic */
  --mock-wa-panel: #E5DDD3;     /* WhatsApp chat canvas — warm parchment grey */
  --mock-wa-bubble-in: #ffffff; /* incoming bubble */
  --mock-wa-bubble-out: #DCF5C8;/* outgoing bubble — mint green */
  --mock-wa-blue: #34B7F1;      /* double-tick read-receipt blue */
  --mock-wa-muted: #999999;     /* typing indicator dots */
  --mock-device-outer: #1F1712; /* phone/browser outer chrome — near-ink dark */
  --mock-device-bar: #15100C;   /* browser toolbar stripe — deepest dark */

  /* Button text on coloured surfaces */
  --on-accent: #ffffff; /* white text on terracotta / clay buttons — ≥ AA confirmed */

  /* Secondary button on accent/terracotta surfaces (frosted white tint) */
  --btn-ghost-on-accent: rgba(255, 255, 255, 0.16);
}

/* ── Reset / base ── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; line-height: 1.02; margin: 0; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-ink); font-weight: 500; }

.btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 22px; border-radius: 999px; font-family: var(--sans); font-weight: 500; font-size: 15px; letter-spacing: -0.005em; transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--btn-primary-bg); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: var(--accent); color: #fff; }

/* ── Brand wordmark in nav ── */
.brand-wordmark { text-decoration: none; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) {
  .brand-wordmark:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--accent); }
}

/* ── Section padding (shared across all pages) ── */
.section-pad { padding: 120px 0; }
@media (max-width: 767px) {
  .section-pad { padding: 72px 0; }
}

/* ── Hero headline (shared across all pages) ── */
.hero-h1 {
  font-size: clamp(52px, 7vw, 104px);
  margin-top: 20px;
  line-height: 0.98;
  letter-spacing: -0.02em;
}
@media (max-width: 767px) {
  .hero-h1 { font-size: clamp(44px, 10vw, 64px); }
}

/* ── Hero section padding ── */
.hero-section {
  padding-top: 80px;
  padding-bottom: 96px;
}
@media (max-width: 767px) {
  .hero-section { padding-top: 48px; padding-bottom: 64px; }
}

/* ── Lede paragraph below hero headline ── */
.lede {
  margin-top: 28px;
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 560px;
}

/* ── Button size variant ── */
.btn-lg { font-size: 16px; padding: 16px 24px; }

.em-serif { font-family: var(--serif); font-style: italic; font-weight: 400; }
.mono { font-family: var(--mono); }
.num { font-family: var(--serif); font-feature-settings: 'tnum' 1; line-height: 0.95; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

html { scroll-behavior: smooth; }
::selection { background: var(--accent); color: #fff; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
input::placeholder { color: var(--muted); }
.input-dark::placeholder { color: rgba(245, 239, 228, 0.45); }

/* ── Footer grid (shared across pages) ── */
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 48px;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
@media (max-width: 600px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }

/* ── Mobile gutter override ── */
@media (max-width: 767px) {
  :root { --gutter: 20px; }
  .container { padding: 0 var(--gutter); }
}

/* ── Focus styles (WCAG 2.4.7) ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.pillar-jump { color: var(--muted); text-decoration: none; transition: color 120ms ease; }
.pillar-jump:hover, .pillar-jump:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.pillar-jump:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ── Skip link (WCAG 2.4.1) ── */
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link:focus-visible {
  position: fixed;
  top: 16px;
  left: 16px;
  width: auto;
  height: auto;
  clip: auto;
  white-space: normal;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  z-index: 9999;
  outline: none;
}

/* ── P3 wide-gamut alpha variants ── */
@supports (color: color(display-p3 0 0 0)) {
  :root {
    --accent-p3: color(display-p3 0.71 0.38 0.12);
    --gold-p3:   color(display-p3 0.88 0.61 0.24);
    --clay-p3:   color(display-p3 0.63 0.18 0.12);
    --olive-p3:  color(display-p3 0.39 0.46 0.20);
  }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Pulsing "open" dot — marks the showcase tile on the region map ── */
@keyframes scbg-open-pulse {
  0%   { transform: scale(1);   opacity: 0.55; }
  70%  { transform: scale(2.4); opacity: 0;    }
  100% { transform: scale(2.4); opacity: 0;    }
}
.scbg-open-dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 8px; height: 8px;
  background: var(--paper);
  border-radius: 999px;
  box-shadow: 0 0 0 1.5px var(--ink);
  pointer-events: none;
  z-index: 4;
}
.scbg-open-dot::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: var(--paper);
  animation: scbg-open-pulse 1.8s ease-out infinite;
}

/* ── Region map tooltips (OriginMap in index.html) ── */
.region-tip {
  position: absolute;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--on-ink-line);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-width: 200px;
  text-align: left;
  font-family: var(--sans);
  z-index: 20;
  box-shadow: 0 14px 28px -10px rgba(0,0,0,0.6);
}
.region-tip--showcase {
  border-color: rgba(232,160,74,0.45);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  min-width: 300px;
  box-shadow: 0 18px 36px -10px rgba(0,0,0,0.6);
}
.region-tip--mobile-showcase { min-width: 240px; }
.region-tip--mobile { min-width: 140px; padding: 10px 12px; }

.region-tip__name { font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em; line-height: 1.15; }
.region-tip--mobile .region-tip__name,
.region-tip--mobile-showcase .region-tip__name { font-size: 15px; }

.region-tip__country {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.region-tip--mobile .region-tip__country,
.region-tip--mobile-showcase .region-tip__country { font-size: 9px; letter-spacing: 0.14em; }

.region-tip__rule { height: 1px; background: var(--on-ink-line); margin: 12px 0; border: 0; }
.region-tip--mobile-showcase .region-tip__rule { margin: 8px 0; }

.region-tip__eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--on-ink-soft);
}

.region-tip__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-top: 10px;
}
.region-tip__stat-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-ink-soft);
}
.region-tip__stat-value {
  display: block;
  margin-top: 2px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--paper);
  line-height: 1.1;
}
.region-tip__stat-unit {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-ink-soft);
}
.region-tip--mobile-showcase .region-tip__stat-value { font-size: 15px; }

.region-tip__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.region-tip__row + .region-tip__row { margin-top: 6px; }
.region-tip__row-label { font-family: var(--sans); font-size: 13px; color: var(--on-ink); }
.region-tip__row-value { font-family: var(--serif); font-size: 20px; color: var(--on-ink-strong); }
.region-tip__row-value--accent { color: var(--gold); }
.region-tip--mobile-showcase .region-tip__row-label { font-size: 11px; }
.region-tip--mobile-showcase .region-tip__row-value { font-size: 15px; }

.region-tip__row-unit {
  margin-left: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-ink-soft);
}

.region-tip__footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--on-ink-line);
  font-size: 13px;
  color: var(--on-ink-soft);
  line-height: 1.45;
}
.region-tip--mobile-showcase .region-tip__footer { margin-top: 8px; padding-top: 8px; font-size: 11px; }
.region-tip__footer-link { color: var(--gold); border-bottom: 1px solid rgba(232,160,74,0.4); }

/* ── Reduced motion (WCAG 2.3.3) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
