/* ════════════════════════════════════════════════════════════════
   home.css — the homepage on the Determinism Layer design system.
   Consumes tokens from tokens.css.
   ════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Mono utility — the single label voice, used sparingly */
.mono {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* ── Header ─────────────────────────────────────────────────── */
.hdr {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 var(--pad);
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.hdr .name { color: var(--fg-muted); }
.hdr-actions { display: flex; align-items: center; gap: 1.5rem; }
.hdr a {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-muted);
  transition: color 0.15s ease;
}
.hdr a:hover { color: var(--fg); }
.hdr a.cta {
  color: var(--gold);
  border: 1px solid var(--gold-line);
  border-radius: 2px;
  padding: 6px 12px;
}
.hdr a.cta:hover { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.hdr a:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }

/* ── Shell ──────────────────────────────────────────────────── */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }

/* ── Hero ───────────────────────────────────────────────────── */
.hero { padding: clamp(3rem, 9vw, 6rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero .eyebrow { margin-bottom: 1.5rem; color: var(--gold); }
.hero h1 {
  font-family: var(--serif);
  font-weight: var(--weight-light);
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.thesis {
  font-family: var(--serif);
  font-weight: var(--weight-light);
  font-size: clamp(1.375rem, 3.2vw, 2rem);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--fg-muted);
  max-width: 24ch;
  margin-top: 1.75rem;
}
.thesis em { font-style: italic; color: var(--fg); }
.thesis .accent { color: var(--gold); font-style: normal; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2.25rem;
}
.tag {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 5px 11px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}
a.tag:hover { color: var(--gold); border-color: var(--gold-line); }
a.tag:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }

/* ── Figure / interactive diagram stage ─────────────────────── */
.figure {
  margin: clamp(2.5rem, 6vw, 4rem) 0 1rem;
  padding-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--rule);
}
.figure-cap { display: flex; gap: 0.75rem; align-items: baseline; margin-bottom: 1.75rem; }
.figure-cap .num { color: var(--gold); }
.figure-cap .txt { color: var(--fg-muted); font-family: var(--mono); font-size: var(--text-xs); letter-spacing: 0.08em; }
.figure-cap .hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.figure-cap .hint::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.viz { position: relative; width: 100%; aspect-ratio: 920 / 320; cursor: pointer; }
.viz--pipeline { aspect-ratio: 920 / 360; }
.viz canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ── Intro ──────────────────────────────────────────────────── */
.intro {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(1rem, 3vw, 2rem);
  max-width: 60ch;
}
.intro p { font-size: var(--text-lg); line-height: 1.7; color: var(--fg-muted); }
.intro em { color: var(--fg); font-style: italic; }

/* ── Section head ───────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: var(--weight-regular);
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
  color: var(--fg);
}

/* ── Era (work history) ─────────────────────────────────────── */
.era { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.era + .era { border-top: 1px solid var(--rule); }
.era-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-8);
  align-items: start;
}
.era-company {
  font-family: var(--serif);
  font-weight: var(--weight-regular);
  font-size: var(--text-2xl);
  color: var(--fg);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.era-role { font-size: var(--text-sm); color: var(--fg-muted); margin-top: var(--space-1); }
.era-dates {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: var(--space-2);
}
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); list-style: none; }
.chip {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--fg-muted);
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  padding: 2px 8px;
  border-radius: 2px;
  letter-spacing: 0.1em;
}
.era-chapter-link {
  display: inline-flex;
  align-items: center;
  margin-top: var(--space-3);
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--fg-muted);
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 3px 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.era-chapter-link:hover { color: var(--gold); border-color: var(--gold-line); }

/* Stat callout (ledger numeral) */
.era-stat { text-align: right; }
.stat-num {
  font-family: var(--serif);
  font-weight: var(--weight-light);
  font-size: var(--text-stat);
  color: var(--gold);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-label {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: var(--space-2);
}

/* Era intro (narrative bridge) */
.era-intro {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--rule);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--fg-muted);
  max-width: 66ch;
}

/* ── Cards ──────────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: var(--space-8); }
.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.5rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
a.card:hover { border-color: var(--gold-line); transform: translateY(-2px); }
a.card:focus-visible { outline: none; border-color: var(--gold); }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.card-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: var(--weight-light);
  font-size: var(--text-2xl);
  color: var(--fg);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.card-link { color: var(--fg-faint); font-family: var(--mono); font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase; flex-shrink: 0; transition: color 0.2s ease; }
a.card:hover .card-link { color: var(--gold); }
.card p { font-size: var(--text-sm); color: var(--fg-muted); margin-top: 0.85rem; flex: 1; line-height: 1.6; }

/* Ledger-rule metric row — the signature connective motif */
.ledger {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--rule);
}
.ledger .metric {
  font-family: var(--serif);
  font-weight: var(--weight-light);
  font-size: var(--text-xl);
  color: var(--gold);
  line-height: 1;
}
.ledger .metric-label {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-align: right;
  max-width: 16ch;
}

/* ── Footer ─────────────────────────────────────────────────── */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5rem) var(--pad) 4rem;
  border-top: 1px solid var(--rule);
  text-align: center;
}
.foot-cta {
  font-family: var(--serif);
  font-weight: var(--weight-light);
  font-style: italic;
  font-size: var(--text-2xl);
  color: var(--fg);
  display: inline-block;
  margin: var(--space-4) 0;
  text-decoration: none;
  transition: color 0.15s ease;
}
.foot-cta:hover { color: var(--gold); }
.foot .copy { margin-top: 1rem; }
.foot a.copy-link { color: var(--fg-muted); text-decoration: none; transition: color 0.15s; }
.foot a.copy-link:hover { color: var(--gold); }

/* ── Reveal-on-scroll (subtle) ──────────────────────────────── */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; }
  .era-head { grid-template-columns: 1fr; gap: var(--space-4); }
  .era-stat { text-align: left; }
  .stat-num { font-size: 2.5rem; }
  .figure-cap { flex-wrap: wrap; }
  .figure-cap .hint { margin-left: 0; flex-basis: 100%; }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
