/* Self-hosted fonts (Latin subset, woff2). Paths resolve relative to this file
   in css/, so ../assets/. Newsreader & IBM Plex Mono replace the former Google
   Fonts load: same-origin + font-display:swap means the real font renders on
   first paint, eliminating the display=optional swap that shifted text vertically
   between loads. Variable faces use a font-weight range (400 500). */
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../assets/fonts/newsreader-latin-roman.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url("../assets/fonts/newsreader-latin-italic.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #f4ead8;
  --paper-warm: #eadbc2;
  --paper-dark: #241914;
  --bone: #fff8e9;
  --ink: #241914;
  --ink-soft: #5d4637;
  --ink-mute: #765d49;
  --ink-faint: #6d573f;
  --brand: #3d5a73;
  --brand-light: #4d7291;
  --sand: #e3d0b1;
  --stone: #bda383;
  --accent-blue: var(--brand-light);
  --accent-text: var(--brand);
  --accent-soft: #334d63;
  --accent-mark: var(--brand-light);
  --olive: #8b7a4b;

  --bg: var(--paper);
  --surface: var(--bone);
  --accent: var(--accent-blue);
  --rule: #c8ad88;
  --rule-light: #dac6a9;
  --control-border: #9a7b5c;
  --control-border-surface: #967657;
  --header-bg: rgba(244, 234, 216, .92);
  --grain-opacity: .11;
  --grain-blend: multiply;
  --image-filter: none;
  --avatar-filter: invert(1) saturate(.9) contrast(1.04);
  --logo-filter: saturate(.82) contrast(1.04);
  --tap-highlight: rgba(77, 114, 145, .28);
  --shadow-card: 0 0 0 1px var(--rule-light), 0 8px 28px rgba(68, 38, 17, .08);
  --shadow-sm: 0 1px 2px rgba(68, 38, 17, .05), 0 3px 10px rgba(68, 38, 17, .05);
  --shadow-md: 0 6px 16px rgba(68, 38, 17, .09), 0 14px 34px rgba(68, 38, 17, .1);
  --button-bg: var(--brand);
  --button-bg-hover: var(--accent-soft);
  --button-text: #fff8e9;
  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Charter", Georgia, serif;
  --font-body: "Newsreader", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Charter", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1360px;
  --page-gutter: 144px;
  --header-offset: 120px;
  --measure: 760px;
  --space-1: 0.125rem;   /* 2px  */
  --space-2: 0.25rem;    /* 4px  */
  --space-3: 0.375rem;   /* 6px  */
  --space-4: 0.5rem;     /* 8px  */
  --space-5: 0.625rem;   /* 10px */
  --space-6: 0.75rem;    /* 12px */
  --space-7: 0.875rem;   /* 14px */
  --space-8: 1rem;       /* 16px */
  --space-9: 1.125rem;   /* 18px */
  --space-10: 1.25rem;   /* 20px */
  --space-12: 1.5rem;    /* 24px */
  --space-14: 1.75rem;   /* 28px */
  --space-16: 2rem;      /* 32px */
  --space-20: 2.5rem;    /* 40px */
  --space-24: 3rem;      /* 48px */
  --space-32: 4rem;      /* 64px */
  --step--1: clamp(13px, 0.9vw, 14px);
  --step-0: 20px;
  --step-1: clamp(18px, 1.6vw, 22px);
  --step-2: clamp(20px, 2vw, 28px);
  --step-3: clamp(24px, 2.4vw, 32px);
  --step-4: clamp(24px, 2.2vw, 34px);
  --step-5: clamp(34px, 4.2vw, 58px);
  --step-6: clamp(44px, 4.8vw, 70px);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;
  --radius: var(--radius-lg);
  --dur-fast: .2s;
  --dur-base: .25s;
  --dur-slow: .3s;
  --ease: cubic-bezier(.2, 0, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #141413;
  --paper-warm: #1d1d1b;
  --paper-dark: #faf9f5;
  --bone: #30302e;
  --ink: #f5f4ed;
  --ink-soft: #d8d3c6;
  --ink-mute: #b2ac9f;
  --ink-faint: #9d978d;
  --brand: #6a9bc4;
  --brand-light: #7eb0d8;
  --sand: #3d3d3a;
  --stone: #6b6a64;
  --accent-blue: var(--brand-light);
  --accent-text: #9ec5e8;
  --accent-soft: #8aa8c9;
  --accent-mark: var(--brand-light);
  --olive: var(--stone);
  --rule: #504e49;
  --rule-light: #3d3d3a;
  --control-border: #757169;
  --control-border-surface: #858178;
  --header-bg: rgba(20, 20, 19, .92);
  --grain-opacity: .045;
  --grain-blend: screen;
  --image-filter: none;
  --avatar-filter: saturate(.92) contrast(1.04) brightness(.96);
  --logo-filter: saturate(.9) contrast(1.04) brightness(1.08);
  --tap-highlight: rgba(126, 176, 216, .36);
  --shadow-card: 0 0 0 1px var(--rule-light), 0 4px 24px rgba(0, 0, 0, .22);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 3px 10px rgba(0, 0, 0, .18);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, .32), 0 16px 40px rgba(0, 0, 0, .34);
  --button-bg: var(--brand);
  --button-bg-hover: var(--accent-soft);
  --button-text: #1d1512;
}

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

html {
  scroll-behavior: auto;
  overflow-anchor: none;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
  scrollbar-gutter: stable;
}

/* Themed scrollbars, token-driven so they track light/dark automatically.
   Elements that intentionally hide their bar (.eq-line, .kirby-roller-list)
   keep doing so via their own scrollbar-width:none / display:none rules. */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--rule);
  border: 3px solid var(--paper);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--stone);
}

main > section[id]:not(.hero),
#contact {
  scroll-margin-top: var(--header-offset);
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  overflow-x: hidden;
}

body:before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: var(--grain-blend);
}

a {
  color: inherit;
  text-decoration-color: var(--brand-light);
  text-underline-offset: .18em;
}

::selection {
  background: var(--brand);
  color: var(--button-text);
}

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

button {
  font: inherit;
  font-weight: 400;
}

strong,
b {
  font-weight: 500;
  color: var(--ink);
}

button,
a {
  -webkit-tap-highlight-color: var(--tap-highlight);
}

button,
a {
  touch-action: manipulation;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 4px;
}

.shell {
  width: min(var(--max), calc(100% - var(--page-gutter)));
  margin: 0 auto;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-text);
}

p {
  text-wrap: pretty;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.meta-strip {
  min-height: 32px;
  border-bottom: 1px solid var(--rule-light);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.meta-strip-inner {
  width: min(var(--max), calc(100% - var(--page-gutter)));
  min-height: 32px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.meta-strip-priority {
  flex-shrink: 0;
}

.pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--accent-blue);
  animation: pulse 2.4s ease-in-out infinite;
}

/* Live status readout: scroll-tracked memory address + section + progress.
   text-transform:none keeps the lowercase 0x convention (the .meta-strip
   forces uppercase); only the section label is re-uppercased below. */
.meta-status {
  min-width: 0;
  text-transform: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.meta-status-addr {
  color: var(--accent-text);
}

.meta-status-label {
  text-transform: uppercase;
  color: var(--ink-faint);
}

.meta-status-pct {
  color: var(--ink-mute);
}

.meta-status-label:before,
.meta-status-pct:before {
  content: "\00b7";
  margin: 0 var(--space-4);
  color: var(--rule);
}

@media (max-width: 560px) {
  .meta-status-label {
    display: none;
  }
}


.nav {
  position: relative;
  min-height: 68px;
  width: min(var(--max), calc(100% - var(--page-gutter)));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  padding: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  min-height: 44px;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 17px;
  letter-spacing: .01em;
  text-decoration: none;
}

.brand span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 0;
  object-fit: contain;
  border: 0;
  filter: var(--avatar-filter);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.nav-links a,
.icon-btn {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-soft);
  padding: var(--space-5) var(--space-8);
  cursor: pointer;
  font-size: 15px;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.icon-btn {
  width: 44px;
  padding: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.theme-toggle .theme-icon-sun,
.mobile-toggle .menu-icon-close {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-icon-moon,
.mobile-toggle[aria-expanded="true"] .menu-icon-open {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-icon-sun,
.mobile-toggle[aria-expanded="true"] .menu-icon-close {
  display: block;
}

.nav-links a:focus-visible,
.icon-btn:focus-visible {
  background: var(--sand);
  border-color: var(--rule-light);
  color: var(--ink);
}

.nav-links a:active,
.icon-btn:active {
  transform: scale(.98);
  background: var(--paper-warm);
}

.nav-links a[aria-current="true"] {
  background: var(--paper-warm);
  border-color: var(--rule-light);
  color: var(--ink);
}

.mobile-toggle {
  display: none;
}

.nav-links[hidden] {
  display: none !important;
}

.hero {
  min-height: calc(100svh - 132px);
  display: grid;
  align-items: center;
  padding: clamp(var(--space-24), 6vw, 80px) 0 var(--space-32);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr);
  gap: clamp(var(--space-20), 6vw, 96px);
  align-items: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin: 0 0 var(--space-12);
}

.eyebrow:before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent-blue);
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -.028em;
  color: var(--ink);
}

h1 {
  max-width: 940px;
  margin-bottom: 0;
  font-size: var(--step-6);
  line-height: 1.06;
  text-wrap: balance;
}

.accent-word {
  color: var(--accent-blue);
}

/* Inline scope trace: one path morphs from noisy analog to a square wave. */
.signal-trace {
  display: inline-block;
  margin-left: 10px;
  vertical-align: middle;
  color: var(--accent-blue);
  overflow: visible;
}

.trace-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lead {
  margin: var(--space-12) 0 0;
  max-width: 640px;
  color: var(--ink-soft);
  font-size: var(--step-1);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-16);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  min-height: 46px;
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--button-bg);
  border-radius: var(--radius-md);
  background: var(--button-bg);
  color: var(--button-text);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.button:after {
  content: "\2192" / "";
  font-size: 14px;
  line-height: 1;
}

.button.internal:after {
  content: "\2192" / "";
}

.button.back:after {
  content: none;
}

.button.back:before {
  content: "\2190" / "";
  font-size: 14px;
  line-height: 1;
}

.button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--control-border);
}

.button:disabled,
.button[aria-disabled="true"] {
  background: var(--sand);
  border-color: var(--rule-light);
  color: var(--ink-faint);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

.button:focus-visible {
  background: var(--button-bg-hover);
  border-color: var(--button-bg-hover);
  color: var(--button-text);
  box-shadow: 0 0 0 1px var(--brand-light);
}

.button.secondary:focus-visible {
  background: var(--sand);
  border-color: var(--control-border);
  color: var(--ink);
  box-shadow: none;
}

.button:active {
  transform: translateY(0) scale(.985);
}

.button.download:after {
  content: "\2193" / "";
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8) var(--space-12);
  margin-top: var(--space-14);
  padding-top: var(--space-12);
  border-top: 1px solid var(--rule-light);
}

#about .about-proof {
  grid-column: 2;
  grid-row: 4;
  max-width: 820px;
  margin-top: 0;
  padding-top: clamp(18px, 2.2vw, 24px);
}

.hero .contact-list {
  margin-top: var(--space-24);
}

.proof-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.proof-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.proof-item.proof-text span {
  padding-left: 2px;
}

.project-card-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.project-card-wrap.featured {
  grid-column: 1 / -1;
  gap: 0;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.project-card-wrap.featured .project-card {
  min-height: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* The card is glued to the toggle/drawer as one unit, so suppress the
   lift/shadow on hover & focus here (other project cards keep theirs).
   The corner-arrow (::after) affordance still fires. */
.project-card-wrap.featured .project-card:hover,
.project-card-wrap.featured .project-card:focus-visible,
.project-card-wrap.featured .project-card:active {
  transform: none;
  box-shadow: none;
}

.project-card-wrap.featured .project-card picture {
  display: block;
  height: clamp(300px, 32vw, 440px);
  overflow: hidden;
}

.project-card-wrap.featured .project-card picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.project-card-wrap.featured .fx-layer,
.project-card-wrap.featured .fx-sched {
  height: clamp(300px, 32vw, 440px);
}

/* Tuner disclosure.
   Full-width trigger that reveals the inline tuner beneath the featured
   impedance card. Kept hidden until instrument.js confirms JS is available,
   so the no-JS state is simply the card on its own. */
.instrument-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  min-height: 44px;
  padding: var(--space-5) var(--space-12);
  border: 0;
  border-top: 1px solid var(--rule-light);
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

/* Author `display: flex` above beats the UA `[hidden]` rule, so this guard is
   REQUIRED to keep the trigger hidden until instrument.js reveals it. */
.instrument-toggle[hidden] {
  display: none;
}

.instrument-toggle-text {
  font-weight: 500;
}

.instrument-toggle-hint {
  margin-left: auto;
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.instrument-toggle-chevron {
  flex: none;
  color: var(--ink-soft);
}

.instrument-toggle[aria-expanded="true"] .instrument-toggle-chevron {
  transform: rotate(180deg);
}

.instrument-toggle:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .instrument-toggle:hover {
    background: var(--sand);
  }

  .instrument-toggle:hover .instrument-toggle-chevron {
    color: var(--ink);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .instrument-toggle-chevron {
    transition: transform var(--dur-base) var(--ease);
  }

  .instrument.is-entering {
    animation: instrument-reveal var(--dur-base) var(--ease);
  }
}

@keyframes instrument-reveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Inline VSWR tuner.
   Hands-on companion under the featured impedance card. Reuses the real
   matcher physics (see js/instrument.js). Index-only: lives in the featured
   project wrap, so project-page figures are untouched. The frame now sits on
   .project-card-wrap.featured — this is the unit's lower section, revealed by
   the .instrument-toggle disclosure. */
.instrument {
  display: grid;
  gap: var(--space-8);
  padding: var(--space-10);
  background: var(--bone);
}

/* Same gotcha as the toggle: `display: grid` beats UA `[hidden]`, so keep the
   drawer collapsed until the disclosure opens it. */
.instrument[hidden] {
  display: none;
}

.instrument-intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.instrument-intro h3 {
  margin: 0;
  font-size: var(--step-1);
  text-wrap: balance;
}

.instrument-intro p {
  margin: 0;
  max-width: 60ch;
  color: var(--ink-mute);
  font-size: var(--step--1);
  line-height: 1.45;
  text-wrap: pretty;
}

.instrument-intro b {
  color: var(--ink);
  font-weight: 500;
}

.instrument-panel {
  display: flex;
  gap: var(--space-10);
  align-items: stretch;
}

.instrument-rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  flex: 1 1 auto;
  min-width: 0;
}

.instrument-field {
  position: relative;
  flex: 0 0 auto;
  align-self: stretch;
  height: auto;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--control-border-surface);
  border-radius: var(--radius-sm);
  background: var(--bone);
}

.instrument-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.instrument-console {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.instrument-vswr {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--space-5);
  row-gap: var(--space-3);
}

.instrument-vswr-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.instrument-vswr-value {
  grid-column: 1 / -1;
  grid-row: 2;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.instrument-vswr .instrument-status {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.instrument-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.instrument-status:before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.instrument-status.is-matched {
  color: var(--brand);
}

.instrument-status.is-near {
  color: var(--brand);
}

.instrument-status.is-off {
  color: var(--ink-mute);
}

.instrument-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-10);
  margin: 0;
}

.instrument-metrics div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.instrument-metrics dt {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.instrument-metrics dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.instrument-refbar {
  height: 4px;
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--stone) 28%, transparent);
  overflow: hidden;
}

.instrument-refbar-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--stone);
  transition: width var(--dur-base) var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .instrument-refbar-fill {
    transition: none;
  }
}

.instrument-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5) var(--space-12);
  align-items: end;
  padding-top: var(--space-5);
  border-top: 1px solid var(--rule-light);
}

.instrument-slider {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.instrument-slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.instrument-slider-val {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.instrument-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.instrument-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--rule);
}

.instrument-slider input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--rule);
}

.instrument-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid var(--bone);
  background: var(--brand);
  box-shadow: var(--shadow-sm);
}

.instrument-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--bone);
  background: var(--brand);
  box-shadow: var(--shadow-sm);
}

.instrument-slider input[type="range"]:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 4px;
}

.instrument-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.instrument-btn {
  appearance: none;
  min-height: 44px;
  padding: 0 var(--space-9);
  border: 1px solid var(--control-border-surface);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.instrument-btn-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--button-text);
}

.instrument-btn:active {
  transform: translateY(1px);
}

.instrument-btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .instrument-btn:hover {
    border-color: var(--control-border-surface);
    background: var(--sand);
  }

  .instrument-btn-primary:hover {
    border-color: var(--accent-soft);
    background: var(--accent-soft);
    color: var(--button-text);
  }
}

@media (max-width: 620px) {
  .instrument-panel {
    flex-direction: column;
    align-items: center;
  }

  .instrument-field {
    align-self: auto;
    width: 100%;
    max-width: 280px;
    height: auto;
  }

  .instrument-rail {
    width: 100%;
  }

  .instrument-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .instrument-actions .instrument-btn {
    flex: 1 1 auto;
  }
}

/* Match .project-copy's mobile inset (var(--space-10)) so the card copy,
   toggle, and drawer keep a shared left edge below 560px. */
@media (max-width: 560px) {
  .instrument {
    padding: var(--space-10);
  }

  .instrument-toggle {
    padding: var(--space-5) var(--space-10);
  }
}

.project-card picture {
  display: block;
  position: relative;
  height: 285px;
  overflow: hidden;
}

.project-card picture img,
.project-card > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-bottom: 1px solid var(--rule-light);
  filter: var(--image-filter);
}

/* Pin the image so the picture box can't grow past its set height (iOS Safari
   fails to resolve height:100% on a flex item, and min-height:auto would then
   let the picture expand and push the fixed-height fx overlays out of place). */
.project-card picture img {
  position: absolute;
  inset: 0;
}

.portrait-card picture,
.hero-img picture,
.visual picture {
  display: block;
  width: 100%;
  height: 100%;
}

.video-embed {
  grid-column: 2;
  margin: var(--space-4) 0 0;
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--paper-dark);
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-embed--short .video-frame {
  aspect-ratio: 9 / 16;
  max-width: 340px;
  margin-inline: auto;
}

.video-embed--short figcaption {
  text-align: center;
}

.results-split {
  grid-column: 2;
  display: flex;
  align-items: flex-start;
  gap: clamp(20px, 3vw, 40px);
}

.results-split p {
  flex: 1 1 auto;
  grid-column: auto;
}

.results-split .video-embed {
  flex: 0 0 auto;
  width: clamp(200px, 26vw, 260px);
  margin: 0;
}

.results-split .video-embed--short .video-frame {
  max-width: none;
}

.video-poster {
  position: absolute;
  inset: 0;
  display: block;
}

.video-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-facade {
  appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: linear-gradient(color-mix(in oklch, var(--paper-dark) 26%, transparent), color-mix(in oklch, var(--paper-dark) 41%, transparent));
  transition: filter .18s ease;
}

.video-facade:hover {
  filter: brightness(1.04);
}

.video-facade:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.video-facade-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, .35));
  transition: transform .18s ease;
}

.video-facade-play svg {
  display: block;
  width: 68px;
  height: 48px;
}

.video-facade-play-bg {
  fill: #212121;
  fill-opacity: .8;
  transition: fill .18s ease, fill-opacity .18s ease;
}

.video-facade:hover .video-facade-play-bg,
.video-facade:focus-visible .video-facade-play-bg {
  fill: #f00;
  fill-opacity: 1;
}

.video-facade:hover .video-facade-play {
  transform: translate(-50%, -50%) scale(1.06);
}

@media (prefers-reduced-motion: reduce) {
  .video-facade,
  .video-facade-play { transition: none; }
}

.video-embed figcaption {
  margin-top: var(--space-5);
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.resume-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.resume-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

.resume-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-9) var(--space-12);
  margin-bottom: 24px;
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--rule);
}

.resume-toolbar h1 {
  margin: 8px 0 0;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.04;
}

.resume-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.resume-viewer {
  flex: 1;
  width: 100%;
  min-height: min(62svh, 520px);
  padding: clamp(12px, 2vw, 20px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bone);
}

.resume-viewer-status {
  margin: 0;
  padding: clamp(32px, 8vw, 48px) 0;
  text-align: center;
  color: var(--ink-mute);
}

.resume-page-canvas {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.resume-page-canvas + .resume-page-canvas {
  margin-top: 16px;
}

.resume-page-canvas canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.resume-fallback {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  min-height: min(62svh, 520px);
  padding: clamp(28px, 6vw, 40px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bone);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.resume-fallback[hidden],
.resume-fallback-noscript {
  display: none;
}

.resume-fallback-noscript {
  margin-top: 24px;
}

noscript .resume-fallback-noscript {
  display: flex;
}

.resume-fallback p {
  margin: 0;
  max-width: 30ch;
  color: var(--ink-soft);
  font-size: clamp(16px, 4vw, 18px);
  line-height: 1.5;
}

.resume-fallback-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  width: 100%;
  max-width: 320px;
}

.resume-fallback-actions .button {
  width: 100%;
}

.hero-media {
  position: relative;
  min-height: min(calc(100svh - 240px), 640px);
}

.portrait-card,
.hero-img,
.visual {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--bone);
  padding: var(--space-5);

}

.portrait-card {
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
  max-width: 620px;
  height: 100%;
}

.portrait-card:before,
.portrait-card:after,
.hero-img:before,
.hero-img:after,
.visual:before,
.visual:after,
.project-card:before,
.project-card:after {
  pointer-events: none;
}

.portrait-card:before,
.hero-img:before,
.visual:before {
  content: "";
  position: absolute;
  inset: 20px;
  z-index: 2;
  background:
    linear-gradient(var(--ink), var(--ink)) left top / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) left top / 1px 22px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right top / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right top / 1px 22px no-repeat,
    linear-gradient(var(--ink), var(--ink)) left bottom / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) left bottom / 1px 22px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right bottom / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right bottom / 1px 22px no-repeat;
  opacity: .58;
}

.portrait-card:after {
  content: none;
}

/* Remove bottom-left corner bracket marks when a caption/plate occupies that
   corner, so the two elements don't visually conflict. */
.portrait-card:before,
.hero-img[data-plate]:before,
.visual[data-plate]:before {
  background:
    linear-gradient(var(--ink), var(--ink)) left top / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) left top / 1px 22px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right top / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right top / 1px 22px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right bottom / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right bottom / 1px 22px no-repeat;
}

/* Opt out of the corner bracket marks for figures that don't need the frame
   (e.g. inline diagrams that already read clearly without it). */
.visual--bare:before {
  content: none;
}

.portrait-plate {
  position: absolute;
  left: var(--space-12);
  bottom: var(--space-12);
  z-index: 3;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--bone) 88%, transparent);
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.hero-img:after,
.visual:after {
  content: attr(data-plate) / "";
  position: absolute;
  left: var(--space-12);
  bottom: var(--space-12);
  z-index: 3;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--bone) 88%, transparent);
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.portrait-card img,
.hero-img img,
.visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--image-filter);
}

/* Portrait.
   The bottom-left corner hosts the live-age plate, so drop the bottom-left
   corner bracket on the hero portrait only. .portrait-card is index-only, so
   this never touches project-page figures. */
.portrait-card:before {
  background:
    linear-gradient(var(--ink), var(--ink)) left top / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) left top / 1px 22px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right top / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right top / 1px 22px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right bottom / 22px 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right bottom / 1px 22px no-repeat;
}

section {
  padding: clamp(var(--space-24), 6vw, 72px) 0 clamp(96px, 9vw, 128px);
}

.section-head {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  column-gap: var(--space-16);
  row-gap: var(--space-10);
  align-items: start;
  margin-bottom: var(--space-20);
  border-top: 1px solid var(--rule);
  padding-top: var(--space-8);
}

.section-head:before {
  content: attr(data-address) / "";
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}

.section-head .mono {
  grid-column: 2;
  grid-row: 1;
}

.section-title {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  max-width: 880px;
  font-size: var(--step-5);
  line-height: 1.04;
  text-wrap: balance;
}

.standfirst {
  grid-column: 2;
  grid-row: 3;
  margin: 2px 0 0;
  max-width: 660px;
  color: var(--ink-soft);
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.6;
}

.about-head {
  row-gap: clamp(18px, 2vw, 24px);
  margin-bottom: 0;
  padding-bottom: clamp(32px, 4vw, 48px);
}

.about-head .about-copy {
  grid-column: 2;
  grid-row: 3;
  margin: 0;
}

.about-copy {
  color: var(--ink-soft);
  max-width: 820px;
  font-size: var(--step-2);
  line-height: 1.45;
  text-wrap: pretty;
}

.about-copy p {
  margin: 0;
}

.about-copy .about-lead {
  color: var(--ink);
  font-weight: 500;
}

.about-copy .about-detail {
  margin-top: 0.55em;
  color: var(--ink-soft);
}

#about .skill-marquee {
  margin-top: 0;
}

.skill-marquee {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-warm);
}

.skill-track {
  display: flex;
  width: max-content;
  animation: skill-scroll 30s linear infinite;
}

.skill-set {
  display: flex;
  flex: 0 0 auto;
}

.skill-set span {
  min-height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0 clamp(24px, 4vw, 58px);
  border-right: 1px solid var(--rule-light);
  color: var(--ink);
  font-size: clamp(17px, 1.8vw, 24px);
  line-height: 1;
}

.skill-set span:before {
  content: "/" / "";
  margin-right: 18px;
  color: var(--accent-blue);
}

@keyframes skill-scroll {
  to {
    transform: translateX(-50%);
  }
}

.role {
  position: relative;
  display: grid;
  grid-template-columns: minmax(168px, 200px) minmax(0, 1fr);
  gap: var(--space-14);
  padding: var(--space-16) 0;
  border-bottom: 1px solid var(--rule-light);
}

.role-meta {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: var(--space-6);
  row-gap: var(--space-2);
  align-content: start;
}

/* Field-record spine: a vertical rule threads through each logo, bridging
   the gap into the next role so the timeline reads as one continuous line. */
.role-meta:before {
  content: "";
  position: absolute;
  left: 21px;
  top: 3px;
  bottom: calc(-1 * (var(--space-32) + 1px));
  width: 1px;
  background: var(--rule);
}

.role:last-child .role-meta:before {
  bottom: auto;
  height: 32px;
}

.logo-mark {
  position: relative;
  z-index: 1;
  grid-row: span 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-mark img[src*="hacker-fab"] {
  transform: scale(1.12);
}

.role time,
.role .org {
  color: var(--ink-faint);
}

.role time {
  align-self: end;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .02em;
  line-height: 1.25;
}

.role .org {
  align-self: start;
  color: var(--ink);
  line-height: 1.25;
}

.role h3 {
  margin: 0 0 8px;
  font-size: var(--step-3);
  line-height: 1.08;
}

.role p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.58;
}

.role-details {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-7);
}

.role-details li {
  color: var(--ink-soft);
  line-height: 1.58;
}

.role-detail-title {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.2;
  letter-spacing: -.01em;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-12);
  counter-reset: work-card;
}

.project-group-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin: var(--space-8) 0 calc(-1 * var(--space-4));
  color: var(--ink-mute);
}

.project-group-label:after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--rule);
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 510px;
  overflow: hidden;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--bone);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  counter-increment: work-card;
}

.project-card:before {
  content: "0" counter(work-card) / "";
  position: absolute;
  top: var(--space-12);
  left: var(--space-12);
  z-index: 4;
  min-width: 0;
  min-height: 0;
  display: block;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--bone) 86%, transparent);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
}

.project-card:after {
  content: "\2192" / "";
  position: absolute;
  right: var(--space-12);
  bottom: var(--space-12);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--control-border-surface);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.project-card img {
  width: 100%;
  height: 285px;
  object-fit: cover;
  border-bottom: 1px solid var(--rule-light);
  filter: var(--image-filter);
}

.project-card--companion {
  position: relative;
}

.project-card--companion .card-img-default,
.project-card--companion .card-img-hover {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 285px;
  overflow: hidden;
}

.project-card--companion .card-img-default img,
.project-card--companion .card-img-hover img {
  width: 100%;
  height: 285px;
  object-fit: cover;
  border-bottom: 1px solid var(--rule-light);
  filter: var(--image-filter);
}

.project-card--companion .card-img-hover {
  opacity: 0;
  z-index: 1;
  transition: opacity var(--dur-slow) var(--ease);
}

.project-card--companion:hover .card-img-hover,
.project-card--companion:focus-visible .card-img-hover,
.project-card--companion.fx-on .card-img-hover {
  opacity: 1;
}

.project-card--companion .project-copy {
  margin-top: 285px;
}

.project-copy {
  padding: var(--space-12) var(--space-12) var(--space-16);
}

.project-copy .mono {
  display: block;
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--rule-light);
}

.project-card h3 {
  margin: 14px 0 12px;
  padding-right: var(--space-14);
  font-size: clamp(26px, 2.4vw, 34px);
  line-height: 1.08;
}

.project-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: 20px;
  padding-right: var(--space-16);
}

.metric-row span {
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-sm);
  padding: var(--space-4) 12px;
  color: var(--ink-mute);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}

.project-card:focus-visible {
  border-color: var(--brand-light);
  background: var(--bone);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.project-card:focus-visible:after {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: var(--button-text);
}

.project-card:active {
  transform: translateY(-1px) scale(.995);
}

.page-main {
  padding: var(--space-32) 0 72px;
}

.page-main > .project-hero,
.page-main > .project-writeup {
  padding: 0;
}

.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 3.5vw, 44px);
}

.project-hero > div > .mono {
  display: block;
  margin-bottom: clamp(10px, 1.5vw, 14px);
}

.project-hero h1 {
  font-size: clamp(44px, 6vw, 84px);
  margin-bottom: clamp(10px, 1.6vw, 14px);
  line-height: 1.08;
  text-wrap: wrap;
}

h1:has(.char) {
  text-wrap: wrap;
}

.project-hero h1 .char {
  vertical-align: top;
}

.project-hero .metric-row {
  padding-right: 0;
}

.project-hero .lead {
  max-width: 760px;
}

.hero-img,
.visual {
  margin-top: 48px;
}

.hero-img {
  min-height: 520px;
}

.hero-img img,
.visual img {
  max-height: 680px;
}

.project-writeup {
  max-width: 940px;
  margin: clamp(36px, 5vw, 56px) auto 0;
}

.writeup-section {
  display: grid;
  grid-template-columns: minmax(150px, .28fr) minmax(0, 1fr);
  gap: clamp(14px, 2.5vw, 32px);
  padding: var(--space-12) 0;
  border-top: 1px solid var(--rule-light);
}

.project-writeup .writeup-section:first-child {
  padding-top: var(--space-7);
  border-top-color: var(--rule);
}

.writeup-section h2 {
  margin: 0;
  color: var(--ink);
  font-size: var(--step-4);
  line-height: 1.05;
  letter-spacing: -.015em;
}

.writeup-section p {
  grid-column: 2;
  margin: 0;
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: var(--step-0);
  line-height: 1.64;
}

.writeup-section p + p {
  margin-top: 0.75em;
}

.writeup-section ul {
  grid-column: 2;
  margin: 0.75em 0 0;
  padding: 0 0 0 1.25em;
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: var(--step-0);
  line-height: 1.64;
}

.writeup-section li + li {
  margin-top: 0.5em;
}

.next-links {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-6);
  margin-top: var(--space-24);
}

/* Inline architecture/diagram figures reuse the .visual bracket frame. */
.visual svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Context-switch diagram: horizontal on desktop, vertical on phones. */
.visual .ctx-switch--tall {
  display: none;
}

@media (max-width: 560px) {
  .visual .ctx-switch--wide {
    display: none;
  }

  .visual .ctx-switch--tall {
    display: block;
    max-width: 340px;
    margin-inline: auto;
  }

  .visual:has(.ctx-switch--tall) {
    padding-top: var(--space-10);
    padding-bottom: var(--space-24);
  }
}

/* Scannable spec lists for dense hardware detail (replaces prose walls). */
.spec-list {
  grid-column: 2;
  max-width: var(--measure);
  margin: 0.9em 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--rule-light);
}

.spec-row {
  display: grid;
  grid-template-columns: minmax(120px, .32fr) 1fr;
  gap: clamp(10px, 2vw, 20px);
  padding: var(--space-5) 0;

  border-bottom: 1px solid var(--rule-light);
}

.spec-row dt {
  margin: 0;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.5;
}

.spec-row dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
}

/* Protocol / data tables for command frames, register maps, etc. */
.protocol-table-wrap {
  grid-column: 2;
  max-width: var(--measure);
  margin: 0.9em 0 0;
  overflow-x: auto;
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-sm);
}

.protocol-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}

.protocol-table caption {
  caption-side: top;
  text-align: left;
  padding: var(--space-5) var(--space-8);
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule-light);
}

.protocol-table th,
.protocol-table td {
  padding: var(--space-4) var(--space-8);
  text-align: left;
  border-bottom: 1px solid var(--rule-light);
  color: var(--ink-soft);
}

.protocol-table th {
  color: var(--ink-mute);
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 10px;
  background: var(--surface);
}

.protocol-table tr:last-child td {
  border-bottom: none;
}

.protocol-table td:first-child,
.protocol-table th:first-child {
  white-space: nowrap;
}

/* Compact equation blocks for project writeups (no MathJax). */
.eq-stack {
  grid-column: 2;
  max-width: var(--measure);
  margin: 0.9em 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.eq-block {
  margin: 0;
  padding: var(--space-7) var(--space-8);
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--bg) 55%, transparent);
}

.eq-block-label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.eq-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  margin: 0;
  padding-top: 0.15em;
  color: var(--ink);
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(17px, 1.85vw, 21px);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  font-variant-numeric: lining-nums;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.eq-line::-webkit-scrollbar {
  display: none;
}

.eq-line + .eq-line {
  margin-top: 12px;
}

.eq-sym {
  font-style: italic;
  font-weight: 400;
}

.eq-op,
.eq-aside,
.eq-bracket {
  font-style: normal;
  font-family: var(--font-body);
}

.eq-op {
  margin: 0 0.28em;
  color: var(--ink-mute);
}

.eq-aside {
  margin-left: 0.5em;
  color: var(--ink-mute);
  font-size: 0.82em;
}

.eq-bracket {
  margin: 0 0.02em;
  font-size: 1.28em;
  line-height: 1;
  color: var(--ink-mute);
}

.eq-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 0.04em;
  text-align: center;
  line-height: 1.15;
}

.eq-num,
.eq-den {
  display: block;
  padding: 0 0.25em;
}

.eq-num {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.2em;
  margin-bottom: 0.2em;
}

.eq-bar {
  display: inline-block;
  border-top: 1.25px solid currentColor;
  padding-top: 0.06em;
  line-height: 1;
}

.eq-tilde {
  position: relative;
  padding-top: 0.12em;
}

.eq-tilde::after {
  content: "~";
  position: absolute;
  left: 50%;
  top: -0.42em;
  transform: translateX(-50%);
  font-style: normal;
  font-size: 0.65em;
  line-height: 1;
  color: currentColor;
  opacity: 0.9;
}

.eq-line sub,
.eq-note sub {
  font-size: 0.68em;
  font-style: normal;
  bottom: -0.08em;
}

.eq-line sup {
  font-size: 0.68em;
  font-style: normal;
  top: -0.4em;
}

.eq-note {
  display: block;
  margin-top: 10px;
  color: var(--ink-mute);
  font-family: var(--font-body);
  font-style: normal;
  font-size: 14px;
  line-height: 1.5;
}

.eq-note .eq-bar {
  font-style: italic;
}

.chart-figure {
  grid-column: 2;
  max-width: var(--measure);
  margin: clamp(20px, 3vw, 28px) 0 0;
  /* Room for the absolute data-plate badge below the plot. */
  padding-bottom: 44px;
}

.chart-figure:after {
  bottom: var(--space-9);
}

.chart-figure svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-axis,
.chart-label {
  fill: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.chart-grid {
  stroke: var(--rule-light);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-frame {
  fill: none;
  stroke: var(--rule-light);
  stroke-width: 1;
}

.chart-series {
  fill: none;
  stroke: var(--brand-light);
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-annot {
  fill: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .spec-list,
  .protocol-table-wrap,
  .eq-stack,
  .chart-figure {
    grid-column: 1;
  }
}

/* Enlarge chart SVG text and strokes so they stay legible when scaled down. */
@media (max-width: 560px) {
  .chart-axis,
  .chart-label,
  .chart-annot {
    font-size: 17px;
    letter-spacing: .03em;
  }

  .chart-series {
    stroke-width: 3.25;
  }

  .chart-grid,
  .chart-frame {
    stroke-width: 1.75;
  }
}

.contact-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.contact-method {
  position: relative;
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: var(--space-2) 12px;
  min-height: 68px;
  padding: var(--space-8) var(--space-8) var(--space-8) 0;
  color: var(--ink);
  text-decoration: none;
  border-right: 1px solid var(--rule-light);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.contact-method + .contact-method {
  padding-left: var(--space-8);
}

.contact-method:last-child {
  border-right: 0;
}

.contact-method:focus-visible {
  color: var(--accent-text);
  background: color-mix(in oklch, var(--paper-warm) 70%, transparent);
}

.contact-method:active {
  transform: scale(.99);
  background: var(--paper-warm);
}

.contact-method svg {
  grid-row: 1 / span 2;
  width: 18px;
  height: 18px;
  color: var(--accent-text);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-method span {
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-method strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.1;
  font-weight: 400;
}

.site-footer {
  position: relative;
  margin-top: 0;
  padding: 0 0 var(--space-24);
  color: var(--ink-faint);
  font-size: 14px;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-10);
  border-top: 1px solid var(--rule-light);
  padding-top: var(--space-12);
}

.footer-row:after {
  content: "FIN." / "";
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
}

.footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-8);
}

.footer-row a {
  color: var(--ink-soft);
  text-decoration: none;
}

/* Halt-log: a shutdown bookend to the first-visit boot sequence. Scoped to
   .site-footer so project-page footers keep their plain FIN. marker. */
.site-footer .halt-log {
  margin: 0 0 var(--space-12);
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.halt-caret {
  display: inline-block;
  width: 8px;
  height: 12px;
  margin-left: 8px;
  vertical-align: -1px;
  background: var(--accent-blue);
  animation: cursor-blink .9s steps(1) infinite;
}


/* Title rise animation: only applied when JS adds .char spans (index hero).
   Titles otherwise paint as normal text — no hide/reveal on navigation. */
.char {
  display: inline-block;
  opacity: 0;
  transform: translateY(.28em);
  animation: rise var(--dur-base) var(--ease) forwards;
  animation-delay: calc(var(--i) * 12ms);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  50% { opacity: .35; }
}

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

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: var(--space-5) var(--space-8);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-140%);
  transition: transform var(--dur-fast) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid var(--accent-blue);
  outline-offset: 4px;
}

/* Boot sequence: first visit only; [data-boot] is set by an inline head
   script so the overlay covers the page from first paint. */
.boot {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--paper);
}

:root[data-boot="1"] .boot {
  display: flex;
}

:root[data-boot="1"] body {
  overflow: hidden;
}

:root[data-boot="1"] .char {
  animation-play-state: paused;
}

.boot.done {
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease);
}

.boot-log {
  display: grid;
  gap: var(--space-6);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.boot-log span {
  opacity: 0;
}

.boot.run .boot-log span {
  animation: boot-line .01s steps(1) forwards;
  animation-delay: calc(var(--bl) * .2s);
}

.boot-cursor {
  display: inline-block;
  width: 8px;
  height: 13px;
  margin-left: 10px;
  vertical-align: -2px;
  background: var(--accent-blue);
  animation: cursor-blink .9s steps(1) infinite;
}

@keyframes boot-line {
  to { opacity: 1; }
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* Project card hover effects: one decorative overlay per card, driven by
   the .fx-on class (added by JS on hover / keyboard focus, once per entry). */
.fx-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 285px;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}

.project-card.fx-on .fx-layer {
  opacity: 1;
}

.fx-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--bone) 88%, transparent);
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Card 01 - impedance matcher: FWD/REF power bars + VSWR convergence. */
.fx-pwr {
  top: 0;
  height: 285px;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: var(--space-8);
}

.fx-pwr .fx-vswr {
  position: static;
  color: var(--accent-text);
}

.fx-pwr-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 150px;
}

.fx-pwr-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

.fx-pwr-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  width: 26px;
  flex-shrink: 0;
}

.fx-pwr-track {
  flex: 1;
  height: 5px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--stone) 22%, transparent);
  overflow: hidden;
}

.fx-pwr-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-sm);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform var(--dur-fast) var(--ease);
}

.fx-pwr-fwd {
  background: var(--accent-blue);
}

.fx-pwr-ref {
  background: color-mix(in oklch, var(--brand-light) 80%, var(--ink));
}

.fx-pwr-val {
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  color: var(--ink-mute);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* Card 02 - RTOS vehicle: labeled rate-monotonic scheduler trace. */
.fx-sched {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 285px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}

.project-card.fx-on .fx-sched {
  opacity: 1;
}

.fx-sched-bar {
  display: flex;
  align-items: flex-end;
  width: 100%;
  padding-top: var(--space-9);
  background: color-mix(in oklch, var(--bone) 86%, transparent);
  border-top: 1px solid var(--rule-light);
}

.fx-sched-bar i {
  position: relative;
  height: 4px;
  background: color-mix(in oklch, var(--stone) 42%, transparent);
}

.fx-sched-bar i:nth-child(odd) {
  background: color-mix(in oklch, var(--accent-blue) 32%, transparent);
}

.fx-sched-bar i:before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--stone);
  transform: scaleX(0);
  transform-origin: left;
}

.fx-sched-bar i:nth-child(odd):before {
  background: var(--accent-blue);
}

.fx-sched-bar i:after {
  content: attr(data-task) / "";
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: .1em;
  opacity: 0;
  white-space: nowrap;
}

.fx-sched-bar i:nth-child(1) { flex: 1.4; }
.fx-sched-bar i:nth-child(2) { flex: 1; }
.fx-sched-bar i:nth-child(3) { flex: 1.2; }
.fx-sched-bar i:nth-child(4) { flex: 2; }

.project-card.fx-on .fx-sched-bar i:before {
  animation: fx-fill .4s var(--ease) forwards;
}

.project-card.fx-on .fx-sched-bar i:after {
  animation: fx-fade .3s var(--ease) forwards;
}

.project-card.fx-on .fx-sched-bar i:nth-child(2):before,
.project-card.fx-on .fx-sched-bar i:nth-child(2):after { animation-delay: .4s; }
.project-card.fx-on .fx-sched-bar i:nth-child(3):before,
.project-card.fx-on .fx-sched-bar i:nth-child(3):after { animation-delay: .8s; }
.project-card.fx-on .fx-sched-bar i:nth-child(4):before,
.project-card.fx-on .fx-sched-bar i:nth-child(4):after { animation-delay: 1.2s; }

/* Card 03 - trash robot: CV bounding box snapping onto the target. */
.fx-cvbox {
  position: absolute;
  left: 29%;
  top: 12%;
  width: 38%;
  height: 74%;
  border: 1px dashed var(--brand-light);
  border-radius: var(--radius-sm);
}

.fx-cvbox:before,
.fx-cvbox:after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
}

.fx-cvbox:before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--brand-light);
  border-left: 1px solid var(--brand-light);
}

.fx-cvbox:after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid var(--brand-light);
  border-right: 1px solid var(--brand-light);
}

.project-card.fx-on .fx-cvbox {
  animation: fx-snap .2s var(--ease) forwards;
}

.fx-cvlabel {
  position: absolute;
  top: -1px;
  left: -1px;
  transform: translateY(-100%);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--rule-light);
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: color-mix(in oklch, var(--bone) 88%, transparent);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Card 04 - Companion uses image-swap hover (.project-card--companion). */

/* Card 05 - keychain: real photo LED chase. Five stacked frames (led-1..5),
   each a lit-LED state, cycled over the resting cover to reproduce the live
   circuit: the LMC555 clocks the CD4017 at ~10Hz, stepping one LED per 100ms,
   so a full 5-LED sweep = 0.5s. A second CD4017 latches off after 9 loops
   (~4.5s), then the frames fade back to the cover like the coin-cell auto-shutoff. */
.project-card--keychain {
  position: relative;
}

.project-card--keychain .card-img-default,
.project-card--keychain .fx-frame {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 285px;
  overflow: hidden;
}

.project-card--keychain .card-img-default img,
.project-card--keychain .fx-frame img {
  width: 100%;
  height: 285px;
  object-fit: cover;
  border-bottom: 1px solid var(--rule-light);
  filter: var(--image-filter);
}

.project-card--keychain .fx-frame {
  opacity: 0;
  z-index: 1;
}

.project-card--keychain .project-copy {
  margin-top: 285px;
}

.project-card--keychain.fx-on .fx-frame {
  animation: fx-led-frame 0.5s linear 4 forwards;
}

.project-card--keychain.fx-on .fx-frame:nth-of-type(2) { animation-delay: 0s; }
.project-card--keychain.fx-on .fx-frame:nth-of-type(3) { animation-delay: .1s; }
.project-card--keychain.fx-on .fx-frame:nth-of-type(4) { animation-delay: .2s; }
.project-card--keychain.fx-on .fx-frame:nth-of-type(5) { animation-delay: .3s; }
.project-card--keychain.fx-on .fx-frame:nth-of-type(6) { animation-delay: .4s; }

@keyframes fx-led-frame {
  0%, 19% { opacity: 1; }
  20%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .project-card--keychain.fx-on .fx-frame {
    animation: none;
    opacity: 0;
  }
}

@keyframes fx-fill {
  to { transform: scaleX(1); }
}

@keyframes fx-fade {
  to { opacity: 1; }
}

@keyframes fx-snap {
  from { transform: translate(14px, -10px); }
  to { transform: translate(0, 0); }
}

/* PCB figure photos in project writeups. */
.writeup-section .visual {
  grid-column: 2;
  margin: clamp(20px, 3vw, 28px) 0 0;
}

.pcb-figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.pcb-viewer {
  grid-column: 2;
  margin: clamp(20px, 3vw, 28px) 0 0;
  border: 1px solid var(--control-border);
  background: var(--bone);
  overflow: hidden;
}

.pcb-viewer-frame {
  position: relative;
  /* Definite height (not just min-height): KiCanvas's <kicanvas-embed> host
     sizes its inner canvas via a height:100% chain, which iOS Safari only
     resolves against an ancestor with a definite height. With min-height alone
     the canvas under-fills the host and its `background-color: aqua` shows as a
     light-blue rectangle below the drawing. */
  height: clamp(360px, 52vw, 560px);
  overflow: hidden;
  background: var(--paper-dark);
}

.pcb-viewer-frame kicanvas-embed {
  display: block;
  width: 100%;
  height: 100%;
  /* Neutralise KiCanvas :host { aspect-ratio: 1.414 } so the definite height
     above governs, and cover its debug `background-color: aqua`. */
  aspect-ratio: auto;
  background: transparent;
}

/* Keep both embeds mounted so KiCanvas can finish loading/painting.
   display:none leaves schematic canvases blank in some browsers. */
.pcb-viewer-frame kicanvas-embed.pcb-view {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
}

.pcb-viewer-frame kicanvas-embed.pcb-view.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}

/* KiCanvas load status: loading indicator + offline fallback. */
.pcb-viewer-status {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  background: var(--bone);
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  line-height: 1.5;
}

.pcb-viewer-status-msg {
  margin: 0;
  max-width: 44ch;
}

.pcb-viewer-status--error .pcb-viewer-status-msg {
  color: var(--ink-soft);
}

.pcb-viewer-status a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pcb-viewer-status a:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.pcb-viewer-caret {
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 6px;
  background: var(--ink-mute);
  vertical-align: text-bottom;
  animation: pcb-viewer-blink 1.05s steps(2, start) infinite;
}

@keyframes pcb-viewer-blink {
  to {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pcb-viewer-caret {
    animation: none;
  }
}

.pcb-viewer figcaption {
  margin: 0;
  padding: var(--space-5) var(--space-7) var(--space-6);
  border-top: 1px solid var(--rule-light);
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.pcb-viewer-toggle {
  display: inline-flex;
  border: 1px solid var(--control-border-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.pcb-toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.pcb-toggle-btn + .pcb-toggle-btn {
  border-left: 1px solid var(--control-border-surface);
}

.pcb-toggle-btn.active {
  background: var(--accent-blue);
  color: var(--button-text);
}

.pcb-toggle-btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  z-index: 1;
}

.pcb-viewer figcaption a {
  color: var(--accent-blue);
  text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover,
  .icon-btn:hover {
    background: var(--sand);
    border-color: var(--rule-light);
    color: var(--ink);
  }

  .button:hover {
    background: var(--button-bg-hover);
    border-color: var(--button-bg-hover);
    color: var(--button-text);
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px var(--brand-light);
  }

  .button.secondary:hover {
    background: var(--sand);
    border-color: var(--control-border);
    color: var(--ink);
    box-shadow: none;
  }

  .project-card:hover {
    border-color: var(--brand-light);
    background: var(--bone);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
  }

  .project-card:hover:after {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: var(--button-text);
  }

  .contact-method:hover {
    color: var(--accent-text);
    background: color-mix(in oklch, var(--paper-warm) 70%, transparent);
  }

  .pcb-toggle-btn:hover:not(.active) {
    background: var(--sand);
    color: var(--ink);
  }

  .pcb-viewer figcaption a:hover {
    text-decoration: underline;
  }

  .footer-row a:hover {
    color: var(--ink);
    text-decoration: underline;
  }

  .rtos-stepper-btn:hover:not(:disabled) {
    background: var(--rule-light);
  }
}

.footer-row a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

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

  .char {
    opacity: 1;
    transform: none;
  }

  .pulse-dot,
  .boot-cursor,
  .halt-caret {
    animation: none !important;
    opacity: 1;
  }

  .skill-marquee {
    overflow: visible;
  }

  .skill-track {
    width: auto;
    animation: none !important;
  }

  .skill-set {
    flex-wrap: wrap;
  }

  .skill-set[aria-hidden="true"] {
    display: none;
  }

}

@media (max-width: 1080px) {
  :root {
    --page-gutter: 80px;
  }

  .meta-strip {
    font-size: 10px;
  }

  .meta-strip-inner {
    gap: var(--space-6);
    min-height: 28px;
  padding: var(--space-3) 0;

  }

  .meta-strip-priority {
    text-align: right;
  }
}

@media (max-width: 900px) {
  :root {
    --header-offset: 124px;
  }

  section {
    padding: clamp(40px, 6vw, 56px) 0 clamp(64px, 8vw, 88px);
  }

  .hero {
    min-height: auto;
    padding: clamp(32px, 5vw, 56px) 0 48px;
  }

  .hero-grid,
  .project-hero,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    gap: clamp(28px, 5vw, 40px);
  }

  .hero-media {
    min-height: auto;
    order: -1;
    margin-bottom: clamp(16px, 3vw, 28px);
  }

  .portrait-card {
    position: relative;
    right: auto;
    top: auto;
    width: min(100%, 440px);
    max-width: 440px;
    margin: 0 auto;
    height: auto;
    aspect-ratio: auto;
    max-height: none;
  }

  .portrait-card picture {
    display: block;
    height: auto;
  }

  .portrait-card img {
    height: auto;
    aspect-ratio: 1;
    min-height: 0;
  }

  .hero-actions {
    flex-direction: column;
    gap: var(--space-5);
  }

  .hero-actions .button {
    width: 100%;
    min-width: 0;
    padding-inline: var(--space-7);
    font-size: 14px;
  }

  .section-head {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: var(--space-7);
    margin-bottom: 32px;
  }

  .section-head:before,
  .section-head .mono,
  .section-title,
  .standfirst,
  .about-head .about-copy,
  .about-head .about-proof,
  #about .about-proof {
    grid-column: 1;
  }

  .section-head:before {
    grid-row: 1;
  }

  .section-head .mono {
    grid-row: 1;
    padding-left: 72px;
  }

  .section-title {
    grid-row: 2;
    font-size: clamp(30px, 6.5vw, 44px);
  }

  .standfirst {
    grid-row: 3;
  }

  .about-head .about-copy {
    grid-row: 3;
    font-size: clamp(18px, 4.2vw, 24px);
  }

  .about-head .about-proof {
    grid-row: 4;
  }

  .about-head {
    padding-bottom: clamp(24px, 4vw, 36px);
  }

  .role {
    grid-template-columns: 1fr;
    gap: var(--space-9);
  }

  .role-meta {
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: var(--space-6);
  }

  .role-meta:before,
  .role:last-child .role-meta:before {
    display: none;
  }

  .logo-mark {
    width: 44px;
    height: 44px;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .nav {
    position: relative;
    gap: var(--space-4);
    min-height: 56px;
  }

  .nav-links {
    margin-left: 0;
  }

  .nav-tools {
    margin-left: auto;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    right: auto;
    width: 100vw;
    margin-left: -50vw;
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    padding: var(--space-4) calc(var(--page-gutter) / 2);
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: var(--paper);
    box-shadow: 0 16px 24px -18px rgba(0, 0, 0, .35);
    max-height: calc(100dvh - 100%);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    min-height: 48px;
    justify-content: flex-start;
    width: 100%;
    border-width: 0;
    border-radius: var(--radius-sm);
  }

  .project-writeup {
    margin-top: clamp(28px, 4.5vw, 40px);
  }

  .writeup-section {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  padding: var(--space-10) 0;

  }

  .project-writeup .writeup-section:first-child {
    padding-top: var(--space-6);
  }

  .writeup-section h2,
  .writeup-section p,
  .writeup-section ul,
  .writeup-section > *,
  .writeup-section .visual,
  .writeup-section .video-embed,
  .writeup-section .pcb-viewer,
  .writeup-section .hardware-demo,
  .writeup-section .impedance-demo-row {
    grid-column: 1;
  }

  .results-split {
    grid-column: 1;
    flex-direction: column;
    align-items: stretch;
  }

  .results-split .video-embed {
    width: auto;
  }

  .results-split .video-embed--short .video-frame {
    max-width: 340px;
    margin-inline: auto;
  }

  .contact-list {
    grid-template-columns: 1fr;
  }

  .contact-method,
  .contact-method + .contact-method {
    padding-left: 0;
    border-right: 0;
  }

  .contact-method + .contact-method {
    border-top: 1px solid var(--rule-light);
  }

  .page-main {
    padding: 56px 0 56px;
  }

  .project-hero h1 {
    font-size: clamp(36px, 8vw, 56px);
  }

  .projects-grid {
    gap: var(--space-10);
  }

  .project-card {
    min-height: auto;
  }

  .project-card-wrap.featured .project-card picture {
    height: clamp(220px, 45vw, 340px);
  }

  .project-card-wrap.featured .fx-layer,
  .project-card-wrap.featured .fx-sched {
    height: clamp(220px, 45vw, 340px);
  }

  .role-detail-title {
    font-size: clamp(16px, 3.8vw, 19px);
  }

  .resume-main {
    padding-top: clamp(24px, 4vw, 36px);
    padding-bottom: clamp(28px, 5vw, 40px);
  }

  .resume-toolbar {
    align-items: start;
    flex-direction: column;
    gap: var(--space-8);
    margin-bottom: 20px;
    padding-bottom: var(--space-10);
  }

  .resume-toolbar h1 {
    font-size: clamp(28px, 7vw, 40px);
  }

  .resume-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
    width: 100%;
  }

  .resume-actions .button {
    width: 100%;
    min-width: 0;
    padding-inline: var(--space-7);
    font-size: 14px;
  }

  .resume-actions .button.internal {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  :root {
    --page-gutter: 56px;
    --header-offset: 112px;
  }

  .meta-strip-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
  padding: var(--space-3) 0;

  }

  .meta-strip-priority {
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    font-size: 10px;
    line-height: 1.3;
  }

  .brand {
    font-size: 15px;
    gap: var(--space-5);
  }

  .brand span {
    display: inline;
    max-width: 9.5rem;
  }

  .nav {
    gap: var(--space-2);
    min-height: 52px;
  }

  .icon-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  h1 {
    font-size: clamp(34px, 9.5vw, 48px);
    line-height: 1.12;
    letter-spacing: -.018em;
    text-wrap: pretty;
    overflow-wrap: break-word;
  }

  .signal-trace {
    display: block;
    margin: 10px 0 0;
  }

  .lead {
    font-size: clamp(17px, 4.6vw, 20px);
    line-height: 1.55;
  }

  section {
    padding: 52px 0;
  }

  .hero {
    padding-top: var(--space-12);
    padding-bottom: 36px;
  }

  .hero-media {
    margin-bottom: 16px;
  }

  .portrait-card {
    width: 100%;
    max-width: none;
    aspect-ratio: auto;
  }

  .hero-proof {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-5);
    margin-top: 22px;
    padding-top: var(--space-9);
  }

  .proof-item {
    max-width: 100%;
  }

  .project-card-wrap.featured .project-card picture {
    height: clamp(200px, 52vw, 300px);
  }

  .project-card-wrap.featured .fx-layer,
  .project-card-wrap.featured .fx-sched {
    height: clamp(200px, 52vw, 300px);
  }

  .video-embed,
  .pcb-viewer {
    grid-column: 1;
  }

  .next-links .button {
    width: 100%;
  }

  .section-head {
    grid-template-columns: 1fr;
    row-gap: var(--space-8);
    margin-bottom: 28px;
  }

  .about-head {
    row-gap: var(--space-7);
    margin-bottom: 0;
    padding-bottom: var(--space-14);
  }

  .section-head:before,
  .section-head .mono,
  .section-title,
  .standfirst,
  .about-head .about-copy,
  .about-head .about-proof,
  #about .about-proof {
    grid-column: 1;
  }

  .section-head:before {
    grid-row: 1;
  }

  .section-head .mono {
    grid-row: 1;
    padding-left: 72px;
  }

  .section-title {
    grid-row: 2;
    font-size: clamp(30px, 8.5vw, 42px);
    line-height: 1.1;
  }

  .standfirst {
    grid-row: 3;
  }

  .about-head .about-copy {
    grid-row: 3;
  }

  .about-head .about-proof {
    grid-row: 4;
  }

  .about-copy {
    font-size: clamp(19px, 5.4vw, 26px);
    line-height: 1.42;
  }

  .role {
    padding: 26px 0;
  }

  .role-meta {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .logo-mark {
    width: 44px;
    height: 44px;
  }

  .skill-track {
    animation-duration: 24s;
  }

  .skill-set span {
    min-height: 58px;
    padding: 0 var(--space-12);
    font-size: 18px;
  }

  .project-card {
    min-height: auto;
  }

  .project-card picture {
    height: 200px;
  }

  .fx-layer,
  .fx-sched {
    height: 200px;
  }

  .project-copy {
  padding: var(--space-10);

  }

  .project-card h3 {
    font-size: clamp(22px, 6vw, 28px);
  }

  .metric-row {
    padding-right: 0;
  }

  .project-card .metric-row {
    padding-right: 44px;
  }

  .metric-row span {
    font-size: 11px;
    padding: 6px 9px;
  }

  .project-hero h1 {
    font-size: clamp(32px, 9vw, 44px);
  }

  .page-main {
    padding: 48px 0 44px;
  }

  .project-writeup {
    margin-top: clamp(24px, 5vw, 32px);
  }

  .writeup-section {
  padding: var(--space-8) 0;

  }

  .project-writeup .writeup-section:first-child {
    padding-top: var(--space-6);
  }

  .writeup-section h2 {
    font-size: 24px;
  }

  .writeup-section p,
  .writeup-section ul {
    font-size: 17px;
    line-height: 1.58;
  }

  .next-links {
    flex-direction: column;
    gap: var(--space-5);
  }

  .contact-method {
    grid-template-columns: 18px minmax(0, 1fr);
    min-height: 64px;
  padding: var(--space-7) 0;

  }

  .contact-method strong {
    grid-column: 2;
    font-size: 16px;
  }

  .contact-method span {
    font-size: 12px;
  }

  .footer-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 420px) {
  .brand span {
    display: none;
  }

  .meta-strip-priority {
    font-size: 10px;
  }
}

/* Command palette (⌘K).
   Site-wide launcher injected by js/portfolio.js into every page's toolbar.
   The `.cmdk` overlay toggles via the `hidden` property while also carrying an
   author `display: flex`, so the `.cmdk[hidden]` guard below is REQUIRED: a bare
   `.cmdk { display: flex }` (specificity 0,1,0) beats the UA `[hidden]` rule, so
   without the guard the dialog could never hide. */

.cmdk-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 44px;
  padding: 0 var(--space-5) 0 var(--space-6);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-md);
  background: color-mix(in oklch, var(--bone) 72%, transparent);
  color: var(--ink-mute);
  font-family: var(--font-body);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.cmdk-chip-icon {
  display: inline-flex;
  color: var(--ink-faint);
}

.cmdk-chip-icon svg {
  width: 16px;
  height: 16px;
}

.cmdk-chip-label {
  font-size: 14px;
  line-height: 1.4;
  /* Deterministic optical nudge (see .cmdk-input) now the font is self-hosted. */
  transform: translateY(2px);
}

.cmdk-chip-keys {
  display: inline-flex;
  gap: 2px;
}

.cmdk-chip-keys kbd {
  min-width: 16px;
  padding: 3px 4px;
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  text-align: center;
}

.cmdk-chip:active {
  transform: scale(.98);
}

.cmdk-chip:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  color: var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .cmdk-chip:hover {
    border-color: var(--control-border);
    color: var(--ink);
  }
}

/* Below the mobile-nav breakpoint the toolbar also gains the hamburger, so the
   chip collapses to a single 44px icon control to keep .nav-tools compact. */
@media (max-width: 900px) {
  .cmdk-chip {
    width: 44px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
    color: var(--ink-soft);
  }

  .cmdk-chip-icon {
    color: inherit;
  }

  .cmdk-chip-label,
  .cmdk-chip-keys {
    display: none;
  }

  .cmdk-chip-icon svg {
    width: 20px;
    height: 20px;
  }
}

.cmdk {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(48px, 12vh, 140px) var(--space-6) var(--space-6);
}

.cmdk[hidden] {
  display: none;
}

.cmdk-scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in oklch, var(--paper-dark) 46%, transparent);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.cmdk-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(60vh, 520px);
  overflow: hidden;
  border: 1px solid var(--control-border);
  border-radius: var(--radius-lg);
  background: var(--bone);
  box-shadow: var(--shadow-md);
  animation: cmdk-in var(--dur-base) var(--ease);
}

@keyframes cmdk-in {
  from { opacity: 0; transform: translateY(-8px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

.cmdk-field {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-7) var(--space-8);
  border-bottom: 1px solid var(--rule-light);
}

.cmdk-field:focus-within {
  box-shadow: inset 0 0 0 2px var(--accent-blue);
}

/* Windows High Contrast / forced-colors ignores box-shadow, so guarantee a
   visible focus indicator on the compound field there. */
@media (forced-colors: active) {
  .cmdk-field:focus-within {
    outline: 2px solid CanvasText;
    outline-offset: -2px;
  }
}

.cmdk-field-icon {
  display: inline-flex;
  color: var(--ink-faint);
}

.cmdk-field-icon svg {
  width: 18px;
  height: 18px;
}

.cmdk-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.4;
  /* Newsreader now always renders (self-hosted), so this optical nudge is a
     fixed, deterministic offset that centers the text on the icon. */
  transform: translateY(2px);
}

.cmdk-input::placeholder {
  color: var(--ink-faint);
}

/* Focus is surfaced on the parent .cmdk-field via :focus-within (ring above),
   so the bare input suppresses its own outline only when focus is styled. */
.cmdk-input:focus-visible {
  outline: none;
}

.cmdk-hint {
  flex-shrink: 0;
  padding: 4px 6px;
  border: 1px solid var(--control-border-surface);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
}

.cmdk-listbox {
  margin: 0;
  padding: var(--space-3);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.cmdk-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: 44px;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
}

.cmdk-option.is-active {
  background: color-mix(in oklch, var(--accent-blue) 15%, transparent);
}

.cmdk-option-label {
  font-size: 15px;
}

.cmdk-option-tag {
  flex-shrink: 0;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.cmdk-empty {
  margin: 0;
  padding: var(--space-12) var(--space-6);
  color: var(--ink-mute);
  font-size: 14px;
  text-align: center;
}

/* Freeze the page behind the open palette (class set on <html> by the script).
   Uses a fixed-body lock rather than `overflow: hidden` on the root: the latter
   breaks the sticky .site-header when the page is scrolled. The script stores the
   scroll offset in --cmdk-lock-y and restores it on close. */
:root.cmdk-open body {
  position: fixed;
  top: var(--cmdk-lock-y, 0);
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .cmdk-dialog {
    animation: none;
  }
}
