:root {
  --bg: #04060c;
  --bg-2: #0a0f1d;
  --panel: rgba(14, 20, 38, 0.72);
  --line: rgba(120, 170, 255, 0.16);
  --line-strong: rgba(120, 200, 255, 0.35);
  --text: #e8eefc;
  --muted: #8b97b5;
  --auto: #47e0ff;
  --space: #ff8a4c;
  --accent: #47e0ff;
  --font-display: "Space Grotesk", "Noto Sans KR", system-ui, sans-serif;
  --font-body: "Noto Sans KR", "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --header-h: 68px;
  --max: 1160px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 40px);
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled,
.site-header.solid {
  background: rgba(4, 6, 12, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 14px;
  white-space: nowrap;
}
.logo-mark {
  width: 26px;
  height: 26px;
  flex: none;
}
.logo .dim { color: var(--muted); font-weight: 500; }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.4vw, 10px);
}
.nav a,
.nav button {
  font: 500 14px/1 var(--font-display);
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: 1px solid transparent;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.nav a:hover,
.nav button:hover { border-color: var(--line-strong); background: rgba(71, 224, 255, 0.06); }
.nav a[aria-current="page"] { border-color: var(--line-strong); color: var(--accent); }
.nav .nav-auto[aria-current="page"] { color: var(--auto); }
.nav .nav-space[aria-current="page"] { color: var(--space); border-color: rgba(255, 138, 76, 0.4); }

@media (max-width: 560px) {
  :root { --header-h: 58px; }
  .logo-text { display: none; }
  .nav a, .nav button { padding: 8px 10px; font-size: 13px; }
}

/* ---------- Author dialog ---------- */
.author-dialog {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(160deg, #0d1528, #070a14);
  color: var(--text);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(71, 224, 255, 0.05) inset;
}
.author-dialog::backdrop { background: rgba(2, 4, 10, 0.7); backdrop-filter: blur(4px); }
.author-dialog .inner { padding: 28px 28px 24px; position: relative; }
.author-dialog .eyebrow { margin: 0 0 6px; }
.author-dialog h2 { margin: 0 0 14px; font: 600 24px/1.3 var(--font-display); }
.author-dialog p { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.author-email {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(71, 224, 255, 0.05);
  font-family: var(--font-mono);
  font-size: 14px;
  word-break: break-all;
}
.author-email a { flex: 1; text-decoration: none; color: var(--auto); }
.author-email button {
  flex: none;
  font: 500 12px/1 var(--font-display);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

/* ---------- Shared bits ---------- */
.eyebrow {
  font: 500 12px/1 var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  font: 600 15px/1 var(--font-display);
  letter-spacing: 0.03em;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  background: rgba(10, 16, 32, 0.6);
  backdrop-filter: blur(8px);
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-auto { border-color: rgba(71, 224, 255, 0.55); color: var(--auto); }
.btn-auto:hover { background: rgba(71, 224, 255, 0.12); }
.btn-space { border-color: rgba(255, 138, 76, 0.55); color: var(--space); }
.btn-space:hover { background: rgba(255, 138, 76, 0.12); }

/* ---------- Hero journey ---------- */
.journey { position: relative; height: 900vh; }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
}
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.story {
  position: absolute;
  left: clamp(16px, 6vw, 80px);
  right: clamp(16px, 6vw, 80px);
  pointer-events: none;
  opacity: 0;
  will-change: opacity, transform;
}
.story.active { pointer-events: auto; }
.story h1, .story h2 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}
.story h1 { font-size: clamp(40px, 8vw, 104px); line-height: 0.98; }
.story h2 { font-size: clamp(28px, 4.6vw, 58px); line-height: 1.1; }
.story p {
  margin: 14px 0 0;
  font-size: clamp(15px, 1.6vw, 19px);
  color: #c4cee6;
  max-width: 34em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
}
.story .eyebrow { display: block; margin-bottom: 16px; }
.story-top { top: calc(var(--header-h) + 6vh); }
.story-bottom { bottom: 12vh; }
.story-center { top: 50%; transform: translateY(-50%); text-align: center; }
.story-center p { margin-left: auto; margin-right: auto; }
.story-final { text-align: center; }
.story-final p { margin-left: auto; margin-right: auto; }
.grad-auto { color: var(--auto); }
.grad-space { color: var(--space); }
.story .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.3em;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.scroll-hint::after {
  content: "";
  width: 1px;
  height: 36px;
  background: linear-gradient(var(--accent), transparent);
  animation: hint 1.8s ease-in-out infinite;
}
@keyframes hint {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

.hud {
  position: absolute;
  right: clamp(16px, 3vw, 36px);
  bottom: clamp(16px, 3vw, 32px);
  font: 500 11px/1.9 var(--font-mono);
  letter-spacing: 0.12em;
  color: var(--muted);
  text-align: right;
  pointer-events: none;
}
.hud b { color: var(--text); font-weight: 500; }
.hud-bar {
  margin-top: 8px;
  width: 160px;
  height: 2px;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}
.hud-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--auto), var(--space));
}
@media (max-width: 560px) { .hud { display: none; } }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 120px) 0; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.section-head h2 {
  margin: 10px 0 0;
  font: 700 clamp(28px, 4vw, 44px)/1.15 var(--font-display);
}
.section-head p { margin: 8px 0 0; color: var(--muted); }

.page-hero {
  padding: calc(var(--header-h) + clamp(48px, 8vw, 96px)) 0 clamp(32px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 120% at 85% 0%, var(--glow, rgba(71, 224, 255, 0.16)), transparent 60%),
    linear-gradient(transparent 0 calc(100% - 1px), var(--line) 0) 0 0 / 100% 48px,
    linear-gradient(90deg, transparent 0 calc(100% - 1px), var(--line) 0) 0 0 / 48px 100%;
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  opacity: 0.8;
  pointer-events: none;
}
.page-hero .wrap { position: relative; }
.page-hero h1 { margin: 14px 0 10px; font: 700 clamp(40px, 7vw, 80px)/1 var(--font-display); }
.page-hero p { margin: 0; color: var(--muted); max-width: 40em; font-size: 17px; }
.page-auto { --accent: var(--auto); --glow: rgba(71, 224, 255, 0.2); }
.page-space { --accent: var(--space); --glow: rgba(255, 138, 76, 0.2); }

/* ---------- Article cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.card {
  --c: var(--auto);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(170deg, rgba(18, 26, 48, 0.75), rgba(8, 11, 22, 0.75));
  text-decoration: none;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  overflow: hidden;
}
.card[data-cat="space"] { --c: var(--space); }
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c), transparent);
  opacity: 0.8;
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--c) 50%, transparent);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 12px/1 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--muted);
}
.card-cat { color: var(--c); text-transform: uppercase; letter-spacing: 0.16em; }
.card h3 { margin: 0; font: 600 20px/1.4 var(--font-body); }
.card p { margin: 0; color: var(--muted); font-size: 15px; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-tags span {
  font: 500 11px/1 var(--font-mono);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.card-sample {
  font: 500 10px/1 var(--font-mono);
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  letter-spacing: 0.1em;
}
.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
}

/* ---------- Article page ---------- */
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--header-h) + clamp(40px, 7vw, 80px)) clamp(16px, 4vw, 40px) 80px;
}
.article .back {
  font: 500 13px/1 var(--font-mono);
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.08em;
}
.article .back:hover { color: var(--accent); }
.article header { margin: 28px 0 36px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.article h1 { margin: 14px 0 16px; font: 700 clamp(30px, 5vw, 46px)/1.25 var(--font-body); }
.article .meta { color: var(--muted); font: 500 13px/1.6 var(--font-mono); letter-spacing: 0.04em; }
.article .summary {
  margin: 0 0 32px;
  padding: 18px 20px;
  border-left: 2px solid var(--accent);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 12px 12px 0;
  color: #cbd4ea;
}
.prose { font-size: 17px; line-height: 1.85; color: #d6ddee; }
.prose h2 { margin: 48px 0 14px; font: 700 24px/1.4 var(--font-body); color: var(--text); }
.prose h3 { margin: 32px 0 10px; font: 600 19px/1.4 var(--font-body); color: var(--text); }
.prose p { margin: 0 0 20px; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 1.3em; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--text); }
.prose .model-list > li { margin-bottom: 20px; }
.prose .model-list > li > ul { margin: 8px 0 0; padding-left: 1.1em; list-style: none; }
.prose .model-list > li > ul > li { margin-bottom: 6px; font-size: 16px; }
.prose .model-list b { color: var(--accent); font-weight: 500; }
.prose blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
}
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 15px; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { color: var(--muted); font-weight: 500; }
.prose td:first-child { min-width: 7.5em; word-break: keep-all; }
.prose .group-row th {
  padding-top: 18px;
  color: var(--accent);
  font: 600 13px/1.4 var(--font-mono);
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--line-strong);
}
.prose .group-row th span { color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 8px; font-family: var(--font-body); }
.prose td { vertical-align: top; }
.prose td .cell-list { margin: 0; padding-left: 1.1em; }
.prose td .cell-list li { margin-bottom: 8px; }
.prose td .cell-list li:last-child { margin-bottom: 0; }
.table-scroll { overflow-x: auto; }
.sources { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.sources a { color: var(--accent); word-break: break-all; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 44px;
  color: var(--muted);
  font-size: 14px;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint::after { animation: none; }
}
