/* ============================================================
   BASE — components/base.css
   Single source of truth: fonts, tokens and global reset.
   Must be loaded FIRST, before any other CSS.
   ============================================================ */

/* ── Font Face (Nohemi — variable, local WOFF2) ──
   A single file covers the whole 100–900 weight axis.
   size-adjust and the *-override descriptors normalise Nohemi's metrics (x-height 0.551em)
   to the previous family's vertical rhythm, so the existing layout is not altered. */
@font-face {
  font-family: 'Nohemi';
  src: url('/fonts/Nohemi-Variable.woff2') format('woff2-variations'),
       url('/fonts/Nohemi-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  size-adjust: 96%;
  ascent-override: 93%;
  descent-override: 21%;
  line-gap-override: 0%;
}
/* ── Design Tokens ── */
:root {
  /* Colors */
  --primary: #FF5A1F;            /* brand orange: decorative ONLY (glows, borders, backgrounds) */
  --primary-ink: #BC3200;
  --primary-hover: #FF6D39;
  --primary-light: rgba(255, 90, 31, 0.1);
  --accent-mint: #00D4AA;
  --accent-amber: #F59E0B;
  --accent-violet: #8B5CF6;

  /* ── Accessible pairs (WCAG 2.2 AA) ──────────────────────────────
     The brand orange gives 3.12:1 with white and 2.84:1 as text on a
     light background: it fails in both uses. These tokens are the
     variants that pass. Rule: --primary to paint,
     --*-solid to fill buttons, --*-on-light / --*-on-dark for text. */

  /* Button fill with white text */
  --primary-solid: #D14000;      /* white 4.72:1 */
  --primary-solid-hover: #B83800;  /* darker hover: white 5.8:1 (#E04600 gave 4.1 and #FF6D39 2.8) */
  --mint-solid: #00866C;         /* white 4.54:1 */
  --amber-solid: #A56A07;        /* white 4.50:1 */
  --violet-solid: #7C48F0;       /* white 5.03:1 */

  /* Text colour on light surfaces */
  --primary-on-light: #BD3200;   /* 5.29:1 on --surface · 4.51:1 on --surface-subtle */
  --mint-on-light: #00735C;
  --amber-on-light: #8C5A06;
  --violet-on-light: #7239F4;

  /* Text colour on dark surfaces */
  --primary-on-dark: #FFA98A;    /* 4.51:1 even on --dark-card */
  --mint-on-dark: #00D7AC;
  --amber-on-dark: #F7B13A;
  --violet-on-dark: #C9B3FB;

  /* Dark surfaces — ladder recalibrated on #16120D.
     The original contrast steps (1.49:1 and 1.37:1) are preserved so the
     sense of depth doesn't change; the deeper background raises the
     legibility of everything resting on it without touching the brand hue
     (Δ 5.6° of hue from the previous #211A14). */
  --dark-bg: #16120D;        /* main text 15.10 → 16.39:1 */
  --dark-elevated: #3D3224;  /* 1.49:1 step over the background */
  --dark-card: #554632;      /* 1.37:1 step over the elevated surface */
  --dark-border: rgba(255, 255, 255, 0.07);
  --dark-border-hover: rgba(255, 255, 255, 0.12);

  /* Light surfaces */
  --surface: #F5F5EC;
  --surface-card: #F5F5EC;
  --surface-subtle: #E9E2D7;
  --surface-muted: #E9E2D7;

  /* Text */
  --text-primary: #211A14;
  --text-secondary: #68655F;   /* 4.52:1 on --surface-subtle (was 4.32 — failed) */
  --text-on-dark: #F2F0ED;
  --text-muted-on-dark: rgba(242, 240, 237, 0.7);  /* α 0.5 failed on card and elevated */

  /* Border */
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);

  /* Typography */
  --font-display: 'Nohemi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Nohemi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', Consolas, 'Fira Code', monospace;  /* Cascadia/Consolas: without them Windows falls back to Courier New */

  /* Weight scale (Nohemi is variable: continuous 100–900).
     Nohemi is geometric, with a tall x-height and a full stroke; at the same value
     it looks optically heavier than a neutral grotesque. That's why the ceiling is 600
     and weight runs inversely to size: large display text drops to 450 and it's
     the small headings that go up to SemiBold, where it does help legibility. */
  --fw-regular: 400;    /* body text, paragraphs, lists */
  --fw-book: 450;       /* leads and XL display (≥ 64px) */
  --fw-medium: 500;     /* 48–63px headings, nav, buttons */
  --fw-strong: 550;     /* 28–47px headings, labels, prices */
  --fw-bold: 600;       /* ceiling: headings ≤ 27px, badges, micro-labels */

  /* Optical tracking: the larger the size, the tighter the spacing */
  --tr-display: -0.035em;   /* ≥ 64px */
  --tr-h1: -0.03em;         /* 40–63px */
  --tr-h2: -0.022em;        /* 28–39px */
  --tr-h3: -0.015em;        /* 20–27px */
  --tr-body: 0;
  --tr-caps: 0.08em;        /* capitals need room */

  /* Text size floor. Nohemi has a tall x-height, but below 12px its
     counters close up and the text clogs. Nothing meant to be read
     goes below these values. */
  --fs-label: 12px;         /* absolute minimum: ONLY capitals with --tr-caps */
  --fs-meta: 13px;          /* metadata: roles, footnotes, captions */
  --fs-small: 14px;         /* secondary text: card descriptions */
  --fs-body: 16px;          /* reading body text */
  --fs-lead: 18px;          /* leads under headings */

  /* Focus ring: 3:1 minimum against the background (WCAG 2.4.13).
     --primary-solid passes on light and on --dark-bg; on elevated dark
     surfaces it is replaced by --primary-on-dark (see .on-dark). */
  --focus-ring: var(--primary-solid);

  /* Spacing */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 48px;
  --sp-6: 64px;
  --sp-7: 96px;
  --sp-8: 128px;

  /* Border radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 99px;

  /* Layout */
  --max-w: 1280px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 48px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 40px rgba(255, 90, 31, 0.2);
  --shadow-glow-lg: 0 0 80px rgba(255, 90, 31, 0.25);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);        /* the site's strong ease-out: entrances, panels, reveals */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);  /* small overshoot, only for playful pops */
  --transition: 0.2s ease;
  --transition-smooth: 0.4s var(--ease-out);
  --transition-spring: 0.6s var(--ease-out);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light;
  /* clip (not hidden) prevents the horizontal scroll caused by the decorative
     glows and the closed mobile overlay, without creating a scroll
     container that would break position: sticky. */
  overflow-x: clip;
  scroll-behavior: smooth;
  /* Anchors (#pricing, #faq…) and keyboard focus land below the fixed nav
     (WCAG 2.4.11). The cookie banner adds scroll-padding-bottom inline. */
  scroll-padding-top: calc(var(--nav-height, 64px) + 16px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* [hidden] always hides, even if the component class sets display: flex/grid */
[hidden] { display: none !important; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: var(--fw-regular);
  line-height: 1.6;
  color: var(--text-primary);
  /* clip, like html: "hidden" here made body a scroll container that
     never scrolls, which silently broke every position: sticky */
  overflow-x: clip;
  /* Nohemi ships liga; it has no ss01/cv01/cv11 (those belonged to the previous family) */
  font-feature-settings: 'liga' 1;
  font-kerning: normal;
}

/* height:auto is mandatory now that <img> elements carry width/height:
   without it, the attribute height wins and distorts the image when scaled. */
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* ── Base typography layer ──
   Sane defaults for any heading without its own class.
   line-height is deliberately NOT touched here: pages already define it
   and overriding it would shift existing layouts. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-strong);
  letter-spacing: var(--tr-h2);
  text-wrap: balance;
}
h1 { font-weight: var(--fw-medium); letter-spacing: var(--tr-h1); }
h4, h5, h6 { font-weight: var(--fw-bold); letter-spacing: var(--tr-h3); }

strong, b { font-weight: var(--fw-strong); }

/* Avoids orphan words at the end of a paragraph */
p, li, blockquote { text-wrap: pretty; }

/* Capitals: 'case' moves punctuation up to cap height,
   and without positive tracking Nohemi gets cramped in caps. */
[class*="eyebrow"], [class*="badge"], [class*="label"], [class*="tag"],
.uppercase, .u-caps {
  font-feature-settings: 'liga' 1, 'case' 1;
}

/* ── Global visible focus ──
   A single style for everything keyboard-focusable. Components
   may redefine --focus-ring, not the mechanism. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* Dark context: the solid orange drops below 3:1 on --dark-elevated */
.on-dark { --focus-ring: var(--primary-on-dark); }

/* Nohemi has no tabular figures (no 'tnum'): its digits are
   proportional and the "1" is noticeably narrower. For columns of
   numbers that must line up vertically, use this utility. */
/* Screen-reader-only text: equivalents for charts and data
   that are drawn visually but not announced. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.num-tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Keeps a hyphenated name or quantity on one line ("S-Drive",
   "30-day"): browsers may break after any hyphen, and "S-" alone at
   the end of a line reads as cut-off text on phones.
   The span must be invisible to page rules such as ".card span
   { display: block }": all: unset makes it inherit everything from
   its parent (and drops any box styling), !important so no
   descendant selector can restyle it. */
.nobr { all: unset !important; white-space: nowrap !important; }
.nobr::before, .nobr::after { content: none !important; }

/* ── Mobile spacing token overrides ── */
@media (max-width: 768px) {
  :root {
    --sp-5: 32px;
    --sp-6: 48px;
    --sp-7: 64px;
    --sp-8: 96px;
  }
}

@media (max-width: 480px) {
  :root {
    --sp-4: 24px;
    --sp-5: 24px;
    --sp-6: 36px;
    --sp-7: 48px;
    --sp-8: 64px;
  }
}

/* ── Layout utility ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-3);
}


/* ── Reduced motion ──
   Global rule: 10 of the 22 CSS files didn't have it, including base and nav.
   Motion is neutralised without breaking reveals: elements that appear
   via IntersectionObserver stay visible in their final state.
   Reduced means fewer, not zero: overlays (nav panels, help panel, cookie
   banner) opt back into a 0.15s opacity fade in their own component CSS,
   with !important to beat this rule. Never movement. */
/* Without JavaScript there is no IntersectionObserver to add .visible:
   .reveal content is shown directly */
@media (scripting: none) {
  .reveal, [class*="reveal--"] { opacity: 1 !important; transform: none !important; }
}

@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;
    scroll-behavior: auto !important;
  }
  .reveal, [class*="reveal"], [class*="animate-in"], [class*="fade-in"] {
    opacity: 1 !important;
    transform: none !important;
  }
}
