:root {
  --bg: #f7f9fc;
  --bg-elevated: #ffffff;
  --bg-soft: #eef3f8;
  --text: #1a2233;
  --text-muted: #4a5568;
  --text-soft: #6b7689;
  --border: #d8e0ec;
  --border-strong: #b9c4d6;
  --primary: #1d4ed8;
  --primary-hover: #1746b0;
  --primary-soft: #e6edfb;
  --accent: #0d9488;
  --accent-soft: #d7f3ee;
  --warning-bg: #fff7e6;
  --warning-border: #f0c36d;
  --warning-text: #7a4d00;
  --info-bg: #eaf2ff;
  --info-border: #9db9ee;
  --info-text: #1b3a72;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --shadow-sm: 0 1px 2px rgba(20, 35, 70, 0.06);
  --shadow-md: 0 6px 24px rgba(20, 35, 70, 0.08);
  --shadow-lg: 0 18px 48px rgba(20, 35, 70, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --maxw: 1140px;
  --font-sans: "Inter", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR",
    system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
h1, h2, h3, h4 { line-height: 1.25; color: #0f1b30; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 1.2rem + 2.6vw, 3.1rem); margin: 0 0 0.6em; }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); margin: 2.2em 0 0.6em; }
h3 { font-size: 1.25rem; margin: 1.6em 0 0.5em; }
p { margin: 0 0 1.1em; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; background: var(--primary);
  color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  z-index: 200; transition: top 0.2s ease;
}
.skip-link:focus { top: 16px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--primary); display: inline-flex; }
.primary-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.primary-nav a {
  display: inline-block; padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 0.95rem;
}
.primary-nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.primary-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.nav-toggle {
  display: none; flex-direction: column; gap: 5px; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer;
}
.nav-toggle-bar { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-md); font-weight: 600;
  font-size: 0.98rem; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: transform 0.05s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-soft); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-steam {
  background: linear-gradient(180deg, #1b2838, #0b1a2a);
  color: #c7d5e0; border-color: #2a475e; font-weight: 600;
}
.btn-steam:hover { color: #fff; background: linear-gradient(180deg, #22324a, #11203a); }

/* Hero */
.hero { padding: 72px 0 48px; }
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: 48px; align-items: center;
}
.eyebrow {
  display: inline-block; font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.hero-lead p { font-size: 1.12rem; color: var(--text-muted); max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-art {
  border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border);
  box-shadow: var(--shadow-md); background: var(--bg-soft); aspect-ratio: 4 / 3;
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }

/* Sections */
.section { padding: 64px 0; }
.section-soft { background: var(--bg-soft); }
.section-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 32px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--text-muted); max-width: 60ch; }
.section-link { color: var(--primary); font-weight: 600; white-space: nowrap; }

/* Cards */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px;
}
.card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-soft); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-meta { display: flex; gap: 10px; font-size: 0.82rem; color: var(--text-soft); flex-wrap: wrap; }
.card-tag { background: var(--accent-soft); color: #0a5a52; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.card-title { margin: 0; font-size: 1.12rem; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--primary); }
.card-summary { color: var(--text-muted); margin: 0; font-size: 0.95rem; }
.card-link { margin-top: auto; padding-top: 6px; color: var(--primary); font-weight: 600; }

/* Pathway */
.pathway {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; counter-reset: step;
}
.pathway-step {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 22px; position: relative;
}
.pathway-step::before {
  counter-increment: step; content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; margin-bottom: 12px;
}
.pathway-step h3 { margin: 0 0 8px; font-size: 1.05rem; }
.pathway-step p { margin: 0; color: var(--text-muted); font-size: 0.94rem; }

/* Article */
.article-layout { padding: 56px 0 64px; }
.article-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px;
  gap: 48px; align-items: start;
}
.article-head { margin-bottom: 28px; }
.article-meta {
  display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.85rem;
  color: var(--text-soft); margin-bottom: 14px;
}
.article-body { font-size: 1.04rem; color: #232d40; }
.article-body h2 { margin-top: 2em; }
.article-body ul { padding-left: 1.2em; }
.article-body li { margin-bottom: 0.4em; }
.article-body blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  margin: 1.6em 0;
  padding: 14px 18px;
  color: #0a5a52;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.article-body blockquote p { margin: 0; }
.article-body a { color: var(--primary); text-decoration: underline; }
.callout {
  border: 1px solid var(--info-border); background: var(--info-bg);
  color: var(--info-text); border-radius: var(--radius-md); padding: 16px 20px; margin: 1.6em 0;
}
.callout.warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
.callout strong { display: block; margin-bottom: 4px; font-weight: 700; }
.toc {
  position: sticky; top: 92px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px;
}
.toc h2 {
  margin: 0 0 10px; font-size: 0.95rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-soft);
}
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.92rem; }
.related { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.related h3 {
  font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-soft); margin: 0 0 10px;
}
.related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

/* Diagram */
.diagram {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 28px; margin: 1.6em 0;
}
.diagram svg { width: 100%; height: auto; }
.diagram-caption { margin-top: 14px; font-size: 0.88rem; color: var(--text-soft); text-align: center; }

/* Features */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.feature { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; }
.feature h3 { margin: 0 0 8px; font-size: 1.08rem; }
.feature p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--primary-soft); color: var(--primary); margin-bottom: 12px;
}

/* App mock */
.app-mock {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elevated); overflow: hidden; box-shadow: var(--shadow-md);
}
.app-mock-bar {
  display: flex; gap: 6px; padding: 12px 16px;
  background: var(--bg-soft); border-bottom: 1px solid var(--border);
}
.app-mock-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.app-mock-body { display: grid; grid-template-columns: 200px 1fr; min-height: 320px; }
.app-mock-side { border-right: 1px solid var(--border); padding: 18px; font-size: 0.86rem; color: var(--text-soft); }
.app-mock-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.app-mock-side li { padding: 6px 10px; border-radius: var(--radius-sm); }
.app-mock-side li.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.app-mock-main { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.app-mock-row { height: 10px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--border); }
.app-mock-row.short { width: 60%; }
.app-mock-row.med { width: 80%; }

/* Forms */
.form-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-sm);
}
.form-row { margin-bottom: 20px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; }
.form-row label .req { color: var(--danger); margin-left: 2px; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); font: inherit; color: var(--text); background: #fff;
}
.form-row textarea { min-height: 140px; resize: vertical; }
.form-row input.invalid, .form-row textarea.invalid {
  border-color: var(--danger); background: var(--danger-soft);
}
.field-error {
  display: none; margin-top: 6px; font-size: 0.85rem; color: var(--danger); font-weight: 500;
}
.field-error.show { display: block; }
.form-status {
  margin-top: 8px; padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 0.92rem; font-weight: 500; display: none;
}
.form-status.show { display: block; }
.form-status.success { background: var(--accent-soft); color: #0a5a52; border: 1px solid #9ad6cc; }
.form-status.error { background: var(--danger-soft); color: var(--danger); border: 1px solid #f3c0bb; }

/* Footer */
.site-footer {
  background: #0f1b30; color: #c8d2e2; margin-top: 64px; padding: 56px 0 28px;
}
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; margin-bottom: 36px;
}
.footer-title { color: #fff; font-weight: 700; font-size: 1.1rem; margin: 0 0 10px; }
.footer-tagline { color: #9aa8c0; font-size: 0.95rem; margin: 0; max-width: 38ch; }
.footer-address { font-style: normal; color: #c8d2e2; font-size: 0.95rem; line-height: 1.8; }
.footer-address a { color: #c8d2e2; }
.footer-address a:hover { color: #fff; }
.footer-nav ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-nav a { color: #c8d2e2; font-size: 0.95rem; }
.footer-nav a:hover { color: #fff; }
.footer-disclaimer {
  border-top: 1px solid #243049; padding-top: 24px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.footer-disclaimer p { margin: 0; color: #8b98b3; font-size: 0.85rem; max-width: 70ch; }
.footer-copy { color: #6b7689 !important; }

/* Cookie banner */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  background: #0f1b30; color: #e6ecf6; box-shadow: 0 -10px 30px rgba(0,0,0,0.18);
}
.cookie-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 24px;
}
.cookie-text { margin: 0; font-size: 0.92rem; max-width: 80ch; color: #c8d2e2; }
.cookie-text a { color: #8fb4ff; text-decoration: underline; }
.cookie-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* 404 */
.error-wrap { text-align: center; padding: 80px 0; }
.error-code { font-size: clamp(4rem, 2rem + 8vw, 8rem); font-weight: 800; color: var(--primary); margin: 0; line-height: 1; }
.error-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }

/* Prose helpers */
.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 64ch; }
.muted { color: var(--text-muted); }
.divider { height: 1px; background: var(--border); border: 0; margin: 40px 0; }
.kv-table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 0.95rem; }
.kv-table th, .kv-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.kv-table th { background: var(--bg-soft); color: var(--text); font-weight: 600; }
.kv-table tr:last-child td { border-bottom: 0; }

/* Responsive */
@media (max-width: 880px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: absolute; top: 68px; left: 0; right: 0;
    background: var(--bg-elevated); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md); padding: 12px 24px 18px;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }
  .primary-nav.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .primary-nav ul { flex-direction: column; gap: 2px; }
  .primary-nav a { display: block; padding: 12px 14px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-art { order: -1; }
  .article-grid { grid-template-columns: 1fr; }
  .toc { position: static; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .app-mock-body { grid-template-columns: 1fr; }
  .app-mock-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .cookie-inner { flex-direction: column; align-items: flex-start; }
  .cookie-actions { width: 100%; }
  .cookie-actions .btn { flex: 1; }
}

@media (max-width: 560px) {
  .hero { padding: 48px 0 32px; }
  .section { padding: 48px 0; }
  .container { padding: 0 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
