/* ============================================================
   Base — typography, layout primitives, global behaviors.
   Components and pages compose on top of these.
   ============================================================ */

html {
  font-size: 16px;
  background: var(--color-bg);
  color: var(--color-text);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}

/* CN typography swap — body class toggled by i18n.js */
body.lang-cn {
  font-family: var(--font-cn);
  letter-spacing: 0;
}

body.lang-cn .display,
body.lang-cn h1, body.lang-cn h2, body.lang-cn h3 {
  font-family: var(--font-cn);
  font-weight: 500;
  letter-spacing: 0;
}

/* Lock scroll while hero animation runs */
body.is-locked {
  overflow: hidden;
  height: 100vh;
}

/* ---------- Display & headings ---------- */

.display,
h1.display, h2.display, h3.display {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  color: var(--color-text);
  text-wrap: balance;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
}

h2, .h2 {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
}

h3, .h3 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-display);
}

/* ---------- Body text ---------- */

p {
  max-width: var(--reading-max);
  line-height: var(--lh-body);
  color: var(--color-text);
}

p + p { margin-top: var(--space-3); }

.lead {
  font-size: var(--fs-md);
  line-height: 1.5;
  max-width: 56ch;
}

.muted    { color: var(--color-text-muted); }
.subtle   { color: var(--color-text-subtle); }
.brand    { color: var(--color-brand); }

/* ---------- Eyebrow / overline labels ---------- */

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tr-eyebrow);
  color: var(--color-text);
  display: inline-block;
  line-height: 1;
  position: relative;
}

/* Red rule prefix — using vertical-align rather than flex baseline.
   `vertical-align: 0.32em` lifts the dash 32% of font-size above
   the text baseline, which lands it on the optical centre of any
   uppercase letterform (Inter, Noto Sans SC, Noto Sans TC, etc).
   Scales perfectly with font-size and is consistent across browsers. */
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1.5px;
  background: var(--color-brand);
  vertical-align: 0.32em;
  margin-right: 12px;
}

/* Variant without the rule (use sparingly, e.g. inside cards) */
.eyebrow--bare::before { content: none; }

.label {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tr-label);
  color: var(--color-text);
}

/* ---------- Numeric face ---------- */

.numeric {
  font-family: var(--font-numeric);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum", "lnum";
  letter-spacing: -0.015em;
}

/* ---------- Layout primitives ---------- */

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter-x);
}

.section {
  padding-block: var(--section-y);
}

.section-tight {
  padding-block: clamp(3rem, 7vw, 6rem);
}

.divider {
  height: var(--hairline);
  background: var(--color-divider);
  border: none;
  width: 100%;
}

.rule-red {
  display: block;
  width: 64px;
  height: 2px;
  background: var(--color-brand);
  border: none;
  margin-block: var(--space-3);
}

.rule-red--thin {
  width: 24px;
  height: 1px;
}

/* ---------- Links ---------- */

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-micro) var(--ease-micro);
}

a:hover { color: var(--color-brand-hover); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: var(--tr-label);
  color: var(--color-text);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color var(--dur-micro) var(--ease-micro),
              border-color var(--dur-micro) var(--ease-micro);
}

.link-arrow .arrow {
  display: inline-block;
  transition: transform var(--dur-short) var(--ease-out);
}

.link-arrow:hover {
  color: var(--color-brand-hover);
  border-color: var(--color-brand-hover);
}

.link-arrow:hover .arrow { transform: translateX(6px); }

/* ---------- Reveal helpers (set by reveals.js / GSAP) ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  will-change: opacity, transform;
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-2);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  padding: var(--space-2) var(--space-3);
  z-index: var(--z-modal);
  border: 1px solid var(--color-brand);
  font-size: var(--fs-sm);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  transition: top var(--dur-micro) var(--ease-micro);
}

.skip-link:focus { top: var(--space-2); }

/* ---------- Reduced-motion overrides for the JS-driven hero ---------- */

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
  body.is-locked {
    overflow: auto;
    height: auto;
  }
}

/* ---------- Utilities ---------- */

.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;
}

.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.no-scroll { overflow: hidden !important; }
