@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500;600&display=swap");

[hidden] {
  display: none !important;
}

:root {
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;

  --bg: #faf7f0;
  --bg-alt: #f0ece3;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --ink: #1a1814;
  --ink-soft: #5c5750;
  --ink-faint: #908a7e;
  --accent: #b34825;
  --accent-hover: #943c1e;
  --accent-soft: rgba(179, 72, 37, 0.08);
  --border: #d8d4c8;
  --border-strong: #b8b2a4;
  --highlight: #f5f0e4;
  --ivory: #ffffff;

  --shadow-soft: none;
  --shadow-medium: none;
  --shadow-heavy: none;
  --ease-spring: cubic-bezier(0.23, 1, 0.32, 1);
  --header-h: 50px;
  --pad-h: clamp(1rem, 3vw, 2rem);
  --pad-v: clamp(1.25rem, 4vw, 2.5rem);
  --max-w: 1260px;
  --radius: 0px;
  --radius-sm: 0px;
  --radius-pill: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  --navy: var(--ink);
  --navy-strong: var(--ink);
  --blue: var(--accent);
  --green: #6a8a30;
  --gold: var(--accent);
  --gold-soft: var(--accent);
  --reader-aid: var(--accent);
  --red: var(--accent);
  --red-glow: var(--accent);
  --gold-from: var(--accent);
  --gold-via: var(--accent);
  --gold-to: var(--accent);
}

.theme-dark {
  --bg: #141413;
  --bg-alt: #1c1b18;
  --bg-card: #1e1d1a;
  --bg-elevated: #262520;
  --ink: #d8d4c8;
  --ink-soft: #9a9588;
  --ink-faint: #6a665c;
  --accent: #e87040;
  --accent-hover: #f28858;
  --accent-soft: rgba(232, 112, 64, 0.12);
  --border: #2e2c26;
  --border-strong: #403d36;
  --highlight: #242010;
  --ivory: #d8d4c8;
}

.theme-retro {
  --bg: #080a06;
  --bg-alt: #0c0e0a;
  --bg-card: #10120e;
  --bg-elevated: #161814;
  --ink: #33ff66;
  --ink-soft: #22cc55;
  --ink-faint: #1a8840;
  --accent: #33ff66;
  --accent-hover: #66ff88;
  --accent-soft: rgba(51, 255, 102, 0.08);
  --border: #1a3320;
  --border-strong: #225530;
  --highlight: #0e1f10;
  --ivory: #33ff66;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  overflow-x: hidden;
}

body.scroll-locked { overflow: hidden; }

.theme-retro::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  pointer-events: none;
  z-index: 10000;
}

.theme-retro * {
  text-shadow: 0 0 6px rgba(51, 255, 102, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .theme-retro::after { display: none; }
  .theme-retro * { text-shadow: none; }
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.t-display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: normal;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  line-height: 0.94;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.t-h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.t-h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.t-body { font-size: 0.95rem; line-height: 1.7; }

.t-mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.t-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.t-serif {
  font-family: var(--font-serif);
}

.t-red { color: var(--accent); }
.t-soft { color: var(--ink-soft); }
.t-faint { color: var(--ink-faint); }

.wrap {
  width: min(var(--max-w), 100% - var(--pad-h) * 2);
  margin-inline: auto;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

.anim-fade-up {
  animation: fadeUp 0.38s var(--ease-spring) both;
}

.anim-d1 { animation-delay: 0.06s; }
.anim-d2 { animation-delay: 0.12s; }
.anim-d3 { animation-delay: 0.18s; }
.anim-d4 { animation-delay: 0.24s; }
.anim-d5 { animation-delay: 0.30s; }

.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  min-height: 36px;
  padding: 0.4rem 0.78rem;
  background: var(--bg-card);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.btn-dark:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  background: var(--highlight);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  padding: 0.14rem 0.4rem;
  background: var(--bg-alt);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
