
:root {
  --night: #0C1535;
  --panel: #121E4A;
  --panel-edge: #2A3A7A;
  --ink: #EAF0FF;
  --quiet: #A6B3DD;
  --edge: #5E6EAA;
  --grid: #2A3772;
  --tint: rgba(170, 190, 255, 0.08);
  --learner: #43E0EE;
  --support: #FFB547;
  --fixed: #FF7EB6;
  --good: #3DDC97;
  --bad: #FF5E6E;
  --display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background-color: var(--night);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(67, 224, 238, 0.10), transparent 70%),
    linear-gradient(rgba(94, 110, 170, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 110, 170, 0.07) 1px, transparent 1px);
  background-size: 100% 900px, 32px 32px, 32px 32px;
  background-repeat: no-repeat, repeat, repeat;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--learner); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--learner); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 12px; background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Hero ---------- */
.hero { padding: 88px 24px 72px; text-align: center; border-bottom: 1px solid var(--grid); }
.chips { display: flex; align-items: flex-start; justify-content: center; margin: 0 auto 40px; }
.chip-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 112px; }
.chip {
  --c: var(--support);
  position: relative;
  width: 104px; height: 104px;
  display: grid; place-items: center;
  border: 2px solid var(--c);
  border-radius: 16px;
  background: color-mix(in srgb, var(--c) 10%, transparent);
  font-family: var(--display);
  font-weight: 700;
  font-size: 68px;
  line-height: 1;
  color: var(--ink);
  animation: chip-on 0.5s ease-out both;
}
/* microchip pins on the top and bottom edges */
.chip::before, .chip::after {
  content: ""; position: absolute; left: 18px; right: 18px; height: 8px;
  background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 14px);
  opacity: 0.8;
}
.chip::before { top: -10px; }
.chip::after { bottom: -10px; }
.chip-s { --c: var(--support); animation-delay: 0.15s; }
.chip-t { --c: color-mix(in srgb, var(--support) 62%, var(--learner)); animation-delay: 0.55s; }
.chip-e { --c: color-mix(in srgb, var(--support) 30%, var(--learner)); animation-delay: 0.95s; }
.chip-p { --c: var(--learner); animation-delay: 1.35s; }
.chip-label { font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--quiet); }
.trace { position: relative; width: 56px; height: 2px; margin-top: 51px; background: var(--edge); overflow: hidden; }
.trace::after {
  content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 100%;
  background: var(--learner);
  box-shadow: 0 0 8px var(--learner);
  animation: pulse 0.4s linear both;
}
.trace-1::after { animation-delay: 0.35s; }
.trace-2::after { animation-delay: 0.75s; }
.trace-3::after { animation-delay: 1.15s; }
@keyframes chip-on {
  from { opacity: 0.25; box-shadow: none; }
  60% { box-shadow: 0 0 28px color-mix(in srgb, var(--c) 55%, transparent); }
  to { opacity: 1; box-shadow: 0 0 14px color-mix(in srgb, var(--c) 25%, transparent); }
}
@keyframes pulse { from { left: -40%; } to { left: 110%; } }
.hero h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 4.4vw, 48px);
  line-height: 1.12;
  letter-spacing: 0.005em;
  margin: 0 auto 20px;
  max-width: 18ch;
}
.thesis { max-width: 36em; margin: 0 auto 28px; font-size: 19px; line-height: 1.6; color: var(--quiet); }
.byline { margin: 0; font-size: 15px; color: var(--quiet); line-height: 1.5; }
.byline strong { color: var(--ink); font-weight: 600; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 230px minmax(0, 740px); gap: 56px; justify-content: center; padding: 64px 24px 96px; }
nav.toc { position: sticky; top: 32px; align-self: start; font-size: 14.5px; line-height: 1.4; }
.toc-title { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--quiet); margin: 0 0 14px; }
.toc ol { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--grid); }
.toc li { position: relative; margin: 0 0 14px; }
.toc li::before {
  content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px;
  border-radius: 3px; background: var(--night); border: 2px solid var(--edge);
}
.toc a { color: var(--quiet); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc li.active::before { border-color: var(--learner); background: var(--learner); box-shadow: 0 0 8px var(--learner); }
.toc li.active a { color: var(--ink); }

article { min-width: 0; }
article section { margin: 0 0 80px; }
article h2 {
  position: relative;
  font-family: var(--display);
  font-weight: 600;
  font-size: 31px;
  line-height: 1.2;
  margin: 0 0 22px;
  padding-top: 26px;
}
/* a circuit node and trace above each section heading */
article h2::before {
  content: ""; position: absolute; top: 0; left: 0; width: 120px; height: 2px;
  background: linear-gradient(90deg, var(--learner), transparent);
}
article h2::after {
  content: ""; position: absolute; top: -4px; left: 0; width: 10px; height: 10px;
  border-radius: 3px; background: var(--learner); box-shadow: 0 0 10px var(--learner);
}
article h3 { font-size: 20px; font-weight: 600; line-height: 1.35; margin: 40px 0 10px; }
article p { margin: 0 0 18px; max-width: 68ch; }
.lead { font-size: 19.5px; line-height: 1.6; color: var(--ink); }
article ul, article ol.plain { margin: 0 0 22px; padding-left: 0; list-style: none; max-width: 68ch; }
article ul li, article ol.plain li { position: relative; padding-left: 26px; margin-bottom: 10px; }
article ul li::before {
  content: ""; position: absolute; left: 2px; top: 0.62em; width: 8px; height: 8px;
  border: 2px solid var(--learner); border-radius: 2px;
}
article ol.plain { counter-reset: n; }
article ol.plain li { counter-increment: n; padding-left: 34px; }
article ol.plain li::before {
  content: counter(n); position: absolute; left: 0; top: 0.15em;
  width: 22px; height: 22px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 13px; line-height: 1;
  color: var(--night); background: var(--learner); border-radius: 5px;
}
strong { font-weight: 600; }

/* ---------- Figures ---------- */
figure.fig {
  margin: 32px 0 36px;
  padding: 22px 22px 18px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
}
.fig-head { margin: 0 0 14px; }
.fig-num { display: block; font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--learner); margin-bottom: 2px; }
.fig-title { display: block; font-size: 17px; font-weight: 600; line-height: 1.4; }
figure.fig svg { display: block; width: 100%; height: auto; font-family: var(--body); }
figure.fig figcaption { margin-top: 12px; font-size: 15px; line-height: 1.55; color: var(--quiet); max-width: 64ch; }

.fig-art { overflow-x: auto; }
@media (min-width: 1320px) { figure.fig { margin-right: -130px; } }
@media (max-width: 640px) { .fig-art svg { min-width: 620px; } }
/* ---------- STEP definitions ---------- */
.steps { list-style: none; margin: 8px 0 28px; padding: 0; border-left: 2px solid var(--grid); }
.steps li { position: relative; padding: 0 0 22px 58px; }
.steps li:last-child { padding-bottom: 0; }
.steps .badge {
  position: absolute; left: -2px; top: 0;
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 2px solid var(--c); border-radius: 9px;
  background: color-mix(in srgb, var(--c) 14%, var(--night));
  font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1;
}
.steps .s { --c: var(--support); }
.steps .t { --c: color-mix(in srgb, var(--support) 62%, var(--learner)); }
.steps .e { --c: color-mix(in srgb, var(--support) 30%, var(--learner)); }
.steps .p { --c: var(--learner); }
.steps h4 { margin: 0 0 4px; font-family: var(--display); font-weight: 600; font-size: 20px; line-height: 38px; }
.steps p { margin: 0; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; margin: 28px 0 32px; border: 1px solid var(--panel-edge); border-radius: 12px; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 15.5px; line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: 13px 16px; }
thead th { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--quiet); background: var(--panel); border-bottom: 2px solid var(--learner); }
tbody tr + tr td { border-top: 1px solid var(--grid); }
tbody td:first-child { font-family: var(--display); font-weight: 600; font-size: 17px; white-space: nowrap; }

/* ---------- Prompt panel ---------- */
.prompt { margin: 24px 0 0; border: 1px solid var(--panel-edge); border-radius: 12px; overflow: hidden; background: #0A1130; }
.prompt-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 10px 18px; background: var(--panel); border-bottom: 1px solid var(--panel-edge); }
.prompt-name { font-family: var(--display); font-weight: 600; font-size: 15px; }
.copy-btn {
  font: 500 14px var(--body); color: var(--night); background: var(--learner);
  border: 0; border-radius: 7px; padding: 7px 14px; cursor: pointer;
}
.copy-btn:hover { background: #7AEAF4; }
.prompt pre { margin: 0; padding: 20px 22px; font-family: var(--mono); font-size: 14px; line-height: 1.65; color: #D7E0FF; white-space: pre-wrap; word-wrap: break-word; }

/* ---------- References ---------- */
.refs p { padding-left: 2em; text-indent: -2em; font-size: 16px; line-height: 1.6; margin-bottom: 14px; }
.refs a { word-break: break-all; }

footer { border-top: 1px solid var(--grid); padding: 28px 24px 40px; text-align: center; font-size: 14px; color: var(--quiet); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 740px); gap: 0; padding-top: 48px; }
  nav.toc { position: static; margin-bottom: 48px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 12px; }
}
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .hero { padding: 56px 16px 48px; }
  .chip-wrap { width: 64px; gap: 10px; }
  .chip { width: 58px; height: 58px; font-size: 36px; border-radius: 11px; }
  .chip::before, .chip::after { left: 10px; right: 10px; height: 6px; background: repeating-linear-gradient(90deg, var(--c) 0 3px, transparent 3px 9px); }
  .chip::before { top: -8px; } .chip::after { bottom: -8px; }
  .trace { width: 18px; margin-top: 28px; }
  .chip-label { font-size: 14px; }
  .thesis { font-size: 17px; }
  .layout { padding: 36px 16px 64px; }
  figure.fig { padding: 16px 12px 14px; margin-left: -4px; margin-right: -4px; }
  article h2 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chip, .trace::after { animation: none; }
  .trace::after { display: none; }
}

/* ---------- Print ---------- */
@media print {
  :root {
    --night: #fff; --panel: #fff; --panel-edge: #bbb; --ink: #111; --quiet: #444;
    --edge: #888; --grid: #ccc; --tint: rgba(0,0,0,0.05);
    --learner: #0A7F8C; --support: #C77700; --fixed: #C2185B; --good: #1B8A5A; --bad: #C62828;
  }
  body { background: #fff; font-size: 11.5pt; }
  .hero { padding: 24px 0; }
  .chip, .trace::after { animation: none; box-shadow: none; }
  nav.toc, .copy-btn, .skip { display: none; }
  .layout { display: block; padding: 0; }
  article h2::after { box-shadow: none; }
  figure.fig, .table-wrap, .steps li { break-inside: avoid; }
  .prompt { background: #fff; }
  .prompt pre { color: #111; }
  a { color: #111; }
}

/* ---------- site additions ---------- */
:root { --fixed: #FF8A5C; }
.topnav { display:flex; gap:22px; align-items:center; padding:14px 24px; border-bottom:1px solid var(--grid); font-size:14.5px; }
.topnav .brand { font-family: var(--display); font-weight:700; font-size:18px; color: var(--ink); text-decoration:none; letter-spacing:0.04em; margin-right:8px; }
.topnav a { color: var(--quiet); text-decoration:none; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--ink); }
.topnav a[aria-current="page"] { border-bottom: 2px solid var(--learner); padding-bottom:2px; }
.topnav .ext { margin-left:auto; }
.kicker { font-family: var(--display); font-weight:600; font-size:16px; color: var(--learner); margin:0 0 10px; letter-spacing:0.02em; }
.status { max-width: 40em; margin: 22px auto 0; padding: 12px 18px; font-size: 14.5px; line-height:1.55; color: var(--quiet); border: 1px solid var(--panel-edge); border-radius: 10px; background: var(--panel); }
.hero-small { padding: 56px 24px 40px; }
.layout.one { grid-template-columns: minmax(0, 760px); }
a.cite { color: var(--learner); text-decoration: none; border-bottom: 1px dotted var(--edge); }
a.cite:hover { border-bottom-style: solid; }
.dialogue { margin: 18px 0 22px; padding: 4px 0 4px 18px; border-left: 2px solid var(--learner); }
.dialogue .turn { margin: 0 0 12px; max-width: 64ch; }
.dialogue .who { display:block; font-family: var(--display); font-weight:600; font-size:13px; color: var(--quiet); margin-bottom:2px; }
.dialogue .assistant .who { color: var(--learner); }
.table-cap { font-size: 15px; color: var(--quiet); margin: -22px 0 10px; max-width: 68ch; }
.table-cap + .table-cap { margin-top: -4px; margin-bottom: 26px; }
figure.fig svg { font-family: var(--body); }
.ref { padding-left: 2em; text-indent: -2em; font-size: 16px; line-height: 1.6; margin-bottom: 16px; scroll-margin-top: 24px; }
.ref:target { background: rgba(67,224,238,0.08); border-radius: 6px; outline: 1px solid var(--panel-edge); padding-top: 8px; padding-bottom: 8px; }
.ref a.back { font-size: 13px; color: var(--quiet); text-decoration: none; margin-left: 6px; white-space: nowrap; }
.ref a.back:hover { color: var(--ink); }
@media print { .topnav, .toc, .copy-btn { display: none; } a.cite { color: #111; border: 0; } }
