/* ── Next.js Full-Stack Tutorial — Vercel Minimal Black & White ── */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --card: #1c2128;
  --card-hover: #262c36;
  --border: rgba(180,185,210,0.12);
  --border-bright: rgba(180,185,210,0.26);
  --text: #e6edf3;
  --text-2: #adbac7;
  --text-3: #768390;
  --accent: #ffffff;
  --accent-dim: #a0a0a0;
  --green: #4ade80;
  --orange: #fb923c;
  --red: #f87171;
  --purple: #c084fc;
  --yellow: #fbbf24;
  --radius: 10px;
  --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,17,23,0.94);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 54px;
  display: flex; align-items: center; gap: 16px;
}
.nav-back {
  color: var(--accent); text-decoration: none;
  font-size: 0.88rem; display: flex; align-items: center; gap: 4px;
  opacity: 0.7; transition: opacity 0.2s;
}
.nav-back:hover { opacity: 1; }
.nav-back::before { content: '‹'; font-size: 1.3rem; }
.nav-title { font-size: 0.95rem; font-weight: 600; flex: 1; color: var(--text); }
.nav-badge {
  background: var(--accent);
  color: #000; font-size: 0.65rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; letter-spacing: 0.04em;
}

/* ── INDEX HERO ── */
.hero {
  min-height: 100vh;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px;
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero-grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 0%, transparent 70%);
}
.hero-eyebrow {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 20px;
  position: relative;
}
.hero h1 {
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--accent);
  position: relative;
  margin-bottom: 10px;
}
.hero-sub-title {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 300;
  color: var(--text-3);
  letter-spacing: -0.01em;
  margin-bottom: 24px;
  position: relative;
}
.hero-desc {
  font-size: 0.95rem; color: var(--text-2); max-width: 480px;
  margin: 0 auto 36px; position: relative; line-height: 1.8;
}
.hero-chips {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; position: relative;
  margin-bottom: 48px;
}
.chip {
  background: transparent; border: 1px solid var(--border-bright);
  color: var(--text-2); font-size: 0.73rem; padding: 5px 12px; border-radius: 20px;
  font-family: 'SF Mono', Consolas, monospace;
  transition: border-color 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* Typewriter cursor */
.typewriter { display: inline-block; }
.typewriter::after {
  content: '|';
  animation: blink 0.8s step-end infinite;
  color: var(--accent);
}
@keyframes blink { 50% { opacity: 0; } }

/* ── CONTAINER ── */
.container { max-width: 860px; margin: 0 auto; padding: 48px 24px 80px; }

/* ── SECTION LABEL ── */
.section-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-3); margin: 32px 0 12px 2px;
}

/* ── CARDS (index chapter list) ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; margin-bottom: 14px;
}
.card-list { list-style: none; }
.card-list li { border-bottom: 1px solid var(--border); }
.card-list li:last-child { border-bottom: none; }
.card-list a {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 12px; text-decoration: none; color: inherit;
  border-radius: var(--radius); transition: background 0.15s;
}
.card-list a:hover { background: var(--card-hover); }
.list-num {
  width: 28px; height: 28px;
  background: var(--accent);
  color: #000; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 0.7rem; font-weight: 800; flex-shrink: 0;
}
.list-content { flex: 1; }
.list-title { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.list-desc { font-size: 0.8rem; color: var(--text-3); }
.list-chevron { color: var(--text-3); font-size: 1rem; align-self: center; }

/* ── CHAPTER HERO ── */
.chapter-hero {
  background: linear-gradient(135deg, #161b22 0%, #21262d 100%);
  border-bottom: 1px solid var(--border);
  padding: 56px 24px 48px; text-align: center;
}
.chapter-hero .ch-num {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 10px;
  font-family: 'SF Mono', monospace;
}
.chapter-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 14px; color: var(--accent);
}
.chapter-hero p { color: var(--text-2); font-size: 0.95rem; max-width: 540px; margin: 0 auto; }

/* ── CONTENT ── */
.content { max-width: 780px; margin: 0 auto; padding: 40px 24px 80px; }

h2 {
  font-size: 1.35rem; font-weight: 700; color: var(--accent);
  margin: 44px 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}
h2:first-child { margin-top: 0; }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: 26px 0 10px; }
h4 {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-3); margin: 18px 0 8px;
}

p { margin-bottom: 14px; color: var(--text-2); font-size: 0.93rem; line-height: 1.85; }

/* ── CALLOUTS ── */
.callout {
  border-radius: var(--radius); padding: 14px 16px; margin: 18px 0;
  display: flex; gap: 12px; align-items: flex-start; font-size: 0.875rem; line-height: 1.7;
  border: 1px solid;
}
.callout-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.callout p { margin: 0; color: inherit; font-size: inherit; line-height: inherit; }
.callout strong { display: block; margin-bottom: 4px; font-weight: 700; }
.callout.info  { background: rgba(180,185,210,0.06); border-color: rgba(180,185,210,0.26); color: var(--text-2); }
.callout.tip   { background: rgba(74,222,128,0.05);  border-color: rgba(74,222,128,0.2);   color: #86EFAC; }
.callout.warning { background: rgba(251,191,36,0.05); border-color: rgba(251,191,36,0.2);  color: #FDE68A; }
.callout.danger  { background: rgba(248,113,113,0.05); border-color: rgba(248,113,113,0.2); color: #FCA5A5; }

/* ── CODE ── */
pre {
  background: #090d12; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  overflow-x: auto; font-size: 0.84rem; line-height: 1.75; margin: 14px 0;
  position: relative;
}
pre .lang-label {
  position: absolute; top: 9px; right: 12px;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-3);
  font-family: 'SF Mono', Consolas, monospace;
}
code { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; }
p code, li code, td code {
  background: rgba(180,185,210,0.1); color: var(--accent-dim);
  padding: 2px 6px; border-radius: 4px; font-size: 0.85em;
}

/* ── SYNTAX HIGHLIGHT ── */
.kw { color: #c084fc; }   /* keywords */
.ty { color: #7dd3fc; }   /* types */
.st { color: #86efac; }   /* strings */
.cm { color: #6a8a6a; }   /* comments */
.fn { color: #fdba74; }   /* functions */
.nu { color: #c084fc; }   /* numbers */
.at { color: #67e8f9; }   /* attributes/decorators */
.pr { color: #a5b4fc; }   /* properties */
.imp { color: #f9a8d4; }  /* imports */
.tag-c { color: #7dd3fc; } /* JSX/HTML tags */

/* ── TABLES ── */
table {
  width: 100%; border-collapse: collapse; margin: 18px 0;
  font-size: 0.86rem; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
th {
  background: var(--surface-2); color: var(--text-2);
  font-weight: 600; padding: 10px 14px; text-align: left;
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em;
}
td { padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text-2); }

/* ── DEF LIST ── */
.def-list { list-style: none; }
.def-list li {
  padding: 13px 0; border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: 190px 1fr; gap: 16px; font-size: 0.88rem;
}
.def-list li:last-child { border-bottom: none; }
.def-term {
  font-weight: 600; color: var(--accent); font-family: 'SF Mono', monospace; font-size: 0.82rem;
}
.def-desc { color: var(--text-2); }

/* ── PROGRESS ── */
.progress { height: 2px; background: var(--border); border-radius: 2px; margin-bottom: 32px; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.6s ease; }

/* ── TWO COL ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
@media (max-width: 600px) {
  .two-col { grid-template-columns: 1fr; }
  .def-list li { grid-template-columns: 1fr; }
}

/* ── STEP LIST ── */
.step-list { list-style: none; counter-reset: steps; }
.step-list li {
  counter-increment: steps; padding: 12px 0 12px 48px; position: relative;
  border-bottom: 1px solid var(--border); font-size: 0.9rem; color: var(--text-2);
}
.step-list li:last-child { border-bottom: none; }
.step-list li::before {
  content: counter(steps); position: absolute; left: 0; top: 12px;
  width: 28px; height: 28px; background: var(--accent);
  color: #000; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 0.72rem; font-weight: 800;
}

/* ul/ol */
.content ul, .content ol {
  padding-left: 22px; margin: 10px 0 14px;
  color: var(--text-2); font-size: 0.9rem; line-height: 1.9;
}

/* ── CHAPTER NAV ── */
.chapter-nav {
  display: flex; gap: 12px; margin-top: 52px; padding-top: 24px;
  border-top: 1px solid var(--border);
}
.chapter-nav a {
  flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: inherit;
  transition: border-color 0.2s, background 0.2s;
}
.chapter-nav a:hover { border-color: var(--border-bright); background: var(--card-hover); }
.nav-dir { font-size: 0.68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; }
.nav-title-text { font-weight: 600; color: var(--accent); font-size: 0.88rem; }
.prev { text-align: left; }
.next { text-align: right; }

/* ── OVERVIEW GRID ── */
.overview-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 12px; margin: 14px 0;
}
.overview-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: border-color 0.2s;
}
.overview-card:hover { border-color: var(--border-bright); }
.overview-card .ov-icon { font-size: 1.4rem; margin-bottom: 8px; }
.overview-card h3 { font-size: 0.88rem; margin: 0 0 5px; color: var(--text); }
.overview-card p { font-size: 0.78rem; margin: 0; color: var(--text-3); line-height: 1.5; }

/* ── COMPARE BOX ── */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.compare-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.compare-box h4 {
  font-size: 0.78rem; font-weight: 700; margin: 0 0 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
  text-transform: none; letter-spacing: 0; color: var(--text);
}
.compare-box ul { padding-left: 16px; margin: 0; color: var(--text-2); font-size: 0.83rem; line-height: 1.8; }
@media (max-width: 600px) { .compare { grid-template-columns: 1fr; } }

/* ── TAG BADGES ── */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; margin-right: 5px;
}
.tag-new  { background: rgba(74,222,128,0.1);  color: var(--green);  border: 1px solid rgba(74,222,128,0.25); }
.tag-warn { background: rgba(251,191,36,0.1);  color: var(--yellow); border: 1px solid rgba(251,191,36,0.25); }
.tag-hot  { background: rgba(248,113,113,0.1); color: var(--red);    border: 1px solid rgba(248,113,113,0.25); }
.tag-tip  { background: rgba(255,255,255,0.07); color: var(--text-2); border: 1px solid var(--border); }

/* ── SITE FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border); padding: 28px 24px;
  text-align: center; font-size: 0.78rem; color: var(--text-3);
}
.site-footer a { color: var(--accent-dim); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ── INDEX FEATURE CARDS ── */
.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; margin: 14px 0;
}
.feature-item {
  background: var(--bg); padding: 24px;
  transition: background 0.15s;
}
.feature-item:hover { background: var(--surface-2); }
.feature-item .fi-icon { font-size: 1.3rem; margin-bottom: 10px; }
.feature-item h3 { font-size: 0.9rem; color: var(--text); margin: 0 0 6px; }
.feature-item p { font-size: 0.8rem; color: var(--text-3); margin: 0; line-height: 1.6; }

/* ── LEARN PATH ── */
.learn-path {
  display: flex; flex-direction: column; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.learn-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
  transition: background 0.15s;
}
.learn-item:last-child { border-bottom: none; }
.learn-item:hover { background: var(--surface-2); }
.learn-num {
  width: 32px; height: 32px; border: 1px solid var(--border);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--text-2); flex-shrink: 0;
  font-family: 'SF Mono', monospace;
}
.learn-info { flex: 1; }
.learn-title { font-size: 0.92rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.learn-desc  { font-size: 0.78rem; color: var(--text-3); }
.learn-arrow { color: var(--text-3); font-size: 0.9rem; }
