:root {
  --primary-color: #3f51b5;
  --primary-dark: #303f9f;
  --primary-light: #e8eaf6;
  --accent-color: #536dfe;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --bg-color: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-sidebar: #f8fafc;
  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;
  --code-bg: #f1f5f9;
  --header-height: 64px;
  --sidebar-width: 280px;
  --content-width: 1120px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  color: var(--text-color);
  background: var(--bg-color);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-color);
  font-weight: 500;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 3px;
}

.skip-link {
  background: #ffffff;
  border: 2px solid var(--primary-color);
  border-radius: 4px;
  left: 1rem;
  padding: 0.45rem 0.75rem;
  position: fixed;
  top: -5rem;
  z-index: 1100;
}

.skip-link:focus {
  top: 0.75rem;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Header */
.site-header {
  align-items: center;
  background: var(--primary-color);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.16);
  color: #ffffff;
  display: flex;
  height: var(--header-height);
  justify-content: space-between;
  padding: 0 1.5rem;
  position: fixed;
  right: 0;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.header-start,
.header-brand,
.header-actions,
.github-link,
.hero-actions {
  align-items: center;
  display: flex;
}

.header-start {
  gap: 1rem;
}

.header-brand {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 700;
  gap: 0.7rem;
  text-decoration: none;
}

.header-brand:hover {
  text-decoration: none;
}

.logo-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  display: inline-flex;
  font-size: 1.25rem;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.header-tagline {
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.82rem;
  font-weight: 400;
  margin-left: 0.25rem;
  opacity: 0.88;
  padding-left: 0.8rem;
}

.header-actions {
  gap: 0.75rem;
}

.lang-switch {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  display: flex;
  flex-shrink: 0;
  padding: 0.12rem;
}

.lang-switch a,
.lang-switch span {
  border-radius: 3px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.4rem 0.55rem;
  text-decoration: none;
}

.lang-switch a:hover {
  background: rgba(255, 255, 255, 0.16);
  text-decoration: none;
}

.lang-switch [aria-current="true"] {
  background: #ffffff;
  color: var(--primary-dark);
}

html[lang="ko"] body {
  font-family: "Noto Sans KR", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.8;
}

html[lang="ko"] p,
html[lang="ko"] li,
html[lang="ko"] h1,
html[lang="ko"] h2,
html[lang="ko"] h3,
html[lang="ko"] td,
html[lang="ko"] th {
  overflow-wrap: break-word;
  word-break: keep-all;
}

html[lang="ko"] .nav-section-title {
  letter-spacing: 0;
}

.top-nav {
  align-items: center;
  display: flex;
  gap: 0.35rem;
}

.top-nav-link {
  border-radius: 4px;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.38rem 0.65rem;
  text-decoration: none;
}

.top-nav-link:hover,
.top-nav-link.active {
  background: rgba(255, 255, 255, 0.18);
  text-decoration: none;
}

.github-link {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #ffffff;
  font-size: 0.84rem;
  gap: 0.4rem;
  padding: 0.38rem 0.75rem;
}

.github-link:hover {
  background: rgba(255, 255, 255, 0.26);
  text-decoration: none;
}

.nav-toggle-btn {
  background: transparent;
  border: 0;
  color: #ffffff;
  cursor: pointer;
  display: none;
  font-size: 1.45rem;
  line-height: 1;
  padding: 0.25rem;
}

/* App shell and navigation */
.app-container {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  position: fixed;
  top: var(--header-height);
  width: var(--sidebar-width);
  z-index: 900;
}

.nav-section {
  margin-bottom: 1.45rem;
}

.nav-section-title {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  margin-bottom: 0.45rem;
  padding-left: 0.55rem;
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: 0.15rem;
}

.nav-link {
  border-radius: 6px;
  color: var(--text-color);
  display: flex;
  font-size: 0.88rem;
  gap: 0.5rem;
  padding: 0.48rem 0.62rem;
}

.nav-link:hover,
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  text-decoration: none;
}

.nav-link.active {
  font-weight: 700;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  max-width: calc(var(--content-width) + var(--sidebar-width));
  overflow-wrap: break-word;
  padding: 2.6rem 3.5rem;
}

.main-content > * {
  max-width: var(--content-width);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #0f172a;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  margin-top: 2rem;
}

h1 {
  border-bottom: 1px solid var(--border-color);
  font-size: 2.15rem;
  margin-top: 0;
  padding-bottom: 0.55rem;
}

h2 {
  border-bottom: 1px solid var(--border-color);
  font-size: 1.5rem;
  padding-bottom: 0.35rem;
}

h3 {
  font-size: 1.22rem;
}

h4 {
  font-size: 1.05rem;
}

p,
ul,
ol,
blockquote,
table,
pre,
.card-grid,
.stats-grid,
.flow {
  margin-bottom: 1.25rem;
}

ul,
ol {
  padding-left: 1.45rem;
}

li {
  margin-bottom: 0.35rem;
}

hr {
  background: var(--border-color);
  border: 0;
  height: 1px;
  margin: 2rem 0;
}

blockquote {
  border-left: 4px solid var(--primary-color);
  background: var(--bg-subtle);
  margin-left: 0;
  padding: 0.9rem 1.2rem;
}

blockquote > :last-child {
  margin-bottom: 0;
}

/* Hero, cards, and compact facts */
.hero {
  background: linear-gradient(135deg, #eef0ff 0%, #f8fafc 70%);
  border: 1px solid #d9ddff;
  border-radius: 10px;
  margin-bottom: 2rem;
  padding: 2.1rem 2.2rem;
}

.hero h1 {
  border: 0;
  font-size: clamp(2rem, 4vw, 3.15rem);
  max-width: 850px;
  padding: 0;
}

.eyebrow {
  color: var(--primary-dark);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.lede {
  color: #334155;
  font-size: 1.1rem;
  max-width: 790px;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.35rem;
}

.button {
  background: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 5px;
  color: #ffffff;
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.58rem 0.95rem;
}

.button:hover {
  background: var(--primary-dark);
  color: #ffffff;
  text-decoration: none;
}

.button.secondary {
  background: #ffffff;
  color: var(--primary-dark);
}

.button.secondary:hover {
  background: var(--primary-light);
}

.card-grid,
.stats-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.card,
.stat {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.1rem;
}

.card h3,
.stat h3 {
  font-size: 1rem;
  margin-top: 0;
}

.card p,
.stat p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 0;
}

.stat-number {
  color: var(--primary-dark);
  display: block;
  font-family: "Roboto Mono", SFMono-Regular, Menlo, monospace;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.badge {
  background: var(--primary-light);
  border-radius: 999px;
  color: var(--primary-dark);
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.14rem 0.52rem;
}

.callout {
  border-left-width: 4px;
  border-left-style: solid;
  border-radius: 0 7px 7px 0;
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.callout-note {
  background: #eff6ff;
  border-left-color: #3b82f6;
}

.callout-tip {
  background: #ecfdf5;
  border-left-color: #10b981;
}

.callout-warning {
  background: #fffbeb;
  border-left-color: #f59e0b;
}

.callout-caution {
  background: #fef2f2;
  border-left-color: #ef4444;
}

.flow {
  background: #1e293b;
  border-radius: 8px;
  color: #f8fafc;
  font-family: "Roboto Mono", SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
  padding: 1rem 1.25rem;
  white-space: pre;
}

/* Code and tables */
code {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: #0f172a;
  font-family: "Roboto Mono", SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  padding: 0.15em 0.35em;
}

pre {
  background: #1e293b;
  border-radius: 8px;
  color: #f8fafc;
  font-size: 0.9em;
  line-height: 1.5;
  overflow-x: auto;
  padding: 1rem 1.25rem;
}

pre code {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
}

table {
  border: 1px solid var(--border-color);
  border-collapse: collapse;
  display: block;
  font-size: 0.92rem;
  overflow-x: auto;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--border-color);
  min-width: 9rem;
  padding: 0.7rem 0.9rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f1f5f9;
  border-bottom: 2px solid var(--border-subtle);
  color: #0f172a;
  font-weight: 700;
}

tr:nth-child(even) {
  background: #f8fafc;
}

tr:hover {
  background: #f1f5f9;
}

/* Footer and responsive shell */
.site-footer {
  align-items: center;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  font-size: 0.84rem;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 1.5rem;
}

@media (max-width: 900px) {
  .top-nav {
    display: none;
  }

  .nav-toggle-btn {
    display: block;
  }

  .header-tagline {
    display: none;
  }

  .sidebar {
    box-shadow: 4px 0 12px rgba(15, 23, 42, 0.15);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 1.7rem 1.15rem;
  }

  .hero {
    padding: 1.5rem;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding: 0 0.85rem;
  }

  .header-brand {
    font-size: 1.03rem;
  }

  .github-link span {
    display: none;
  }

  h1 {
    font-size: 1.8rem;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .sidebar {
    transition: none;
  }
}
