/* Fonts (self-hosted, latin subset) -------------------------------- */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("assets/fonts/archivo-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

/* Tokens ------------------------------------------------------------ */
:root {
  --bg: #E8EDF1;
  --surface: #F7F9FB;
  --ink: #13203A;
  --muted: #4F5D74;
  --line: #C6D0DB;
  --run: #E8A317;
  --pass: #1E8656;
  --pass-ink: #F7F9FB;
  --log-bg: #13203A;
  --log-ink: #D6E0EA;
  --log-dim: #8394AD;
  --lead-accent: #F4B740;

  --display: "Archivo", system-ui, sans-serif;
  --body: "Archivo", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius-sm: 6px;
  --radius-lg: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1A2B;
    --surface: #16233A;
    --ink: #E4ECF4;
    --muted: #9AAAC0;
    --line: #283850;
    --run: #F4B740;
    --pass: #3FC489;
    --pass-ink: #0F1A2B;
    --log-bg: #0A1322;
    --log-ink: #D6E0EA;
    --log-dim: #7487A3;
    --lead-accent: #8A5A00;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0F1A2B;
  --surface: #16233A;
  --ink: #E4ECF4;
  --muted: #9AAAC0;
  --line: #283850;
  --run: #F4B740;
  --pass: #3FC489;
  --pass-ink: #0F1A2B;
  --log-bg: #0A1322;
  --log-ink: #D6E0EA;
  --log-dim: #7487A3;
  --lead-accent: #8A5A00;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: inherit; text-decoration-color: var(--run); text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--ink); }

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--bg); padding: .5rem 1rem; border-radius: var(--radius-sm);
}
.skip:focus { top: 1rem; }

/* Top bar ----------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.topbar.scrolled { border-bottom-color: var(--line); }

.topbar-inner { display: flex; align-items: center; gap: 1.5rem; height: 4rem; }

.mark { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 700; font-variation-settings: "wdth" 112; }
.mark svg { width: 2rem; height: 2rem; }
.mark path { stroke: var(--ink); stroke-width: 2.4; }
.mark .mark-pass { fill: var(--pass); }
.mark .mark-run { fill: var(--run); }

.nav { display: flex; gap: 1.4rem; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; position: relative; }
.nav a:hover, .nav a.active { color: var(--ink); }
.nav a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.35rem; height: 2px; background: var(--pass); border-radius: 2px; }

.topbar .menu-toggle { display: none; }
.mobile-menu { border-top: 1px solid var(--line); background: var(--bg); }
.mobile-menu .wrap { display: grid; padding-top: .5rem; padding-bottom: 1rem; }
.mobile-menu a {
  padding: .8rem 0; border-bottom: 1px solid var(--line);
  font-family: var(--display); font-weight: 750; font-variation-settings: "wdth" 120; font-size: 1.4rem;
  text-decoration: none;
}
.mobile-menu a:last-child { border-bottom: 0; }

.term-toggle, .theme-toggle, .menu-toggle {
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.term-toggle { margin-left: -.75rem; }
.menu-toggle svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.menu-toggle path { transition: transform .25s ease; transform-origin: 12px 12px; }
.menu-toggle[aria-expanded="true"] .l1 { transform: translateY(4px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .l2 { transform: translateY(-4px) rotate(-45deg); }
.term-toggle svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.term-toggle:hover, .theme-toggle:hover, .menu-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Hero -------------------------------------------------------------- */
.hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(3.5rem, 8vw, 6rem); }
.hero-canvas {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
          mask-image: linear-gradient(to bottom, #000 55%, transparent);
}

.name {
  font-family: var(--display);
  font-weight: 850;
  font-variation-settings: "wdth" 125;
  font-size: clamp(3.1rem, 12.5vw, 10rem);
  line-height: .86;
  letter-spacing: -.035em;
  display: flex; flex-wrap: wrap; column-gap: .22em;
}
.name { flex-direction: column; align-items: flex-start; }
.name .word { white-space: nowrap; }
.name .ch {
  display: inline-block;
  font-variation-settings: "wdth" var(--w, 125);
  font-weight: var(--wt, 850);
  transition: font-variation-settings .5s cubic-bezier(.2,.8,.2,1), font-weight .5s cubic-bezier(.2,.8,.2,1);
}
.name.tracking .ch { transition-duration: .18s; transition-delay: 0s !important; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  margin-top: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

.role { font-weight: 700; font-size: 1.35rem; font-variation-settings: "wdth" 112; margin-bottom: .9rem; }
.lede { color: var(--muted); max-width: 34rem; }
.where { color: var(--muted); margin-top: .9rem; }

.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

.btn {
  display: inline-flex; align-items: center; min-height: 2.9rem; padding: 0 1.25rem;
  border: 1.5px solid var(--ink); border-radius: var(--radius-sm);
  font-weight: 650; text-decoration: none; color: var(--ink);
  transition: background-color .2s ease, color .2s ease;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-primary { background: var(--run); border-color: var(--run); color: #13203A; }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.shell-hint { margin-top: 1.25rem; color: var(--muted); font-size: .95rem; }
kbd {
  font-family: var(--mono); font-size: .85em; padding: .05rem .4rem; border-radius: 4px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface); color: var(--ink);
}
.link-btn {
  font: inherit; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--run); text-decoration-thickness: 2px; text-underline-offset: 4px;
}

/* Pipeline ---------------------------------------------------------- */
.pipeline {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pipe-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
}
.pipe-title { font-weight: 700; font-variation-settings: "wdth" 112; }
.pipe-status { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .95rem; }
.pipe-status .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--line); }
.pipeline[data-state="running"] .pipe-status .dot { background: var(--run); animation: pulse 1s ease-in-out infinite; }
.pipeline[data-state="passed"] .pipe-status .dot { background: var(--pass); }

.rerun {
  font: inherit; font-size: .95rem; font-weight: 600;
  padding: .45rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer;
}
.rerun { white-space: nowrap; flex-shrink: 0; }
.rerun:hover { border-color: var(--ink); }
.rerun:disabled { opacity: .45; cursor: default; }

.stages {
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 1.6rem 1.25rem 1.4rem;
  position: relative;
}
.stage { position: relative; display: grid; justify-items: center; text-align: center; gap: .15rem; }
/* connector to the next stage */
.stage:not(:last-child)::after {
  content: ""; position: absolute; top: .95rem; left: calc(50% + 1.15rem); right: calc(-50% + 1.15rem);
  height: 2px; background: var(--line);
  background-image: linear-gradient(var(--pass), var(--pass));
  background-repeat: no-repeat; background-size: 0% 100%;
  transition: background-size .6s ease;
}
.stage.passed:not(:last-child)::after { background-size: 100% 100%; }

.node {
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  border: 2px dashed var(--line); background: var(--surface);
  display: grid; place-items: center; margin-bottom: .45rem;
  transition: background-color .25s ease, border-color .25s ease;
}
.stage.running .node { border: 2px solid var(--run); border-top-color: transparent; animation: spin .8s linear infinite; }
.stage.passed .node { border: 2px solid var(--pass); background: var(--pass); }
.stage.passed .node::before {
  content: ""; width: .5rem; height: .85rem; margin-top: -.2rem;
  border: solid var(--pass-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.stage.waiting .node { border: 2px solid var(--run); background: color-mix(in srgb, var(--run) 22%, var(--surface)); }

.stage-name { font-weight: 650; font-size: .95rem; line-height: 1.25; }
.stage-year { color: var(--muted); font-size: .85rem; }

.log {
  margin: 0; padding: 1.1rem 1.25rem 1.25rem;
  background: var(--log-bg); color: var(--log-ink);
  font-family: var(--mono); font-size: .82rem; line-height: 1.75;
  min-height: 13.5rem; white-space: pre-wrap; word-break: break-word;
}
.log .pending { visibility: hidden; }
.log .dim { color: var(--log-dim); }
.log .ok { color: #3FC489; }
.log .go { color: #F4B740; }
.log .caret { display: inline-block; width: .55em; height: 1.05em; vertical-align: text-bottom; background: var(--log-ink); animation: blink 1s steps(1) infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes blink { 50% { opacity: 0; } }

/* Sections ---------------------------------------------------------- */
.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; border-top: 1px solid var(--line); }

.section-head {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1rem, 5vw, 4.5rem); align-items: end;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.section-head h2 {
  font-family: var(--display); font-weight: 800; font-variation-settings: "wdth" 125;
  font-size: clamp(2.2rem, 6vw, 4rem); line-height: .95; letter-spacing: -.025em;
}
.section-head p { color: var(--muted); max-width: 36rem; }

/* Career timeline */
.timeline { position: relative; }
.job {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1rem, 5vw, 4.5rem);
  position: relative;
  padding-bottom: 2.75rem;
}
.job-when {
  display: flex; gap: .5rem; align-items: baseline;
  font-family: var(--display); font-weight: 800; font-variation-settings: "wdth" 125;
  font-size: clamp(1.6rem, 3.4vw, 2.5rem); letter-spacing: -.02em; line-height: 1;
}
.job-when span + span { color: var(--muted); font-weight: 500; }
.job-when span + span::before { content: "\2013"; margin-right: .5rem; }

.job-body { position: relative; padding-left: 2rem; max-width: 40rem; }
.job-body::before { /* rail */
  content: ""; position: absolute; left: .45rem; top: .6rem; bottom: -2.75rem; width: 2px;
  background: linear-gradient(var(--pass), var(--pass)) no-repeat 0 0 / 100% calc(var(--p, 0) * 100%), var(--line);
}
.job:last-child .job-body::before { bottom: 0; }
.job-body::after { /* commit node */
  content: ""; position: absolute; left: 0; top: .35rem;
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--pass);
}
.job-body::after { transition: background-color .3s ease, box-shadow .3s ease; }
.job.reached .job-body::after { background: var(--pass); box-shadow: 0 0 0 5px color-mix(in srgb, var(--pass) 22%, transparent); }

.job h3 { font-size: 1.3rem; font-weight: 750; line-height: 1.3; font-variation-settings: "wdth" 108; }
.job .at { font-weight: 450; color: var(--muted); }
.job-body > p { margin-top: .4rem; }
.job ul { margin-top: .9rem; display: grid; gap: .45rem; }
.job li { position: relative; padding-left: 1.1rem; color: var(--muted); }
.job li::before { content: ""; position: absolute; left: 0; top: .72em; width: .45rem; height: 2px; background: var(--run); }

.edu {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: clamp(1rem, 5vw, 4.5rem); row-gap: .4rem;
  margin-top: 1.5rem; padding-top: 2rem; border-top: 1px dashed var(--line);
}
.edu h3 { font-size: 1.05rem; font-weight: 700; grid-column: 1; }
.edu p { grid-column: 2; color: var(--muted); padding-left: 2rem; }
.edu h3:nth-of-type(2), .edu p:nth-of-type(2) { margin-top: .75rem; }
.edu h3:nth-of-type(2) { grid-row: 2; }
.edu p:nth-of-type(2) { grid-row: 2; }

/* Stack */
.stack { display: grid; }
.stack-row {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(.5rem, 5vw, 4.5rem);
  padding: 1.25rem 0; border-bottom: 1px solid var(--line);
}
.stack-row:first-child { border-top: 1px solid var(--ink); }
.stack dt { font-weight: 700; font-size: 1.1rem; }
.stack dd ul { display: flex; flex-wrap: wrap; gap: .5rem; }
.stack dd li {
  padding: .2rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: .95rem;
  transition: border-color .2s ease, background-color .2s ease;
}
.stack dt { transition: color .2s ease; }
.stack-row:hover dt { color: var(--pass); }
.stack-row:hover dd li { border-color: color-mix(in srgb, var(--pass) 45%, var(--line)); }

/* Projects */
.projects {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.project {
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface);
  display: grid; align-content: start; gap: .75rem;
}
.project h3 { font-size: 1.3rem; font-weight: 750; font-variation-settings: "wdth" 108; }
.project p { color: var(--muted); }

.project-lead {
  grid-column: 1 / -1;
  background: var(--ink); color: var(--bg); border-color: var(--ink);
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: clamp(1rem, 5vw, 4.5rem);
}
.project-lead h3 {
  font-family: var(--display); font-weight: 900; font-variation-settings: "wdth" 125;
  font-size: clamp(3rem, 9vw, 6rem); line-height: .9; letter-spacing: -.03em;
  grid-row: span 2;
}
.project-lead .project-role { color: var(--lead-accent); font-weight: 700; font-size: 1.1rem; }
.project-lead p { color: color-mix(in srgb, var(--bg) 80%, var(--ink)); max-width: 38rem; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .25rem; }
.tags li { font-size: .85rem; padding: .1rem .6rem; border-radius: 999px; background: var(--bg); color: var(--muted); }

/* Contact */
.contact h2 {
  font-family: var(--display); font-weight: 850; font-variation-settings: "wdth" 125;
  font-size: clamp(2.5rem, 8vw, 6rem); line-height: .92; letter-spacing: -.03em;
  max-width: 14ch;
}
.contact-lede { color: var(--muted); max-width: 36rem; margin-top: 1.25rem; }
.email {
  display: inline-block; margin-top: 2rem;
  font-weight: 700; font-variation-settings: "wdth" 110;
  font-size: clamp(1.25rem, 4.2vw, 2.4rem);
  word-break: break-all;
  text-decoration-thickness: 3px; text-underline-offset: 8px;
}
.links { display: flex; flex-wrap: wrap; gap: 1.75rem; margin-top: 2rem; font-weight: 600; }

.footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: .9rem; }

/* Services */
.services {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ink); border-left: 1px solid var(--line);
}
.service {
  display: flex; flex-direction: column; gap: .6rem;
  padding: clamp(1.25rem, 2.6vw, 2rem);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transition: background-color .25s ease;
}
.service:hover { background: var(--surface); }
.service-icon {
  flex: none; width: 2.4rem; height: 2.4rem; padding: .45rem; margin-bottom: .4rem;
  border-radius: 10px; background: color-mix(in srgb, var(--pass) 14%, transparent);
  fill: none; stroke: var(--pass); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.service h3 { font-size: 1.2rem; font-weight: 750; font-variation-settings: "wdth" 108; line-height: 1.3; }
.service p { color: var(--muted); }
.service .service-tools { color: var(--ink); font-size: .9rem; font-weight: 550; padding-top: .4rem; border-top: 1px dashed var(--line); margin-top: auto; }
.service-cta { background: var(--ink); color: var(--bg); }
.service-cta:hover { background: var(--ink); }
.service-cta p { color: color-mix(in srgb, var(--bg) 78%, var(--ink)); }
.service-cta .btn { align-self: flex-start; margin-top: .6rem; }

/* Delivery flow */
.flow { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.flow-track {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line); position: relative;
}
.flow-stage {
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: none; border: 0; border-right: 1px solid var(--line);
  padding: 1.1rem 1rem 1.2rem; display: grid; gap: .2rem; align-content: start;
  position: relative; transition: background-color .2s ease;
}
.flow-stage:last-child { border-right: 0; }
.flow-stage::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: var(--pass); transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.flow-stage:hover { background: color-mix(in srgb, var(--pass) 6%, transparent); }
.flow-stage[aria-selected="true"]::after { transform: scaleX(1); }
.flow-stage[aria-selected="true"] .flow-num { background: var(--pass); color: var(--pass-ink); border-color: var(--pass); }
.flow-stage.done .flow-num { border-color: var(--pass); color: var(--pass); }
.flow-num {
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem; margin-bottom: .5rem;
  border-radius: 50%; border: 2px solid var(--line); font-weight: 700; font-size: .85rem;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.flow-name { font-weight: 700; font-variation-settings: "wdth" 108; }
.flow-tools { font-size: .82rem; color: var(--muted); line-height: 1.35; }

.flow-panel {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.25rem, 4vw, 3rem); padding: clamp(1.25rem, 3vw, 2rem); align-items: start;
}
.flow-panel[hidden] { display: none; }
.flow-panel:not([hidden]) { animation: panel-in .3s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } }
.flow-text h3 { font-size: 1.35rem; font-weight: 750; font-variation-settings: "wdth" 112; margin-bottom: .5rem; }
.flow-text p { color: var(--muted); }
.flow-code {
  margin: 0; padding: 1.1rem 1.25rem; border-radius: 10px;
  background: var(--log-bg); color: var(--log-ink);
  font-family: var(--mono); font-size: .85rem; line-height: 1.7; overflow-x: auto;
  scrollbar-width: thin; scrollbar-color: #283850 transparent;
}

.principles {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2rem);
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}
.principles li { padding-top: 1rem; border-top: 3px solid var(--run); }
.principles h3 { font-size: 1.1rem; font-weight: 750; margin-bottom: .4rem; line-height: 1.3; }
.principles p { color: var(--muted); font-size: .98rem; }

/* FAQ */
.faq { border-top: 1px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.25rem 0; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.35; }
.faq summary:hover h3 { color: var(--pass); }
.faq-icon { position: relative; flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid var(--line); }
.faq-icon::before, .faq-icon::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: .75rem; height: 2px; margin: -1px 0 0 -.375rem;
  background: var(--ink); transition: transform .25s ease;
}
.faq-icon::after { transform: rotate(90deg); }
.faq details[open] .faq-icon { background: var(--pass); border-color: var(--pass); }
.faq details[open] .faq-icon::before, .faq details[open] .faq-icon::after { background: var(--pass-ink); }
.faq details[open] .faq-icon::after { transform: rotate(0deg); }
.faq details p { color: var(--muted); max-width: 46rem; padding: 0 0 1.4rem; }
.faq details[open] p { animation: panel-in .25s ease; }

/* Footer */
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }

::selection { background: var(--run); color: #13203A; }

/* Terminal ---------------------------------------------------------- */
.term {
  width: min(46rem, calc(100vw - 2rem)); max-height: min(36rem, calc(100vh - 4rem));
  padding: 0; border: 1px solid #283850; border-radius: var(--radius-lg);
  background: #0A1322; color: #D6E0EA; color-scheme: dark;
  box-shadow: 0 30px 80px -20px rgba(5, 12, 25, .6);
  overflow: hidden;
}
.term[open] { display: flex; flex-direction: column; animation: term-in .22s cubic-bezier(.2,.8,.2,1); }
.term::backdrop { background: rgba(10, 19, 34, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes term-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.term-head {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .9rem; border-bottom: 1px solid #1C2B44; background: #0F1A2B;
}
.term-head p { flex: 1; text-align: center; font-family: var(--mono); font-size: .8rem; color: #7487A3; }
.term-lights { display: flex; gap: .4rem; }
.term-lights i { width: .7rem; height: .7rem; border-radius: 50%; background: #283850; }
.term-lights i:nth-child(1) { background: #E5604D; }
.term-lights i:nth-child(2) { background: #F4B740; }
.term-lights i:nth-child(3) { background: #3FC489; }
.term-close { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border: 0; border-radius: 6px; background: none; color: #9AAAC0; cursor: pointer; }
.term-close:hover { background: #1C2B44; color: #E4ECF4; }
.term-close svg { width: 1rem; height: 1rem; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.term-body { overflow-y: auto; padding: 1rem 1.1rem 1.2rem; font-family: var(--mono); font-size: .85rem; line-height: 1.7; }
.term-out p { white-space: pre-wrap; word-break: break-word; margin: 0; }
.term-out .cmd { color: #E4ECF4; margin-top: .5rem; }
.term-out .cmd::before { content: "ahmad@naamna:~$ "; color: #3FC489; }
.term-out .dim { color: #7487A3; }
.term-out .ok { color: #3FC489; }
.term-out .go { color: #F4B740; }
.term-out .err { color: #E5604D; }
.term-out a { color: #F4B740; }
.term-line { display: flex; gap: .6rem; align-items: baseline; margin-top: .5rem; }
.term-prompt { color: #3FC489; white-space: nowrap; }
.term-input {
  flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; background: none;
  color: #E4ECF4; font: inherit; caret-color: #F4B740;
}

/* Responsive -------------------------------------------------------- */
@media (max-width: 1100px) {
  .nav { display: none; }
  .topbar .menu-toggle { display: grid; }
  .term-toggle { margin-left: auto; }
  .flow-track { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .flow-stage:nth-child(4) { border-right: 0; }
  .flow-stage:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-panel { grid-template-columns: minmax(0, 1fr); }
  .hero-grid, .section-head, .job, .stack-row, .edu, .project-lead { grid-template-columns: minmax(0, 1fr); }
  .job { gap: .75rem; }
  .job-body::before { bottom: -2.75rem; }
  .edu p { grid-column: 1; padding-left: 0; }
  .edu h3:nth-of-type(2), .edu p:nth-of-type(2) { grid-row: auto; }
  .projects { grid-template-columns: minmax(0, 1fr); }
  .project-lead h3 { grid-row: auto; }
}

@media (max-width: 640px) {
  .services { grid-template-columns: minmax(0, 1fr); }
  .principles { grid-template-columns: minmax(0, 1fr); }
  .flow-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .flow-track::-webkit-scrollbar { display: none; }
  .flow-stage { flex: 0 0 40%; scroll-snap-align: start; border-bottom: 0 !important; border-right: 1px solid var(--line) !important; }
  .flow-code { font-size: .78rem; }
  .topbar-inner { gap: .6rem; }
  .shell-hint { display: none; }
  .stages { padding-inline: .5rem; }
  .stage-name { font-size: .82rem; }
  .log { font-size: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
