/* ═══════════════════════════════════════
   Unity 교과서 2026 — Companion Site
   Aesthetic: Dark terminal × Game HUD
   ═══════════════════════════════════════ */

:root {
  --bg: #0c0e14;
  --bg2: #12151e;
  --bg3: #191d2a;
  --surface: #1e2233;
  --surface2: #252a3a;
  --border: #2a3048;
  --border2: #353d58;
  --text: #c8cee0;
  --text2: #8891a8;
  --text3: #5c6480;
  --heading: #e8ecf4;
  --accent: #4fc3f7;
  --accent2: #00e5ff;
  --accent-glow: rgba(79, 195, 247, .15);
  --green: #66bb6a;
  --yellow: #ffd54f;
  --red: #ef5350;
  --orange: #ffab40;
  --purple: #b388ff;
  --sidebar-w: 280px;
  --topbar-h: 56px;
  --font-body: 'Noto Sans KR', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Orbitron', sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
}

[data-theme="light"] {
  --bg: #f4f5f8;
  --bg2: #ebedf2;
  --bg3: #e2e5eb;
  --surface: #fff;
  --surface2: #f0f1f5;
  --border: #d5d8e0;
  --border2: #c0c5d0;
  --text: #2c3040;
  --text2: #5c6280;
  --text3: #8890a4;
  --heading: #1a1e30;
  --accent: #1976d2;
  --accent2: #0288d1;
  --accent-glow: rgba(25, 118, 210, .08);
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow: hidden;
  height: 100vh;
  display: flex;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); text-decoration: underline; }
img { max-width: 100%; }
::selection { background: var(--accent); color: var(--bg); }

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 100;
  overflow: hidden;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  color: var(--accent);
  letter-spacing: -1px;
}
.logo-dot { color: var(--green); }
.logo-text { font-size: 14px; font-weight: 600; color: var(--text2); }
.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 24px;
  cursor: pointer;
}
.search-box {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.search-box input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--text3); }
.nav-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.nav-list::-webkit-scrollbar { width: 4px; }
.nav-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.nav-item { border: none; }
.nav-part {
  display: block;
  padding: 10px 18px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text3);
}
.nav-link {
  display: block;
  padding: 6px 18px 6px 28px;
  font-size: 13.5px;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-link:hover {
  color: var(--text);
  background: var(--accent-glow);
  text-decoration: none;
}
.nav-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-glow);
}
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.phimir-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #1a237e, #311b92);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: #e8eaf6;
  transition: transform .2s;
}
.phimir-badge:hover { transform: scale(1.04); text-decoration: none; color: #fff; }
.badge-icon { font-size: 14px; }

/* ═══ MAIN ═══ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-btn span { display: block; width: 20px; height: 2px; background: var(--text2); border-radius: 2px; }
.breadcrumb { font-size: 13px; color: var(--text3); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  background: none; border: none; font-size: 18px; cursor: pointer;
  filter: grayscale(.5);
  transition: filter .2s;
}
.theme-toggle:hover { filter: none; }
.progress-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--accent);
}
.content-scroll {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.content-scroll::-webkit-scrollbar { width: 6px; }
.content-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 6px; }

/* ═══ HERO ═══ */
.hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 50%, rgba(79,195,247,.07) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 30%, rgba(102,187,106,.05) 0%, transparent 50%);
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: .25;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}
.hero-inner { position: relative; z-index: 1; }
.hero-badge {
  display: inline-block;
  padding: 4px 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 28px;
  animation: fadeUp .6s ease both;
}
.hero-title { margin-bottom: 20px; }
.hero-line1 {
  display: block;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(48px, 8vw, 88px);
  letter-spacing: -2px;
  color: var(--heading);
  line-height: 1.05;
  animation: fadeUp .6s ease .1s both;
}
.hero-line2 {
  display: block;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
  animation: fadeUp .6s ease .2s both;
}
.hero-sub {
  font-size: 16px;
  color: var(--text2);
  margin-bottom: 40px;
  animation: fadeUp .6s ease .3s both;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 40px;
  animation: fadeUp .6s ease .4s both;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--heading);
}
.stat-label { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; }
.hero-cta {
  display: inline-block;
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--bg) !important;
  font-weight: 700;
  font-size: 15px;
  border-radius: 8px;
  transition: transform .2s, box-shadow .2s;
  animation: fadeUp .6s ease .5s both;
}
.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(79,195,247,.3);
  text-decoration: none;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ PARTS & CHAPTERS ═══ */
.part {
  max-width: 880px;
  margin: 0 auto;
  padding: 60px 28px 40px;
}
.part-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 40px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--accent);
}
.part-num {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  opacity: .4;
  line-height: 1;
}
.part-header h2 {
  font-size: 30px;
  font-weight: 800;
  color: var(--heading);
}
.chapter {
  margin-bottom: 56px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: chIn .5s ease both;
}
@keyframes chIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.chapter h3 {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 24px;
  font-weight: 800;
  color: var(--heading);
  margin-bottom: 20px;
}
.ch-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  flex-shrink: 0;
}
.chapter h4 {
  font-size: 17px;
  font-weight: 700;
  color: var(--heading);
  margin: 28px 0 14px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}
.chapter p { margin-bottom: 14px; }
.chapter ul, .chapter ol { padding-left: 24px; margin-bottom: 16px; }
.chapter li { margin-bottom: 6px; }
code {
  font-family: var(--font-mono);
  font-size: .88em;
  padding: 2px 7px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
}

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--heading);
  border-bottom: 2px solid var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr:hover { background: var(--accent-glow); }
.status-green { color: var(--green); font-weight: 700; }
.status-yellow { color: var(--yellow); font-weight: 700; }
.status-red { color: var(--red); font-weight: 700; }
kbd {
  display: inline-block;
  padding: 2px 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--heading);
  box-shadow: 0 1px 0 var(--border);
}

/* ─── CALLOUTS ─── */
.callout {
  padding: 18px 22px;
  border-radius: var(--radius-sm);
  margin: 20px 0;
  border-left: 4px solid;
}
.callout-title { font-weight: 700; margin-bottom: 8px; font-size: 14px; }
.callout-new { background: rgba(79,195,247,.06); border-color: var(--accent); }
.callout-new .callout-title { color: var(--accent); }
.callout-info { background: rgba(102,187,106,.06); border-color: var(--green); }
.callout-info .callout-title { color: var(--green); }
.callout-warn { background: rgba(255,213,79,.06); border-color: var(--yellow); }
.callout-warn .callout-title { color: var(--yellow); }
.callout ul { margin-top: 8px; padding-left: 20px; }
.callout li { margin-bottom: 4px; font-size: 14.5px; }

/* ─── CARDS ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card-grid-2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  padding: 18px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-icon { font-size: 24px; margin-bottom: 8px; }
.card h5 { font-size: 14.5px; font-weight: 700; color: var(--heading); margin-bottom: 6px; }
.card p { font-size: 13px; color: var(--text2); margin: 0; }
.card-dark { background: var(--bg); }
.card-accent { background: linear-gradient(135deg, rgba(79,195,247,.08), rgba(102,187,106,.05)); border-color: rgba(79,195,247,.2); }

/* ─── CODE BLOCKS ─── */
.code-block {
  margin: 16px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.code-block pre {
  padding: 18px 20px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}
.c-keyword { color: var(--purple); }
.c-string { color: var(--green); }
.c-comment { color: var(--text3); }

/* ─── CHECKLIST ─── */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}
.checklist label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: border-color .2s;
}
.checklist label:hover { border-color: var(--accent); }
.checklist input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* ─── STEP LIST ─── */
.step-list { counter-reset: step; list-style: none; padding-left: 0; margin: 16px 0; }
.step-list li {
  counter-increment: step;
  padding: 12px 16px 12px 52px;
  position: relative;
  margin-bottom: 8px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 14.5px;
}
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
}

/* ─── DIAGRAM ─── */
.diagram {
  margin: 20px 0;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.dia-node {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 8px;
}
.dia-scene { background: rgba(79,195,247,.1); border: 1px solid var(--accent); color: var(--accent); }
.dia-go { background: rgba(102,187,106,.1); border: 1px solid var(--green); color: var(--green); }
.dia-comp {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  display: inline-block;
  margin: 4px 6px 4px 0;
  font-size: 12px;
  padding: 6px 12px;
}
.dia-children { padding-left: 24px; margin-top: 10px; }

/* ─── FEATURE PILLS ─── */
.feature-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.pill {
  padding: 6px 14px;
  background: var(--accent-glow);
  border: 1px solid rgba(79,195,247,.25);
  border-radius: 20px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ─── SUITES ─── */
.suite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.suite-card {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg3);
  position: relative;
  transition: border-color .2s;
}
.suite-card:hover { border-color: var(--accent); }
.suite-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 10px;
  border-radius: 10px;
}
.suite-free .suite-badge { background: rgba(102,187,106,.15); color: var(--green); }
.suite-pro .suite-badge { background: rgba(255,171,64,.15); color: var(--orange); }
.suite-card h5 { font-size: 16px; font-weight: 700; color: var(--heading); margin-bottom: 8px; }
.suite-card p { font-size: 13.5px; color: var(--text2); margin: 0; }

/* ─── PRICING ─── */
.pricing-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.price-card {
  padding: 24px 20px;
  text-align: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.price-card h5 { font-size: 15px; color: var(--heading); margin-bottom: 8px; }
.price { font-size: 28px; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.price span { font-size: 14px; font-weight: 400; color: var(--text3); }
.price-card p:last-child { font-size: 13px; color: var(--text2); margin: 0; }
.price-highlight {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 30px rgba(79,195,247,.08);
}

/* ─── FLOW STEPS ─── */
.flow-steps {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  margin: 20px 0;
  justify-content: center;
}
.flow-step {
  padding: 16px 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--heading);
  min-width: 120px;
}
.flow-step span {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 4px;
}
.flow-step small { font-size: 11px; color: var(--text3); font-weight: 400; }
.flow-arrow { padding: 0 10px; color: var(--accent); font-size: 20px; }

/* ─── GLOSSARY ─── */
.glossary dl { margin: 0; }
.glossary dt {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  margin-top: 14px;
  font-size: 14px;
}
.glossary dd {
  margin-left: 0;
  padding-left: 16px;
  border-left: 2px solid var(--border);
  color: var(--text2);
  font-size: 14px;
  margin-top: 4px;
}

/* ─── BTN ─── */
.btn-link {
  display: inline-block;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--bg) !important;
  font-weight: 700;
  font-size: 14px;
  border-radius: 8px;
  margin-top: 16px;
  transition: transform .2s, box-shadow .2s;
}
.btn-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(79,195,247,.25);
  text-decoration: none;
}

/* ─── FOOTER ─── */
.site-footer {
  padding: 40px 28px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}
.footer-inner p { font-size: 14px; color: var(--text2); margin-bottom: 6px; }
.footer-sub { font-size: 12px; color: var(--text3); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 30px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .menu-btn { display: flex; }
  .part { padding: 40px 18px 30px; }
  .chapter { padding: 22px 18px; }
  .hero-stats { gap: 24px; }
  .flow-steps { flex-direction: column; align-items: stretch; }
  .flow-arrow { transform: rotate(90deg); text-align: center; padding: 6px 0; }
}
@media (max-width: 480px) {
  .card-grid, .card-grid-3, .card-grid-2, .suite-grid, .pricing-row {
    grid-template-columns: 1fr;
  }
}
