/* =========================================================
   Shaikh Zaka Tabish — portfolio
   Palette: deep graphite "AI lab", electric indigo + signal cyan
   Type: IBM Plex superfamily (serif display / sans UI / mono data)
   ========================================================= */

:root {
  --paper:      #F5F6FA;
  --paper-2:    #EBEDF5;
  --ink:        #12131C;
  --mute:       #5B6076;
  --rule:       #DBDEEA;
  --accent:     #5645D6;
  --accent-lo:  #ECE9FC;
  --accent2:    #0C8C86;
  --accent2-lo: #E1F5F2;
  --ok:         #17944B;
  --card:       #FFFFFF;
  --shadow:     0 1px 0 var(--rule);

  --f-sans: "IBM Plex Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --f-serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --rail-w: 232px;
  --pad: clamp(1.25rem, 4vw, 4rem);
  --maxw: 68rem;

  --t: 220ms cubic-bezier(.2, .7, .3, 1);
}

[data-theme="dark"] {
  --paper:      #0A0C13;
  --paper-2:    #10131D;
  --ink:        #E7E9F5;
  --mute:       #8991AC;
  --rule:       #212537;
  --accent:     #8B7DFF;
  --accent-lo:  #191531;
  --accent2:    #3FE0D0;
  --accent2-lo: #0E211F;
  --ok:         #4ADE93;
  --card:       #12151F;
  --shadow:     0 1px 0 var(--rule);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 1.0625rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

h1, h2, h3 { font-family: var(--f-serif); font-weight: 500; line-height: 1.18; letter-spacing: -.012em; margin: 0; }
p { margin: 0 0 1em; }
a { color: inherit; }
img, canvas, svg { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; top: .5rem; left: .5rem; z-index: 999;
  transform: translateY(-160%);
  background: var(--ink); color: var(--paper);
  padding: .6rem 1rem; border-radius: 6px; text-decoration: none;
  transition: transform var(--t);
}
.skip:focus { transform: none; }

/* faint neural-grid backdrop utility */
.gridbg {
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--accent) 22%, transparent) 1px, transparent 0);
  background-size: 26px 26px;
}

/* ── buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: 500 .95rem/1 var(--f-sans);
  padding: .78rem 1.15rem;
  border-radius: 7px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  background: none; color: inherit;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.btn--solid { background: var(--accent); color: #fff; }
[data-theme="dark"] .btn--solid { color: #0A0C13; }
.btn--solid:hover { background: var(--ink); color: var(--paper); }
[data-theme="dark"] .btn--solid:hover { background: var(--accent2); color: #0A0C13; }

.btn--outline { border-color: var(--rule); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }

.btn--ghost { color: var(--mute); padding: .5rem .6rem; }
.btn--ghost:hover { color: var(--ink); }

.btn--sm { font-size: .85rem; padding: .55rem .8rem; }

.btn kbd {
  font: 500 .72rem/1 var(--f-mono);
  border: 1px solid var(--rule); border-radius: 4px;
  padding: .16rem .3rem;
}

.linkbtn {
  font: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent);
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ── side rail ───────────────────────────────────────── */
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: var(--rail-w);
  padding: 1.6rem 1.4rem;
  display: flex; flex-direction: column; gap: 2rem;
  background: var(--paper);
  border-right: 1px solid var(--rule);
}

.rail__mark { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.rail__mark svg { width: 30px; height: 30px; flex: none; }
.rail__mark svg rect { fill: var(--accent); stroke: none; }
.rail__mark svg path { fill: none; stroke: var(--accent2); stroke-width: 2.6; stroke-linecap: round; }
.rail__name { font-family: var(--f-serif); font-size: 1.02rem; }

.rail__nav { display: flex; flex-direction: column; gap: .1rem; margin-top: -.6rem; }
.rail__nav a {
  text-decoration: none; color: var(--mute);
  font-size: .95rem; padding: .34rem 0 .34rem .8rem;
  border-left: 2px solid transparent;
  transition: color var(--t), border-color var(--t);
}
.rail__nav a:hover { color: var(--ink); }
.rail__nav a[aria-current="true"] { color: var(--ink); border-left-color: var(--accent2); }

.rail__foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }

.railToggle { display: none; }

/* ── layout ──────────────────────────────────────────── */
main { margin-left: var(--rail-w); }

.section, .hero, .band {
  padding-inline: var(--pad);
  max-width: calc(var(--maxw) + var(--pad) * 2);
}

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }

.section__head { max-width: 46rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section__head h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); margin-bottom: .5rem; }
.section__head p { color: var(--mute); max-width: 40rem; margin: 0; }
.section__eyebrow {
  display: block; font: 500 .78rem/1 var(--f-mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent2); margin-bottom: .8rem;
}

/* ── hero ────────────────────────────────────────────── */
.hero {
  display: grid; gap: clamp(2rem, 5vw, 3.5rem);
  grid-template-columns: 1fr;
  align-items: center;
  padding-block: clamp(3rem, 9vh, 6rem) clamp(2.5rem, 6vw, 4rem);
  min-height: min(92vh, 780px);
}

.hero__id {
  font: 500 .9rem/1 var(--f-mono);
  color: var(--mute);
  letter-spacing: .04em;
  margin-bottom: 1.4rem;
}
.hero__id::before {
  content: ""; display: inline-block;
  width: 1.8rem; height: 1px; background: var(--accent2);
  vertical-align: middle; margin-right: .7rem;
}

.hero__line {
  font-size: clamp(2.15rem, 5.6vw, 3.9rem);
  max-width: 18ch;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
.hero__line em { font-style: normal; color: var(--accent); }

.hero__sub { color: var(--mute); max-width: 46ch; font-size: 1.06rem; }

.hero__actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }

/* hero neural net visual */
.net { margin: 0; }
.net canvas {
  display: block; width: 100%; height: auto;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px 12px 0 0;
  border-bottom: 0;
  touch-action: pan-y;
}
.net__readout {
  display: flex; flex-wrap: wrap; gap: .1rem 1.6rem;
  padding: .7rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 0 0 12px 12px;
  background: var(--paper-2);
  font: 400 .8rem/1.7 var(--f-mono);
}
.rd { display: inline-flex; align-items: baseline; gap: .5rem; }
.rd b { color: var(--mute); font-weight: 400; letter-spacing: .08em; }
.rd data { color: var(--ink); }
.rd--state { margin-left: auto; }

.led {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mute); display: inline-block;
  align-self: center;
}
.led[data-state="boot"]  { background: var(--accent2); animation: blink 1s steps(1) infinite; }
.led[data-state="lock"]  { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
@keyframes blink { 50% { opacity: .25; } }

.net__hint { font-size: .82rem; color: var(--mute); margin: .7rem 0 0; max-width: 62ch; }
.net__hint span { display: block; margin-top: .35rem; opacity: .82; }

/* the rotating line under the hero net — changes on every training cycle,
   so it needs to hold its own height or the section below it jumps */
.net__quote {
  margin: .85rem 0 0;
  padding-left: .9rem;
  border-left: 2px solid var(--accent2);
  font-family: var(--f-serif);
  font-style: italic;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--ink);
  min-height: 2.9em;
  max-width: 46ch;
}

/* ── status band ─────────────────────────────────────── */
.band {
  padding-block: clamp(1.6rem, 3vw, 2.2rem);
  border-block: 1px solid var(--rule);
  background: var(--paper-2);
  max-width: none;
}
.status {
  display: grid; gap: 1.2rem 2.5rem; margin: 0;
  grid-template-columns: 1fr;
  max-width: var(--maxw);
}
.status dt {
  font: 400 .74rem/1 var(--f-mono);
  color: var(--mute); letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .35rem;
}
.status dd { margin: 0; font-size: .96rem; }
.status dd.is-target { color: var(--accent2); }

/* ── experience track ────────────────────────────────── */
.track { list-style: none; margin: 0; padding: 0; }

.track__item {
  display: grid; gap: .6rem 2.5rem;
  grid-template-columns: 1fr;
  padding-block: clamp(1.6rem, 3vw, 2.4rem);
  border-top: 1px solid var(--rule);
}
.track__item:last-child { border-bottom: 1px solid var(--rule); }

.track__when {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
  font: 400 .84rem/1.5 var(--f-mono);
  color: var(--mute);
}
.track__dash { width: 1.1rem; height: 1px; background: var(--rule); }
.track__when em { font-style: normal; color: var(--accent2); flex-basis: 100%; }

.track__what h3 { font-size: 1.28rem; margin-bottom: .25rem; }
.track__org { color: var(--accent); font-size: .92rem; margin-bottom: .9rem; }
.track__what ul { margin: 0; padding-left: 1.1rem; color: var(--mute); }
.track__what li { margin-bottom: .5rem; max-width: 62ch; }
.track__what li::marker { color: var(--accent2); }
.track__what abbr { text-decoration: none; border-bottom: 1px dotted currentColor; cursor: help; }

.track__item--edu .track__what ul { display: none; }
.track__item--edu .track__org { margin-bottom: 0; }

/* ── featured projects ───────────────────────────────── */
.feature { display: grid; gap: 1.1rem; grid-template-columns: 1fr; margin-bottom: clamp(2.5rem, 5vw, 4rem); }

.feature__item {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: clamp(1.3rem, 3vw, 1.9rem);
}
.feature__item h3 { font-size: 1.3rem; margin-bottom: .4rem; }
.feature__meta { font: 400 .8rem/1.5 var(--f-mono); color: var(--accent); margin-bottom: 1rem; }
.feature__item p { color: var(--mute); max-width: 62ch; }
.feature__note { font-size: .87rem; color: var(--mute); font-style: italic; margin-bottom: 0; }

/* the standfirst line under a project's tech stack — who, where, when */
.feature__sub {
  font-size: .93rem; line-height: 1.6;
  color: var(--mute); max-width: 66ch;
  margin: -.4rem 0 0;
  padding-left: .85rem;
  border-left: 2px solid var(--rule);
}

/* the three user-role columns in the waste-management case study */
.portals { display: grid; gap: .8rem; grid-template-columns: 1fr; margin-top: .3rem; }
.portal {
  background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: 10px; padding: .85rem 1rem;
}
.portal h4 {
  font: 500 .74rem/1 var(--f-mono); letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent2); margin: 0 0 .45rem;
}
.portal p { font-size: .89rem; line-height: 1.6; margin: 0; color: var(--mute); }
@media (min-width: 720px) { .portals { grid-template-columns: repeat(3, 1fr); } }

.case__block li b, .case__block p b { color: var(--ink); font-weight: 500; }
.case__block code {
  font: 400 .84em/1 var(--f-mono);
  background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: 4px; padding: .1em .35em;
  color: var(--ink);
}
.feature__links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }

.feature__item--open { border-left: 3px solid var(--accent2); }

.feature__stats { display: flex; flex-wrap: wrap; gap: 1.6rem; margin-bottom: 1rem; }
.feature__stats span { font-size: .87rem; color: var(--mute); }
.feature__stats b { display: block; font: 500 1.5rem/1.2 var(--f-serif); color: var(--ink); }

/* ── waste-management live dashboard ─────────────────── */
.dash {
  margin-top: 1.4rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 14px;
  overflow: hidden;
}
.dash__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--rule);
}
.dash__title { font: 500 .8rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
.dash__title b { color: var(--ink); text-transform: none; letter-spacing: 0; font-family: var(--f-serif); font-size: 1.05rem; }
.dash__live { display: inline-flex; align-items: center; gap: .4rem; font: 400 .76rem/1 var(--f-mono); color: var(--ok); margin-left: auto; }
.dash__live i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: blink 1.4s steps(1) infinite; }
.dash__note { flex-basis: 100%; font-size: .78rem; color: var(--mute); margin: 0; }

.dash__body {
  display: grid; grid-template-columns: 1fr; gap: 0;
}
.dash__map { position: relative; height: 340px; background: var(--paper-2); }
.dash__map .leaflet-container { height: 100%; width: 100%; background: var(--paper-2); font-family: var(--f-sans); }
[data-theme="dark"] .dash__map .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.92) saturate(.85); }
.dash__van {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; border: 2px solid var(--card);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  font-size: 13px;
}
.dash__bin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.dash__side { padding: 1.1rem 1.3rem; border-top: 1px solid var(--rule); }
.dash__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin-bottom: 1rem; }
.dash__stat { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 9px; padding: .7rem .8rem; }
.dash__stat b { display: block; font: 500 1.35rem/1.2 var(--f-serif); }
.dash__stat span { font: 400 .72rem/1.5 var(--f-mono); color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.dash__chart { height: 150px; margin-bottom: 1rem; }
.dash__log { list-style: none; margin: 0; padding: 0; max-height: 130px; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; }
.dash__log li { font: 400 .78rem/1.5 var(--f-mono); color: var(--mute); border-left: 2px solid var(--rule); padding-left: .6rem; }
.dash__log li b { color: var(--ink); font-weight: 500; }
.dash__log li.is-alert { border-left-color: var(--accent2); color: var(--ink); }

.projects__more { margin: 1.6rem 0 0; }

/* ── home hub ────────────────────────────────────────── */
.hub { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.hub__card {
  display: block; background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  padding: 1.3rem 1.4rem; text-decoration: none;
  transition: border-color var(--t), transform var(--t);
}
.hub__card:hover { border-color: var(--accent); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .hub__card:hover { transform: translateY(-2px); }
}
.hub__card h3 { font-size: 1.15rem; margin-bottom: .4rem; }
.hub__card p { color: var(--mute); margin: 0 0 .9rem; font-size: .92rem; max-width: 34ch; }
.hub__card span { font: 500 .82rem/1 var(--f-mono); color: var(--accent); }

/* ── project case studies ────────────────────────────── */
.case { margin-top: 1.3rem; display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
.case__label {
  display: block; font: 500 .72rem/1 var(--f-mono); letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent); margin-bottom: .4rem;
}
.case__block p { color: var(--mute); max-width: 68ch; margin: 0; }
.case__block ul { margin: .3rem 0 0; padding-left: 1.1rem; color: var(--mute); }
.case__block li { margin-bottom: .35rem; max-width: 64ch; }
.case__block li::marker { color: var(--accent2); }

.flow {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: 1.1rem; margin: .3rem 0 1rem;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px;
}
.flow__node {
  flex: 1 1 8rem; min-width: 8rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 9px;
  padding: .65rem .8rem; text-align: center;
}
.flow__node b { display: block; font: 600 .84rem/1.3 var(--f-sans); color: var(--ink); }
.flow__node span { display: block; font: 400 .72rem/1.4 var(--f-mono); color: var(--mute); margin-top: .15rem; }
.flow__group { display: flex; flex-direction: column; gap: .4rem; flex: 1 1 8rem; }
.flow__arrow { flex: none; color: var(--mute); font-size: 1.05rem; }

/* ── playground ──────────────────────────────────────── */
.section--playground { background: var(--paper-2); border-block: 1px solid var(--rule); max-width: none; }
.section--playground > * { max-width: var(--maxw); }

.demos { display: grid; gap: 1.6rem; grid-template-columns: 1fr; }

.demo {
  background: var(--card); border: 1px solid var(--rule); border-radius: 14px;
  padding: clamp(1.2rem, 3vw, 1.8rem);
}
.demo__head { margin-bottom: 1.2rem; }
.demo__tag {
  display: inline-block; font: 500 .72rem/1 var(--f-mono); letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent2);
  padding: .3rem .55rem; border: 1px solid var(--accent2); border-radius: 5px;
  margin-bottom: .7rem;
}
.demo__head h3 { font-size: 1.4rem; margin-bottom: .4rem; }
.demo__head p { color: var(--mute); max-width: 58ch; margin: 0; }
.demo__head p + p { margin-top: .75rem; }
.demo__head p b { color: var(--ink); font-weight: 500; }
.demo__head p em { font-style: italic; }

.demo__note {
  margin: 1rem 0 0; font-size: .87rem; line-height: 1.6;
  color: var(--mute); max-width: 62ch;
}
.demo__note b { color: var(--ink); font-weight: 500; }

.demo__quote {
  margin: 1.2rem 0 0; padding: .9rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-lo);
  border-radius: 0 8px 8px 0;
  font: 500 italic 1rem/1.5 var(--f-serif);
  color: var(--ink);
}
.demo__quote cite { display: block; margin-top: .4rem; font: 400 normal .78rem/1 var(--f-mono); color: var(--mute); font-style: normal; }

.demo__stage { display: grid; gap: 1.2rem; grid-template-columns: 1fr; align-items: start; }

/* digit recogniser */
.digitpad { display: flex; flex-direction: column; gap: 1.2rem; }
.digitpad__canvas-wrap { position: relative; flex: none; display: flex; flex-direction: column; gap: .6rem; }
.digitpad__result { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .8rem; }
#digitCanvas {
  display: block; width: 100%; aspect-ratio: 1; max-width: 260px;
  background: #000; border: 1px solid var(--rule); border-radius: 10px;
  cursor: crosshair; touch-action: none;
}
[data-theme="light"] #digitCanvas, :root:not([data-theme="dark"]) #digitCanvas { background: #0A0C13; }
.digitpad__acts { display: flex; gap: .5rem; }
.digitpad__status { font: 400 .8rem/1.5 var(--f-mono); color: var(--mute); min-height: 2.4em; }
.digitpad__status b { color: var(--ink); }

.digitbars { display: flex; flex-direction: column; gap: .3rem; }
.digitbar { display: grid; grid-template-columns: 1.2rem 1fr 3rem; align-items: center; gap: .5rem; }
.digitbar__label { font: 500 .82rem/1 var(--f-mono); text-align: center; }
.digitbar__track { height: 9px; background: var(--paper-2); border-radius: 5px; overflow: hidden; }
.digitbar__fill { display: block; height: 100%; background: var(--rule); transition: width 180ms ease, background var(--t); width: 0%; }
.digitbar.is-top .digitbar__fill { background: var(--accent2); }
.digitbar.is-top .digitbar__label { color: var(--accent2); }
.digitbar__val { font: 400 .74rem/1 var(--f-mono); color: var(--mute); text-align: right; }

.netviz { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; }
.netviz__thumbwrap { display: flex; flex-direction: column; align-items: center; gap: .35rem; flex: none; }
.netviz__thumbwrap canvas {
  width: 40px; height: 40px; image-rendering: pixelated;
  border: 1px solid var(--rule); border-radius: 4px; background: #05070C;
}
.netviz__arrow { color: var(--mute); flex: none; font-size: 1rem; }
.netviz__label { font: 400 .68rem/1 var(--f-mono); color: var(--mute); }
#digitNetCanvas {
  flex: 1; min-width: 0; width: 100%; height: 168px;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px;
}

.netctrl { display: flex; flex-direction: column; gap: .5rem; }
.netctrl__row { display: flex; align-items: center; gap: .5rem; font: 400 .78rem/1 var(--f-mono); color: var(--mute); }
.netctrl__row span { flex: 1; }
.netctrl__row b { min-width: 1.7rem; text-align: center; color: var(--ink); font-weight: 500; }
.netctrl__btn {
  width: 22px; height: 22px; border-radius: 5px; padding: 0;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  cursor: pointer; font: 500 .95rem/1 var(--f-mono);
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--t), color var(--t);
}
.netctrl__btn:hover { border-color: var(--accent); color: var(--accent); }
.netctrl__btn:disabled { opacity: .4; cursor: default; }

.trainbar { display: flex; align-items: center; gap: .8rem; margin-top: .6rem; }
.trainbar__track { flex: 1; height: 8px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.trainbar__fill { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 160ms linear; }
.trainbar__val { font: 400 .78rem/1 var(--f-mono); color: var(--mute); min-width: 6.5rem; text-align: right; }

/* decision-boundary playground */
.dbplay { display: grid; gap: 1rem; grid-template-columns: 1fr; }
#dbCanvas { display: block; width: 100%; aspect-ratio: 1; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 10px; cursor: crosshair; }
.dbplay__side { display: flex; flex-direction: column; gap: .9rem; }
.dbplay__row { display: flex; flex-wrap: wrap; gap: .5rem; }
.dbplay__stat { font: 400 .82rem/1.6 var(--f-mono); color: var(--mute); }
.dbplay__stat b { color: var(--ink); }
.dbplay__legend { display: flex; gap: 1rem; font: 400 .78rem/1 var(--f-mono); color: var(--mute); }
.dbplay__legend span { display: inline-flex; align-items: center; gap: .35rem; }
.dbplay__legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* MCP explainer */
.mcpviz { display: grid; gap: 1.4rem; grid-template-columns: 1fr; }
.mcpviz__stage { position: relative; min-height: 300px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-2); overflow: hidden; }
.mcpnode {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: .2rem;
  width: 108px; padding: .6rem .5rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  font: 400 .72rem/1.35 var(--f-mono); color: var(--mute);
  transition: border-color 200ms, box-shadow 200ms, transform 200ms;
}
.mcpnode b { font-family: var(--f-sans); font-size: .82rem; color: var(--ink); font-weight: 600; }
.mcpnode.is-active { border-color: var(--accent2); box-shadow: 0 0 0 3px var(--accent2-lo); transform: translateY(-2px); }
.mcpedge { position: absolute; height: 2px; background: var(--rule); transform-origin: left center; }
.mcpedge.is-active { background: var(--accent2); }
.mcppacket {
  position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent2);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent2) 80%, transparent);
  opacity: 0; top: 0; left: 0;
}
.mcpviz__log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; font: 400 .82rem/1.5 var(--f-mono); }
.mcpviz__log li { padding-left: .7rem; border-left: 2px solid var(--rule); color: var(--mute); }
.mcpviz__log li.is-now { border-left-color: var(--accent2); color: var(--ink); }
.mcpviz__ctrl { display: flex; gap: .5rem; align-items: center; }

/* RL pong */
.pong { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
#pongCanvas { display: block; width: 100%; aspect-ratio: 5/3; background: #05070C; border: 1px solid var(--rule); border-radius: 10px; }
.pong__side { display: flex; flex-direction: column; gap: 1rem; }
.pong__stages { display: flex; flex-wrap: wrap; gap: .4rem; }
.stagebtn {
  font: 400 .78rem/1 var(--f-mono); padding: .5rem .7rem; border-radius: 20px;
  border: 1px solid var(--rule); background: var(--card); color: var(--mute); cursor: pointer;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.stagebtn:hover { border-color: var(--accent); color: var(--ink); }
.stagebtn[aria-pressed="true"] { background: var(--accent-lo); border-color: var(--accent); color: var(--accent); }
.pong__curve { height: 90px; }
.pong__readout { font: 400 .82rem/1.6 var(--f-mono); color: var(--mute); }
.pong__readout b { color: var(--ink); }
.pong__score { display: flex; gap: 1.6rem; }
.pong__score span { display: flex; flex-direction: column; }
.pong__score b { font: 500 1.4rem/1.2 var(--f-serif); }
.pong__score small { font: 400 .7rem/1.4 var(--f-mono); color: var(--mute); letter-spacing: .06em; text-transform: uppercase; }

/* ── a pulled quote from a written reference, inside a timeline entry ── */
.track__quote {
  margin: .9rem 0 0;
  padding: .75rem .95rem;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent2);
  border-radius: 0 9px 9px 0;
  font-family: var(--f-serif);
  font-style: italic;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: 62ch;
}
.track__quote span {
  display: block; margin-top: .45rem;
  font: 400 normal .72rem/1.5 var(--f-mono);
  font-style: normal;
  color: var(--mute);
}
.track__quote a { color: var(--accent); }

/* ── credentials grid ────────────────────────────────── */
.creds { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 760px)  { .creds { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1360px) { .creds { grid-template-columns: repeat(3, 1fr); } }

.cred {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--rule);
  border-radius: 12px;
  padding: 1.15rem 1.25rem 1.05rem;
  transition: border-color var(--t);
}
.cred:hover { border-color: var(--accent); }
.cred--ref  { border-top-color: var(--accent); }
.cred--edu  { border-top-color: var(--accent2); }
.cred--lang { border-top-color: var(--ok); }

.cred__top {
  display: flex; align-items: baseline; justify-content: space-between; gap: .8rem;
  margin-bottom: .6rem;
}
.cred__kind {
  font: 500 .68rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
.cred--edu  .cred__kind { color: var(--accent2); }
.cred--lang .cred__kind { color: var(--ok); }
.cred__date { font: 400 .72rem/1 var(--f-mono); color: var(--mute); white-space: nowrap; }

.cred h3 { font-size: 1.06rem; line-height: 1.35; margin: 0 0 .3rem; }
.cred__issuer {
  font: 400 .76rem/1.5 var(--f-mono);
  color: var(--mute); margin: 0 0 .7rem;
}
.cred__body { font-size: .9rem; line-height: 1.6; color: var(--mute); margin: 0 0 .8rem; }
.cred__grade {
  margin: 0 0 .9rem; padding: .5rem .7rem;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px;
  font-size: .86rem; color: var(--mute);
}
.cred__grade b { color: var(--ink); font-weight: 500; }

/* the link row sits at the card's foot so cards of different text
   lengths still line their actions up with each other */
.cred__link {
  display: block; margin-top: auto;
  font: 500 .8rem/1.8 var(--f-mono);
  color: var(--accent); text-decoration: none;
}
.cred__link + .cred__link { margin-top: 0; }
.cred__link:hover { text-decoration: underline; }

.creds__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.4rem 0 0; }

.creds__foot {
  margin: 1.4rem 0 0; max-width: 66ch;
  font-size: .89rem; color: var(--mute); font-style: italic;
}

/* ── skills ──────────────────────────────────────────── */
.kit { display: grid; gap: 1.6rem 2.5rem; grid-template-columns: 1fr; }
.kit__group h3 {
  font-family: var(--f-sans); font-size: .78rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--mute);
  padding-bottom: .6rem; margin-bottom: .8rem;
  border-bottom: 1px solid var(--rule);
}
.kit__group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.kit__group li {
  font: 400 .86rem/1 var(--f-mono);
  padding: .48rem .65rem; border-radius: 6px;
  background: var(--card); border: 1px solid var(--rule);
}

.strengths { margin-top: clamp(2.5rem, 5vw, 3.5rem); max-width: 46rem; }
.strengths h3 { font-size: 1.25rem; margin-bottom: 1rem; }
.strengths ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.strengths li { color: var(--mute); padding-left: 1.1rem; border-left: 2px solid var(--rule); }
.strengths b { color: var(--ink); font-weight: 500; }

/* ── contact ─────────────────────────────────────────── */
.section--contact { padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.contact { display: grid; gap: .8rem; grid-template-columns: 1fr; }
.contact__card {
  display: flex; flex-direction: column; gap: .3rem;
  padding: 1.15rem 1.3rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 11px;
  text-decoration: none;
  transition: border-color var(--t), background var(--t);
}
.contact__card:hover { border-color: var(--accent); background: var(--accent-lo); }
.contact__label { font: 400 .72rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.contact__val { font-size: 1rem; }

.foot {
  padding: 2rem var(--pad) 3rem;
  border-top: 1px solid var(--rule);
  color: var(--mute); font-size: .87rem;
  display: flex; flex-wrap: wrap; gap: .3rem 2rem;
  max-width: calc(var(--maxw) + var(--pad) * 2);
}
.foot p { margin: 0; }

/* ── console ─────────────────────────────────────────── */
.console {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 12, 19, .4);
  background: color-mix(in srgb, var(--ink) 34%, transparent);
  padding: 0;
}
.console[hidden] { display: none; }

.console__sheet {
  width: min(680px, 100%);
  max-height: min(80vh, 560px);
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .18);
  overflow: hidden;
}

.console__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem .6rem .6rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.console__title { font: 400 .78rem/1 var(--f-mono); color: var(--mute); }
.console__close {
  background: none; border: 0; cursor: pointer; color: var(--mute);
  font-size: 1.4rem; line-height: 1; padding: .2rem .55rem; border-radius: 6px;
}
.console__close:hover { color: var(--ink); background: var(--rule); }

.console__out {
  flex: 1; overflow-y: auto;
  padding: 1rem;
  font: 400 .84rem/1.65 var(--f-mono);
  white-space: pre-wrap; word-break: break-word;
}
.console__out .ok { color: var(--ok); }
.console__out .warn { color: var(--accent2); }
.console__out .dim { color: var(--mute); }
.console__out .cmd { color: var(--accent); }
.console__out a { color: var(--accent); }

.console__chips {
  display: flex; gap: .35rem; padding: 0 1rem .7rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.console__chips .chip { flex: none; }

.chip {
  font: 400 .8rem/1 var(--f-mono);
  padding: .45rem .65rem; border-radius: 20px;
  border: 1px solid var(--rule); background: var(--card);
  color: var(--mute); cursor: pointer;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent-lo); border-color: var(--accent); color: var(--accent); }

.console__form {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem 1rem;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
}
.console__prompt { font: 500 .84rem/1 var(--f-mono); color: var(--accent2); }
.console__form input {
  flex: 1; border: 0; background: none; color: var(--ink);
  font: 400 .86rem/1.4 var(--f-mono);
  padding: .35rem 0;
}
.console__form input:focus { outline: none; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; background: none; cursor: grab;
}
input[type="range"]:active { cursor: grabbing; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--rule); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 3px; background: var(--rule); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -9.5px;
  border-radius: 50%; background: var(--accent);
  border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--rule);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--rule);
}
input[type="range"]:disabled { opacity: .45; cursor: default; }

/* ═════════ responsive ═════════ */

@media (max-width: 639px) {
  .flow { flex-direction: column; align-items: stretch; }
  .flow__arrow { transform: rotate(90deg); align-self: center; }
}

@media (min-width: 640px) {
  .status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash__stats { grid-template-columns: repeat(4, 1fr); }
  .hub { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 860px) {
  .feature { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature__item--open { grid-column: 1 / -1; }
  .track__item { grid-template-columns: 12.5rem 1fr; }
  .track__when { align-content: start; }
  .status { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .case { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case__block--wide { grid-column: 1 / -1; }
  .dash__body { grid-template-columns: 1.4fr 1fr; }
  .dash__map { height: auto; min-height: 380px; }
  .dash__side { border-top: 0; border-left: 1px solid var(--rule); }
  .demo__stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .digitpad { flex-direction: row; }
  .digitpad__canvas-wrap { flex: none; }
  .dbplay { grid-template-columns: minmax(0, 1fr) 16rem; }
  .pong { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}

@media (min-width: 1080px) {
  .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
  .contact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kit { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
  .console { align-items: center; padding: 2rem; }
  .console__sheet { border-radius: 14px; }
}

@media (max-width: 1079px) {
  main { margin-left: 0; }

  .rail {
    inset: 0 auto 0 0;
    width: min(280px, 82vw);
    transform: translateX(-102%);
    transition: transform var(--t);
    box-shadow: 0 0 40px rgba(0, 0, 0, .14);
    padding-top: 4.6rem;
  }
  .rail.is-open { transform: none; }

  .railToggle {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: .85rem; left: .85rem; z-index: 70;
    width: 44px; height: 44px;
    border: 1px solid var(--rule); border-radius: 10px;
    background: var(--card); cursor: pointer;
  }
  .railToggle__bars { display: grid; gap: 5px; }
  .railToggle__bars i {
    display: block; width: 17px; height: 1.5px;
    background: var(--ink); border-radius: 2px;
    transition: transform var(--t), opacity var(--t);
  }
  .railToggle[aria-expanded="true"] .railToggle__bars i:first-child { transform: translateY(3.25px) rotate(45deg); }
  .railToggle[aria-expanded="true"] .railToggle__bars i:last-child { transform: translateY(-3.25px) rotate(-45deg); }

  .railScrim {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(10, 12, 19, .3);
    background: color-mix(in srgb, var(--ink) 30%, transparent);
    border: 0; cursor: pointer;
  }

  .hero { padding-top: 5.2rem; min-height: 0; }
  .rd--state { margin-left: 0; }
}

@media (max-width: 520px) {
  body { font-size: 1rem; }
  .hero__line { max-width: 20ch; }
  .net__readout { gap: .1rem 1.1rem; font-size: .74rem; }
  .foot { flex-direction: column; }
  .dash__stats { grid-template-columns: repeat(2, 1fr); }
}
