:root {
  --bg: #ffffff;
  --bg-alt: #f6f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --brand: #4f46e5;
  --brand-2: #06b6d4;
  --brand-ink: #ffffff;
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
  --radius: 16px;
  --max: 1140px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --bg-alt: #111833;
    --surface: #141c3a;
    --text: #e8ecf8;
    --muted: #a3adc8;
    --border: #243056;
    --brand: #818cf8;
    --brand-2: #22d3ee;
    --brand-ink: #0b1020;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 800; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.container--narrow { max-width: 760px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; font-weight: 700; color: var(--brand); margin-bottom: 0.75em; }
.gradient { background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 680px; margin-inline: auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  padding: 0.85em 1.5em; border-radius: 999px; border: 2px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font-weight: 600; font-size: 1rem;
  text-decoration: none; cursor: pointer; font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--small { padding: 0.5em 1.1em; font-size: 0.9rem; }
.btn--block { width: 100%; }
.btn--light { background: #fff; color: #312e81; border-color: #fff; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 1.2rem; font-weight: 600; }
.brand strong { color: var(--brand); font-weight: 800; }
.nav__links { display: flex; align-items: center; gap: 28px; }
.nav__links a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav__links a:not(.btn):hover { color: var(--text); }
.nav__toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav__toggle span { display: block; width: 22px; height: 2px; margin: 5px 0; background: var(--text); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }

@media (max-width: 820px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    gap: 0; padding: 8px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav__links.open { display: flex; }
  .nav__links a:not(.btn) { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav__links .btn { margin-top: 12px; }
  .nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* Hero */
.hero { position: relative; overflow: hidden; text-align: center; padding: clamp(72px, 12vw, 140px) 0 clamp(64px, 10vw, 110px); }
.hero__glow {
  position: absolute; inset: -40% -10% auto; height: 900px; z-index: -1;
  background:
    radial-gradient(closest-side at 30% 40%, color-mix(in srgb, var(--brand) 28%, transparent), transparent),
    radial-gradient(closest-side at 70% 50%, color-mix(in srgb, var(--brand-2) 22%, transparent), transparent);
  filter: blur(20px);
}
.hero__cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 2em 0 2.5em; }
.hero__tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.hero__tags li { padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.88rem; color: var(--muted); background: var(--surface); }

/* Sections */
.section { padding: clamp(64px, 9vw, 104px) 0; }
.section--alt { background: var(--bg-alt); }
.section__head { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.section__head p:not(.eyebrow) { color: var(--muted); }

.grid { display: grid; gap: 24px; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card, .path { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.card p, .path > p { color: var(--muted); }
.card__icon { font-size: 1.8rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--brand) 12%, transparent); margin-bottom: 16px; }

.path { display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s; }
.path:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.path .btn { margin-top: auto; }
.path--featured { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.path__level { align-self: flex-start; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); padding: 4px 10px; border-radius: 999px; margin-bottom: 14px; }

.checks { list-style: none; padding: 0; margin: 0 0 24px; }
.checks li { position: relative; padding-left: 28px; margin-bottom: 10px; }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--brand-2); font-weight: 800; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: none; }
.steps li { padding: 24px; border-radius: var(--radius); border: 1px dashed var(--border); }
.steps li p { color: var(--muted); margin: 0; }
.steps__num { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800; margin-bottom: 14px; }

/* Split */
.split { display: grid; gap: 48px; grid-template-columns: 1.1fr 0.9fr; align-items: center; }
.split > div > p { color: var(--muted); }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.split__visual { display: grid; place-items: center; }
.orbit { position: relative; width: min(340px, 80vw); aspect-ratio: 1; border-radius: 50%; border: 1px dashed var(--border); }
.orbit__core { position: absolute; inset: 32%; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 0 60px color-mix(in srgb, var(--brand) 50%, transparent); }
.orbit__dot {
  position: absolute; top: 50%; left: 50%; padding: 6px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); white-space: nowrap;
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(min(340px, 80vw) / -2)) rotate(calc(-1 * var(--a)));
}

/* FAQ */
details { border: 1px solid var(--border); border-radius: 12px; padding: 0 20px; margin-bottom: 12px; background: var(--surface); }
summary { cursor: pointer; font-weight: 600; padding: 18px 0; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--brand); transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { color: var(--muted); padding-bottom: 6px; }

/* CTA */
.cta { text-align: center; color: #fff; padding: clamp(40px, 7vw, 72px) clamp(20px, 5vw, 64px); border-radius: 24px; background: linear-gradient(135deg, #4f46e5, #0891b2); box-shadow: var(--shadow); }
.cta p { opacity: 0.9; max-width: 560px; margin-inline: auto; }

.btn--outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,0.7); }
.cta .hero__cta { margin: 28px 0 0; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 32px 0; }
.footer__inner { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.footer__links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer__links a { color: var(--muted); text-decoration: none; }
.footer__links a:hover { color: var(--text); }
.footer__copy { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .path { transition: none; }
}

/* ---------- Content additions ---------- */
:root { --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; --code-bg: #0f172a; --code-text: #e2e8f0; }
@media (prefers-color-scheme: dark) { :root { --code-bg: #070b18; } }

.center { text-align: center; margin-top: 40px; }
.section--tight { padding-top: clamp(32px, 5vw, 56px); }

.card--link { display: block; text-decoration: none; color: inherit; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.card--link:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brand); }
.card__more { font-weight: 600; color: var(--brand); }

.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 10px; border-radius: 999px; }
.tag--fundamentals { color: #7c3aed; background: color-mix(in srgb, #7c3aed 13%, transparent); }
.tag--stack { color: #0891b2; background: color-mix(in srgb, #0891b2 13%, transparent); }
.tag--dev { color: #059669; background: color-mix(in srgb, #059669 13%, transparent); }
@media (prefers-color-scheme: dark) {
  .tag--fundamentals { color: #c4b5fd; } .tag--stack { color: #67e8f9; } .tag--dev { color: #6ee7b7; }
}

.article-card { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: inherit; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brand); }
.article-card h3 { margin: 4px 0 0; }
.article-card p { color: var(--muted); margin: 0; }
.article-card__meta { margin-top: auto; padding-top: 8px; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.article-card[hidden] { display: none; }

/* Stack diagram */
.stack { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.stack li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.stack li span { color: var(--muted); font-size: 0.9rem; }
.stack li:nth-child(1) { border-left: 4px solid #4f46e5; }
.stack li:nth-child(2) { border-left: 4px solid #6366f1; }
.stack li:nth-child(3) { border-left: 4px solid #3b82f6; }
.stack li:nth-child(4) { border-left: 4px solid #0ea5e9; }
.stack li:nth-child(5) { border-left: 4px solid #06b6d4; }
.stack li:nth-child(6) { border-left: 4px solid #14b8a6; }
.steps li > a { display: inline-block; margin-top: 12px; font-weight: 600; text-decoration: none; }

/* Articles index */
.page-head { padding: clamp(48px, 8vw, 88px) 0 8px; }
.lead--left { margin-inline: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.filter { font: inherit; font-weight: 600; font-size: 0.9rem; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.filter:hover { color: var(--text); }
.filter.is-active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.coming-soon { margin-top: 56px; padding: 28px; border: 1px dashed var(--border); border-radius: var(--radius); }
.coming-soon h2 { font-size: 1.4rem; }
.coming-soon ul { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 12px; }
.coming-soon li { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.coming-soon p { color: var(--muted); margin: 0; }

/* Article */
.container--prose { max-width: 760px; }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.article__head { padding-top: clamp(40px, 7vw, 72px); padding-bottom: 16px; }
.article__head h1 { font-size: clamp(2rem, 5vw, 3rem); margin-top: 16px; }
.back { display: block; margin-bottom: 20px; text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.article__dek { font-size: 1.2rem; color: var(--muted); }
.article__meta { font-size: 0.9rem; color: var(--muted); font-weight: 500; padding-bottom: 24px; border-bottom: 1px solid var(--border); }

.prose { padding-bottom: 72px; font-size: 1.075rem; line-height: 1.75; }
.prose h2 { font-size: clamp(1.45rem, 3vw, 1.8rem); margin-top: 2.2em; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose ul.checks { padding-left: 0; }
.prose :not(pre) > code { font-family: var(--mono); font-size: 0.88em; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--brand) 10%, transparent); }
.prose pre { position: relative; background: var(--code-bg); color: var(--code-text); padding: 20px; border-radius: 12px; overflow-x: auto; font-size: 0.88rem; line-height: 1.6; margin: 0 0 1.4em; }
.prose pre code { font-family: var(--mono); }
.copy-btn { position: absolute; top: 8px; right: 8px; font: 600 0.75rem var(--mono); padding: 4px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); color: #e2e8f0; cursor: pointer; opacity: 0.8; }
.copy-btn:hover { opacity: 1; }

.toc { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; margin: 32px 0 8px; font-size: 0.97rem; }
.toc ol { margin: 10px 0 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.callout { border-left: 4px solid var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); padding: 16px 20px; border-radius: 0 12px 12px 0; margin: 0 0 1.4em; }
.callout--tip { border-left-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 9%, transparent); }

.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--border); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.93rem; line-height: 1.5; }
.prose th, .prose td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { background: var(--bg-alt); font-weight: 700; }
.prose tr:last-child td { border-bottom: 0; }

.flow { display: grid; gap: 14px; margin: 0 0 1.4em; }
.flow__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.flow__label { width: 100%; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand); }
.flow__step { padding: 6px 12px; border-radius: 8px; background: var(--bg-alt); border: 1px solid var(--border); font-size: 0.9rem; font-weight: 600; }
.flow__arrow { color: var(--muted); }

.next-article { margin-top: 56px; padding: 24px; border-radius: var(--radius); background: var(--bg-alt); border: 1px solid var(--border); display: grid; gap: 6px; }
.next-article span { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--muted); }
.next-article a { font-size: 1.2rem; font-weight: 700; text-decoration: none; }
.nav__links a[aria-current="page"] { color: var(--text); }

/* Before/after prompt comparison */
.compare { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0 0 1.4em; }
.compare > div > span { display: inline-block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.compare__bad > span { color: #dc2626; }
.compare__good > span { color: #059669; }
.compare pre { margin: 0; }
@media (prefers-color-scheme: dark) { .compare__bad > span { color: #f87171; } .compare__good > span { color: #6ee7b7; } }

/* Glossary */
.glossary { margin: 0 0 1.4em; }
.glossary dt { font-weight: 700; font-size: 1.08rem; margin-top: 1.2em; scroll-margin-top: 90px; }
.glossary dd { margin: 0.25em 0 0; color: var(--muted); }
.glossary dt:target { color: var(--brand); }
