:root {
  --ink: #111827;
  --muted: #5b6472;
  --line: #dce2e9;
  --soft: #f4f7fa;
  --blue: #075fd8;
  --blue-soft: #eaf3ff;
  --green: #087a55;
  --amber: #8a4b05;
  --paper: #ffffff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.7 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: .65rem 1rem;
  color: #fff;
  background: #000;
  border-radius: .5rem;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
}

.nav-shell,
.page-shell,
.footer-shell {
  width: min(100% - 2rem, 1080px);
  margin-inline: auto;
}

.nav-shell {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -.035em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: #fff;
  background: #111;
  border-radius: 7px;
  font: 800 13px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.nav-links { display: flex; align-items: center; gap: 1.25rem; }
.nav-links a { color: #4b5563; font-size: .9rem; font-weight: 650; text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: #000; }

.page-shell { padding-block: 3.5rem 5rem; }

.eyebrow {
  margin: 0 0 .8rem;
  color: var(--blue);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.035em; }
h1 { max-width: 820px; margin: 0 0 1rem; font-size: clamp(2.4rem, 7vw, 4.6rem); }
h2 { margin: 3.25rem 0 1rem; font-size: clamp(1.65rem, 4vw, 2.25rem); }
h3 { margin: 1.8rem 0 .55rem; font-size: 1.22rem; }
p, li { max-width: 76ch; }
.lede { max-width: 760px; margin: 0; color: #3f4a59; font-size: 1.15rem; }

.meta-row { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin-top: 1.5rem; color: var(--muted); font-size: .9rem; }
.meta-row a { color: inherit; }

.summary-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin-top: 2.25rem;
}

.stat,
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.stat { padding: 1rem; }
.stat b { display: block; margin-top: .2rem; font-size: 1.05rem; }
.stat span { color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 3.5rem;
  align-items: start;
  margin-top: 3.5rem;
}

.article { min-width: 0; }
.article > :first-child { margin-top: 0; }
.article ul, .article ol { padding-left: 1.35rem; }
.article li + li { margin-top: .45rem; }

.toc {
  position: sticky;
  top: 90px;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
}
.toc strong { display: block; margin-bottom: .65rem; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }
.toc a { display: block; padding: .3rem 0; color: var(--muted); font-size: .88rem; text-decoration: none; }
.toc a:hover { color: var(--blue); }

.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid #bcd8ff;
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  background: var(--blue-soft);
}
.callout.warning { border-color: #f0d29e; border-left-color: #c96c0b; background: #fff7e8; }
.callout.success { border-color: #a9dec8; border-left-color: var(--green); background: #edf9f4; }
.callout p { margin: 0; }

pre {
  position: relative;
  overflow-x: auto;
  margin: 1.15rem 0;
  padding: 1.15rem 1.25rem;
  border-radius: 12px;
  color: #e5edf6;
  background: #10151c;
  font: .9rem/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
p code, li code, td code {
  padding: .1rem .32rem;
  border: 1px solid #d9e0e7;
  border-radius: 5px;
  color: #b42318;
  background: #f7f8fa;
  font-size: .9em;
}

.table-wrap { overflow-x: auto; margin: 1.25rem 0; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--soft); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

.steps { counter-reset: step; padding: 0; list-style: none; }
.steps > li { position: relative; padding: 0 0 1.6rem 3.2rem; }
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: -.15rem;
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  color: #fff;
  background: #111;
  border-radius: 50%;
  font-weight: 800;
}
.steps h3 { margin-top: 0; }

.card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { display: block; padding: 1.15rem; color: inherit; text-decoration: none; }
.card:hover { border-color: #8ebdf8; box-shadow: 0 10px 28px rgba(20, 62, 110, .08); }
.card small { color: var(--blue); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.card h3 { margin: .4rem 0; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }

.source-list { padding: 0; list-style: none; }
.source-list li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.source-list li:last-child { border-bottom: 0; }
.source-list span { display: block; color: var(--muted); font-size: .88rem; }

.byline {
  margin-top: 3rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}
.byline strong { display: block; margin-bottom: .25rem; }
.byline p { margin: 0; color: var(--muted); font-size: .92rem; }

.site-footer { border-top: 1px solid var(--line); }
.footer-shell { display: flex; justify-content: space-between; gap: 1.5rem; padding-block: 2rem; color: var(--muted); font-size: .88rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-links a { color: inherit; }

@media (max-width: 820px) {
  .nav-links a:nth-child(-n+2) { display: none; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .toc { position: static; order: -1; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .page-shell { padding-block: 2.5rem 4rem; }
  .nav-links { gap: .8rem; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .footer-shell { flex-direction: column; }
}
