/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100svh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── WHITE theme (default) ────────────────────────────────────────── */
:root {
  --bg:         #f8fafc;
  --bg-card:    #ffffff;
  --bg-nav:     rgba(255,255,255,0.85);
  --border:     #e2e8f0;
  --text:       #0f172a;
  --text-muted: #64748b;
  --accent:     #0ea5e9;
  --accent-2:   #0284c7;
  --accent-glow:rgba(14,165,233,0.15);
  --pill-bg:    #f1f5f9;
  --pill-text:  #334155;
  --hero-from:  #e0f2fe;
  --hero-to:    #f0fdf4;
  --wave-fill:  #bae6fd;
}

/* ── OCEAN theme ──────────────────────────────────────────────────── */
[data-theme="ocean"] {
  --bg:         #060f23;
  --bg-card:    #172554;
  --bg-nav:     rgba(6,15,35,0.9);
  --border:     #1e40af;
  --text:       #eff6ff;
  --text-muted: #93c5fd;
  --accent:     #38bdf8;
  --accent-2:   #0ea5e9;
  --accent-glow:rgba(56,189,248,0.2);
  --pill-bg:    #1e3a8a;
  --pill-text:  #bfdbfe;
  --hero-from:  #0c1a3a;
  --hero-to:    #0f2a4a;
  --wave-fill:  #1e3a8a;
}

body { background: var(--bg); color: var(--text); }

/* ── Navigation ───────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 900px; margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); font-weight: 900;
  font-size: 1.15rem; letter-spacing: -0.5px;
}
.nav-logo .logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #10b981);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

/* ── Page quick-nav bar (below hero) ──────────────────────────────── */
/* Replaces the old nav-links that cluttered the sticky header on mobile */
.page-nav-bar {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.page-nav-bar::-webkit-scrollbar { display: none; }
.page-nav-bar a {
  flex-shrink: 0;
  padding: 6px 14px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; white-space: nowrap;
  color: var(--text-muted); text-decoration: none;
  background: var(--pill-bg); transition: all 0.2s;
}
.page-nav-bar a:hover, .page-nav-bar a.active {
  background: var(--accent); color: #fff; text-decoration: none;
}

/* ── Theme toggle ─────────────────────────────────────────────────── */
.theme-toggle {
  width: 42px; height: 24px; border-radius: 12px;
  border: none; cursor: pointer; position: relative;
  background: linear-gradient(90deg, #0ea5e9, #2563eb);
  flex-shrink: 0; transition: opacity 0.2s;
}
.theme-toggle::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.25s ease;
}
[data-theme="ocean"] .theme-toggle::after { transform: translateX(18px); }
.theme-toggle-wrap { display: flex; align-items: center; gap: 8px; }
.theme-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, var(--hero-from), var(--hero-to));
  padding: 80px 24px 60px;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero-wave {
  position: absolute; bottom: -2px; left: 0; width: 100%;
}
.hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 900; letter-spacing: -1px; color: var(--text); }
.hero p  { margin-top: 12px; font-size: 1rem; color: var(--text-muted); max-width: 520px; margin-left: auto; margin-right: auto; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px; font-size: 0.78rem; font-weight: 700;
  background: var(--accent-glow); color: var(--accent);
  border: 1px solid var(--accent); margin-bottom: 20px;
}

/* ── Page layout ──────────────────────────────────────────────────── */
.page-wrap {
  max-width: 780px; margin: 0 auto;
  padding: 48px 24px 80px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 40px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
@media (max-width: 520px) { .card { padding: 24px 20px; } }

/* ── Typography ───────────────────────────────────────────────────── */
h1, h2, h3 { letter-spacing: -0.4px; }
h2 { font-size: 1.35rem; font-weight: 800; color: var(--text); margin-bottom: 12px; }
h2 .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 0.8rem;
  margin-right: 10px; flex-shrink: 0;
}
h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin: 20px 0 8px; }
p  { color: var(--text-muted); margin-bottom: 14px; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 22px; color: var(--text-muted); margin-bottom: 14px; }
li { margin-bottom: 6px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: var(--text); font-weight: 700; }
.meta  { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 24px; opacity: 0.7; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Index page cards ─────────────────────────────────────────────── */
.index-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; margin-top: 32px;
}
.index-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 24px; text-decoration: none;
  transition: all 0.2s; position: relative; overflow: hidden;
}
.index-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
  border-color: var(--accent);
  text-decoration: none;
}
.index-card .icon {
  font-size: 1.8rem; margin-bottom: 4px;
}
.index-card h3 { font-size: 1rem; font-weight: 800; color: var(--text); margin: 0 0 4px; }
.index-card p  { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

/* ── Footer ───────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  text-align: center; font-size: 0.78rem; color: var(--text-muted);
}
footer a { color: var(--accent); }
