:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --primary-light: #dbeafe;
  --primary-lighter: #eff6ff;
  --border: #e5e7eb;
  --surface: #f9fafb;
  --code-bg: #f3f4f6;
  --green-bg: #f0fdf4;
  --green-border: #bbf7d0;
  --green-text: #166534;
  --yellow-bg: #fffbeb;
  --yellow-border: #fde68a;
  --yellow-text: #92400e;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --red-text: #991b1b;
  --nav-height: 56px;
  --sidebar-width: 228px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'Fira Code', 'Cascadia Code', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  font-size: 16px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TOP NAV ─────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--nav-height);
  background: var(--primary-dark);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-logo {
  font-weight: 800;
  font-size: 0.9375rem;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.topnav-links {
  display: flex;
  list-style: none;
  gap: 0.125rem;
  flex-wrap: wrap;
}

.topnav-links a {
  color: rgba(255,255,255,0.75);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.topnav-links a:hover,
.topnav-links a.active {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  text-decoration: none;
}

.topnav-links a.nav-cta {
  background: #ffffff;
  color: var(--primary-dark);
  font-weight: 700;
  padding: 0.375rem 0.875rem;
}

.topnav-links a.nav-cta:hover {
  background: #e0e7ff;
  color: var(--primary-dark);
}

/* ── PAGE LAYOUT ─────────────────────────────────────── */
.page-wrapper {
  display: flex;
  padding-top: var(--nav-height);
  min-height: 100vh;
}

/* ── LEFT SIDEBAR ────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 1.75rem 0;
  background: var(--bg);
}

.sidebar-section {
  margin-bottom: 1.25rem;
}

.sidebar-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 1.25rem;
  margin-bottom: 0.375rem;
}

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

.sidebar-nav a {
  display: block;
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 0.3rem 1.25rem;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1.4;
}

.sidebar-nav a:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
}

.sidebar-nav a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: var(--primary-lighter);
  font-weight: 500;
}

/* ── MAIN CONTENT ────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 760px;
  padding: 3rem 3rem 6rem;
}

/* ── TYPOGRAPHY ──────────────────────────────────────── */
h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  color: var(--text);
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 0.875rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 2rem;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

p:last-child { margin-bottom: 0; }

/* ── PAGE HEADER ─────────────────────────────────────── */
.page-header {
  padding-bottom: 2rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.page-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: var(--primary-lighter);
  border: 1px solid var(--primary-light);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  margin-bottom: 0.875rem;
}

.page-header .subtitle {
  font-size: 1.0625rem;
  color: var(--muted);
  max-width: 580px;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* ── CALLOUTS ────────────────────────────────────────── */
.callout {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border: 1px solid;
  font-size: 0.9375rem;
}

.callout-title {
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.callout.blue {
  background: var(--primary-lighter);
  border-color: var(--primary-light);
}
.callout.blue .callout-title { color: var(--primary); }

.callout.green {
  background: var(--green-bg);
  border-color: var(--green-border);
}
.callout.green .callout-title { color: var(--green-text); }

.callout.yellow {
  background: var(--yellow-bg);
  border-color: var(--yellow-border);
}
.callout.yellow .callout-title { color: var(--yellow-text); }

.callout.red {
  background: var(--red-bg);
  border-color: var(--red-border);
}
.callout.red .callout-title { color: var(--red-text); }

/* ── LISTS ───────────────────────────────────────────── */
ul.content-list,
ol.content-list {
  padding-left: 1.5rem;
  margin: 0.75rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

ul.content-list li,
ol.content-list li {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.55;
}

ul.content-list ul {
  margin-top: 0.35rem;
  padding-left: 1.25rem;
}

/* ── TABLES ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1.25rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.6rem 1rem;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
  line-height: 1.5;
}

td:first-child { font-weight: 500; }

tr:last-child td { border-bottom: none; }

/* ── CODE ────────────────────────────────────────────── */
code {
  font-family: var(--mono);
  font-size: 0.8125em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: #0f172a;
}

pre {
  background: #0f172a;
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: #e2e8f0;
  margin: 1.25rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ── CARDS ───────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(29,78,216,0.08);
}

.card h3 { margin-top: 0; font-size: 0.9375rem; }
.card p { font-size: 0.875rem; color: var(--muted); margin: 0; }

/* ── DIVIDER ─────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── PAGE BOTTOM NAV ─────────────────────────────────── */
.page-bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}

.page-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  min-width: 148px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.page-nav-btn:hover {
  border-color: var(--primary);
  background: var(--primary-lighter);
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(29,78,216,0.08);
}

.page-nav-direction {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
}

.page-nav-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.page-nav-btn-next {
  align-items: flex-end;
  text-align: right;
}

/* ── CONTENTS GRID (home page) ───────────────────────── */
.contents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.contents-card {
  display: block;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.contents-card:hover {
  border-color: var(--primary);
  background: var(--primary-lighter);
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(29,78,216,0.08);
}

.contents-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.contents-card-desc {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── SKIP NOTICE ─────────────────────────────────────── */
.skip-notice {
  margin-bottom: 2rem;
}

/* ── FOOTER ──────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: var(--sidebar-width);
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 2rem 1.25rem 4rem; }
  footer { margin-left: 0; }
}
