/* =====================================================================
   BASE — reset, semantic defaults, container, typography, motion base
   ===================================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-400);
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;            /* guard against fluid-layer overflow; html stays scrollable */
}

a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
input, textarea, select, button { font: inherit; color: inherit; }

:focus-visible {
  outline: 0.125rem solid var(--accent);
  outline-offset: 0.125rem;
}

/* Palette / theme transition (matches reference behaviour) */
body, section, nav, footer,
.card, .btn, .pill, .navbar, .topbar, input, textarea, select {
  transition: background-color var(--dur-base) ease, color var(--dur-base) ease,
              border-color var(--dur-base) ease, box-shadow var(--dur-base) ease;
}

/* ===== CONTAINER (CLAUDE.md pattern) ===== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

/* ===== SECTION rhythm ===== */
.section { position: relative; padding-block: var(--space-5xl); }
.section--tight { padding-block: var(--space-2xl); }

/* Progressive scale-down so the gaps don't get cavernous on small screens
   (CLAUDE.md "never single-step jumps"). */
@media (max-width: 47.9375rem)   { .section { padding-block: var(--space-4xl); } }
@media (max-width: 37.5rem) { .section { padding-block: var(--space-3xl); } }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
  color: var(--text);
}

.t-xl   { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-1000); line-height: 1; letter-spacing: -0.04em; text-wrap: balance; }
.t-lg   { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-900);  line-height: 1.02; letter-spacing: -0.035em; text-wrap: balance; }
.t-md   { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-800);  line-height: 1.05; letter-spacing: -0.03em; }
.t-sm   { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-700);  line-height: 1.14; letter-spacing: -0.02em; }
.t-card { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-600);  line-height: 1.16; letter-spacing: -0.015em; color: var(--text-sec); }

.t-body-lg { font-size: var(--fs-500); line-height: 1.45; letter-spacing: -0.01em; }
.t-body    { font-size: var(--fs-400); line-height: 1.55; letter-spacing: -0.006em; }
.t-small   { font-size: var(--fs-200); line-height: 1.4; color: var(--text-muted); }

.t-label {
  font-family: var(--font-mono);
  font-size: var(--fs-100); font-weight: 700; line-height: 1.2;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.t-label-md {
  font-family: var(--font-mono);
  font-size: var(--fs-200); font-weight: 700; line-height: 1.33;
  letter-spacing: 0.08em; text-transform: uppercase;
}

.t-center { text-align: center; }
.t-muted  { color: var(--text-muted); }
.t-accent { color: var(--accent); }

/* Apple-style body copy: muted grey base with full-contrast emphasis spans.
   .t-muted-body sets readable secondary grey for paragraphs (lighter touch
   than .t-muted, which uses --text-muted for labels/captions). .em lifts a
   key phrase to full-contrast solid colour — near-black on light palettes,
   near-white on ember-dark — with no layout impact. */
.t-muted-body { color: var(--text-sec); }
.em { color: var(--text); font-weight: 600; }

/* ===== REVEAL-ON-SCROLL base =====
   Only hide when JS is active (html.js) so no-JS users still see all content. */
html.js .reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  /* background-color + box-shadow are listed here too so revealed cards (which
     are `.card.reveal`) still animate their hover background/shadow — this
     transition shorthand otherwise overrides the one on `.card` and the change
     would snap. They don't change during the entrance, so the reveal is intact. */
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease),
              background-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
  will-change: opacity, transform;
}
html.js .reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }

/* Accessibility: honour reduced motion globally */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===== helpers ===== */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.divider { height: 1px; background: var(--border-light); width: 100%; }
