/* =========================================================
   Kyle Klugewicz — site styles
   Look: a neuroscience lab notebook. Warm paper with a faint
   grid, Cajal-style ink, an action-potential red for anything
   that "fires", violet (Nissl stain) for links, and green
   (GFP) for things that passed.
   ========================================================= */

:root {
  --paper: #f3ecdd;
  --paper-hi: #fbf7ee;
  --paper-lo: #e9dfca;
  --ink: #1f1a16;
  --ink-2: #463c33;
  --ink-3: #7b6f62;
  --rule: #d8cab0;
  --grid: rgba(122, 96, 58, .085);
  --spike: #e2462c;
  --spike-soft: #f6c3b6;
  --nissl: #5a3d9a;
  --gfp: #1d8f62;
  --amber: #b86b0a;
  --marker: #ffd84d;
  --max: 1160px;
  --display: "Gloock", "Georgia", serif;
  --body: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --hand: "Caveat", "Comic Sans MS", cursive;
  --shadow: 4px 4px 0 var(--ink);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; overflow-x: clip; }
body {
  font: 17px/1.7 var(--body);
  color: var(--ink-2);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: var(--nissl); text-decoration: none; transition: color .15s; }
a:hover { color: var(--spike); }
h1, h2, h3, h4 { color: var(--ink); font-weight: 400; line-height: 1.15; }
::selection { background: var(--marker); color: var(--ink); }

.row { max-width: var(--max); margin: 0 auto; padding: 0 28px; }
section { padding: 110px 0; position: relative; }

/* highlighter-pen emphasis */
.mark {
  background: linear-gradient(transparent 55%, var(--marker) 55%, var(--marker) 92%, transparent 92%);
  padding: 0 2px; color: inherit;
}
.hand { font-family: var(--hand); font-weight: 600; }

/* ---------- Section intro (notebook tab + big headline) ---------- */
.intro { max-width: 760px; margin: 0 0 56px; }
.eyebrow {
  font: 500 13px/1.4 var(--mono); letter-spacing: .08em; text-transform: lowercase;
  color: var(--spike); margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 34px; height: 14px; flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 14'%3E%3Cpath d='M0 9h11l3-8 4 12 3-6h13' fill='none' stroke='%23e2462c' stroke-width='1.8' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}
.intro h2 { font-family: var(--display); font-size: clamp(36px, 5.6vw, 64px); letter-spacing: -0.01em; }
.intro .lead { font-size: 19px; margin-top: 18px; max-width: 620px; }

.gray {
  background-color: var(--paper-lo);
  border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
}

/* ---------- Nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(243, 236, 221, .93); backdrop-filter: blur(6px);
  border-bottom: 1.5px solid var(--ink);
}
.site-nav .inner {
  max-width: var(--max); margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; height: 64px;
}
.site-nav .brand {
  color: var(--ink); font: 22px/1 var(--display); margin-right: auto;
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
}
.site-nav .brand svg { width: 30px; height: 30px; flex-shrink: 0; transition: transform .4s; }
.site-nav .brand:hover { color: var(--ink); }
.site-nav .brand:hover svg { transform: rotate(-18deg) scale(1.08); }
.site-nav .brand:hover .soma { fill: var(--spike); }
.site-nav ul { list-style: none; display: flex; gap: 2px; }
.site-nav li { position: relative; }
.site-nav li > a, .site-nav li > button {
  display: block; padding: 8px 12px; color: var(--ink);
  font: 500 13.5px/1.5 var(--mono); text-transform: lowercase;
  background: none; border: 0; cursor: pointer; border-radius: 999px;
}
.site-nav li > a:hover, .site-nav li > button:hover { color: var(--spike); }
.site-nav li.current > a, .site-nav li.current > button { background: var(--ink); color: var(--paper); }
.site-nav .caret { font-size: 9px; margin-left: 5px; display: inline-block; transition: transform .2s; }
.has-menu.open .caret { transform: rotate(180deg); }

.dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 290px;
  background: var(--paper-hi); border: 1.5px solid var(--ink); box-shadow: var(--shadow);
  padding: 8px; opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .15s, transform .15s, visibility .15s; border-radius: 6px;
}
.has-menu:hover .dropdown, .has-menu:focus-within .dropdown, .has-menu.open .dropdown {
  opacity: 1; visibility: visible; transform: none;
}
.has-menu::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; }
.dropdown a { display: block; padding: 8px 12px; color: var(--ink); font-size: 15.5px; line-height: 1.35; border-radius: 4px; }
.dropdown a small { display: block; color: var(--ink-3); font: 12px/1.5 var(--mono); }
.dropdown a:hover { background: var(--paper-lo); color: var(--ink); }
.dropdown a.active { background: var(--spike-soft); }

.menu-toggle {
  display: none; background: var(--paper-hi); border: 1.5px solid var(--ink);
  color: var(--ink); border-radius: 6px; width: 44px; height: 38px; cursor: pointer;
  font: 600 12px var(--mono);
}

/* ---------- Recording intro (homepage, once per visit) ---------- */
.rec-intro {
  position: fixed; inset: 0; z-index: 200; background: #f7f1e3; overflow: hidden;
  transition: transform .9s cubic-bezier(.7, 0, .25, 1);
}
.rec-intro.done { transform: translateY(-104%); }
.rec-intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.rec-intro .rec-head {
  position: absolute; left: 0; right: 0; top: 0; padding: 14px 20px;
  display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  font: 500 12.5px/1.4 var(--mono); color: var(--ink-2);
  border-bottom: 1.5px solid var(--ink); background: rgba(247, 241, 227, .9);
}
.rec-intro .rec-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--spike); margin-right: 8px; animation: blink 1s steps(2) infinite; }
.rec-intro .rec-log {
  position: absolute; left: 20px; bottom: 22px; right: 20px;
  font: 500 13.5px/1.7 var(--mono); color: var(--ink); white-space: pre-wrap; max-width: 560px;
  background: rgba(247, 241, 227, .88); padding: 10px 14px; border: 1.5px solid var(--ink); border-radius: 6px;
}
.rec-intro .rec-log .ok { color: var(--gfp); }
.rec-intro .skip {
  position: absolute; right: 20px; bottom: 22px; z-index: 2;
  font: 600 13px/1 var(--mono); color: var(--paper-hi); background: var(--ink);
  border: 0; border-radius: 999px; padding: 12px 18px; cursor: pointer;
}
.rec-intro .skip:hover { background: var(--spike); }
@keyframes blink { 50% { opacity: 0; } }
@media (max-width: 640px) {
  .rec-intro .rec-log { bottom: 76px; font-size: 12px; }
}

/* ---------- Home hero ---------- */
.hero { padding: 72px 0 64px; }
.hero .row {
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 48px; align-items: center;
}
.hero .hello { font: 500 14px/1.5 var(--mono); color: var(--ink-3); margin-bottom: 18px; }
.hero .hello b { color: var(--spike); font-weight: 600; }
.hero h1 {
  font-family: var(--display); font-size: clamp(56px, 7.4vw, 106px); line-height: .92;
  letter-spacing: -0.025em;
}
.hero h1 > span { display: block; }
.hero h1 .last { padding-left: .4em; }
.hero h1 .dot { color: var(--spike); }
.roles { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; }
.roles li {
  font: 500 13px/1 var(--mono); padding: 9px 13px; border: 1.5px solid var(--ink); border-radius: 999px;
  background: var(--paper-hi); color: var(--ink);
}
.roles li:nth-child(1) { background: var(--ink); color: var(--paper-hi); }
.hero .tagline { margin: 26px 0 0; max-width: 560px; font-size: 19px; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 32px; }

.social { list-style: none; display: flex; gap: 10px; }
.social a {
  color: var(--ink); display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 1.5px solid var(--ink); border-radius: 50%; background: var(--paper-hi);
  transition: transform .15s, background .15s, color .15s;
}
.social a:hover { background: var(--spike); color: var(--paper-hi); transform: translateY(-2px); }
.social svg { width: 19px; height: 19px; fill: currentColor; }

.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border-radius: 999px;
  font: 600 14px/1.2 var(--mono); background: var(--ink); color: var(--paper-hi);
  border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--spike);
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { color: var(--paper-hi); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--spike); }
.btn.ghost { background: var(--paper-hi); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.btn.ghost:hover { color: var(--ink); box-shadow: 5px 5px 0 var(--ink); }

/* live spiking network, "Fig. 1" */
.net-fig { position: relative; margin: 0; }
.net-box {
  position: relative; background: var(--paper-hi); border: 1.5px solid var(--ink);
  border-radius: 10px; box-shadow: 6px 6px 0 var(--ink); overflow: hidden;
}
.net-box canvas { display: block; width: 100%; touch-action: manipulation; }
#network { height: 420px; cursor: crosshair; }
#raster { height: 92px; border-top: 1.5px dashed var(--rule); }
.net-hud {
  position: absolute; left: 12px; top: 10px; right: 12px; display: flex; justify-content: space-between;
  font: 500 12px/1.4 var(--mono); color: var(--ink-3); pointer-events: none;
}
.net-hud b { color: var(--spike); font-weight: 600; }
.poke {
  position: absolute; right: -6px; top: -38px; transform: rotate(4deg);
  font: 600 25px/1 var(--hand); color: var(--spike); pointer-events: none; white-space: nowrap;
}
.poke svg { width: 40px; height: 34px; vertical-align: -14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.net-fig figcaption { font-size: 14px; color: var(--ink-3); margin-top: 16px; line-height: 1.55; }
.net-fig figcaption b { font: 600 13px var(--mono); color: var(--ink); margin-right: 6px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 64px; align-items: start; }
.polaroid {
  background: #fffdf8; padding: 12px 12px 14px; border: 1px solid var(--rule);
  box-shadow: 0 10px 24px rgba(60, 40, 20, .16); rotate: -2.2deg; position: relative;
}
.polaroid::before {
  content: ""; position: absolute; top: -14px; left: 50%; width: 110px; height: 28px; margin-left: -55px;
  background: rgba(255, 216, 77, .62); transform: rotate(3deg); box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.polaroid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 26%; }
.polaroid figcaption { font: 600 24px/1.2 var(--hand); color: var(--ink); text-align: center; padding-top: 10px; }
.about-text > p { font-size: 20px; line-height: 1.75; color: var(--ink); }
.about-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 48px; }
.about-cols h3 {
  font: 600 13px/1.4 var(--mono); text-transform: lowercase; color: var(--spike); margin-bottom: 12px;
}
.info-list { list-style: none; margin-top: 16px; border-top: 1.5px solid var(--ink); }
.info-list li { padding: 10px 0; border-bottom: 1px dashed var(--rule); display: flex; gap: 12px; }
.info-list strong { color: var(--ink-3); flex: 0 0 96px; font: 500 13px/1.9 var(--mono); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; }
.chips li {
  font: 500 12.5px/1.3 var(--mono); padding: 6px 10px; border-radius: 4px;
  background: var(--paper-hi); color: var(--ink); border: 1px solid var(--ink);
}
.chips li:hover { background: var(--marker); }

/* ---------- Project cards (home) ---------- */
.proj-group + .proj-group { margin-top: 64px; }
.proj-group > h3 {
  font: 600 13px/1.4 var(--mono); text-transform: lowercase; color: var(--ink);
  display: flex; align-items: center; gap: 14px; margin-bottom: 24px;
}
.proj-group > h3::after { content: ""; flex: 1; border-top: 1.5px dashed var(--ink-3); }
.cards { display: grid; gap: 28px; }
.cards.big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.small { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.card {
  position: relative; display: flex; flex-direction: column; color: var(--ink-2);
  background: var(--paper-hi); border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s;
}
.card:hover { color: var(--ink-2); transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--ink); }
.card .media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1.5px solid var(--ink); background: var(--ink); }
.cards.small .card .media { aspect-ratio: 4 / 3; }
.card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; filter: saturate(.9); }
.card:hover .media img { transform: scale(1.05); filter: none; }
.card .tag {
  position: absolute; left: 10px; top: 10px; font: 600 11.5px/1 var(--mono);
  background: var(--paper-hi); color: var(--ink); padding: 6px 8px; border: 1.5px solid var(--ink); border-radius: 4px;
}
.card .body { padding: 20px 22px 18px; display: flex; flex-direction: column; flex: 1; }
.card .kind { font: 500 12px/1.4 var(--mono); color: var(--spike); text-transform: lowercase; }
.card h3 { font-family: var(--display); font-size: 30px; margin: 6px 0 10px; }
.cards.small .card h3 { font-size: 22px; }
.card p { font-size: 15.5px; line-height: 1.55; }
.cards.small .card p { font-size: 14.5px; }
.card .more {
  margin-top: auto; padding-top: 16px; font: 600 12.5px/1 var(--mono); color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.card .more svg { width: 52px; height: 16px; fill: none; stroke: var(--spike); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.card .more path { stroke-dasharray: 80; stroke-dashoffset: 80; transition: stroke-dashoffset .6s ease; }
.card:hover .more path { stroke-dashoffset: 0; }

/* ---------- Timeline drawn as a myelinated axon ---------- */
.timeline-group { max-width: 900px; margin: 0 0 72px; }
.timeline-group > h3 {
  font: 600 13px/1.4 var(--mono); text-transform: lowercase; color: var(--ink);
  margin-bottom: 30px; display: inline-flex; gap: 10px; align-items: center;
  background: var(--marker); padding: 4px 10px; border-radius: 3px;
}
.tl { list-style: none; position: relative; margin-left: 24px; }
.tl::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 2px; background: var(--ink); }
.tl > li { position: relative; padding: 0 0 46px 52px; }
.tl > li:last-child { padding-bottom: 0; }
/* myelin sheath between nodes */
.tl > li:not(:last-child)::before {
  content: ""; position: absolute; left: -9px; top: 58px; bottom: 10px; width: 16px; border-radius: 9px;
  background: var(--paper-hi); border: 1.5px solid var(--ink);
  background-image: linear-gradient(var(--spike-soft), var(--spike-soft));
  background-repeat: no-repeat; background-size: 100% 0%; transition: background-size .9s ease .25s;
}
.tl > li.fired:not(:last-child)::before { background-size: 100% 100%; }
/* node of Ranvier */
.tl .dot {
  position: absolute; left: -24px; top: 0; width: 46px; height: 46px; border-radius: 50%;
  background: var(--paper-hi); border: 1.5px solid var(--ink); display: grid; place-items: center; color: var(--ink);
  transition: background .25s, color .25s;
}
.tl .dot svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tl > li.fired .dot { background: var(--spike); color: var(--paper-hi); animation: fire .9s ease-out; }
@keyframes fire {
  0% { box-shadow: 0 0 0 0 rgba(226, 70, 44, .55); }
  100% { box-shadow: 0 0 0 22px rgba(226, 70, 44, 0); }
}
.tl .when { font: 500 12.5px/1.5 var(--mono); color: var(--ink-3); }
.tl h4 { font-family: var(--display); font-size: 27px; margin-top: 2px; }
.tl .role { font-weight: 700; color: var(--ink); margin: 2px 0 8px; font-size: 16px; }
.tl p { font-size: 16.5px; }
.tl .readmore { font: 600 13px/1 var(--mono); display: inline-block; margin-top: 10px; }
.tl .readmore:hover { text-decoration: underline; }
.tl .chips { margin-top: 12px; }
.axon-note {
  font: 600 22px/1.2 var(--hand); color: var(--spike); margin: -12px 0 34px; transform: rotate(-1.5deg);
}

/* ---------- Readouts (stats band) ---------- */
.stats { padding: 0 0 110px; }
.stats ul {
  list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--ink); border-radius: 10px; overflow: hidden; gap: 1px; border: 1.5px solid var(--ink);
}
.stats li { background: var(--paper-hi); padding: 22px 16px 18px; position: relative; }
.stats li::before { content: "ch" counter(stat, decimal-leading-zero); counter-increment: stat; font: 500 11px var(--mono); color: var(--ink-3); }
.stats ul { counter-reset: stat; }
.stats .num { display: block; font: 600 30px/1.2 var(--mono); color: var(--ink); margin-top: 8px; letter-spacing: -0.02em; }
.stats .lbl { font-size: 13.5px; color: var(--ink-2); line-height: 1.35; display: block; margin-top: 4px; }
.stats li:hover .num { color: var(--spike); }

/* ---------- Off the clock (polaroids) ---------- */
.beyond { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; padding-top: 10px; }
.beyond figure { background: #fffdf8; padding: 12px 12px 20px; border: 1px solid var(--rule); box-shadow: 0 10px 24px rgba(60, 40, 20, .14); position: relative; transition: rotate .25s, translate .25s, opacity .7s, transform .7s; }
.beyond figure:nth-child(1) { rotate: -2deg; }
.beyond figure:nth-child(2) { rotate: 1.6deg; translate: 0 14px; }
.beyond figure:nth-child(3) { rotate: -1deg; }
.beyond figure:hover { rotate: 0deg; translate: 0 -4px; z-index: 2; }
.beyond figure::before {
  content: ""; position: absolute; top: -12px; left: 50%; width: 90px; height: 24px; margin-left: -45px;
  background: rgba(226, 70, 44, .22); transform: rotate(-4deg);
}
.beyond figure:nth-child(2)::before { background: rgba(90, 61, 154, .22); transform: rotate(5deg); }
.beyond figure:nth-child(3)::before { background: rgba(255, 216, 77, .6); }
.beyond img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.beyond figcaption { padding: 12px 4px 0; }
.beyond h3 { font: 700 28px/1.1 var(--hand); margin-bottom: 6px; }
.beyond p { font-size: 15px; line-height: 1.55; }

/* ---------- Contact (the one dark section) ---------- */
.contact { background: var(--ink); color: #cfc5b6; border-top: 1.5px solid var(--ink); overflow: hidden; }
.contact .intro h2 { color: var(--paper-hi); }
.contact .eyebrow { color: #ff7a5c; }
.contact .big-mail {
  display: inline-block; font: clamp(20px, 5.4vw, 56px)/1.15 var(--display); color: var(--paper-hi);
  overflow-wrap: anywhere; border-bottom: 3px solid var(--spike); padding-bottom: 4px; margin-bottom: 56px;
}
.contact .big-mail:hover { color: var(--marker); border-color: var(--marker); }
.contact-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid #3a322b; }
.contact-cols > div { padding: 26px 24px 4px 0; }
.contact-cols > div + div { padding-left: 24px; border-left: 1px solid #3a322b; }
.contact-cols .icon { color: #ff7a5c; margin-bottom: 8px; display: inline-flex; }
.contact-cols .icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.contact-cols h4 { color: #9d9283; font: 500 12.5px/1.5 var(--mono); text-transform: lowercase; margin-bottom: 4px; }
.contact-cols p { color: var(--paper-hi); font-size: 18px; }
.contact-cols a { color: var(--paper-hi); border-bottom: 1px solid #6b5f52; }
.contact-cols a:hover { color: var(--marker); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink); color: #9d9283; padding: 36px 28px 44px; font: 500 13px/1.6 var(--mono);
  border-top: 1px dashed #3a322b;
}
.site-footer .inner { max-width: var(--max); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.site-footer .social a { background: transparent; color: #cfc5b6; border-color: #5a4f45; width: 40px; height: 40px; }
.site-footer .social a:hover { background: var(--spike); border-color: var(--spike); color: var(--paper-hi); }
.site-footer .flat { display: inline-flex; align-items: center; gap: 10px; }
.site-footer .flat svg { width: 90px; height: 18px; fill: none; stroke: #6b5f52; stroke-width: 1.6; stroke-linejoin: round; }
.site-footer .flat:hover svg { stroke: var(--spike); }
.site-footer .flat path { transition: d .25s; }

/* scroll reveal */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* =========================================================
   Detail pages (projects / experience)
   ========================================================= */
.page-hero { padding: 64px 0 72px; border-bottom: 1.5px solid var(--ink); }
.page-hero .row {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 56px; align-items: center;
}
.page-hero .row > * { grid-column: 1; }
.page-hero .row::after {
  content: ""; grid-column: 2; grid-row: 1 / span 6; align-self: center;
  aspect-ratio: 4 / 3; width: 100%;
  background: var(--paper-hi) var(--hero-img, url("assets/img/neuron-plate.svg")) var(--hero-pos, center) / cover no-repeat;
  border: 1.5px solid var(--ink); border-radius: 8px; box-shadow: 8px 8px 0 var(--ink); transform: rotate(1.2deg);
}
.page-hero.no-img .row { grid-template-columns: minmax(0, 1fr); }
.page-hero.no-img .row::after { display: none; }
.crumbs { font: 500 12.5px/1.5 var(--mono); margin-bottom: 22px; text-transform: lowercase; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--spike); }
.crumbs span { color: var(--rule); margin: 0 8px; }
.page-hero h1 { font-family: var(--display); font-size: clamp(40px, 6.4vw, 72px); letter-spacing: -0.02em; line-height: 1; }
.page-hero .subtitle { font-size: clamp(17px, 2vw, 20px); color: var(--ink-2); margin-top: 18px; max-width: 640px; }
.facts {
  list-style: none; display: flex; flex-wrap: wrap; gap: 14px 34px; margin-top: 30px; padding-top: 20px;
  border-top: 1.5px dashed var(--ink-3);
}
.facts li { font-size: 15.5px; color: var(--ink); }
.facts strong { display: block; font: 500 11.5px/1.6 var(--mono); text-transform: lowercase; color: var(--spike); }

.detail-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 64px; }
.prose { counter-reset: sec; }
.prose h2 {
  font: 600 13px/1.4 var(--mono); text-transform: lowercase; color: var(--spike);
  margin: 56px 0 16px; display: flex; align-items: center; gap: 12px;
}
.prose h2::before {
  counter-increment: sec; content: counter(sec, decimal-leading-zero);
  font-weight: 600; color: var(--paper-hi); background: var(--ink); border-radius: 4px; padding: 3px 7px;
}
.prose h2::after { content: ""; flex: 1; border-top: 1.5px dashed var(--rule); }
.prose h2:first-child { margin-top: 0; }
.prose p { margin-bottom: 16px; font-size: 17.5px; }
.prose p.lead { font-size: 21px; line-height: 1.7; color: var(--ink); }
.prose ul { margin: 0 0 18px 22px; }
.prose li { margin-bottom: 10px; font-size: 17px; }
.prose li::marker { color: var(--spike); }
.prose strong { color: var(--ink); }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.callout {
  background: #fff3b8; padding: 16px 20px; margin: 22px 0; font-size: 16px;
  border: 1.5px solid var(--ink); border-radius: 4px; box-shadow: 3px 3px 0 var(--ink); transform: rotate(-.4deg);
}

.aside { position: sticky; top: 96px; align-self: start; }
.aside-block { margin-bottom: 30px; }
.aside-block h4 { font: 700 26px/1.1 var(--hand); color: var(--spike); margin-bottom: 10px; transform: rotate(-2deg); transform-origin: left; }
.aside-block ul.plain { list-style: none; font-size: 15.5px; border-top: 1.5px solid var(--ink); }
.aside-block ul.plain li { padding: 7px 0; border-bottom: 1px dashed var(--rule); color: var(--ink); }

.metrics, .prose .metrics { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 4px 0 40px; }
.metrics li {
  background: var(--paper-hi); border: 1.5px solid var(--ink); padding: 16px 16px 14px; border-radius: 6px;
  box-shadow: 3px 3px 0 var(--ink); margin: 0;
}
.metrics .num { display: block; font: 600 25px/1.2 var(--mono); color: var(--ink); letter-spacing: -0.02em; }
.metrics li:nth-child(3n+1) .num { color: var(--spike); }
.metrics .lbl { font-size: 14px; color: var(--ink-2); line-height: 1.4; display: block; margin-top: 6px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px; }
.gallery figure { margin: 0; background: #fffdf8; padding: 10px 10px 14px; border: 1px solid var(--rule); box-shadow: 0 8px 20px rgba(60, 40, 20, .13); transition: transform .2s; }
.gallery figure:nth-child(3n+1) { transform: rotate(-1deg); }
.gallery figure:nth-child(3n+2) { transform: rotate(.8deg); }
.gallery figure:hover { transform: rotate(0) translateY(-3px); }
.gallery a { display: block; overflow: hidden; background: var(--ink); }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .4s; }
.gallery a:hover img { transform: scale(1.04); }
.gallery figcaption { font: 600 19px/1.25 var(--hand); color: var(--ink); padding: 10px 2px 0; }

.pager { display: grid; grid-template-columns: 1fr 1fr; border-top: 1.5px solid var(--ink); background: var(--paper-hi); }
.pager a { padding: 34px 28px; display: block; color: var(--ink); transition: background .15s; }
.pager a:hover { background: var(--marker); color: var(--ink); }
.pager a + a { text-align: right; border-left: 1.5px solid var(--ink); }
.pager small { display: block; font: 500 12.5px/1.6 var(--mono); color: var(--spike); text-transform: lowercase; }
.pager span { font: clamp(22px, 3vw, 30px)/1.15 var(--display); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(31, 26, 22, .94);
  display: none; align-items: center; justify-content: center; padding: 24px; flex-direction: column;
}
.lightbox.open { display: flex; }
.lightbox img { max-height: 82vh; max-width: 92vw; object-fit: contain; border: 8px solid #fffdf8; }
.lightbox p { color: var(--paper); margin-top: 14px; font: 600 22px/1.3 var(--hand); text-align: center; max-width: 800px; }
.lightbox button {
  position: absolute; top: 16px; right: 18px; background: var(--paper-hi); border: 1.5px solid var(--ink); color: var(--ink);
  width: 42px; height: 42px; border-radius: 50%; font-size: 26px; cursor: pointer; line-height: 1;
}

/* ---------- Detail-page analysis blocks ---------- */
.table-wrap { overflow-x: auto; margin: 8px 0 28px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--paper-hi); }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.data-table th {
  text-align: left; font: 600 11.5px/1.4 var(--mono); text-transform: lowercase;
  color: var(--paper-hi); background: var(--ink); padding: 10px 14px; white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px dashed var(--rule); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fff8dc; }
.data-table td:first-child { font-weight: 700; color: var(--ink); }
.pill {
  display: inline-block; font: 600 11px/1.4 var(--mono); text-transform: lowercase;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1.5px solid currentColor;
}
.pill.pass { background: #dff3e8; color: var(--gfp); }
.pill.partial { background: #fdf0d9; color: var(--amber); }
.pill.fail { background: #fde4dc; color: #b8301a; }
.pill.ruled-out { background: #eee9df; color: var(--ink-3); }

.fig { margin: 18px 0 32px; }
.fig a { display: block; border-radius: 6px; overflow: hidden; background: #fff; border: 1.5px solid var(--ink); }
.fig img { width: 100%; height: auto; transition: opacity .2s; }
.fig a:hover img { opacity: .92; }
.fig figcaption { font-size: 14.5px; color: var(--ink-3); margin-top: 10px; line-height: 1.5; }
.fig figcaption::before { content: "fig. "; font: 600 12px var(--mono); color: var(--spike); }
.fig-row { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 16px; margin: 18px 0 32px; }
.fig-row .fig { margin: 0; }
.fig-row .fig img { aspect-ratio: var(--ratio, auto); object-fit: cover; }
.formula {
  font: 500 15px/1.5 var(--mono); background: var(--paper-hi); border: 1.5px solid var(--ink);
  border-radius: 4px; padding: 10px 14px; display: inline-block; margin: 2px 0 18px; color: var(--ink); max-width: 100%;
}

.video-fig { margin: 10px 0 36px; }
.video-fig video {
  display: block; width: 100%; max-width: var(--video-max, 560px); margin: 0 auto;
  border-radius: 8px; background: var(--ink); border: 1.5px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
}
.video-fig figcaption { text-align: center; font-size: 14.5px; color: var(--ink-3); margin-top: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .cards.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-body { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .aside { position: static; order: -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 32px; }
}
@media (max-width: 900px) {
  .hero .row { grid-template-columns: minmax(0, 1fr); gap: 64px; }
  .about-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .polaroid { max-width: 260px; }
  .page-hero .row { grid-template-columns: minmax(0, 1fr); }
  .page-hero .row::after { grid-column: 1; grid-row: auto; margin-top: 34px; max-height: 300px; transform: rotate(.8deg); box-shadow: 5px 5px 0 var(--ink); }
}
@media (max-width: 760px) {
  section { padding: 76px 0; }
  .row { padding: 0 16px; }
  .site-nav .inner { padding: 0 16px; }
  .menu-toggle { display: block; }
  .site-nav ul {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--paper-hi); border-bottom: 1.5px solid var(--ink); padding: 8px 8px 16px;
    max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .site-nav.menu-open ul { display: flex; }
  .site-nav li > a, .site-nav li > button { padding: 12px 14px; width: 100%; text-align: left; font-size: 15px; border-radius: 6px; }
  .dropdown { position: static; opacity: 1; visibility: visible; transform: none; display: none; box-shadow: none; border: 0; padding: 0 0 8px 10px; background: transparent; min-width: 0; }
  .has-menu.open .dropdown { display: block; }
  .has-menu:hover .dropdown { display: none; }
  .has-menu.open:hover .dropdown { display: block; }
  .has-menu::after { display: none; }
  .hero { padding: 44px 0 40px; }
  .hero h1 { font-size: clamp(52px, 16vw, 92px); }
  .hero h1 .last { padding-left: .3em; }
  #network { height: 340px; }
  .poke { font-size: 21px; top: -32px; right: 0; }
  .about-text > p { font-size: 18px; }
  .about-cols, .beyond, .cards.big, .cards.small, .contact-cols { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .contact-cols { gap: 0; }
  .contact-cols > div + div { padding-left: 0; border-left: 0; border-top: 1px solid #3a322b; }
  .beyond { gap: 44px; padding: 10px 6px 0; }
  .stats { padding-bottom: 76px; }
  .stats ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .num { font-size: 25px; }
  .card h3 { font-size: 26px; }
  .pager { grid-template-columns: 1fr; }
  .pager a + a { border-left: 0; border-top: 1.5px solid var(--ink); }
  .tl { margin-left: 20px; }
  .tl > li { padding-left: 38px; }
  .tl .dot { width: 40px; height: 40px; left: -21px; }
  .tl > li:not(:last-child)::before { top: 50px; left: -8px; width: 14px; }
  .tl h4 { font-size: 23px; }
  .fig-row { grid-template-columns: minmax(0, 1fr); }
  .page-hero { padding: 40px 0 52px; }
  .prose p.lead { font-size: 19px; }
  .info-list strong { flex-basis: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .rec-intro .rec-dot { animation: none; }
  .tl > li.fired .dot { animation: none; }
}
