/**
 * HD design tokens — humidor_child (design sandbox).
 *
 * THE single source of truth for the shop's visual language: type scale,
 * spacing rhythm, radii, neutrals, accent. Nothing in this file paints a
 * component — it only declares values every other stylesheet consumes.
 * If a number appears twice anywhere in the theme, it belongs here.
 *
 * Runtime Bootstrap 5.3 variable overrides, per HUMMINGBIRD-CONVENTIONS
 * ("configuration before overrides"): we override the CSS custom properties
 * Bootstrap components already consume, never the component rules themselves.
 * Loaded by the child head.tpl override (templates/_partials/head.tpl),
 * after the compiled theme bundle so these tokens win.
 *
 * Owner design direction 2026-08-17 (quick-fix pass):
 *  1. Links: normal text color instead of Hummingbird's default blue.
 *  2. Primary buttons: HD yellow accent (#f8b800, sampled from
 *     design-refs/cta-and-palette-example.png) with dark text for
 *     WCAG-sufficient contrast (yellow + white fails).
 *
 * Round 14 (owner 2026-08-19, "site-level CSS"): the type scale, spacing
 * rhythm, neutrals and radii that the three designed pages had each been
 * declaring for themselves are hoisted here, so every page — designed or
 * not, in any of the 30+ shop languages — reads from one scale.
 */

/* Brand typeface: Satoshi, self-hosted in the child theme (EU/GDPR-safe,
   no third-party font CDN). Approved in the category-page design rounds
   (2026-08-17): modern sans replaces the parent's default stack.
   The three @font-face declarations live in hd-fonts.css (page-speed F23,
   2026-10-22): every page but the home page loads that file with this one;
   the home page adds the same faces from a script once the hero image has
   loaded, so the font files no longer share the first seconds of a slow
   connection with the hero. The fallback faces below stay here: they are
   local() faces, cost no request, and the home page needs them from its
   first paint. */

/* Metric-matched fallbacks (round 15, 2026-08-20 — measured, not guessed).
 *
 * The page paints in the fallback face first, and re-lays-out when Satoshi
 * arrives wherever the real face is still allowed to replace it (the home
 * page's script, `font-display: swap`; every other page now loads hd-fonts.css
 * with `optional`, which keeps the fallback for that one page view - see that
 * file). Satoshi is 1-4% wider than the system
 * faces and noticeably taller in the box (ascent 1010 / descent 240 / gap 100
 * per 1000 em, against Segoe UI's 2210/514/0 and Arial's 1854/434/67 per
 * 2048), so that re-layout moves text — cumulative layout shift on every
 * first visit.
 *
 * These two faces are the same system fonts re-declared with Satoshi's
 * metrics, so the first paint already occupies the space the real face will
 * need. They download nothing: `src: local()` only ever uses a font already
 * on the machine, and if none of them is present the family is simply skipped
 * and the stack falls through as before.
 *
 * Numbers measured with fontTools from satoshi-500.woff2 against the actual
 * C:\Windows\Fonts files, averaging glyph advance widths over a real sample
 * of German and English shop copy (198 characters, full coverage in all three
 * fonts):
 *   size-adjust     = avg advance Satoshi / avg advance fallback
 *   *-override      = Satoshi hhea metric / upem / size-adjust
 * Re-run that measurement if the typeface or its weights ever change.
 */
@font-face {
  font-family: "Satoshi Fallback Segoe";
  src: local("Segoe UI"), local("Segoe UI Regular");
  size-adjust: 103.61%;
  ascent-override: 97.48%;
  descent-override: 23.16%;
  line-gap-override: 9.65%;
}
@font-face {
  font-family: "Satoshi Fallback Arial";
  src: local("Helvetica Neue"), local("Arial"), local("Roboto"), local("Liberation Sans");
  size-adjust: 100.97%;
  ascent-override: 100.03%;
  descent-override: 23.77%;
  line-gap-override: 9.90%;
}

/* Bold weights (page-speed F17, 2026-10-17 — measured). The two faces above
 * carry the regular weight's ratio only; a 700 or 900 request fell back to the
 * same regular face with synthetic bold, which is 3-4% narrower than Satoshi
 * 700, so the bold subcategory chips and the meta line re-wrapped when the
 * real face landed (category CLS 0.10-0.20 on .com in the font race). Satoshi
 * 700 is 3% wider than Satoshi 500, while Arial Bold is 7% wider than Arial,
 * so bold needs its own ratio against the real bold face: avg advance over the
 * English+German letter-frequency sample, fontTools, Satoshi 700/900 against
 * Liberation Sans Bold (metric-identical to Arial Bold): 0.4756/0.4876 and
 * 0.4915/0.4876. Verified in Chrome with the woff2 held back 2.5 s and hinting
 * off (phone rendering): category CLS .com 0.197 -> 0.000, .de 0 -> 0 at any
 * value from 96% to 99%. Liberation first: only Linux has it, the others skip
 * it. No Segoe bold face: its metrics were not measurable here (needs the
 * Windows files); Windows keeps the regular Segoe face at weight 700 as before. */
@font-face {
  font-family: "Satoshi Fallback Arial";
  font-weight: 700;
  src: local("Liberation Sans Bold"), local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Bold"), local("Roboto Bold");
  size-adjust: 97.53%;
  ascent-override: 103.56%;
  descent-override: 24.61%;
  line-gap-override: 10.25%;
}
@font-face {
  font-family: "Satoshi Fallback Arial";
  font-weight: 900;
  src: local("Liberation Sans Bold"), local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Bold"), local("Roboto Bold");
  size-adjust: 100.81%;
  ascent-override: 100.19%;
  descent-override: 23.81%;
  line-gap-override: 9.92%;
}

:root,
[data-bs-theme="light"] {
  /* ---------- Typeface (Bootstrap consumes this var at runtime) ---------- */
  /* Round 15: the two metric-matched fallbacks sit directly behind Satoshi,
     so the swap re-layout is nearly invisible. Windows resolves the Segoe
     entry, everything else falls through to the Arial/Helvetica/Roboto one;
     the plain stack still terminates the list if neither exists. */
  --bs-body-font-family: "Satoshi", "Satoshi Fallback Segoe", "Satoshi Fallback Arial", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* 1. Links inherit the body text color (Bootstrap consumes the -rgb pair). */
  --bs-link-color: var(--bs-body-color);
  --bs-link-color-rgb: var(--bs-body-color-rgb);
  --bs-link-hover-color: var(--bs-body-color);
  --bs-link-hover-color-rgb: var(--bs-body-color-rgb);

  /* ---------- Brand colour (approved 2026-08-17, category rounds 1-7) ---------- */
  --hdd-accent: #f8b800;
  --hdd-accent-deep: #c69200;
  --hdd-accent-hover: #e2ab00;
  /* Round 15: the accent read as TEXT or as a glyph on a light background.
     --hdd-accent-deep (#c69200) is a fill/border value — as text it measures
     2.80:1 on white and 2.64:1 on --hdd-beige, failing both the 4.5:1 text
     rule and the 3:1 non-text (UI glyph) rule. This is the same hue carried
     down to 5.27:1 on white / 4.98:1 on beige / 4.60:1 on beige-deep. Use it
     for `color:`, never for a fill — fills stay on --hdd-accent-deep. */
  --hdd-accent-ink: #8a6600;
  --hdd-beige: #fbf8f2;
  --hdd-beige-deep: #f4efe3;
  --hdd-sale: #c8102e;
  --hdd-sale-line: #f0b9c2; /* outline of the -% chip on white */
  --hdd-star: #e8a53a;
  --hdd-ok: #1e7a35;
  /* Round 15: was #b06a00 = 4.28:1 on white, just under AA. Availability
     notes ("Versand in wenigen Tagen") render at 13-15px, so they need the
     full 4.5:1. #9c5e00 is 5.23:1 on white, 4.56:1 on --hdd-beige-deep. */
  --hdd-warn: #9c5e00;

  /* ---------- Neutrals (round 14) ----------
     These were previously typed as raw hex 90+ times across the page
     stylesheets. Named once here, changed once here. */
  --hdd-ink: var(--bs-body-color); /* primary text */
  --hdd-muted: #5c6167;            /* secondary text, captions, meta */
  --hdd-muted-strong: #4c5157;     /* secondary text that must stay legible */
  /* Round 15 (2026-08-19, PageSpeed/a11y pass): was #8a8f95, which measured
     3.26:1 on white — below WCAG AA's 4.5:1 for body text, and flagged by
     Lighthouse on the product, category, search and footer surfaces (spec
     labels, review authors, the brands strip). #676c72 measures 5.30:1 on
     white, 5.00:1 on --hdd-beige and 4.62:1 on --hdd-beige-deep, so it
     passes on every background this theme puts it on. */
  --hdd-faint: #676c72;            /* tertiary / de-emphasised */
  --hdd-surface: #fff;             /* card + panel fill */
  --hdd-line: #e9e5db;             /* warm hairline (dividers on beige) */
  --hdd-line-soft: #e9e7e0;        /* warm hairline (borders on white) */
  --hdd-line-cool: #dee2e6;        /* form-control border */

  /* ---------- Radii (round 14) ----------
     Ten ad-hoc radii collapse to a five-step scale plus the pill. */
  --hdd-r-xs: 4px;    /* dense chips */
  --hdd-r-sm: 6px;    /* small controls, -% chip */
  --hdd-r-md: 8px;    /* inputs, images inside cards */
  --hdd-r-lg: 12px;   /* product + content cards */
  --hdd-r-xl: 16px;   /* large panels, media blocks */
  --hdd-r-pill: 999px;

  /* ---------- Elevation ---------- */
  --hdd-shadow-card: 0 14px 32px rgba(29, 32, 36, 0.13);
  --hdd-shadow-soft: 0 2px 5px rgba(29, 32, 36, 0.14);
  --hdd-shadow-pop: 0 6px 18px rgba(29, 32, 36, 0.15);

  /* ---------- Type scale (round 14) ----------
     Before this round every page declared its own headings: H1 was 48px on
     the homepage, 46.4px on category, 32px on every undesigned page and 31px
     on the five legacy CMS pages, with weights 900 vs 600. One scale now
     covers all of them.

     Sizes are fluid, so the same token also serves mobile — no per-page
     media-query heading overrides needed, and long German/French headings
     shrink instead of breaking the layout. */
  --hdd-fs-hero: clamp(2rem, 5.6vw, 3rem);       /* homepage hero only */
  --hdd-fs-h1: clamp(1.75rem, 3.2vw, 2.9rem);    /* every page title */
  /* ONE documented exception to --hdd-fs-h1: the product name sits in a
     half-width column beside the buy box, and product names run long
     ("adorini Roma Humidorschrank schwarz mit elektronischem
     Befeuchtungssystem"). At the page-title size it wrapped to four lines and
     pushed the price below the fold. It is declared here, at site level, so
     the exception is visible in the scale rather than hidden in a page file. */
  --hdd-fs-h1-product: clamp(1.55rem, 2.2vw, 1.95rem);
  /* Owner pick, round 14: of three candidate sizes the quieter, more
     editorial one wins. 24.8px at 1440 — the product page's former size,
     now the shop's. The homepage steps down from 33.6px. */
  --hdd-fs-h2: clamp(1.25rem, 1.75vw, 1.55rem);  /* section heading */
  --hdd-fs-h3: clamp(1.1rem, 1.3vw, 1.25rem);    /* sub-section */
  --hdd-fs-h4: 1.02rem;
  --hdd-fs-lead: 1.06rem;                        /* section intro line */
  --hdd-fs-body: 1rem;
  --hdd-fs-sm: 0.92rem;
  --hdd-fs-xs: 0.84rem;
  --hdd-fs-2xs: 0.78rem;

  --hdd-ls-display: -0.028em; /* hero / H1 */
  --hdd-ls-tight: -0.02em;    /* H2 / H3 */

  --hdd-lh-display: 1.1;
  --hdd-lh-heading: 1.22;
  --hdd-lh-body: 1.6;

  /* ---------- Spacing rhythm (round 14) ----------
     Vertical distance between top-level page sections. The three designed
     pages used 46/34/30/26/20px more or less at random; one token drives
     them all and steps down twice on narrow screens (below). */
  --hdd-section-y: 46px;
  --hdd-section-y-tight: 26px;
  --hdd-gap: 24px;
  --hdd-gap-sm: 14px;

  /* ---------- Category filter-bar slot (page-speed F5, 2026-10-13) ----------
     Height the pm_advancedsearch4 chip bar takes once hd-category.js has
     moved it under the category header: 61px of bar plus its 14px top margin,
     measured on both shops at 412 and 1440px. hd-category.css keeps that much
     space open under the header until the bar arrives, so the first paint and
     the final layout agree. Re-measure if the chip padding or the bar margin
     change. */
  --hdd-filterbar-slot: 75px;

  /* ---------- List thumbnail (owner 2026-10-22) ----------
     On a phone the homepage TOP 48 list showed every product photo at the
     full column width (366px at 390), which made its 48 cards ~44 screens
     long. There the photo becomes a thumbnail beside title / rating / price;
     the inset keeps the rank and -N% badges clear of its rounded corner. */
  --hdd-thumb-list: 120px;
  --hdd-thumb-inset: 4px;

  /* ---------- Readable measure ----------
     Legal / CMS / help copy ran 162 characters per line at 1440px before
     this round. Prose is capped; tables, grids and media are not. */
  --hdd-measure: 40rem;      /* ~640px — roughly 70 characters at 16px */
  --hdd-measure-wide: 46rem; /* ~736px — legal / reference copy */
}

@media (max-width: 1080px) {
  :root,
  [data-bs-theme="light"] {
    --hdd-section-y: 34px;
    --hdd-section-y-tight: 20px;
  }
}
@media (max-width: 767px) {
  :root,
  [data-bs-theme="light"] {
    --hdd-section-y: 28px;
    --hdd-gap: 16px;
  }
}

/* 2. Primary buttons: yellow accent. Hover/active are darker shades of the
   accent (Bootstrap's own shade steps), text stays dark throughout. */
.btn-primary {
  --bs-btn-color: #212529;
  --bs-btn-bg: var(--hdd-accent);
  --bs-btn-border-color: var(--hdd-accent);
  --bs-btn-hover-color: #212529;
  --bs-btn-hover-bg: #d99f00;
  --bs-btn-hover-border-color: #cc9600;
  --bs-btn-focus-shadow-rgb: 248, 184, 0;
  --bs-btn-active-color: #212529;
  --bs-btn-active-bg: var(--hdd-accent-deep);
  --bs-btn-active-border-color: #ba8900;
  --bs-btn-disabled-color: #212529;
  --bs-btn-disabled-bg: var(--hdd-accent);
  --bs-btn-disabled-border-color: var(--hdd-accent);
}

/* Outline variant: yellow text on white fails contrast, so the resting state
   is dark text + yellow border; hover/active fill with the accent. */
.btn-outline-primary {
  --bs-btn-color: #212529;
  --bs-btn-border-color: var(--hdd-accent);
  --bs-btn-hover-color: #212529;
  --bs-btn-hover-bg: var(--hdd-accent);
  --bs-btn-hover-border-color: var(--hdd-accent);
  --bs-btn-focus-shadow-rgb: 248, 184, 0;
  --bs-btn-active-color: #212529;
  --bs-btn-active-bg: var(--hdd-accent-deep);
  --bs-btn-active-border-color: #ba8900;
  --bs-btn-disabled-color: #212529;
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--hdd-accent);
}

/* Round 14: secondary/tertiary buttons get a quiet neutral, so "cancel",
   "back" and "continue shopping" never compete with the yellow primary.
   Until now every non-primary button on the cart, account and CMS pages
   fell back to Bootstrap's grey-blue, which is not in the palette. */
.btn-secondary,
.btn-outline-secondary {
  --bs-btn-color: #212529;
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--hdd-line-cool);
  --bs-btn-hover-color: #212529;
  --bs-btn-hover-bg: var(--hdd-beige);
  --bs-btn-hover-border-color: #cfc9bb;
  --bs-btn-active-color: #212529;
  --bs-btn-active-bg: var(--hdd-beige-deep);
  --bs-btn-active-border-color: #cfc9bb;
  --bs-btn-focus-shadow-rgb: 248, 184, 0;
}
