/* AplusGen — design tokens
 *
 * Contrast: every text pairing below has been measured against WCAG 2.x.
 * Ratios in comments are vs. the stated background. Recompute with
 * `python3 tools/check_contrast.py` after changing any value.
 *
 * Brand colors are NOT final — they were sampled from flattened mockups and
 * await brand sign-off (see review appendix B.2.6). The `-ink` variants are
 * darkened, text-safe counterparts introduced per Review V1 §5.3: bright
 * brand colors stay for fills, icons and large emphasis; text uses navy or
 * an `-ink` variant.
 */

:root {
  /* ---- Brand: fills, icons, large emphasis ---- */
  --navy: #0b2a5b;          /* 14.03:1 on white */
  --navy-deep: #0a2559;     /* footer base */
  --navy-deep-2: #12377f;   /* footer gradient end */
  --blue: #1668e3;          /* 5.09:1 on white — passes as text */
  --blue-strong: #1554d1;   /* 6.52:1 with white text */
  --orange: #f2731c;        /* 2.90:1 — FILL/ICON ONLY, never text on white */
  --orange-strong: #dd6210;
  --green: #22a45d;         /* 3.21:1 — fill/icon only */
  --purple: #7c4dff;        /* 4.81:1 on white */
  --teal: #12a5a5;          /* 3.02:1 — fill/icon only */
  --amber: #e0a300;         /* fill/icon only */

  /* ---- Text-safe semantic variants (AA on white and on matching tint) ---- */
  --orange-ink: #a8480a;    /* 5.47:1 on tint-orange, 6.02:1 on white */
  --green-ink: #137a41;     /* 5.01:1 on tint-green */
  --teal-ink: #0a6e6e;      /* 5.58:1 on tint-teal */
  --amber-ink: #8a5a00;     /* 5.65:1 on tint-amber */
  --blue-ink: #1354bd;      /* 6.33:1 on tint-blue */
  --purple-ink: #5b2fd6;    /* 6.70:1 on tint-purple */

  /* ---- Accent pair: blue -> green ----
   * One pair, two uses, so the logo and the headlines are visibly the same
   * idea: the "Aplus" / "Gen" split in the wordmark, and the gradient on
   * "Curious" / "Future".
   *
   * A gradient is only as legible as its worst point, and CSS interpolates
   * linear-gradient in sRGB, so tools/check_contrast.py samples the whole ramp
   * rather than the two ends. For this pair the minimum sits at the green end;
   * the blue-to-green midpoint does not dip below it.
   *
   *   #1553C9  6.75:1 on white
   *   #1A9553  3.84:1 on white   <- ramp minimum
   *
   * The exact brand green #22A45D measures 3.21:1 — it clears the 3:1
   * large-text threshold but with almost no margin, so this is a touch deeper.
   * Swapping back is one line and still passes, just without headroom.
   *
   * Large, bold text only. Do not reuse below 18.66px bold / 24px regular.
   */
  --accent-from: #1553c9;
  --accent-to: #1a9553;
  --grad-hl: linear-gradient(96deg, var(--accent-from) 6%, var(--accent-to) 94%);

  /* The green above is tuned for white. On the navy footer it drops to 2.91:1
   * at the lighter end of the gradient, so the wordmark needs a lifted variant
   * there — 5.01:1 worst case. */
  --accent-to-on-dark: #3fc47e;

  /* ---- Neutrals ---- */
  --ink: #1f2937;
  --muted: #5b6b82;         /* 5.43:1 on white */
  --faint: #5f6f87;         /* 5.11:1 — was #8797ad at 2.97:1, failed AA */
  --line: #e5eaf2;
  --bg: #ffffff;
  --bg-tint: #f5f8fc;

  /* ---- Card tints ---- */
  --tint-blue: #eff5ff;
  --tint-orange: #fff6ee;
  --tint-green: #eff9f1;
  --tint-purple: #f5f1ff;
  --tint-teal: #ecf8f8;
  --tint-amber: #fff9ec;
  --tint-grey: #f4f7fb;

  /* ---- Type ---- */
  --font-head: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Sizes measured off the mockups rather than guessed. At 1024px wide the
     hero glyph band is 38-39px and section titles are 15-21px; scaled to this
     1200px container that is roughly 43-48px and 18-26px. The previous 56px
     and 40px were well above the design and were what made the pages read as
     airy — a bigger font stretches the leading with it. */
  --fs-hero: clamp(1.875rem, 3vw, 2.75rem);   /* 30px mobile → 44px desktop */
  --fs-h2: clamp(1.375rem, 1.9vw, 1.75rem);   /* 22px → 28px */
  --fs-h2-sm: clamp(1.25rem, 1.7vw, 1.5rem);  /* 20px → 24px, for in-band headings */
  --fs-h3: 1.125rem;                           /* 18px */
  --fs-lead: 1.0625rem;                        /* 17px */
  --fs-body: 1rem;                             /* 16px — never smaller for body */
  --fs-sm: 0.9375rem;                          /* 15px */
  --fs-xs: 0.875rem;                           /* 14px — floor for metadata */

  /* Mock baseline-to-baseline on the hero is 48px at 1024 (~56px here);
     against a 46px hero that is ~1.2, but the display sizes read tighter in
     the design, so headings sit just under it. */
  --lh-tight: 1.14;
  --lh-body: 1.6;
  --measure: 68ch;          /* ~55-75 chars per line */

  /* ---- Spacing: 4/8px scale ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* ---- Shape ---- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(16, 42, 82, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 42, 82, 0.07);
  --shadow-lg: 0 10px 34px rgba(16, 42, 82, 0.10);

  /* ---- Focus ---- */
  --focus-ring: 3px solid #1354bd;
  --focus-offset: 2px;

  /* ---- Motion (zeroed under prefers-reduced-motion, see base.css) ---- */
  --dur-fast: 150ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Layout ---- */
  --container: 1200px;
  --gutter: 32px;           /* 20px below 600px, see base.css */
  /* Measured off template/home.png: pure-white bands between sections run
     16-22px at 1024px wide, ~19-26px scaled to this container. Was 64px,
     which read as loose next to the mock. */
  --section-y: 16px;   /* two adjacent tight sections = 26px total */
  --header-h: 76px;         /* sticky header height, drives scroll-padding */
  --tap-min: 44px;          /* minimum touch target */
}

html:lang(zh-CN) {
  --font-head: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --lh-tight: 1.25;
}

/* Breakpoints (CSS variables can't be used in media queries — this is the
   convention every stylesheet follows):
     1200px  full desktop
     1100px  grids drop a column
      900px  nav collapses to hamburger; hero stacks
      600px  single column; gutter 20px
*/

@media (max-width: 600px) {
  :root {
    --gutter: 20px;
    --section-y: 13px;
    --header-h: 66px;
  }
}
