/* ==========================================================================
   ashishc.me
   Hand-written CSS. No framework, no build step.
   Sections: tokens, reset, type, layout, nav, hero, systems/diagrams,
             principles, offhours, education, contact, footer, responsive
   ========================================================================== */

/* --------------------------------------------------------------- tokens -- */
:root {
  --bg:          #08090a;
  --bg-elev:     #0d0f11;
  --bg-elev-2:   #121517;
  --line:        #1c2023;
  --line-strong: #2b3035;
  --fg:          #eceae6;
  --fg-mid:      #a4a8ab;
  --fg-dim:      #6d7276;
  --accent:      #ff4a1c;
  --accent-soft: rgba(255, 74, 28, 0.13);
  --accent-line: rgba(255, 74, 28, 0.45);
  --ok:          #74d1a4;
  --ok-soft:     rgba(116, 209, 164, 0.12);

  --font-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 1120px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --radius: 3px;

  --sect-pad: clamp(4.5rem, 11vw, 9rem);
}

[data-theme="light"] {
  --bg:          #f7f6f3;
  --bg-elev:     #ffffff;
  --bg-elev-2:   #f0efeb;
  --line:        #e0ded8;
  --line-strong: #c9c6be;
  --fg:          #16181a;
  --fg-mid:      #4d5154;
  --fg-dim:      #7c8085;
  --accent:      #d63105;
  --accent-soft: rgba(214, 49, 5, 0.09);
  --accent-line: rgba(214, 49, 5, 0.4);
  --ok:          #1f8a5c;
  --ok-soft:     rgba(31, 138, 92, 0.1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; height: auto; }
svg { display: block; }

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

::selection { background: var(--accent); color: #fff; }

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

/* ----------------------------------------------------------------- type -- */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 7.2vw, 5.6rem); }
h2 { font-size: clamp(1.9rem, 4.2vw, 3.1rem); }
h3 { font-size: clamp(1.15rem, 2.1vw, 1.5rem); letter-spacing: -0.015em; }

p { margin: 0 0 1.1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: clamp(1.05rem, 1.9vw, 1.3rem);
  line-height: 1.6;
  color: var(--fg-mid);
  max-width: 62ch;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 500;
}

.dim { color: var(--fg-dim); }
.mid { color: var(--fg-mid); }
.accent { color: var(--accent); }

/* --------------------------------------------------------------- layout -- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section { position: relative; }

.section {
  padding-block: var(--sect-pad);
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.75rem;
  flex-wrap: wrap;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  flex: none;
}

.section-sub {
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ nav -- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.nav.is-stuck { border-bottom-color: var(--line); }

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

.nav-brand {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}

.brand-short { display: none; }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
  box-shadow: 0 0 0 0 var(--ok-soft);
  animation: pulse 3.2s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--ok-soft); }
  70%  { box-shadow: 0 0 0 7px rgba(116, 209, 164, 0); }
  100% { box-shadow: 0 0 0 0 rgba(116, 209, 164, 0); }
}

.nav-links {
  display: flex;
  gap: 1.4rem;
  margin-left: auto;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  transition: color 0.18s ease;
  position: relative;
  padding-block: 0.35rem;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a.is-active { color: var(--fg); }
.nav-links a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.15rem;
  height: 1px;
  background: var(--accent);
}

.theme-toggle {
  flex: none;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg-dim);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--line-strong); }
.theme-toggle svg { width: 14px; height: 14px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ----------------------------------------------------------------- hero -- */
.hero {
  padding-top: clamp(2.25rem, 6vw, 4.5rem);
  padding-bottom: clamp(3rem, 7vw, 4.5rem);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60rem 30rem at 78% -10%, var(--accent-soft), transparent 62%);
  pointer-events: none;
}

.hero-inner { position: relative; }

.hero-id {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}
.hero-id picture { flex: none; display: block; }
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  flex: none;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--fg-dim);
  flex-wrap: wrap;
}
.hero-kicker .rule {
  height: 1px;
  width: 2.5rem;
  background: var(--line-strong);
  flex: none;
}

.hero h1 { margin-bottom: 1.6rem; max-width: 16ch; }
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-lede { max-width: 58ch; margin-bottom: 2.25rem; }

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-mid);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}
.btn:hover { color: var(--fg); border-color: var(--fg-dim); background: var(--bg-elev); }
.btn svg { width: 13px; height: 13px; flex: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; filter: brightness(1.1); }
[data-theme="light"] .btn-primary { color: #fff; }

/* ---------------------------------------------------- hero live diagram -- */
.pipeline {
  margin-top: clamp(2.25rem, 5vw, 3.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}

.pipeline-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.pipeline-bar .spacer { margin-left: auto; }

#pipeline-state { color: var(--ok); transition: color 0.3s ease; }
.pipeline.is-faulted #pipeline-state { color: var(--accent); }

.pipeline-stage { padding: 1.25rem 0.9rem 1.4rem; }
.pipeline svg { width: 100%; height: auto; }

.pl-node rect {
  fill: var(--bg-elev-2);
  stroke: var(--line-strong);
  stroke-width: 1;
  transition: stroke 0.3s ease, fill 0.3s ease;
}
.pl-node text {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  fill: var(--fg-mid);
  transition: fill 0.3s ease;
}
.pl-node.is-faulted rect { stroke: var(--accent); fill: var(--accent-soft); }
.pl-node.is-faulted text { fill: var(--accent); }

.pl-edge {
  stroke: var(--line-strong);
  stroke-width: 1;
  transition: stroke 0.3s ease;
}
.pl-edge.is-faulted { stroke: var(--accent); stroke-dasharray: 3 3; }

.pl-dot { fill: var(--accent); }

.pl-caption {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--accent);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.pl-caption.is-shown { opacity: 1; }

/* -------------------------------------------------------------- systems -- */
.systems { display: grid; gap: clamp(2rem, 4vw, 3rem); }

.case {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}

.case-head {
  padding: clamp(1.4rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
}

.case-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.case-org {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
}
.case-role, .case-dates {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
}
.case-dates { margin-left: auto; }

.case-head h3 { margin-bottom: 0.75rem; }
.case-head p { color: var(--fg-mid); max-width: 68ch; font-size: 0.97rem; }

/* ---- toggle ---- */
.case-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem clamp(1.4rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg button {
  padding: 0.4rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  transition: color 0.18s ease, background 0.18s ease;
}
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.case-hint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fg-dim);
  letter-spacing: 0.05em;
}

/* ---- flow diagram ---- */
.case-body { padding: clamp(1.4rem, 3vw, 2rem); }

.flow {
  list-style: none;
  margin: 0 0 0;
  padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: stretch;
  gap: 0;
}

.flow li {
  position: relative;
  padding-right: 1.6rem;
  display: flex;
}
.flow li:last-child { padding-right: 0; }

/* connector */
.flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.35rem;
  width: 0.9rem;
  height: 1px;
  background: var(--line-strong);
  transform: translateY(-50%);
}
.flow li:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.35rem;
  width: 5px;
  height: 5px;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  transform: translateY(-50%) rotate(45deg);
}

.node {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
  padding: 0.85rem 0.8rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
  position: relative;
}

.node-label {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--fg);
}
.node-note {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.node-flag {
  position: absolute;
  top: -0.55rem;
  left: -0.55rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: none;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

/* faults mode */
.case[data-mode="faults"] .node[data-fault] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.case[data-mode="faults"] .node[data-fault] .node-flag { display: grid; }
.case[data-mode="faults"] .node:not([data-fault]) { opacity: 0.45; }

/* ---- fault list ---- */
.faults {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.case[data-mode="nominal"] .faults { display: none; }

.faults li {
  background: var(--bg-elev);
  padding: 1.1rem clamp(1rem, 2vw, 1.4rem);
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.35rem 0.9rem;
  align-items: start;
}

.fault-idx {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  grid-row: span 2;
  padding-top: 0.15rem;
}

.fault-q {
  font-size: 0.97rem;
  color: var(--fg);
  font-weight: 500;
  line-height: 1.5;
}

.fault-a {
  font-size: 0.92rem;
  color: var(--fg-mid);
  line-height: 1.6;
  border-left: 2px solid var(--ok);
  padding-left: 0.85rem;
}

.case-outcome {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--line-strong);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
}
.metric { display: flex; flex-direction: column; gap: 0.15rem; }
.metric b {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.metric span {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.case-stack {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.2rem 0.45rem;
}

/* ----------------------------------------------------------- principles -- */
.principles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.principles li {
  border-bottom: 1px solid var(--line);
  padding-block: clamp(1.5rem, 3vw, 2.25rem);
  display: grid;
  grid-template-columns: 3rem minmax(0, 20rem) minmax(0, 1fr);
  gap: 0.6rem 2rem;
  align-items: start;
}

.principles .p-idx {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  padding-top: 0.3rem;
}
.principles h3 { line-height: 1.25; }
.principles p { color: var(--fg-mid); font-size: 0.97rem; }

/* ------------------------------------------------------------- offhours -- */
.offhours-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  margin-top: 2.5rem;
}

.ph {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.ph picture { display: block; width: 100%; height: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; }

.ph-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.4rem;
  text-align: center;
  padding: 1rem;
  background-image:
    repeating-linear-gradient(45deg, var(--line) 0 1px, transparent 1px 9px);
}
.ph-empty span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.ph-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.7rem 0.85rem;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: #e6e4e0;
}

/* ------------------------------------------------------------ education -- */
.rows { border-top: 1px solid var(--line); }

.row {
  border-bottom: 1px solid var(--line);
  padding-block: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem 2rem;
  align-items: baseline;
}
.row h3 { font-size: clamp(1.05rem, 1.9vw, 1.3rem); }
.row .row-org { color: var(--fg-mid); font-size: 0.95rem; }
.row .row-when {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  white-space: nowrap;
}
.row-note {
  grid-column: 1 / -1;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.75;
  color: var(--fg-dim);
  border-left: 2px solid var(--line-strong);
  padding-left: 0.9rem;
}
.row-note b { color: var(--fg-mid); font-weight: 500; }

/* ------------------------------------------------------------------- ai -- */
.pull {
  margin: 0 0 2.5rem;
  padding: 1.5rem 0 1.5rem 1.5rem;
  border-left: 3px solid var(--accent);
}
.pull p {
  font-size: clamp(1.35rem, 3.1vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.18;
  margin: 0 0 0.6rem;
  max-width: 22ch;
}
.pull cite {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-style: normal;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.ai-card {
  background: var(--bg-elev);
  padding: clamp(1.4rem, 3vw, 2rem);
}
.ai-key {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
}
.ai-card p { color: var(--fg-mid); font-size: 0.97rem; }

/* ---------------------------------------------------------------- stack -- */
.stack-grid {
  border-top: 1px solid var(--line);
}
.stack-col {
  border-bottom: 1px solid var(--line);
  padding-block: 1.25rem;
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 0.75rem 2rem;
  align-items: start;
}
.stack-col h3 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  padding-top: 0.35rem;
  margin: 0;
}
.stack-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.stack-col li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-mid);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.25rem 0.55rem;
  background: var(--bg-elev);
  transition: border-color 0.18s ease, color 0.18s ease;
}
.stack-col li:hover { border-color: var(--line-strong); color: var(--fg); }

/* -------------------------------------------------------------- contact -- */
.contact { padding-block: var(--sect-pad); border-top: 1px solid var(--line); }
.contact h2 { margin-bottom: 1.5rem; max-width: 26ch; }

.contact-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}
.portrait {
  margin: 1rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--bg-elev);
}
.portrait picture { display: block; width: 100%; height: 100%; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.contact-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 2.5rem;
}
.contact-links a {
  background: var(--bg-elev);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: background 0.18s ease;
}
.contact-links a:hover { background: var(--bg-elev-2); }
.contact-links a:hover .cl-val { color: var(--accent); }
.cl-key {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.cl-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg);
  transition: color 0.18s ease;
  word-break: break-word;
}

/* --------------------------------------------------------------- footer -- */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem 3rem;
}
.footer-inner {
  display: flex;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
}
.footer-inner .spacer { margin-left: auto; }

/* -------------------------------------------------------------- reveals -- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.is-in { opacity: 1; transform: none; }

/* JS off: everything visible */
.no-js .reveal { opacity: 1; transform: none; }
.no-js .case[data-mode] .faults { display: grid; }
.no-js .case-controls { display: none; }
.no-js .pipeline { display: none; }

/* ----------------------------------------------------------- responsive -- */
@media (max-width: 900px) {
  .flow {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 1.35rem;
  }
  .flow li { padding-right: 0; padding-bottom: 0; }
  .flow li:not(:last-child)::after {
    top: auto; bottom: -0.95rem; right: auto; left: 1.1rem;
    width: 1px; height: 0.7rem; transform: none;
  }
  .flow li:not(:last-child)::before {
    top: auto; bottom: -0.95rem; right: auto; left: 0.95rem;
    transform: rotate(135deg);
  }
  .node-flag { left: auto; right: -0.4rem; top: -0.5rem; }

  .principles li { grid-template-columns: 2rem 1fr; gap: 0.5rem 1.25rem; }
  .principles p { grid-column: 2; }

  .stack-col { grid-template-columns: 1fr; gap: 0.75rem; }
  .ai-grid { grid-template-columns: 1fr; }
  .contact-top { grid-template-columns: 1fr; }
  .portrait { max-width: 14rem; }
}

@media (max-width: 720px) {
  .nav-inner { gap: 0.75rem; }
  .nav-links { gap: 0.9rem; }
  .nav-links a[data-optional] { display: none; }
  .brand-full { display: none; }
  .brand-short { display: inline; }
  .offhours-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .row .row-when { grid-row: 1; }
  .case-dates { margin-left: 0; width: 100%; }
  .faults li { grid-template-columns: 1.3rem 1fr; }
}

@media (max-width: 600px) {
  /* Stack the kicker beside the avatar; the connecting rules stop reading
     as separators once the line wraps, so drop them. */
  .hero-kicker { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
  .hero-kicker .rule { display: none; }
  .hero-id { align-items: flex-start; }
  .avatar { margin-top: 0.15rem; }
}

@media (max-width: 480px) {
  .hero-actions { gap: 0.5rem; }
  .hero-actions .btn-primary { width: 100%; justify-content: center; }
  .nav-links a[href="#systems"] { display: none; }
}

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

/* ---------------------------------------------------------------- print -- */
@media print {
  .nav, .pipeline, .case-controls, .theme-toggle, .hero-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .case, .faults li, .stack-col { background: #fff; }
  .section { padding-block: 1.5rem; }
  .case[data-mode] .faults { display: grid !important; }
}
