/* ====== shared.css — Scale of Everything (3D) ====== */

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

:root {
  --bg: #07080f;
  --bg-soft: #0e1019;
  --ink: #f0ebde;
  --ink-soft: #b8b1a0;
  --ink-faint: #6b6757;
  --primary: #4a9b86;
  --primary-soft: #2a4a45;
  --accent: #d49661;
  --accent-soft: #5a3d28;
  --rose: #d4828a;
  --rose-soft: #5a343a;
  --line: rgba(240, 235, 222, 0.10);
  --line-strong: rgba(240, 235, 222, 0.22);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.serif { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; }
.mono  { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* === PAGE FADE === */
.page {
  position: fixed; inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.page.ready { opacity: 1; }
.page.fade-out { opacity: 0; }

/* === NAV === */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px;
  z-index: 100;
  pointer-events: none;
}
.nav > * { pointer-events: auto; }
.nav a, .nav span {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.05em;
  transition: color 0.2s, opacity 0.2s;
}
.nav a:hover { color: var(--ink); }
.nav .brand {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.nav .brand small {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-left: 8px;
}
.nav .progress {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* Section navigation arrows */
.sec-nav {
  position: fixed; bottom: 32px; right: 32px;
  display: flex; align-items: center; gap: 12px;
  z-index: 100;
}
.sec-nav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: rgba(14, 16, 25, 0.7);
  border: 1px solid var(--line);
  border-radius: 100px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.sec-nav a:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(20, 23, 35, 0.8);
}
.sec-nav a svg { width: 14px; height: 14px; }

/* === OVERLAY UI === */
.overlay {
  position: fixed;
  pointer-events: none;
  z-index: 50;
}
.overlay > * { pointer-events: auto; }

.overlay.tl { top: 90px; left: 32px; max-width: 360px; }
.overlay.bl { bottom: 32px; left: 32px; max-width: 420px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.eyebrow::before {
  content: ""; display: inline-block; width: 24px; height: 1px;
  background: var(--accent);
}

.title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 18px;
  max-width: 14ch;
}
.title em { font-style: italic; color: var(--primary); }

.lede {
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 50ch;
  margin-bottom: 0;
}

/* === BIG STAT === */
.hero-stat {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.hero-stat .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(48px, 6vw, 72px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 8px;
}
.hero-stat .num sup { font-size: 0.4em; vertical-align: super; color: var(--primary); }
.hero-stat .num .small { font-size: 0.5em; color: var(--ink-faint); }
.hero-stat .lbl {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

/* === STAT GRID (bottom-left) === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.stat-cell {
  padding: 14px 16px;
  background: rgba(14, 16, 25, 0.55);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.stat-cell .v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.stat-cell .v sup { font-size: 0.55em; color: var(--primary); }
.stat-cell .l {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  line-height: 1.4;
}

/* === 3D CANVAS === */
.scene-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 1;
}

/* === HINT (top-right) === */
.hint {
  position: fixed; top: 90px; right: 32px;
  display: flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  z-index: 50;
}
.hint .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 var(--primary);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 155, 134, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(74, 155, 134, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 155, 134, 0); }
}

/* === LANDING PAGE === */
.landing-grid {
  position: fixed; inset: 0;
  z-index: 10;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 90px 48px 60px;
  pointer-events: none;
}
.landing-grid > * { pointer-events: auto; }
.landing-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 40px;
}
.landing-head h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(56px, 9vw, 120px);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--ink);
  max-width: 12ch;
}
.landing-head h1 em { font-style: italic; color: var(--primary); }
.landing-head .by {
  max-width: 36ch;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.6;
  padding-bottom: 16px;
}
.landing-mid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-content: end;
  gap: 16px;
  margin-top: 40px;
}
@media (max-width: 1100px) { .landing-mid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .landing-mid { grid-template-columns: 1fr; } }

.topic-card {
  position: relative;
  padding: 20px;
  background: rgba(14, 16, 25, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  overflow: hidden;
  display: block;
  min-height: 140px;
}
.topic-card::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 60%, var(--accent-soft) 100%);
  opacity: 0; transition: opacity 0.3s;
}
.topic-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: rgba(20, 23, 35, 0.75);
}
.topic-card:hover::before { opacity: 0.5; }
.topic-card .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.topic-card .num::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.topic-card .name {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  position: relative;
}
.topic-card .v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 12px;
  position: relative;
}
.topic-card .d {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  position: relative;
}
.topic-card .arrow {
  position: absolute;
  bottom: 16px; right: 16px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
  transition: all 0.3s;
}
.topic-card:hover .arrow { color: var(--accent); transform: translate(2px, -2px); }
.topic-card .arrow svg { width: 14px; height: 14px; }

.landing-foot {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

/* === MOBILE === */
@media (max-width: 768px) {
  .nav { padding: 16px 20px; }
  .sec-nav { bottom: 20px; right: 20px; }
  .overlay.tl { top: 80px; left: 20px; max-width: calc(100% - 40px); }
  .overlay.bl { bottom: 80px; left: 20px; max-width: calc(100% - 40px); }
  .landing-grid { padding: 80px 20px 40px; }
  .landing-head { flex-direction: column; align-items: flex-start; gap: 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
