/* ── Tokens ───────────────────────────────────────────── */
:root {
  --bg: #060a0f;
  --bg2: #0b141e;
  --surface: rgba(77, 184, 133, 0.05);
  --border: rgba(77, 184, 133, 0.12);
  --primary: #4db885;
  --bright: #7fffc4;
  --text: #d4e8dc;
  --muted: #4a6a58;
  --dim: #2a3a30;
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;
}

/* Light theme */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f7f4;
    --bg2: #e6efe9;
    --surface: rgba(77, 184, 133, 0.08);
    --border: rgba(77, 184, 133, 0.22);
    --text: #0d1c14;
    --muted: #4a6a58;
    --dim: #b8d4c4;
  }
}
:root[data-theme="light"] {
  --bg: #f2f7f4;
  --bg2: #e6efe9;
  --surface: rgba(77, 184, 133, 0.08);
  --border: rgba(77, 184, 133, 0.22);
  --text: #0d1c14;
  --muted: #4a6a58;
  --dim: #b8d4c4;
}

/* ── Reset ────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.75;
  min-height: 100vh;
}
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--bright);
}
img {
  display: block;
  max-width: 100%;
}

/* ── Navigation ───────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 56px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 10, 15, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .nav {
    background: rgba(242, 247, 244, 0.9);
  }
}
:root[data-theme="light"] .nav {
  background: rgba(242, 247, 244, 0.9);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.nav-logo img {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.nav-back {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-back::before {
  content: "←";
  font-size: 0.8rem;
}
.nav-back:hover {
  color: var(--primary);
}

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 24px 72px;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* Dot grid */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle,
    rgba(77, 184, 133, 0.14) 1px,
    transparent 1px
  );
  background-size: 26px 26px;
  mask-image: radial-gradient(
    ellipse 70% 70% at 50% 50%,
    black 20%,
    transparent 75%
  );
  pointer-events: none;
}
/* Ambient glow */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 55% 45% at 50% 55%,
    rgba(77, 184, 133, 0.07) 0%,
    transparent 65%
  );
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.file-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: rgba(77, 184, 133, 0.06);
  margin-bottom: 44px;
}
.file-tag::before {
  content: "►";
  font-size: 0.45rem;
}

/* Sprite */
.sprite-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 200px;
  margin-bottom: 40px;
}
.orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(77, 184, 133, 0.18);
  animation: spin 14s linear infinite;
}
.orbit-ring::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow:
    0 0 10px rgba(77, 184, 133, 0.9),
    0 0 20px rgba(77, 184, 133, 0.4);
}
.orbit-ring-2 {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  border: 1px dashed rgba(77, 184, 133, 0.08);
  animation: spin 22s linear infinite reverse;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sprite {
  position: relative;
  z-index: 1;
  width: 130px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 40px rgba(77, 184, 133, 0.5))
    drop-shadow(0 0 12px rgba(77, 184, 133, 0.3));
  animation: float 4.5s ease-in-out infinite;
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-12px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sprite {
    animation: none;
  }
  .orbit-ring,
  .orbit-ring-2 {
    animation: none;
  }
  .orbit-ring::after {
    opacity: 0.5;
  }
}

.hero-name {
  font-family: var(--font-head);
  font-size: clamp(3.5rem, 10vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 14px;
}
.hero-name .g {
  color: var(--primary);
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-bottom: 48px;
}
.hero-tagline .c {
  color: rgba(77, 184, 133, 0.4);
}

/* Meta strip */
.meta-strip {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(6, 10, 15, 0.7);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .meta-strip {
    background: rgba(242, 247, 244, 0.8);
  }
}
:root[data-theme="light"] .meta-strip {
  background: rgba(242, 247, 244, 0.8);
}

.meta-cell {
  padding: 12px 22px;
  border-right: 1px solid var(--border);
  text-align: left;
}
.meta-cell:last-child {
  border-right: none;
}
.meta-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 3px;
}
.meta-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--primary);
  display: block;
}

/* ── Page content ─────────────────────────────────────── */
.content {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 28px 80px;
}

/* ── Chapter ──────────────────────────────────────────── */
.chapter {
  padding: 72px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.chapter:last-child {
  border-bottom: none;
}

/* Left accent rail */
.chapter::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 72px;
  bottom: 16px;
  width: 1px;
  background: linear-gradient(to bottom, var(--primary) 0%, transparent 100%);
  opacity: 0.2;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.chapter-title {
  font-family: var(--font-head);
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-bottom: 28px;
  text-wrap: balance;
}

.story {
  font-size: 1.08rem;
  line-height: 1.82;
  color: var(--text);
  max-width: 62ch;
}
.story p + p {
  margin-top: 1.25em;
}
.story strong {
  color: var(--primary);
  font-weight: bold;
}
.story em {
  color: var(--text);
  font-style: italic;
}

/* Blockquote */
.pull-quote {
  margin: 40px 0;
  padding: 22px 28px;
  border-left: 2px solid var(--primary);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}
.pull-quote p {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text);
  font-style: italic;
}
.pull-quote cite {
  display: block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-style: normal;
}

/* ── Trait grid ───────────────────────────────────────── */
.traits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 40px;
}
.trait {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 14px 18px;
}
.trait-label {
  font-family: var(--font-mono);
  font-size: 0.57rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 5px;
}
.trait-value {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* Stat bars */
.stats {
  display: flex;
  flex-direction: column;
}
.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(77, 184, 133, 0.06);
}
.stat:last-child {
  border-bottom: none;
}
.stat-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  width: 116px;
  flex-shrink: 0;
}
.stat-bar {
  flex: 1;
  height: 3px;
  background: rgba(77, 184, 133, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Appearances ──────────────────────────────────────── */
.appearances {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 32px;
}
.appear-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.appear-card:hover {
  border-color: rgba(77, 184, 133, 0.3);
  background: rgba(77, 184, 133, 0.08);
}
.appear-sprite {
  width: 36px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 6px rgba(77, 184, 133, 0.35));
}
.appear-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── CTA section ──────────────────────────────────────── */
.cta {
  text-align: center;
  padding: 80px 24px 64px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(77, 184, 133, 0.04) 50%,
    transparent
  );
  border-top: 1px solid var(--border);
}
.cta-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}
.cta h2 {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  text-wrap: balance;
}
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 30px;
  background: var(--primary);
  color: #060a0f;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 6px;
  transition:
    background 0.2s,
    transform 0.15s;
}
.cta-btn:hover {
  background: var(--bright);
  color: #060a0f;
  transform: translateY(-2px);
}

/* ── Footer ───────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}
.footer-logo img {
  width: 18px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .nav {
    padding: 0 16px;
  }
  .content {
    padding: 0 20px 60px;
  }
  .chapter::before {
    display: none;
  }
  .meta-strip {
    flex-direction: column;
  }
  .meta-cell {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .meta-cell:last-child {
    border-bottom: none;
  }
  .footer {
    flex-direction: column;
    text-align: center;
  }
  .sprite-wrap {
    width: 160px;
    height: 160px;
  }
  .sprite {
    width: 100px;
  }
}
