/* =========================================================================
   Sakib Alam Mubin (SA Mubin) — Light & Dark Theme Portfolio
   ========================================================================= */

@view-transition {
  navigation: auto;
}

/* Page-to-page cross-fade: quick, and the header holds still instead of fading with the page. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 200ms;
}

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-var-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* ---------- 1. Theme Tokens: Dev (Light Mode, Default) ---------- */
:root,
html[data-mode="light"] {
  --header-h: 5rem;
  --ground: #dfe2e6;
  --ground-alt: var(--ground);
  --surface: #f2f4f7;
  --surface-2: #e6e9ef;
  --plate: #c6ccd4;
  --oled-bg: #141619;
  --oled-ink: #f4a83a;
  --oled-muted: #a69f91;
  --ink: #16171a;
  --ink-2: #363940;
  --ink-3: #525660;
  --line: #bfc5cf;
  --line-strong: #9fa7b3;

  --accent: #ff5a1f;
  --accent-side: #b8380c;
  --accent-ink: #1a0d06;
  --accent-text: #b33205;

  --cap-daily-top: #f8f9fb;
  --cap-daily-bg: #eaecef;
  --cap-daily-side: #b4bac4;
  --cap-daily-ink: #16171a;

  --cap-prof-top: #464b55;
  --cap-prof-bg: #353942;
  --cap-prof-side: #1f2228;
  --cap-prof-ink: #f2f4f7;

  --cap-fam-top: #d9dde3;
  --cap-fam-bg: #cdd2da;
  --cap-fam-side: #9ea5b0;
  --cap-fam-ink: #2c2f36;

  --shadow-enclosure:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 22px 44px -20px rgba(22, 23, 26, 0.18),
    0 4px 12px -4px rgba(22, 23, 26, 0.08);

  --font: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --stretch-display: 112%;
  --stretch-head: 108%;
  --stretch-title: 104%;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --morph-t: 180ms var(--ease-out);

  color-scheme: light;
}

/* ---------- 2. Theme Tokens: Dark Mode ---------- */
html[data-mode="dark"] {
  --ground: #0b0708;
  --ground-alt: var(--ground);
  --surface: #160d0e;
  --surface-2: #1e1214;
  --plate: #090506;
  --oled-bg: #080405;
  --oled-ink: #ff5e52;
  --oled-muted: #b88b84;
  --ink: #e9dcd8;
  --ink-2: #ccb8b2;
  --ink-3: #a89089;
  --line: #2e1b1e;
  --line-strong: #46262a;

  --accent: #c42018;
  --accent-side: #7f130d;
  --accent-ink: #fff8f7;
  --accent-text: #ff6e63;

  --cap-daily-top: #2b1719;
  --cap-daily-bg: #211113;
  --cap-daily-side: #110809;
  --cap-daily-ink: #f2e4e0;

  --cap-prof-top: #221416;
  --cap-prof-bg: #190e10;
  --cap-prof-side: #0d0607;
  --cap-prof-ink: #d9c4be;

  --cap-fam-top: #180e10;
  --cap-fam-bg: #130b0c;
  --cap-fam-side: #090405;
  --cap-fam-ink: #b59c95;

  --shadow-enclosure:
    inset 0 1px 0 rgba(255, 190, 180, 0.08),
    0 16px 34px -16px rgba(0, 0, 0, 0.84),
    0 4px 12px -4px rgba(0, 0, 0, 0.65);

  --stretch-display: 112%;
  --stretch-head: 108%;
  --stretch-title: 104%;

  color-scheme: dark;
}

/* ---------- 3. Reset & Browser Surfaces ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  background-color: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  /* The one place that keeps anchor targets clear of the sticky header. */
  scroll-padding-top: calc(var(--header-h) + 0.5rem);
  caret-color: var(--accent);
  scrollbar-color: var(--line-strong) var(--ground);
  overflow-x: clip;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-color: var(--ground);
  color: var(--ink);
  overflow-x: clip;
  transition:
    background-color var(--morph-t),
    color var(--morph-t);
}

main {
  flex: 1;
}

/* Dark Mode Subtle Ambient Spotlight Overlay.
   Without JavaScript it is a fixed vignette (body::after). With it, torch.js adds a .torch
   element that follows the pointer; its position lives in two registered, non-inheriting
   properties set on that element alone, so moving the pointer restyles nothing else. */
@property --torch-x {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --torch-y {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

html[data-mode="dark"] body::after,
.torch {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  background: radial-gradient(
    560px circle at 50vw 35vh,
    rgba(224, 53, 43, 0.13) 0%,
    rgba(201, 138, 58, 0.05) 36%,
    rgba(5, 2, 3, 0.34) 78%
  );
}

.torch {
  display: none;
  background: radial-gradient(
    560px circle at var(--torch-x) var(--torch-y),
    rgba(224, 53, 43, 0.13) 0%,
    rgba(201, 138, 58, 0.05) 36%,
    rgba(5, 2, 3, 0.34) 78%
  );
}

html[data-mode="dark"] .torch {
  display: block;
}

html.has-torch[data-mode="dark"] body::after {
  display: none;
}

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

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

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

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

/* ---------- 4. Layout & Containers ---------- */
.wrap {
  width: 100%;
  max-width: 1156px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (max-width: 480px) {
  .wrap {
    padding-inline: 1rem;
  }
  .hero {
    min-height: auto;
    padding-top: 2.25rem;
    padding-bottom: 2.25rem;
    margin-bottom: 0;
  }
  .page-head {
    padding-top: 36px;
    padding-bottom: 26px;
  }
  .section {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    margin-bottom: 0;
  }
  .split-enclosure,
  .dossier-console,
  .dispatch-console {
    padding: 10px;
    border-radius: 14px;
    gap: 12px;
  }
  .index-enclosure,
  .ledger-enclosure {
    border-radius: 14px;
  }
  .split-pane,
  .dossier-bio-bay,
  .dossier-roles-bay,
  .dispatch-bay {
    padding: 16px 14px;
    border-radius: 11px;
  }
  .ledger-row {
    padding: 14px 12px;
    border-radius: 11px;
  }
  .index-row {
    padding: 1.15rem 0.95rem;
  }
}

@media (max-width: 360px) {
  .wrap {
    padding-inline: 0.875rem;
  }
}

@media (min-width: 768px) {
  .wrap {
    padding-inline: 2.5rem;
  }
}

@media (min-width: 1120px) {
  .wrap {
    padding-inline: 3rem;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus {
  left: 1rem;
}

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

/* ---------- 5. Typography Hierarchy (No Kickers!) ---------- */
h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--ink);
  text-wrap: balance;
  transition: color var(--morph-t), font-stretch var(--morph-t);
}

h1,
.hero-name,
.page-title {
  font-size: clamp(2.55rem, 4.8vw, 4.35rem);
  font-weight: 800;
  font-stretch: var(--stretch-display);
  line-height: 0.96;
  letter-spacing: -0.038em;
  margin-bottom: 1.15rem;
}

.hero-name .line {
  display: block;
}

.hero-name .accent {
  color: var(--accent-text);
}

h2,
.section-title {
  font-size: clamp(1.85rem, 3.6vw, 2.95rem);
  font-weight: 800;
  font-stretch: var(--stretch-head);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}

h3,
.card-title,
.index-title {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  font-weight: 800;
  font-stretch: var(--stretch-title);
  line-height: 1.16;
  letter-spacing: -0.015em;
}

p {
  max-width: 66ch;
  text-wrap: pretty;
}

.is-crypt {
  font-variant-numeric: tabular-nums;
}

/* ---------- 6. Header & Dev / Sec Theme Switch ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 45;
  padding: 0.75rem 1.5rem 0.35rem;
  background: transparent;
  border-bottom: 0;
  pointer-events: none;
}

.site-header .wrap {
  position: relative;
  view-transition-name: site-header;
  pointer-events: auto;
  max-width: 1180px;
  min-height: 3.65rem;
  padding: 0.45rem 0.65rem 0.45rem 1.15rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  transition:
    background-color var(--morph-t),
    border-color var(--morph-t),
    box-shadow 220ms var(--ease-out);
}

.site-header.is-stuck .wrap {
  border-color: var(--line-strong);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 800;
  font-stretch: var(--stretch-display);
  font-size: clamp(1.18rem, 1.4vw, 1.38rem);
  letter-spacing: -0.036em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--morph-t), font-stretch var(--morph-t);
}

.brand-accent {
  color: var(--accent-text);
  transition: color var(--morph-t);
}

.site-nav {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: background-color var(--morph-t), border-color var(--morph-t);
}

.site-nav a {
  padding: 0.42rem 0.95rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink-2);
  text-decoration: none;
  transition:
    color 150ms var(--ease-out),
    background-color 150ms var(--ease-out),
    box-shadow 150ms var(--ease-out);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 760;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
  text-decoration: none;
}

.header-tools {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

/* Tactile Dev (Light) ⇄ Sec (Dark) Sliding Segmented Toggle */
.mode-switch {
  --ms-pad: 3px;
  appearance: none;
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: var(--ms-pad);
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--morph-t), border-color var(--morph-t), transform 80ms var(--ease-out);
}

.mode-switch:active {
  transform: translateY(1px);
}

.mode-switch-thumb {
  position: absolute;
  left: var(--ms-pad);
  top: var(--ms-pad);
  bottom: var(--ms-pad);
  width: calc(50% - var(--ms-pad));
  border-radius: 8px;
  background: linear-gradient(180deg, #ff7a47, var(--accent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -2px 0 var(--accent-side),
    0 2px 6px rgba(0, 0, 0, 0.22);
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background var(--morph-t),
    box-shadow var(--morph-t);
  z-index: 0;
}

html[data-mode="dark"] .mode-switch-thumb {
  transform: translateX(100%);
  background: linear-gradient(180deg, #d12820, var(--accent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.55);
}

.mode-switch-opt {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.34rem;
  padding: 0.34rem 0.62rem 0.42rem;
  font-weight: 760;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--ink-3);
  transition: color 180ms var(--ease-out);
}

.mode-switch svg {
  width: 0.88rem;
  height: 0.88rem;
  flex-shrink: 0;
}

html:not([data-mode="dark"]) .mode-switch-opt--light,
html[data-mode="light"] .mode-switch-opt--light {
  color: var(--accent-ink);
}

html[data-mode="dark"] .mode-switch-opt--dark {
  color: var(--accent-ink);
}

/* Compact Sound Mute Button */
.tool {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  width: 2.45rem;
  height: 2.45rem;
  padding: 0 0 3px;
  border-radius: 11px;
  color: var(--cap-daily-ink);
  background: linear-gradient(180deg, var(--cap-daily-top), var(--cap-daily-bg));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -4px 0 var(--cap-daily-side),
    0 4px 8px -2px rgba(0, 0, 0, 0.24);
  transition: transform 80ms var(--ease-out), box-shadow 80ms;
}

.tool:active {
  transform: translateY(2px);
  box-shadow: inset 0 -1px 0 var(--cap-daily-side);
}

.tool svg {
  width: 1.1rem;
  height: 1.1rem;
}

.tool[aria-pressed="false"] .ico-on,
.tool[aria-pressed="true"] .ico-off {
  display: none;
}

@media (max-width: 1020px) {
  .site-header .wrap {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.65rem;
    padding: 0.45rem 0.55rem 0.45rem 0.95rem;
  }
  .site-nav {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar {
    display: none;
  }
  .site-nav a {
    padding: 0.4rem 0.68rem;
    font-size: 0.88rem;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 5.9rem;
  }
  .site-header {
    padding: 0.45rem 0.65rem 0.25rem;
  }
  .site-header .wrap {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "brand tools"
      "nav nav";
    align-items: center;
    gap: 0.4rem;
    min-height: 0;
    padding: 0.4rem 0.55rem;
    border-radius: 14px;
  }
  .brand {
    grid-area: brand;
    font-size: 1rem;
    gap: 0.42rem;
    flex-shrink: 0;
    padding-left: 0.15rem;
  }
  .header-tools {
    grid-area: tools;
    justify-self: end;
    display: flex !important;
    align-items: center;
    gap: 0;
    margin-right: 0.05rem;
    min-width: 0;
  }
  .mode-switch {
    --ms-pad: 3px;
    min-height: 36px;
    align-self: center;
  }
  .mode-switch-opt {
    padding: 0.32rem 0.62rem 0.38rem;
    gap: 0.3rem;
    font-size: 0.76rem;
  }
  .mode-switch svg {
    width: 0.78rem;
    height: 0.78rem;
  }
  /* No sound control on phones: the Dev/Sec switch is the only header tool. */
  .header-tools [data-sound-toggle] {
    display: none;
  }
  .site-nav {
    grid-area: nav;
    justify-self: stretch;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 3px;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar {
    display: none;
  }
  .site-nav a {
    flex: 1 0 auto;
    justify-content: center;
    text-align: center;
    padding: 0.36rem 0.55rem;
    font-size: 0.8rem;
    white-space: nowrap;
    min-height: 36px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 380px) {
  .site-header {
    padding-inline: 0.5rem;
  }
  .site-header .wrap {
    padding: 0.38rem 0.45rem;
    gap: 0.35rem;
  }
  .brand {
    font-size: 0.94rem;
    gap: 0.36rem;
  }
  .mode-switch-opt {
    padding: 0.3rem 0.5rem 0.36rem;
    gap: 0.22rem;
    font-size: 0.7rem;
  }
  .site-nav a {
    padding: 0.34rem 0.46rem;
    font-size: 0.76rem;
    min-height: 34px;
  }
}

/* ---------- 7. Tactile Mechanical Keycap Buttons (.key) ---------- */
.keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.key {
  --cap-top: var(--cap-daily-top);
  --cap-bg: var(--cap-daily-bg);
  --cap-side: var(--cap-daily-side);
  --cap-ink: var(--cap-daily-ink);
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1.25rem 0.96rem;
  border-radius: 11px;
  font-family: var(--font);
  font-weight: 760;
  font-size: 0.96rem;
  line-height: 1.1;
  color: var(--cap-ink);
  text-decoration: none;
  background: linear-gradient(180deg, var(--cap-top), var(--cap-bg) 78%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -5px 0 var(--cap-side),
    0 7px 14px -6px rgba(0, 0, 0, 0.35),
    0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 75ms var(--ease-out), box-shadow 75ms var(--ease-out), filter 120ms;
  -webkit-tap-highlight-color: transparent;
}

.key:hover {
  filter: brightness(1.03);
}

.key:active,
.key.is-down {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 var(--cap-side),
    0 2px 4px -2px rgba(0, 0, 0, 0.35);
}

.key--accent,
.key[data-mode-set][aria-pressed="true"] {
  --cap-top: #ff7a47;
  --cap-bg: var(--accent);
  --cap-side: var(--accent-side);
  --cap-ink: var(--accent-ink);
}

html[data-mode="dark"] .key--accent,
html[data-mode="dark"] .key[data-mode-set][aria-pressed="true"] {
  --cap-top: #d12820;
  --cap-bg: var(--accent);
  --cap-side: var(--accent-side);
  --cap-ink: var(--accent-ink);
}

.key-led {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
  flex-shrink: 0;
  transition: background-color 160ms, opacity 160ms, box-shadow 160ms;
}

.key[data-mode-set][aria-pressed="true"] .key-led {
  background: currentColor;
  opacity: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 1px rgba(0, 0, 0, 0.25);
}

.key--slate {
  --cap-top: var(--cap-prof-top);
  --cap-bg: var(--cap-prof-bg);
  --cap-side: var(--cap-prof-side);
  --cap-ink: var(--cap-prof-ink);
}

.key svg {
  width: 1.05rem;
  height: 1.05rem;
}

.kbd {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.08rem 0.34rem;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.09);
  color: inherit;
  line-height: 1.25;
}

.key--accent .kbd,
.key[data-mode-set][aria-pressed="true"] .kbd {
  background: rgba(255, 255, 255, 0.24);
}

html[data-mode="dark"] .kbd {
  background: rgba(255, 255, 255, 0.12);
}

html[data-mode="dark"] .key--accent .kbd,
html[data-mode="dark"] .key[data-mode-set][aria-pressed="true"] .kbd {
  background: rgba(0, 0, 0, 0.24);
}

kbd {
  font-family: var(--mono);
  font-size: 0.85em;
  font-weight: 700;
  padding: 0.08rem 0.38rem;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

/* ---------- 8. Hero Section, Portrait & 4-Stage Intro Choreography ---------- */
.hero {
  position: relative;
  min-height: calc(100svh - var(--header-h, 4.5rem));
  display: flex;
  align-items: center;
  padding-block: clamp(2rem, 4.5vh, 4rem);
  margin-bottom: 0;
  background-color: var(--ground);
  border-bottom: 0;
  transition: background-color var(--morph-t);
}

.hero-grid {
  display: block;
  max-width: 860px;
  margin-inline: auto;
}

.hero-grid:not(:has(.hero-portrait-col)) {
  text-align: center;
}

.hero-grid:not(:has(.hero-portrait-col)) .hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-inline: auto;
}

.hero-grid:not(:has(.hero-portrait-col)) .hero-lead {
  margin-inline: auto;
}

.hero-grid:not(:has(.hero-portrait-col)) .keys {
  justify-content: center;
}

.hero-grid:has(.hero-portrait-col) {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(310px, 380px);
  align-items: center;
  justify-content: center;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  max-width: 1156px;
  margin-inline: auto;
}

.hero-name {
  font-size: clamp(2.65rem, 5.2vw, 5.15rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
  margin-bottom: clamp(1.1rem, 2vh, 1.55rem);
}

.hero-role {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: clamp(1.16rem, 1.55vw, 1.38rem);
  font-weight: 760;
  letter-spacing: -0.015em;
  color: var(--accent-text);
  text-wrap: balance;
  margin-bottom: clamp(0.85rem, 1.6vh, 1.15rem);
  transition: color var(--morph-t);
}

.hero-lead {
  font-size: clamp(1.04rem, 1.24vw, 1.15rem);
  color: var(--ink-2);
  line-height: 1.65;
  margin-bottom: 1.4rem;
  max-width: 52ch;
  transition: color var(--morph-t);
}

.hero-lead--minimal {
  font-size: clamp(1.04rem, 1.22vw, 1.15rem);
  line-height: 1.68;
  max-width: 100%;
  margin-bottom: 1.4rem;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
  text-wrap: wrap;
}

.hero-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0;
}

.hero-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.34rem 0.72rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-2);
  line-height: 1.25;
  transition: background-color var(--morph-t), border-color var(--morph-t), color var(--morph-t);
}

.hero-meta-pill strong {
  color: var(--ink);
  font-weight: 720;
}

.hero-meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* Smooth staggered Hero entrance (only runs when .intro-stage is absent / inactive) */
@keyframes hero-enter {
  from {
    opacity: 0;
    translate: 0 14px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > * {
  animation: hero-enter 640ms var(--ease-out) both;
}

html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > *:nth-child(1) {
  animation-delay: 0ms;
}
html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > *:nth-child(2) {
  animation-delay: 65ms;
}
html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > *:nth-child(3) {
  animation-delay: 130ms;
}
html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > *:nth-child(4) {
  animation-delay: 195ms;
}
html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > *:nth-child(5) {
  animation-delay: 260ms;
}

/* Stagger Hero slots 0 -> 65 -> 130 -> 195 -> 260ms */
html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > .hero-role {
  animation-delay: 65ms;
}
html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > .hero-lead {
  animation-delay: 130ms;
}
html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > .hero-meta-strip {
  animation-delay: 195ms;
}
html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-copy > .keys {
  animation-delay: 260ms;
}

html:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-portrait-frame {
  animation: hero-enter 680ms var(--ease-out) 110ms both;
}

.hero-note {
  margin-top: 1.35rem;
  font-size: 0.88rem;
  color: var(--ink-3);
  transition: color var(--morph-t);
}

/* Hero Headshot / Avatar Stage Frame (Single-Enclosure Rule, borderless inset well) */
.hero-portrait-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 960px;
}

.hero-portrait-frame {
  --tilt-rx: 0deg;
  --tilt-ry: 0deg;
  width: 100%;
  max-width: 380px;
  margin: 0;
  padding: 12px 12px 10px;
  border-radius: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: rotateX(calc(var(--tilt-rx) + var(--press-rx, 0deg))) rotateY(var(--tilt-ry)) scale(var(--press-s, 1));
  transform-style: preserve-3d;
  will-change: transform;
  transition:
    background-color var(--morph-t),
    border-color var(--morph-t),
    box-shadow var(--morph-t),
    transform 260ms var(--ease-out);
}

.hero-portrait-well {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 90, 31, 0.14), transparent 68%),
    linear-gradient(180deg, #161c24 0%, #0f1319 100%);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.36),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

html[data-mode="dark"] .hero-portrait-well {
  background:
    radial-gradient(circle at 50% 36%, rgba(224, 53, 43, 0.18), transparent 68%),
    linear-gradient(180deg, #190d10 0%, #0b0607 100%);
}

.hero-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 12%;
  display: block;
  transition: filter 320ms var(--ease-out), transform 420ms var(--ease-out);
}

html[data-mode="dark"] .hero-portrait-img {
  filter: contrast(1.05) brightness(0.88);
}

.hero-portrait-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 2px 6px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-2);
}

.hero-portrait-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
}

.hero-portrait-boop {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition:
    background-color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    transform 90ms var(--ease-out);
}

.hero-portrait-boop:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.hero-portrait-boop:active {
  transform: translateY(1px) scale(0.98);
}

.hero-portrait-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  transition: background-color 140ms var(--ease-out), transform 140ms var(--ease-out);
}

.hero-portrait-boop.is-booped .hero-portrait-led {
  background: var(--oled-ink);
  transform: scale(1.25);
}

.hero-portrait-handle {
  color: var(--accent-text);
}

/* 4-Stage Intro Choreography & FLIP Docking States */
[data-brand-text],
[data-intro-name-text] {
  display: inline-block;
  line-height: 1;
}

.site-header [data-brand-text],
.hero [data-hero-portrait-well] {
  transition: opacity 200ms var(--ease-out);
}

html.is-intro-active:not(.is-intro-landed) .site-header [data-brand-text],
html.is-intro-active:not(.is-intro-landed) .hero [data-hero-portrait-well] {
  opacity: 0;
  transition: none;
}

html.is-intro-active.is-intro-landed .site-header [data-brand-text],
html.is-intro-active.is-intro-landed .hero [data-hero-portrait-well] {
  opacity: 1;
}

html.is-intro-active:not(.is-intro-docking) .site-header,
html.is-intro-active:not(.is-intro-docking) .hero .hero-copy,
html.is-intro-active:not(.is-intro-docking) .hero .hero-portrait-frame,
html.is-intro-active:not(.is-intro-docking) main > :not(.hero),
html.is-intro-active:not(.is-intro-docking) .site-footer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}

html.is-intro-active:not(.is-intro-docking) .hero .hero-copy {
  transform: translate3d(0, 14px, 0);
}

html.is-intro-active.is-intro-docking .site-header {
  transition: opacity 420ms var(--ease-out) 160ms;
}

html.is-intro-active.is-intro-docking .hero .hero-copy {
  transition: opacity 480ms var(--ease-out) 160ms, transform 540ms var(--ease-out) 160ms;
}

html.is-intro-active.is-intro-docking .hero .hero-portrait-frame {
  transition:
    opacity 480ms var(--ease-out) 160ms,
    background-color var(--morph-t),
    border-color var(--morph-t);
}

html.is-intro-active.is-intro-docking main > :not(.hero),
html.is-intro-active.is-intro-docking .site-footer {
  transition: opacity 480ms var(--ease-out) 220ms;
}

.intro-stage[hidden] {
  display: none !important;
}

.intro-stage {
  --intro-photo-size: clamp(140px, 19vw, 210px);
  --intro-photo-gap: clamp(18px, 3.2vw, 40px);
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--ground);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    background-color 540ms var(--ease-out),
    opacity 240ms var(--ease-out),
    visibility 240ms;
}

html.is-intro-active .intro-stage {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: background-color 540ms var(--ease-out);
}

html.is-intro-docking .intro-stage {
  background-color: transparent;
  pointer-events: none;
}

html.is-intro-done .intro-stage {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-actor-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--intro-photo-gap);
}

.intro-name {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 4.25rem);
  font-weight: 800;
  font-stretch: var(--stretch-display);
  letter-spacing: -0.036em;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  transform: translate3d(calc((var(--intro-photo-size) + var(--intro-photo-gap)) * 0.5), 22px, 0) scale(0.95);
  transition:
    opacity 680ms var(--ease-out),
    transform 780ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}

/* Step 1 is pure CSS: the name rises the moment the bootstrap arms the intro, before any module loads. */
html.is-intro-active .intro-name,
.intro-stage.is-step-enter .intro-name {
  opacity: 1;
  transform: translate3d(calc((var(--intro-photo-size) + var(--intro-photo-gap)) * 0.5), 0, 0) scale(1);
}

html.is-intro-active .intro-name {
  animation: intro-name-in 780ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@keyframes intro-name-in {
  from {
    opacity: 0;
    transform: translate3d(calc((var(--intro-photo-size) + var(--intro-photo-gap)) * 0.5), 22px, 0) scale(0.95);
  }
}

.intro-stage.is-step-split .intro-name {
  transform: translate3d(0, 0, 0) scale(1);
}

.intro-word--accent {
  color: var(--accent-text);
  transition: color 420ms var(--ease-out);
}

.intro-collapse {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  opacity: 1;
  transform: translate3d(0, 0, 0) scaleX(1);
  transform-origin: left center;
  transition:
    width 580ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 420ms var(--ease-out),
    transform 580ms cubic-bezier(0.22, 1, 0.36, 1);
}

.intro-stage.is-step-collapse .intro-collapse {
  opacity: 0;
  transform: translate3d(0, -6px, 0) scaleX(0.65);
}

.intro-photo {
  width: var(--intro-photo-size);
  height: var(--intro-photo-size);
  border-radius: 14px;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(26px, 0, 0) scale(0.88);
  flex-shrink: 0;
  box-shadow: var(--shadow-enclosure);
  transition:
    opacity 540ms var(--ease-out),
    transform 780ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}

.intro-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 12%;
  display: block;
}

.intro-stage.is-step-split .intro-photo {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.intro-stage.is-step-dock .intro-photo {
  box-shadow: none;
  border-radius: 14px;
}

@media (max-width: 900px) {
  .hero-grid,
  .hero-grid:has(.hero-portrait-col) {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 2rem;
  }
  .hero-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 540px;
  }
  .hero-lead,
  .hero-lead--minimal {
    margin-inline: auto;
  }
  .hero-meta-strip {
    justify-content: center;
  }
  .hero-portrait-col {
    order: -1;
    align-items: center;
  }
  .hero-portrait-frame {
    width: 100%;
    max-width: 340px;
  }
}

@media (max-width: 580px) {
  .intro-stage {
    --intro-photo-size: clamp(88px, 23vw, 124px);
    --intro-photo-gap: clamp(12px, 2.8vw, 18px);
  }
  .intro-name {
    font-size: clamp(1.45rem, 5.8vw, 2.2rem);
  }
}

/* ---------- 9. Hanging S-A-M-U-B-I-N Keypad Below Hero ---------- */
.keypad-drop {
  position: relative;
  background: var(--ground);
  border-bottom: 0;
  padding: 20px 0 28px;
}

.keypad-drop-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  align-items: center;
  gap: 2rem;
}

.rig {
  position: relative;
  height: 235px;
  touch-action: pan-y;
}

.rig-cable {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.cable-shadow {
  fill: none;
  stroke: rgba(0, 0, 0, 0.26);
  stroke-width: 11px;
  stroke-linecap: round;
  transform: translate(3px, 5px);
}

.cable-body {
  fill: none;
  stroke: #23262d;
  stroke-width: 8px;
  stroke-linecap: round;
}

html[data-mode="dark"] .cable-body {
  stroke: #2c1215;
}

.cable-spec {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 2px;
  stroke-linecap: round;
  transform: translateX(-1.5px);
}

.pad {
  --u: clamp(50px, 4.6vw, 62px);
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--u) * 4 + 9px * 3 + 34px);
  padding: 21px 17px 17px;
  border-radius: 20px;
  background: linear-gradient(180deg, #383c44, #22252b 58%, #191b20);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.55),
    0 24px 42px -16px rgba(0, 0, 0, 0.65);
  transform-origin: 50% 0;
  will-change: transform;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
}

html[data-mode="dark"] .pad {
  background: linear-gradient(180deg, #271517, #170c0e 58%, #0f0708);
}

.pad.is-dragging {
  cursor: grabbing;
}

.pad-port {
  position: absolute;
  left: 50%;
  top: -8px;
  width: 32px;
  height: 12px;
  translate: -50% 0;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #c9c9c9, #86888d);
}

.pad-led {
  position: absolute;
  left: 19px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3a2a22;
}

.pad-led.is-on {
  background: var(--accent);
}
.pad-led.is-auth {
  background: #4ade80;
}

.pad-grid {
  display: grid;
  grid-template-columns: repeat(4, var(--u));
  gap: 9px;
}

.cap {
  --cap-top: #f5f1e8;
  --cap-bg: #e6e0d2;
  --cap-side: #b6ae9b;
  --cap-ink: #18191c;
  position: relative;
  width: var(--u);
  height: var(--u);
  border: 0;
  border-radius: 11px;
  padding: 0 0 5px;
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-weight: 800;
  font-stretch: var(--stretch-head);
  font-size: calc(var(--u) * 0.39);
  color: var(--cap-ink);
  background: linear-gradient(180deg, var(--cap-top), var(--cap-bg) 76%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -5px 0 var(--cap-side),
    0 4px 7px -2px rgba(0, 0, 0, 0.65);
  cursor: pointer;
  transition: transform 70ms var(--ease-out), box-shadow 70ms;
}

html[data-mode="dark"] .cap {
  --cap-top: #2d181b;
  --cap-bg: #211113;
  --cap-side: #0e0607;
  --cap-ink: #f2deda;
}

.cap--accent {
  --cap-top: #ff7c4a;
  --cap-bg: var(--accent);
  --cap-side: var(--accent-side);
  --cap-ink: var(--accent-ink);
}

html[data-mode="dark"] .cap--accent {
  --cap-top: #d12820;
  --cap-bg: var(--accent);
  --cap-side: var(--accent-side);
  --cap-ink: var(--accent-ink);
}

.cap.is-down {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 var(--cap-side),
    0 1px 2px rgba(0, 0, 0, 0.65);
}

.cap svg {
  width: 42%;
  height: 42%;
}

.keypad-copy h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 800;
  font-stretch: var(--stretch-title);
  margin-bottom: 0.45rem;
}

.keypad-copy p {
  color: var(--ink-2);
  font-size: 0.98rem;
}

@media (max-width: 820px) {
  .keypad-drop-inner {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .keypad-copy {
    padding-top: 1.5rem;
  }
}

/* ---------- 10. Signature "Loadout / Arsenal" Mechanical Keyboard Section ---------- */
.section {
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: clamp(3rem, 6vh, 4.75rem);
  padding-bottom: clamp(3rem, 6vh, 4.75rem);
  margin-bottom: 0;
  background-color: var(--ground);
  border-top: 1px solid var(--line);
  border-bottom: 0;
  transition: background-color var(--morph-t), border-color var(--morph-t);
}

.section:last-of-type {
  margin-bottom: 0;
}

main > .section:first-child {
  border-top: 0;
}

@media (max-width: 640px) {
  .hero {
    min-height: auto;
    padding-top: 2.25rem;
    padding-bottom: 2.25rem;
    margin-bottom: 0;
  }
  .section {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    margin-bottom: 0;
  }
}

.section-alt {
  background-color: var(--ground);
}

.section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  margin-bottom: clamp(1.75rem, 3vw, 2.35rem);
}

.section-head > div {
  max-width: 68ch;
  margin-inline: auto;
}

.section-head h2 {
  margin-inline: auto;
}

.section-sub {
  color: var(--ink-2);
  font-size: 1.04rem;
  max-width: 62ch;
  margin-inline: auto;
  text-align: center;
  transition: color var(--morph-t);
}

/* ---------- Loadout Showcase Stage: Centered Title + Dynamic Category Editorial Panel & Hanging Rig ---------- */
#loadout .wrap {
  max-width: 1280px;
}

.section-head--center {
  justify-content: center;
  text-align: center;
  margin-bottom: clamp(16px, 2.2vw, 28px);
}

.section-head--center h2 {
  margin-inline: auto;
}

.loadout-stage {
  display: grid;
  grid-template-columns: minmax(310px, 0.46fr) minmax(0, 1fr);
  gap: clamp(22px, 3vw, 44px);
  align-items: center;
}

.loadout-editorial {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.loadout-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.loadout-step {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.5rem 0.65rem;
  min-height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 720;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    background-color 160ms var(--ease-out),
    color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
}

.loadout-step:hover {
  color: var(--ink);
  background: var(--surface);
}

.loadout-step.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.28);
}

.loadout-card {
  height: 364px;
  min-height: 364px;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: clamp(18px, 2.2vw, 26px);
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background-color var(--morph-t), border-color var(--morph-t);
}

.loadout-card.is-switching > * {
  animation: loadout-text-swap 220ms var(--ease-out) both;
}

@keyframes loadout-text-swap {
  0% {
    opacity: 0.3;
    transform: none;
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

.loadout-layer-title {
  flex-shrink: 0;
  margin: 0 auto;
  min-height: 2.36em;
  font-family: var(--font-display);
  font-size: clamp(1.26rem, 2.1vw, 1.62rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--ink);
}

.loadout-layer-desc {
  flex-shrink: 0;
  margin: 0 auto;
  min-height: 6.2em;
  font-size: 0.96rem;
  line-height: 1.55;
  text-align: center;
}

.loadout-chip-grid {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
}

.loadout-chip {
  padding: 0.24rem 0.52rem;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  cursor: pointer;
  user-select: none;
  transition: border-color 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.loadout-chip.is-active,
.loadout-chip:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
  transform: translateY(-1px);
}

/* Custom Hanging 3D Keyboard Rig: Dual Permanently-Connected Braided USB-C Cables */
.hanging-kb-rig {
  --rig-top: clamp(72px, 8.5vw, 96px);
  --rig-bot: clamp(46px, 6vw, 66px);
  position: relative;
  width: 100%;
  max-width: 800px;
  margin-inline: auto;
  padding-top: var(--rig-top);
  padding-bottom: var(--rig-bot);
}

.loadout-stage .hanging-kb-rig {
  margin-inline: 0;
  justify-self: end;
}

.kb-wall-shadow {
  position: absolute;
  left: 10px;
  right: 10px;
  top: var(--rig-top);
  bottom: var(--rig-bot);
  border-radius: 20px;
  background: radial-gradient(ellipse at 50% 42%, rgba(15, 17, 22, 0.34) 0%, rgba(15, 17, 22, 0.16) 66%, transparent 100%);
  filter: blur(18px);
  transform-origin: 50% 0;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

html[data-mode="dark"] .kb-wall-shadow {
  background: radial-gradient(ellipse at 50% 42%, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.5) 68%, transparent 100%);
  filter: blur(22px);
}

.kb-cables {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 155px;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.kb-cables .kb-cable-wall-shadow {
  fill: none;
  stroke: rgba(12, 14, 19, 0.22);
  stroke-width: 14px;
  stroke-linecap: round;
  filter: blur(4px);
}

html[data-mode="dark"] .kb-cables .kb-cable-wall-shadow {
  stroke: rgba(0, 0, 0, 0.62);
  stroke-width: 15.5px;
}

.kb-cables .cable-shadow {
  fill: none;
  stroke: rgba(0, 0, 0, 0.22);
  stroke-width: 9px;
  stroke-linecap: round;
  transform: translate(1.6px, 2.4px);
}

html[data-mode="dark"] .kb-cables .cable-shadow {
  stroke: rgba(0, 0, 0, 0.54);
}

.kb-cables .cable-body {
  fill: none;
  stroke: #12151b;
  stroke-width: 7.8px;
  stroke-linecap: round;
}

html[data-mode="dark"] .kb-cables .cable-body {
  stroke: #0b0305;
}

.kb-cables .cable-core {
  fill: none;
  stroke: #242934;
  stroke-width: 6px;
  stroke-linecap: round;
}

html[data-mode="dark"] .kb-cables .cable-core {
  stroke: #220d11;
}

.kb-cables .cable-sheath {
  fill: none;
  stroke: #343b48;
  stroke-width: 3.6px;
  stroke-linecap: round;
}

html[data-mode="dark"] .kb-cables .cable-sheath {
  stroke: #36151a;
}

.kb-cables .cable-weave-a {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1.7px;
  stroke-dasharray: 1.4 2.4;
  stroke-linecap: round;
}

.kb-cables .cable-weave-b {
  fill: none;
  stroke: rgba(0, 0, 0, 0.44);
  stroke-width: 1.7px;
  stroke-dasharray: 1.4 2.4;
  stroke-dashoffset: 1.9;
  stroke-linecap: round;
}

html[data-mode="dark"] .kb-cables .cable-weave-a {
  stroke: rgba(255, 102, 92, 0.2);
}

html[data-mode="dark"] .kb-cables .cable-weave-b {
  stroke: rgba(0, 0, 0, 0.65);
}

.kb-cables .cable-spec {
  fill: none;
  stroke: rgba(255, 255, 255, 0.34);
  stroke-width: 1.15px;
  stroke-linecap: round;
  transform: none;
}

html[data-mode="dark"] .kb-cables .cable-spec {
  stroke: rgba(255, 168, 160, 0.21);
}

.kb-cables .cable-pulse {
  fill: none;
  stroke: #60a5fa;
  stroke-width: 2.1px;
  stroke-linecap: round;
  opacity: 0;
}

html[data-mode="dark"] .kb-cables .cable-pulse {
  stroke: #ff6b63;
}

.power-mount-shadow {
  fill: rgba(10, 12, 16, 0.24);
  filter: blur(2.2px);
}

html[data-mode="dark"] .power-mount-shadow {
  fill: rgba(0, 0, 0, 0.65);
}

.power-mount-plate {
  fill: url(#mountPlateDev);
  stroke: rgba(0, 0, 0, 0.48);
  stroke-width: 1.15px;
}

.power-mount-bevel {
  fill: rgba(255, 255, 255, 0.2);
}

.power-mount-screw {
  fill: #98a0ae;
  stroke: rgba(0, 0, 0, 0.6);
  stroke-width: 0.75px;
}

.power-mount-collar {
  fill: #1b1e24;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 0.8px;
}

.power-mount-gland {
  fill: url(#mountGlandGrad);
  stroke: rgba(0, 0, 0, 0.65);
  stroke-width: 0.75px;
}

.power-mount-rib {
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 0.9px;
  stroke-linecap: round;
}

html[data-mode="dark"] .power-mount-plate {
  fill: url(#mountPlateHack);
  stroke: rgba(255, 95, 85, 0.24);
}

html[data-mode="dark"] .power-mount-bevel {
  fill: rgba(255, 110, 99, 0.16);
}

html[data-mode="dark"] .power-mount-screw {
  fill: #784247;
}

html[data-mode="dark"] .power-mount-collar {
  fill: #0f0709;
  stroke: rgba(255, 95, 85, 0.2);
}

html[data-mode="dark"] .power-mount-gland {
  stroke: rgba(255, 95, 85, 0.16);
}

/* Real 3D Miniature Mechanical Keyboard Case (Unified One-Piece Injection-Molded SVG Shell) */
.kb-shell {
  position: relative;
  z-index: 2;
  padding: clamp(6px, 1vw, 10px) clamp(6px, 1vw, 10px) clamp(12px, 2.1vw, 18px);
  border-radius: 14px;
  background: transparent;
  border: 0;
  overflow: visible;
  transform-origin: 50% 0;
  will-change: transform;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
}

.kb-shell.is-dragging {
  cursor: grabbing;
}

.kb-case-svg {
  position: absolute;
  left: 0;
  top: -54px;
  width: 100%;
  height: calc(100% + 62px);
  overflow: visible;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.26));
}

html[data-mode="dark"] .kb-case-svg {
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.65));
}

.kb-case-lip {
  fill: #989285;
}

html[data-mode="dark"] .kb-case-lip {
  fill: #080304;
}

.kb-case-body {
  fill: url(#kbCaseGradDev);
}

html[data-mode="dark"] .kb-case-body {
  fill: url(#kbCaseGradHack);
}

.kb-case-seam {
  fill: none;
  stroke: rgba(0, 0, 0, 0.22);
  stroke-width: 1.15px;
  stroke-linejoin: round;
}

html[data-mode="dark"] .kb-case-seam {
  stroke: rgba(255, 95, 85, 0.16);
}

.kb-case-spec {
  fill: none;
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 2.2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-mode="dark"] .kb-case-spec {
  stroke: rgba(255, 120, 110, 0.22);
}

.kb-case-border {
  fill: none;
  stroke: rgba(0, 0, 0, 0.24);
  stroke-width: 1.15px;
  stroke-linejoin: round;
}

html[data-mode="dark"] .kb-case-border {
  stroke: rgba(229, 57, 45, 0.36);
}

/* Dual Left & Right Metal USB-C Power Ports & Connectors */
.kb-usb-port {
  position: absolute;
  top: 0;
  translate: -50% 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.kb-usb-port--left {
  left: 14%;
}

.kb-usb-port--right {
  left: 86%;
}

.kb-usb-socket {
  position: absolute;
  top: -6px;
  width: 28px;
  height: 8px;
  border-radius: 5px 5px 0 0;
  background: #0d0f13;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 3px 4px rgba(0, 0, 0, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
}

.kb-usb-socket-tongue {
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: #c8a234;
  opacity: 0.72;
}

.kb-usb-plug {
  position: relative;
  top: -25px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.usb-tip-anchor {
  width: 4px;
  height: 2px;
  display: block;
}

.usb-boot {
  width: 11px;
  height: 9px;
  border-radius: 5px 5px 0 0;
  background:
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.45) 0%,
      transparent 28%,
      rgba(0, 0, 0, 0.45) 56%,
      transparent 82%,
      rgba(0, 0, 0, 0.5) 100%
    ),
    linear-gradient(90deg, #121419, #2f3540 48%, #101216);
  border-inline: 0.5px solid rgba(255, 255, 255, 0.08);
}

.usb-collar {
  width: 16px;
  height: 5px;
  background: linear-gradient(90deg, #4b505b, #b6bcc8 48%, #484d57);
  border: 1px solid #20232a;
}

.usb-housing {
  width: 24px;
  height: 12px;
  border-radius: 5px;
  background: linear-gradient(90deg, #747a87, #d7dce6 48%, #5e6470);
  border: 1px solid #20232a;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 2px 4px rgba(0, 0, 0, 0.4);
}

.usb-led {
  width: 9px;
  height: 3px;
  border-radius: 999px;
  background: #4ade80;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 1px 2px rgba(0, 0, 0, 0.45);
}

html[data-mode="dark"] .usb-boot {
  background:
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.55) 0%,
      transparent 28%,
      rgba(0, 0, 0, 0.55) 56%,
      transparent 82%,
      rgba(0, 0, 0, 0.6) 100%
    ),
    linear-gradient(90deg, #0d0507, #291115 48%, #0a0405);
}

html[data-mode="dark"] .usb-collar {
  background: linear-gradient(90deg, #2b1417, #612c32 48%, #251114);
  border-color: #16090b;
}

html[data-mode="dark"] .usb-housing {
  background: linear-gradient(90deg, #34191d, #70353b 48%, #291317);
  border-color: rgba(255, 95, 85, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 130, 120, 0.22),
    0 2px 5px rgba(0, 0, 0, 0.72);
}

html[data-mode="dark"] .usb-led {
  background: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 215, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.65);
}

/* Unified Deep Dark Recessed Brushed Switch Plate Cavity (No Vertical Divider Wall) */
.kb-plate {
  position: relative;
  z-index: 3;
  padding: clamp(4px, 0.8vw, 6.5px);
  border-radius: 11px;
  background: linear-gradient(180deg, #21242b 0%, #16181d 68%, #111317 100%);
  border: 1px solid rgba(0, 0, 0, 0.42);
  box-shadow:
    inset 0 4px 10px rgba(0, 0, 0, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.48);
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.65vw, 6px);
  perspective: 1100px;
  transition: background-color var(--morph-t), border-color var(--morph-t);
}

html[data-mode="dark"] .kb-plate {
  background: linear-gradient(180deg, #0f0708 0%, #070304 75%, #050202 100%);
  border-color: rgba(255, 95, 85, 0.14);
  box-shadow:
    inset 0 4px 10px rgba(0, 0, 0, 0.96),
    inset 0 -1px 0 rgba(255, 95, 85, 0.1),
    0 1px 0 rgba(255, 110, 99, 0.14);
}

/* Upper Deck (Rows 1 & 2): Top-Left Rotary Knob + OLED Display | 7u Rows 1 & 2 Key Matrix */
.kb-upper-deck {
  display: grid;
  grid-template-columns: minmax(82px, 1.45fr) 7fr;
  gap: clamp(3px, 0.65vw, 6px);
  align-items: stretch;
  transform-style: preserve-3d;
  min-width: 0;
}

.kb-top-left {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(3px, 0.65vw, 6px);
  min-width: 0;
}

.kb-knob-well {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(40px, 5.5vw, 72px);
}

/* Recessed circular collar seated on the dark switch plate around the CNC knob */
.kb-knob-well::before {
  content: "";
  position: absolute;
  width: clamp(44px, 5.6vw, 64px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.62) 62%, rgba(255, 255, 255, 0.05) 100%);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.85),
    0 1px 0 rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

html[data-mode="dark"] .kb-knob-well::before {
  background: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.82) 62%, rgba(255, 95, 85, 0.08) 100%);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.92),
    0 1px 0 rgba(255, 110, 99, 0.14);
}

.kb-upper-matrix {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(3px, 0.65vw, 6px);
  transform-style: preserve-3d;
  min-width: 0;
}

.kb-caps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(3px, 0.65vw, 6px);
  transform-style: preserve-3d;
  min-width: 0;
}

/* Row 3: Staggered Wide Shift + 6 Continuous Matrix Keys (incl. 2u Enter) */
.kb-row-3 {
  display: grid;
  grid-template-columns: 1.78fr 6.67fr;
  gap: clamp(3px, 0.65vw, 6px);
  align-items: stretch;
  transform-style: preserve-3d;
  min-width: 0;
}

.kb-caps--r3 {
  grid-template-columns: repeat(5, minmax(0, 1fr)) 2fr;
}

.kb-caps--r3 .kb-cap--enter {
  grid-column: span 1;
}

/* Row 4: Realistic Bottom Row (Ctrl, Win, Alt, Space, Fn, SAMUBIN, Mode) */
.kb-bottom-row {
  display: grid;
  grid-template-columns: 1.12fr 1.05fr 1.05fr 2.45fr 1.02fr 1.48fr 1.28fr;
  gap: clamp(3px, 0.65vw, 6px);
  min-width: 0;
}

.kb-win-ico {
  width: clamp(0.82rem, 1.45vw, 1.12rem);
  height: clamp(0.82rem, 1.45vw, 1.12rem);
  flex-shrink: 0;
  opacity: 0.92;
}

/* Dynamic Tactile Switch-Depression Wave & Directional Icon Morph */
.kb-cap.is-flipping {
  animation: kb-cap-press-wave 420ms var(--ease-smooth) both;
  animation-delay: var(--k-delay, 0ms);
  will-change: transform;
  pointer-events: none;
}

@keyframes kb-cap-press-wave {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  38% {
    transform: translate3d(0, 3.2px, 0) scale(0.984);
  }
  78% {
    transform: translate3d(0, -0.4px, 0) scale(1.003);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.kb-cap.is-flipping .kb-cap-ico {
  animation: kb-ico-morph 420ms linear both;
  animation-delay: var(--k-delay, 0ms);
  will-change: transform, opacity;
}

@keyframes kb-ico-morph {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    animation-timing-function: cubic-bezier(0.4, 0, 0.85, 0.3);
  }
  36% {
    opacity: 0;
    transform: translate3d(calc(var(--flip-dir, 1) * -7px), 2px, 0) scale(0.76);
    animation-timing-function: step-end;
  }
  40% {
    opacity: 0;
    transform: translate3d(calc(var(--flip-dir, 1) * 7px), -2px, 0) scale(0.76);
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Sympathetic Mechanical Re-seat Bounce for SAMUBIN Cipher Keys */
.kb-cap.is-settling {
  animation: kb-cap-settle 360ms var(--ease-smooth) both;
  animation-delay: var(--k-delay, 0ms);
  will-change: transform;
}

@keyframes kb-cap-settle {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  36% {
    transform: translate3d(0, 3px, 0) scale(0.968);
  }
  70% {
    transform: translate3d(0, -1.2px, 0) scale(1.012);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Tactile Modifier Key Latch Punch (Esc, Tab, Shift) */
.kb-mod.is-punching {
  animation: kb-mod-punch 260ms var(--ease-out) both;
}

@keyframes kb-mod-punch {
  0% {
    transform: translateY(0) scale(1);
  }
  45% {
    transform: translateY(4px) scale(0.95);
  }
  100% {
    transform: translateY(2px) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kb-cap.is-flipping,
  .kb-cap.is-flipping .kb-cap-ico,
  .kb-cap.is-settling,
  .kb-mod.is-punching {
    animation: none !important;
  }
}

/* ==========================================================================
   TRUE 3D SCULPTED TRAPEZOIDAL KEYCAPS
   - Dev (Light): "Studio Alabaster & Carbon Graphite" (Alabaster alphas, Graphite modifiers, Safety Terracotta accents)
   - Sec (Dark):  "Obsidian & Crimson" (Obsidian alphas, Stealth Pitch modifiers, Crimson accents)
   ========================================================================== */
.kb-cap {
  /* Default Tech/Stack Alpha Keycap: Ceramic Alabaster / PBT Ivory */
  --dish-top: #f4f1ea;
  --dish-bg: #e7e2d7;
  --skirt-top: #cbc5b7;
  --skirt-bot: #a49e90;
  --cap-ink: #15171a;
  --dish-spec: rgba(255, 255, 255, 0.54);
  --skirt-spec: rgba(255, 255, 255, 0.42);
  --dish-rim: transparent;

  position: relative;
  min-width: 0;
  appearance: none;
  border: 0;
  outline: none;
  cursor: pointer;
  touch-action: pan-y;
  min-height: clamp(40px, 5.5vw, 72px);
  padding: clamp(2.5px, 0.45vw, 4px) clamp(2.5px, 0.65vw, 5.5px) clamp(6px, 1.25vw, 11px);
  border-radius: 8px;
  color: var(--cap-ink);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0%, transparent 15%, transparent 85%, rgba(0, 0, 0, 0.24) 100%),
    linear-gradient(180deg, var(--skirt-top) 0%, var(--skirt-bot) 100%);
  box-shadow:
    inset 0 1px 0 var(--skirt-spec),
    inset 0 -3px 0 rgba(0, 0, 0, 0.36),
    0 3px 4px rgba(0, 0, 0, 0.74);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  transition:
    transform 85ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 85ms ease,
    filter 95ms ease,
    color var(--morph-t);
}

.kb-cap-dish {
  position: relative;
  width: 100%;
  min-width: 0;
  border-radius: 5px;
  border: 1px solid var(--dish-rim);
  background: radial-gradient(115% 95% at 50% 42%, var(--dish-bg) 38%, var(--dish-top) 100%);
  box-shadow:
    inset 0 1.5px 1px var(--dish-spec),
    inset 0 -1.5px 3px rgba(0, 0, 0, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.34);
  padding: clamp(2px, 0.5vw, 4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}

.kb-cap[data-sam-key="u"] .kb-cap-dish::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: clamp(3px, 0.55vw, 5px);
  translate: -50% 0;
  width: clamp(10px, 2.2vw, 16px);
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.55;
}

/* Unified Tech/Stack Alphas across Rows 1-3 (no muddy tier tinting on icon keys) */
.kb-cap--icon,
.kb-cap--icon.kb-cap--cream,
.kb-cap--icon.kb-cap--daily,
.kb-cap--icon.kb-cap--proficient,
.kb-cap--icon.kb-cap--familiar {
  --dish-top: #f4f1ea;
  --dish-bg: #e7e2d7;
  --skirt-top: #cbc5b7;
  --skirt-bot: #a49e90;
  --cap-ink: #15171a;
  --dish-spec: rgba(255, 255, 255, 0.54);
  --skirt-spec: rgba(255, 255, 255, 0.42);
}

/* Outer Modifier Frame: Machined Carbon Graphite (Tab, Shift, Enter, Fn, Alt, SAMUBIN, Mode) */
.kb-mod,
.kb-cap--mod,
.kb-cap--enter,
.kb-cap--back,
.kb-cap--mode,
.kb-bottom-row .kb-cap--cream,
.kb-bottom-row .kb-cap--proficient {
  --dish-top: #363a41;
  --dish-bg: #2a2e34;
  --skirt-top: #1f2227;
  --skirt-bot: #131519;
  --cap-ink: #f4f1ea;
  --dish-spec: rgba(255, 255, 255, 0.13);
  --skirt-spec: rgba(255, 255, 255, 0.16);
}

.kb-cap--enter {
  grid-column: span 2;
}

/* Bottom Mode Badge Key ("Dev" / "Red"): Warm Studio Pewter Sub-Accent */
.kb-cap--badge,
.kb-cap--yellow {
  --dish-top: #464442;
  --dish-bg: #393735;
  --skirt-top: #282725;
  --skirt-bot: #191817;
  --cap-ink: #f4f1ea;
  --dish-spec: rgba(255, 250, 244, 0.15);
  --skirt-spec: rgba(255, 250, 244, 0.18);
}

/* Signature Safety Signal Terracotta Accent (Active Layer Key, S-A-M-U-B-I-N, & Spacebar) */
.kb-cap--sam:not(.kb-cap--enter):not(.kb-cap--space),
.kb-mod[aria-pressed="true"],
.kb-cap--space {
  --dish-top: #f7915a;
  --dish-bg: #ef7b40;
  --skirt-top: #c6501d;
  --skirt-bot: #91320b;
  --cap-ink: #110602;
  --dish-spec: rgba(255, 232, 214, 0.38);
  --skirt-spec: rgba(255, 224, 200, 0.34);
}

/* Sec (Dark) Keycap Palette */
html[data-mode="dark"] .kb-cap,
html[data-mode="dark"] .kb-cap--icon,
html[data-mode="dark"] .kb-cap--icon.kb-cap--cream,
html[data-mode="dark"] .kb-cap--icon.kb-cap--daily,
html[data-mode="dark"] .kb-cap--icon.kb-cap--proficient,
html[data-mode="dark"] .kb-cap--icon.kb-cap--familiar {
  --dish-top: #282022;
  --dish-bg: #1e1719;
  --skirt-top: #150f11;
  --skirt-bot: #0c0809;
  --cap-ink: #f0e4e1;
  --dish-spec: rgba(255, 215, 210, 0.1);
  --skirt-spec: rgba(255, 200, 195, 0.12);
  --dish-rim: transparent;
}

/* Sec (Dark) Outer Modifiers: Stealth Pitch */
html[data-mode="dark"] .kb-mod,
html[data-mode="dark"] .kb-cap--mod,
html[data-mode="dark"] .kb-cap--back,
html[data-mode="dark"] .kb-cap--mode,
html[data-mode="dark"] .kb-bottom-row .kb-cap--cream,
html[data-mode="dark"] .kb-bottom-row .kb-cap--proficient {
  --dish-top: #1a1416;
  --dish-bg: #130e10;
  --skirt-top: #0c090a;
  --skirt-bot: #060405;
  --cap-ink: #dfd0cc;
  --dish-spec: rgba(255, 205, 200, 0.08);
  --skirt-spec: rgba(255, 195, 190, 0.09);
  --dish-rim: transparent;
}

/* Sec (Dark) 2u Enter: Sleek Stealth Modifier with Crimson Legend & Rim Accent */
html[data-mode="dark"] .kb-cap--enter {
  --dish-top: #1d1416;
  --dish-bg: #150e10;
  --skirt-top: #0d080a;
  --skirt-bot: #060304;
  --cap-ink: #ff948b;
  --dish-spec: rgba(255, 180, 175, 0.11);
  --skirt-spec: rgba(255, 110, 99, 0.18);
  --dish-rim: rgba(224, 52, 43, 0.48);
}

/* Sec (Dark) Badge Key: Stealth Crimson-Legend Sub-Accent */
html[data-mode="dark"] .kb-cap--badge,
html[data-mode="dark"] .kb-cap--yellow {
  --dish-top: #211618;
  --dish-bg: #181012;
  --skirt-top: #100a0b;
  --skirt-bot: #070405;
  --cap-ink: #ff948b;
  --dish-spec: rgba(255, 190, 185, 0.1);
  --skirt-spec: rgba(255, 120, 110, 0.14);
  --dish-rim: rgba(224, 52, 43, 0.28);
}

/* Sec (Dark) S-A-M-U-B-I-N Cipher Keys: Crimson-on-Obsidian Novelties */
html[data-mode="dark"] .kb-cap--sam:not(.kb-cap--enter):not(.kb-cap--space) {
  --dish-top: #24171a;
  --dish-bg: #1b1113;
  --skirt-top: #120b0d;
  --skirt-bot: #090506;
  --cap-ink: #ff9990;
  --dish-spec: rgba(255, 185, 180, 0.11);
  --skirt-spec: rgba(255, 120, 110, 0.16);
  --dish-rim: rgba(224, 52, 43, 0.34);
}

/* Sec (Dark) Primary Signal Controls (Active Layer & Spacebar) */
html[data-mode="dark"] .kb-mod[aria-pressed="true"],
html[data-mode="dark"] .kb-cap--space {
  --dish-top: #a81711;
  --dish-bg: #98130d;
  --skirt-top: #700d09;
  --skirt-bot: #450604;
  --cap-ink: #fffaf9;
  --dish-spec: rgba(255, 195, 190, 0.24);
  --skirt-spec: rgba(255, 190, 180, 0.24);
  --dish-rim: transparent;
  box-shadow:
    inset 0 1px 0 var(--skirt-spec),
    inset 0 -3px 0 rgba(0, 0, 0, 0.5),
    0 3px 4px rgba(0, 0, 0, 0.85);
}

/* 3D CNC Knurled Rotary Encoder Knob + Motion-Graphics HUD Ring */
.kb-knob-hud {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: clamp(48px, 6.2vw, 72px);
  height: clamp(48px, 6.2vw, 72px);
  pointer-events: none;
  overflow: visible;
}

.kb-knob-hud-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.25;
  stroke-dasharray: 2 4;
}

html[data-mode="dark"] .kb-knob-hud-track {
  stroke: rgba(255, 110, 100, 0.2);
}

.kb-knob-hud-arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  transition: stroke-dasharray 260ms cubic-bezier(0.22, 1, 0.36, 1), stroke-width 180ms ease, filter 200ms ease;
}

.kb-knob-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  opacity: 0;
  transform-origin: 40px 40px;
}

.kb-knob-well.is-turning .kb-knob-hud-arc {
  stroke-width: 2.8;
  filter: brightness(1.15);
}

.kb-knob-well.is-turning .kb-knob-pulse {
  animation: kb-knob-ring-pulse 360ms var(--ease-out) forwards;
}

@keyframes kb-knob-ring-pulse {
  0% {
    opacity: 0.78;
    transform: scale(0.9);
    stroke-width: 2.2;
  }
  100% {
    opacity: 0;
    transform: scale(1.38);
    stroke-width: 0.4;
  }
}

.kb-cap.kb-knob-btn {
  position: relative;
  width: clamp(36px, 4.8vw, 56px);
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: #1b1e24;
  box-shadow:
    0 5px 10px rgba(0, 0, 0, 0.62),
    0 2px 3px rgba(0, 0, 0, 0.55),
    inset 0 1px 1px rgba(255, 255, 255, 0.42);
  display: grid;
  place-items: center;
  overflow: visible;
}

html[data-mode="dark"] .kb-cap.kb-knob-btn {
  background: #0d0708;
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.88),
    0 2px 4px rgba(0, 0, 0, 0.78),
    inset 0 1px 1px rgba(255, 110, 99, 0.24);
}

.kb-cap.kb-knob-btn:active,
.kb-cap.kb-knob-btn.is-down {
  transform: translateY(2px) scale(0.97);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.72),
    inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.kb-knob-ticks {
  position: absolute;
  inset: -6px;
  pointer-events: none;
}

.kb-knob-tick {
  position: absolute;
  inset: 0;
}

.kb-knob-tick--0 {
  transform: rotate(-90deg);
}

.kb-knob-tick--1 {
  transform: rotate(-36deg);
}

.kb-knob-tick--2 {
  transform: rotate(18deg);
}

.kb-knob-tick--3 {
  transform: rotate(72deg);
}

.kb-knob-tick--4 {
  transform: rotate(126deg);
}

.kb-knob-tick--5 {
  transform: rotate(180deg);
}

.kb-knob-tick::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: clamp(3px, 0.5vw, 4.5px);
  height: clamp(3px, 0.5vw, 4.5px);
  translate: -50% 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

html[data-mode="dark"] .kb-knob-tick::before {
  background: rgba(255, 130, 120, 0.22);
  box-shadow: none;
}

.kb-knob-btn[data-active-layer="0"] .kb-knob-tick--0::before,
.kb-knob-btn[data-active-layer="1"] .kb-knob-tick--1::before,
.kb-knob-btn[data-active-layer="2"] .kb-knob-tick--2::before,
.kb-knob-btn[data-active-layer="3"] .kb-knob-tick--3::before,
.kb-knob-btn[data-active-layer="4"] .kb-knob-tick--4::before,
.kb-knob-btn[data-active-layer="5"] .kb-knob-tick--5::before {
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  transform: scale(1.15);
}

.kb-knob-knurl {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: clamp(3px, 0.55vw, 4.5px);
  display: grid;
  place-items: center;
  background: conic-gradient(
    from 0deg,
    #5b626e 0deg,
    #1b1e24 45deg,
    #626975 90deg,
    #1b1e24 135deg,
    #565d68 180deg,
    #1b1e24 225deg,
    #626975 270deg,
    #1b1e24 315deg,
    #5b626e 360deg
  );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -2px 3px rgba(0, 0, 0, 0.72);
}

html[data-mode="dark"] .kb-knob-knurl {
  background: conic-gradient(
    from 0deg,
    #4b2429 0deg,
    #12090b 45deg,
    #56292f 90deg,
    #12090b 135deg,
    #462126 180deg,
    #12090b 225deg,
    #56292f 270deg,
    #12090b 315deg,
    #4b2429 360deg
  );
}

.kb-knob-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 2px;
  display: grid;
  place-items: center;
  background: conic-gradient(from 35deg, #d8dde6, #9aa1ae, #eef1f6, #7d8492, #d8dde6);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.7),
    inset 0 1px 1px rgba(255, 255, 255, 0.85),
    inset 0 -1px 2px rgba(0, 0, 0, 0.35);
}

html[data-mode="dark"] .kb-knob-face {
  background: conic-gradient(from 35deg, #3c2125, #1b0e10, #4b282d, #150a0c, #3c2125);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.85),
    inset 0 1px 1px rgba(255, 145, 138, 0.28),
    inset 0 -1px 2px rgba(0, 0, 0, 0.7);
}

.kb-knob-cap {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, #eef1f5 0%, #b4bac5 58%, #858c99 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.65);
  transform: rotate(var(--knob-deg, -90deg));
  transition: transform 240ms cubic-bezier(0.22, 1.35, 0.36, 1);
}

html[data-mode="dark"] .kb-knob-cap {
  background: radial-gradient(circle at 42% 36%, #361c20 0%, #1d0e11 62%, #0e0607 100%);
  box-shadow: inset 0 1px 2px rgba(255, 125, 118, 0.2);
}

.kb-knob-notch {
  position: absolute;
  left: 50%;
  top: clamp(3px, 0.5vw, 4.5px);
  translate: -50% 0;
  width: clamp(2px, 0.35vw, 3px);
  height: clamp(7px, 1.25vw, 11px);
  border-radius: 999px;
  background: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.45);
}

html[data-mode="dark"] .kb-knob-notch {
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 215, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.68);
}

/* Clean High-Contrast Recessed Glass OLED Category Screen */
.kb-oled-well {
  position: relative;
  padding: clamp(2.5px, 0.45vw, 4px);
  border-radius: 8px;
  background: linear-gradient(180deg, #14171c 0%, #0b0d10 100%);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.12);
  display: grid;
  min-width: 0;
  min-height: clamp(40px, 5.5vw, 72px);
}

html[data-mode="dark"] .kb-oled-well {
  background: linear-gradient(180deg, #12090b 0%, #070304 100%);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.96),
    0 1px 0 rgba(255, 110, 99, 0.14);
}

.kb-oled-screen {
  position: relative;
  overflow: hidden;
  border-radius: 5px;
  padding: clamp(4px, 0.6vw, 7px);
  background: radial-gradient(120% 100% at 50% 50%, #141d26 0%, #06080b 85%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  min-width: 0;
  transition: box-shadow 180ms ease, filter 180ms ease, border-color 180ms ease;
}

html[data-mode="dark"] .kb-oled-screen {
  background: radial-gradient(120% 100% at 50% 50%, #200c10 0%, #070203 85%);
  border-color: rgba(255, 110, 99, 0.24);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.98);
}

.kb-oled-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(132deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.03) 36%, transparent 52%);
  pointer-events: none;
  z-index: 2;
}

.kb-oled-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(100% 100% at 50% 50%, transparent 62%, rgba(0, 0, 0, 0.32) 100%);
  pointer-events: none;
  z-index: 2;
}

.kb-oled-screen.is-updating {
  filter: brightness(1.18);
  border-color: var(--accent);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.95);
}

html[data-mode="dark"] .kb-oled-screen.is-updating {
  border-color: var(--accent-text);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.98);
}

.kb-oled-cat {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: clamp(0.62rem, 1.22vw, 0.94rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  overflow-wrap: break-word;
}

html[data-mode="dark"] .kb-oled-cat {
  color: #fff8f7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92);
}

/* Wide Staggered Left Shift Key Label */
.kb-left-mod-dish {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(0.2rem, 0.48vw, 0.38rem);
  padding: clamp(2px, 0.45vw, 5px) clamp(3px, 0.55vw, 7px);
}

.kb-left-mod-sym {
  font-family: var(--font);
  font-size: clamp(0.66rem, 1vw, 0.86rem);
  font-weight: 700;
  opacity: 0.78;
  line-height: 1;
}

.kb-left-mod-txt {
  font-family: var(--font);
  font-size: clamp(0.66rem, 1.08vw, 0.86rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Large Centered Tech Icon inside the 3D Dish; Short Tech Name Appears ONLY in Floating Top Badge on Hover */
.kb-cap-ico {
  width: clamp(1rem, 2.75vw, 2.15rem);
  height: clamp(1rem, 2.75vw, 2.15rem);
  flex-shrink: 0;
}

.kb-sam-char {
  font-family: var(--font);
  font-weight: 850;
  font-stretch: var(--stretch-display);
  font-size: clamp(0.8rem, 1.85vw, 1.42rem);
  letter-spacing: -0.02em;
  line-height: 1;
}

.kb-cap--enter .kb-sam-char {
  font-family: var(--font);
  font-stretch: var(--stretch-head);
  font-size: clamp(0.7rem, 1.28vw, 0.98rem);
  font-weight: 800;
  white-space: nowrap;
}

.kb-bot-main {
  font-family: var(--font);
  font-size: clamp(0.7rem, 1.14vw, 0.88rem);
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
}

/* Center Convex 3D Spacebar Dish (Only says "Space") */
.kb-space-dish {
  flex-direction: column;
  justify-content: center;
  gap: clamp(2px, 0.45vw, 4px);
  background: linear-gradient(180deg, var(--dish-top) 0%, var(--dish-bg) 82%, var(--skirt-top) 100%);
  box-shadow:
    inset 0 2px 2px var(--dish-spec),
    inset 0 -2px 3px rgba(0, 0, 0, 0.24),
    0 1px 2px rgba(0, 0, 0, 0.36);
}

.kb-space-barline {
  width: clamp(18px, 4.8vw, 38px);
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.52;
}

.kb-space-text {
  font-family: var(--font);
  font-size: clamp(0.6875rem, 1.08vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Tactile Physical Switch Highlight & Click Stem Travel (Uniform Across All Keys) */
.kb-cap:hover,
.kb-cap--icon.is-spotlight {
  filter: brightness(1.06);
}

.kb-cap--icon.is-spotlight {
  --dish-rim: var(--accent);
  box-shadow:
    inset 0 1px 0 var(--skirt-spec),
    inset 0 -3px 0 rgba(0, 0, 0, 0.36),
    0 3px 6px rgba(0, 0, 0, 0.78);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

html[data-mode="dark"] .kb-cap:hover,
html[data-mode="dark"] .kb-cap--icon.is-spotlight {
  filter: brightness(1.16);
}

.kb-cap:focus {
  outline: none;
}

.kb-cap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.kb-cap:active,
.kb-cap.is-down {
  transform: translateY(3px);
  filter: brightness(0.95);
  box-shadow:
    inset 0 1px 0 var(--skirt-spec),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 1px 1px rgba(0, 0, 0, 0.8);
}

/* Row-Aware Floating Tooltip (above Top Tabs, inter-row gap for Mid rows, below chassis chin for Row 4) */
.kb-hover-tip {
  position: absolute;
  left: 0;
  top: 0;
  translate: -50% calc(-100% + 4px);
  z-index: 999;
  padding: 0.24rem 0.56rem;
  border-radius: 5px;
  background: var(--oled-bg);
  color: var(--oled-ink);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.54);
  transition: opacity 110ms var(--ease-out), translate 110ms var(--ease-out);
}

.kb-hover-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% - 4px);
  width: 7px;
  height: 7px;
  translate: -50% 0;
  rotate: 45deg;
  background: var(--oled-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.kb-hover-tip.is-visible {
  opacity: 1;
  translate: -50% -100%;
}

.kb-hover-tip[data-place="below"] {
  translate: -50% -4px;
}

.kb-hover-tip[data-place="below"].is-visible {
  translate: -50% 0;
}

.kb-hover-tip[data-place="below"]::after {
  top: auto;
  bottom: calc(100% - 4px);
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

@media (max-width: 980px) {
  .loadout-stage {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .loadout-stage .hanging-kb-rig {
    --rig-top: clamp(68px, 10vw, 96px);
    --rig-bot: clamp(50px, 8vw, 76px);
    max-width: 780px;
    margin-inline: auto;
    justify-self: center;
  }
  .kb-cap,
  .kb-knob-well,
  .kb-oled-well {
    min-height: clamp(38px, 8.2vw, 68px);
  }
  .kb-knob-btn {
    width: clamp(36px, 6.2vw, 54px);
  }
  .kb-knob-well::before {
    width: clamp(44px, 7.2vw, 62px);
  }
  .kb-knob-hud {
    width: clamp(48px, 8vw, 70px);
    height: clamp(48px, 8vw, 70px);
  }
}

@media (max-width: 640px) {
  .loadout-card {
    height: auto;
    min-height: 300px;
  }
  .kb-plate {
    border-radius: 8px;
  }
  .kb-cap,
  .kb-oled-well {
    border-radius: 5px;
  }
}

@media (max-width: 580px) {
  .loadout-step {
    font-size: 0.72rem;
    min-height: 36px;
    padding: 0.42rem 0.25rem;
  }
  .loadout-card {
    height: auto;
    min-height: 0;
    padding: 14px 16px;
    gap: 8px;
  }
  .loadout-layer-title,
  .loadout-layer-desc {
    min-height: 0;
  }
  .loadout-chip-grid {
    display: none;
  }
  .kb-usb-port {
    scale: 0.78;
    transform-origin: center top;
  }
  .kb-upper-deck {
    grid-template-columns: minmax(68px, 1.55fr) 7fr;
  }
  .kb-oled-cat {
    font-size: 0.54rem;
    letter-spacing: 0.02em;
  }
  .kb-left-mod-sym,
  .kb-left-mod-txt {
    font-size: 0.58rem;
  }
  .kb-bot-main,
  .kb-space-text {
    font-size: clamp(0.5rem, 2.3vw, 0.66rem);
  }
  .kb-bottom-row {
    grid-template-columns: 1fr 0.85fr 0.85fr 1.95fr 0.82fr 2.05fr 1.48fr;
  }
}

/* ---------- 12. Projects Section: Visual Hardware Cartridge Showcase ---------- */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.proj-card {
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.15rem;
  transition:
    background-color var(--morph-t),
    border-color var(--morph-t),
    transform 180ms var(--ease-out);
}

.proj-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.proj-viewport {
  position: relative;
  min-height: 196px;
  border-radius: 14px;
  background: var(--oled-bg);
  color: var(--oled-ink);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.32);
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
}

.proj-vp-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--oled-muted);
}

.proj-vp-art {
  width: 100%;
  height: 128px;
}

.proj-content {
  padding: 6px 8px;
}

.proj-content h3 {
  margin-bottom: 0.5rem;
}

.proj-content p {
  color: var(--ink-2);
  font-size: 0.96rem;
  line-height: 1.58;
  transition: color var(--morph-t);
}

.proj-foot {
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  border-top: 1px solid var(--line);
  transition: border-color var(--morph-t);
}

@media (max-width: 900px) {
  .proj-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- 13. Experience Section: PCB Signal-Trace Career Ledger ---------- */
.ledger-enclosure {
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ledger-row {
  position: relative;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.5rem;
  padding: 22px 24px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.ledger-row:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.ledger-time {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--mono);
}

.ledger-period {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-text);
}

.ledger-node {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.ledger-org {
  font-size: 0.78rem;
  color: var(--ink-3);
}

.ledger-main h3 {
  margin-bottom: 0.45rem;
}

.ledger-main p {
  color: var(--ink-2);
  font-size: 0.96rem;
}

@media (max-width: 860px) {
  .ledger-row {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

/* ---------- 14. Homepage Contact Console: Direct Frequency Dispatch ---------- */
.dispatch-console {
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.dispatch-bay {
  padding: 28px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.35rem;
}

.dispatch-bay h3 {
  text-align: center;
}

.dispatch-bay > div > .index-desc {
  text-align: center;
  margin-inline: auto;
}

.dispatch-bay .keys {
  justify-content: center;
}

[data-contact-form] .key[type="submit"] {
  width: 100%;
  justify-content: center;
}

.freq-readout {
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--oled-bg);
  color: var(--oled-ink);
  font-family: var(--mono);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
}

.freq-label {
  font-size: 0.75rem;
  color: var(--oled-muted);
}

.freq-addr {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 700;
  color: var(--oled-ink);
  word-break: break-all;
}

.patch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.patch-key {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 150ms, transform 120ms;
}

.patch-key-left {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.patch-ico {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  color: var(--accent-text);
}

.patch-key:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Social keys (home contact section): one tactile key per profile, mark above name.
   The mark takes its brand colour on hover and focus. */
.dispatch-bay--social {
  justify-content: space-between;
  gap: 1.6rem;
}

.social-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.social-key {
  --brand: var(--cap-daily-ink);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  aspect-ratio: 1;
  padding: 10px 4px 14px;
  border-radius: 16px;
  color: var(--cap-daily-ink);
  text-decoration: none;
  background: linear-gradient(180deg, var(--cap-daily-top), var(--cap-daily-bg) 78%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -5px 0 var(--cap-daily-side),
    0 7px 14px -6px rgba(0, 0, 0, 0.35),
    0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 110ms var(--ease-out), box-shadow 110ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

html[data-mode="dark"] .social-key {
  box-shadow:
    inset 0 1px 0 rgba(255, 200, 190, 0.1),
    inset 0 -5px 0 var(--cap-daily-side),
    0 7px 14px -6px rgba(0, 0, 0, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.5);
}

.social-key:hover {
  transform: translateY(-2px);
}

.social-key:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 var(--cap-daily-side),
    0 2px 4px -2px rgba(0, 0, 0, 0.35);
}

.social-ico {
  width: clamp(24px, 30%, 32px);
  height: auto;
  aspect-ratio: 1;
  fill: currentColor;
  transition: fill 160ms, transform 240ms var(--ease-out), opacity 160ms;
}

.social-key:hover .social-ico,
.social-key:focus-visible .social-ico {
  fill: var(--brand);
  transform: scale(1.14) rotate(-5deg);
}

.social-name {
  color: var(--ink-2);
  font-size: clamp(0.6875rem, 0.62rem + 0.18vw, 0.78rem);
  font-weight: 700;
  font-stretch: 94%;
  letter-spacing: 0.02em;
  line-height: 1;
}

.social-key[data-social="facebook"] {
  --brand: #1877f2;
}
.social-key[data-social="instagram"] {
  --brand: #e4405f;
}
.social-key[data-social="linkedin"] {
  --brand: #0a66c2;
}
.social-key[data-social="whatsapp"] {
  --brand: #1faa53;
}
.social-key[data-social="youtube"] {
  --brand: #ff0000;
}
.social-key[data-social="blogger"] {
  --brand: #f57d00;
}
.social-key[data-social="gitlab"] {
  --brand: #fc6d26;
}
html[data-mode="dark"] .social-key[data-social="linkedin"] {
  --brand: #4d9fe6;
}
html[data-mode="dark"] .social-key[data-social="facebook"] {
  --brand: #4c97f7;
}

.social-grid > li:nth-child(2) {
  --i: 1;
}
.social-grid > li:nth-child(3) {
  --i: 2;
}
.social-grid > li:nth-child(4) {
  --i: 3;
}
.social-grid > li:nth-child(5) {
  --i: 4;
}
.social-grid > li:nth-child(6) {
  --i: 5;
}
.social-grid > li:nth-child(7) {
  --i: 6;
}
.social-grid > li:nth-child(8) {
  --i: 7;
}

@keyframes social-pop {
  from {
    opacity: 0;
    translate: 0 26px;
    scale: 0.8;
  }
  70% {
    opacity: 1;
  }
}

/* The address, one press to copy. */
.social-mail {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
}

.social-mail:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

/* ---------- The bird on the X key (assets/js/bird.js) ----------
   With scripting and motion the key's X mark is hidden and a small blue bird flies in from the
   panel's top right-hand corner to sit in its place while the section is on screen. The first
   press of the key drops the X on it; after that the key is a plain link.
   The bird, the falling X and the feathers are drawn on a layer over the whole panel. */
.dispatch-console {
  position: relative;
}

.tweety-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
.social-key.is-nest .social-ico {
  opacity: 0;
}

.social-key.is-nest.is-x .social-ico {
  opacity: 1;
  animation: bird-x-land 460ms cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes bird-x-land {
  0% {
    scale: 1.5;
  }
  45% {
    scale: 0.86;
  }
}

/* A point the script moves about the layer; the drawing is centred on it. */
.tweety {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  opacity: 0;
  will-change: transform, opacity;
}

.tweety.is-on {
  opacity: 1;
}

.tweety-svg {
  position: absolute;
  left: -31px;
  top: -31px;
  display: block;
  width: 62px;
  max-width: none;
  height: 62px;
  overflow: visible;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22));
}

/* One blue, as on the mark it is modelled on; wing and tail a shade deeper so that they read
   against the body, the far wing deeper still, and a paler breast. */
.tweety-body {
  fill: #1d9bf0;
}
.tweety-wing,
.tweety-tuck,
.tweety-tail {
  fill: #1a8cd8;
}
.tweety-wing--far {
  fill: #1577bd;
}
.tweety-belly {
  fill: #8ed0fb;
  opacity: 0.55;
}
.tweety-pupil {
  fill: #0b2a45;
}
.tweety-glint {
  fill: #fff;
}
.tweety-legs {
  fill: none;
  stroke: #0f5f9c;
  stroke-width: 0.62;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Each moving part sits in a group whose own origin is its pivot (feet, middle of the body,
   shoulder, middle of the head, the eye, the root of the tail), so everything here turns and
   scales about 0 0. */
.tweety-hop,
.tweety-tilt,
.tweety-wing,
.tweety-tuck,
.tweety-tail,
.tweety-head,
.tweety-eye {
  transform-box: view-box;
  transform-origin: 0 0;
}

/* Two drawings, one at a time: sitting on the key, or in the air. */
.tweety-fly,
.tweety.is-flying .tweety-sit {
  display: none;
}
.tweety.is-flying .tweety-fly {
  display: block;
}

/* In the air: the body levelled out, both wings beating from the shoulder, up to where the mark
   has them and down along the body. */
.tweety-tilt {
  transform: rotate(22deg);
}
.tweety-fly .tweety-head {
  transform: rotate(-6deg);
}
.tweety.is-flying .tweety-wing {
  animation: bird-flap 165ms ease-in-out infinite alternate;
}
.tweety.is-flying .tweety-wing--far {
  animation-name: bird-flap-far;
  animation-delay: -45ms;
}
.tweety.is-gliding .tweety-wing {
  animation-duration: 250ms;
}

@keyframes bird-flap {
  from {
    transform: rotate(14deg) scale(1, 1);
  }
  50% {
    transform: rotate(-24deg) scale(1, 0.62);
  }
  to {
    transform: rotate(-62deg) scale(1, 1);
  }
}
@keyframes bird-flap-far {
  from {
    transform: rotate(28deg) scale(1, 1);
  }
  50% {
    transform: rotate(-8deg) scale(1, 0.7);
  }
  to {
    transform: rotate(-48deg) scale(1, 1);
  }
}

/* On the key: head level, tail cocked up a little. */
.tweety-sit .tweety-head {
  transform: rotate(20deg);
  transition: transform 180ms var(--ease-out);
}
.tweety-tail {
  transform: rotate(16deg);
  transition: transform 160ms var(--ease-out);
}
.tweety-tuck {
  transition: transform 160ms var(--ease-out);
}
.tweety-sit .tweety-eye {
  transition: transform 140ms var(--ease-out);
}

/* Touching down: a small squash and a wobble while the wing settles against its side. */
.tweety.is-landing .tweety-hop {
  animation: bird-land 340ms cubic-bezier(0.3, 1.5, 0.5, 1);
}
.tweety.is-landing .tweety-tuck {
  animation: bird-tuck 340ms cubic-bezier(0.3, 0.9, 0.4, 1);
}
.tweety.is-landing .tweety-tail {
  animation: bird-tail-settle 340ms cubic-bezier(0.3, 0.9, 0.4, 1);
}

@keyframes bird-land {
  0% {
    transform: scale(1.14, 0.8);
  }
  55% {
    transform: scale(0.95, 1.08);
  }
}
@keyframes bird-tuck {
  0% {
    transform: rotate(46deg);
  }
  45% {
    transform: rotate(-4deg);
  }
  70% {
    transform: rotate(12deg);
  }
}
@keyframes bird-tail-settle {
  0% {
    transform: rotate(34deg);
  }
  60% {
    transform: rotate(10deg);
  }
}

/* Sitting: it breathes, looks about, blinks, flicks its tail and shakes out its wing, each on
   its own clock. */
.tweety.is-perched .tweety-hop {
  animation: bird-breathe 2.7s ease-in-out infinite;
}
.tweety.is-perched .tweety-head {
  animation: bird-look 7.3s ease-in-out infinite;
}
.tweety.is-perched .tweety-eye {
  animation: bird-blink 4.4s steps(1) infinite;
}
.tweety.is-perched .tweety-tail {
  animation: bird-tail 5.2s ease-in-out infinite;
}
.tweety.is-perched .tweety-tuck {
  animation: bird-ruffle 6.1s ease-in-out infinite;
}

@keyframes bird-breathe {
  50% {
    transform: scale(1.03, 0.965);
  }
}
@keyframes bird-look {
  0%,
  56%,
  100% {
    transform: rotate(20deg);
  }
  61%,
  71% {
    transform: rotate(3deg);
  }
  77%,
  88% {
    transform: rotate(30deg);
  }
}
@keyframes bird-blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  95%,
  98% {
    transform: scaleY(0.1);
  }
}
@keyframes bird-tail {
  0%,
  78%,
  100% {
    transform: rotate(16deg);
  }
  82% {
    transform: rotate(30deg);
  }
  86% {
    transform: rotate(12deg);
  }
  90% {
    transform: rotate(26deg);
  }
}
@keyframes bird-ruffle {
  0%,
  84%,
  100% {
    transform: rotate(0deg);
  }
  88% {
    transform: rotate(22deg);
  }
  91% {
    transform: rotate(4deg);
  }
  94% {
    transform: rotate(18deg);
  }
}

/* It notices the pointer, and it sees what is coming: head back, eyes wide, wing and tail up. */
.tweety.is-perched.is-noticed .tweety-head {
  animation: none;
  transform: rotate(5deg);
}
.tweety.is-doomed .tweety-head {
  animation: none;
  transform: rotate(-24deg);
}
.tweety.is-doomed .tweety-eye {
  animation: none;
  transform: scale(1.14);
}
.tweety.is-doomed .tweety-tuck {
  animation: none;
  transform: rotate(26deg);
}
.tweety.is-doomed .tweety-tail {
  animation: none;
  transform: rotate(28deg);
}

/* The X that lands on it, and the feathers that come off. The script sizes and places both on the key. */
.tweety-x,
.tweety-feather {
  position: absolute;
  left: 0;
  top: 0;
}

.tweety-x {
  width: 30px;
  height: 30px;
  fill: var(--cap-daily-ink);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.3));
}

.tweety-feather {
  width: 7px;
  height: 15px;
  margin: -7px 0 0 -3px;
  border-radius: 80% 20% 80% 20% / 60% 40% 60% 40%;
  background: linear-gradient(135deg, #8ed0fb, #1d9bf0 55%, #1a8cd8);
}

@media (max-width: 900px) {
  .dispatch-console {
    grid-template-columns: 1fr;
  }
  .patch-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- 11. Selected Work & Numbered Index Rows (Single Enclosure) ---------- */
.index-enclosure {
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  overflow: hidden;
}

.index-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.55rem 1.75rem;
  border-bottom: 1px solid var(--line);
  transition: background-color 180ms var(--ease-out);
}

.index-row:last-child {
  border-bottom: 0;
}

.index-row:hover {
  background: var(--surface-2);
}

.index-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.index-desc {
  color: var(--ink-2);
  font-size: 0.98rem;
}

@media (max-width: 860px) {
  .index-row {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

/* ---------- 12. Inner Pages (Work, About, Contact) ---------- */
.page-head {
  padding: 52px 0 40px;
  background-color: var(--ground);
  border-bottom: 0;
  transition: background-color var(--morph-t);
}

.split-enclosure {
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  overflow: hidden;
  transition: background-color var(--morph-t), border-color var(--morph-t);
}

.split-pane {
  display: flex;
  flex-direction: column;
  padding: 22px 24px;
  border-radius: 14px;
  background: var(--surface-2);
  transition: background-color var(--morph-t);
}

.split-pane h2,
.split-pane h3 {
  text-align: left;
  margin-bottom: 0.65rem;
}

.split-pane p + p {
  margin-top: 0.85rem;
}

.about-lead {
  font-size: 0.95rem;
  line-height: 1.58;
  color: var(--ink-2);
  margin-bottom: 0.25rem;
}

.trace-list {
  flex: 1;
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
  margin-top: 0.25rem;
  border-top: 1px solid var(--line);
}

.trace-item {
  padding: 12px 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.trace-item:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.trace-item .index-desc {
  font-size: 0.89rem;
  line-height: 1.48;
  color: var(--ink-2);
}

.trace-item .index-desc a {
  display: inline-block;
  padding: 0.2rem 0.35rem;
  margin: -0.2rem 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.trace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  font-weight: 760;
  font-size: 0.96rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.trace-meta {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--accent-text);
}

.trace-org {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--accent-text);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.16rem 0.52rem;
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
  transition:
    border-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.trace-org:hover,
.trace-org:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.about-domains {
  margin-top: auto;
  padding-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.about-domain-item {
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr);
  align-items: baseline;
  gap: 0.75rem;
  padding: 10px 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  transition: border-color var(--morph-t);
}

.about-domain-item:last-child {
  padding-bottom: 2px;
}

.about-domain-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 760;
  color: var(--ink);
  font-size: 0.9rem;
  white-space: nowrap;
}

.about-domain-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.about-domain-desc {
  font-size: 0.87rem;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0;
}

/* ---------- 12B. Stage 2A: Operator Dossier Console & OLED Oscilloscope (#about) ---------- */
#about.section {
  padding-top: clamp(3rem, 6vh, 4.75rem);
  padding-bottom: clamp(3rem, 6vh, 4.75rem);
}

@media (max-width: 640px) {
  #about.section {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
}

.dossier-console {
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  padding: 16px;
  transition: background-color var(--morph-t), border-color var(--morph-t);
}

.dossier-bio-bay,
.dossier-roles-bay {
  padding: 26px;
  border-radius: 14px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  transition: background-color var(--morph-t);
}

.about-mindset-lead {
  font-size: clamp(0.98rem, 1.12vw, 1.08rem);
  font-weight: 700;
  line-height: 1.48;
  color: var(--ink);
  margin: 0;
  max-width: 56ch;
  transition: color var(--morph-t);
}

.about-narrative-copy {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 100%;
}

.about-narrative-copy p {
  font-size: 0.96rem;
  line-height: 1.68;
  color: var(--ink-2);
  margin: 0;
  max-width: 100%;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
  text-wrap: wrap;
  transition: color var(--morph-t);
}

.about-narrative-copy strong {
  font-weight: 760;
  color: var(--ink);
}

.about-cred-grid {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.about-cred-card {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  transition: background-color var(--morph-t), border-color var(--morph-t);
}

.about-cred-val {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.012em;
  color: var(--accent-text);
  line-height: 1.2;
}

.about-cred-label {
  font-size: 0.76rem;
  line-height: 1.32;
  color: var(--ink-2);
}

/* Borderless Embedded OLED Signal Oscilloscope Well */
.dossier-scope-well {
  margin-top: auto;
  border-radius: 14px;
  background: var(--oled-bg);
  color: var(--oled-ink);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: background-color var(--morph-t), color var(--morph-t);
}

.dossier-scope-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--oled-ink);
  font-variant-numeric: tabular-nums;
}

.dossier-scope-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.dossier-scope-clock {
  margin-left: auto;
  color: var(--oled-muted);
  white-space: nowrap;
}

.dossier-scope-canvas {
  display: block;
  width: 100%;
  height: 124px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.dossier-scope-readout {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.42;
  color: var(--oled-ink);
  min-height: 2.15em;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.dossier-scope-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.scope-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f2f4f7;
  font-family: var(--mono);
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.38rem 0.72rem;
  min-height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition:
    background-color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    transform 80ms var(--ease-out);
}

.scope-btn:hover {
  border-color: var(--oled-ink);
  color: var(--oled-ink);
  background: rgba(255, 255, 255, 0.1);
}

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

.scope-btn--accent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.scope-btn--accent:hover {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  filter: brightness(1.06);
}

/* Right Bay: Interactive PCB Trace Rail & Leadership / Operational Roles */
.about-col-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color var(--morph-t);
}

.about-col-title {
  font-family: var(--font-display);
  font-size: clamp(1.16rem, 1.55vw, 1.38rem);
  font-weight: 800;
  font-stretch: var(--stretch-title);
  letter-spacing: -0.02em;
  line-height: 1.18;
  color: var(--ink);
  margin: 0;
}

.about-col-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pcb-role-stage {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0.35rem;
  align-items: stretch;
  flex: 1;
}

.pcb-trace-svg {
  width: 28px;
  height: 100%;
  min-height: 180px;
  display: block;
  overflow: visible;
}

.pcb-trace-line {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-dasharray: 5 4;
  animation: pcb-trace-flow 3.2s linear infinite;
  transition: stroke var(--morph-t);
}

@keyframes pcb-trace-flow {
  to {
    stroke-dashoffset: -18;
  }
}

.pcb-trace-via {
  fill: var(--surface-2);
  stroke: var(--line-strong);
  stroke-width: 2;
  transition: fill 160ms var(--ease-out), stroke 160ms var(--ease-out);
}

.pcb-trace-via.is-selected,
.pcb-trace-via.is-active {
  fill: var(--accent);
  stroke: var(--ink);
}

.pcb-pulse-dot {
  fill: var(--accent);
  animation: pcb-dot-breathe 2s ease-in-out infinite;
}

.pcb-pulse-dot--alt {
  fill: var(--oled-ink);
  animation-delay: -1s;
}

@keyframes pcb-dot-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.pcb-role-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.25rem;
}

.role-trace-item {
  position: relative;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.65rem 0.7rem;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out);
}

.role-trace-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: -2px;
  height: 1px;
  background: var(--line);
  pointer-events: none;
  transition: opacity 140ms var(--ease-out), background-color var(--morph-t);
}

.role-trace-item:hover,
.role-trace-item.is-selected {
  background: var(--surface);
  border-color: var(--line-strong);
}

.role-trace-item.is-selected {
  border-color: var(--accent);
}

.role-trace-item:hover::after,
.role-trace-item.is-selected::after {
  opacity: 0;
}

.role-trace-node {
  position: relative;
  z-index: 1;
  margin-top: 0.3rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2.5px solid var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition:
    background-color 160ms var(--ease-out),
    border-color var(--morph-t),
    transform 160ms var(--ease-out);
}

.role-trace-item:hover .role-trace-node,
.role-trace-item.is-selected .role-trace-node {
  background: var(--accent);
  transform: scale(1.12);
}

.role-trace-body {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
}

.role-trace-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.6rem;
}

.role-trace-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.012em;
  color: var(--ink);
  line-height: 1.25;
}

.role-trace-org {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.2rem 0.52rem;
  border-radius: 5px;
  background: var(--ground);
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-text);
  text-decoration: none;
  white-space: nowrap;
  transition:
    border-color 150ms var(--ease-out),
    background-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.role-trace-org:hover,
.role-trace-org:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.role-trace-link {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent-text) 45%, transparent);
  text-underline-offset: 0.2em;
  transition:
    color 150ms var(--ease-out),
    text-decoration-color 150ms var(--ease-out);
}

.role-trace-link:hover,
.role-trace-link:focus-visible {
  text-decoration-color: var(--accent-text);
}

.role-trace-desc {
  font-size: 0.86rem;
  line-height: 1.46;
  color: var(--ink-2);
  margin: 0;
  max-width: 100%;
}

.role-trace-sig {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-text);
  letter-spacing: 0.02em;
  margin-top: 0.1rem;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 920px) {
  .dossier-console {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .dossier-scope-canvas {
    height: 108px;
  }
  .pcb-role-stage {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 0.25rem;
  }
  .pcb-trace-svg {
    width: 22px;
  }
  .role-trace-item {
    padding: 0.75rem 0.55rem;
    gap: 0.6rem;
  }
}

@media (max-width: 860px) {
  .split-enclosure {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .about-cred-grid {
    grid-template-columns: 1fr;
  }
  .about-domain-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

@media (max-width: 640px) {
  .proj-content,
  .ledger-row,
  .index-row {
    text-align: center;
  }
  .proj-foot {
    justify-content: center;
  }
  .ledger-main p,
  .index-desc {
    margin-inline: auto;
  }
  .trace-item .index-desc {
    margin-inline: 0;
  }
  .index-meta {
    justify-content: center;
  }
  .ledger-period {
    justify-content: center;
  }
}

/* Contact Composer */
.composer-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.composer-field label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}

.composer-field input,
.composer-field textarea {
  width: 100%;
  padding: 0.78rem 0.95rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
}

.composer-field input::placeholder,
.composer-field textarea::placeholder {
  color: var(--ink-3);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 1.2rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--ground);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.44rem 0.82rem;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ---------- 13. Footer & Seam ---------- */
.site-footer {
  position: relative;
  background: #141619;
  color: #c8cdd4;
  padding-bottom: 3.5rem;
  transition: background-color var(--morph-t), color var(--morph-t);
}

html[data-mode="dark"] .site-footer {
  background: #080405;
  color: #a89089;
}

/* The mascot hangs from the dip of this wave once the page reaches its end (mascot.js). */
.footer-seam {
  position: relative;
  width: 100%;
  height: 96px;
  overflow: hidden;
}

.footer-seam-wave {
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 46px;
  z-index: 3;
  pointer-events: none;
  transform-origin: 50% 0;
  transform: scaleY(calc(1 + var(--wave, 0) * 0.85));
}

.footer-seam-wave path {
  fill: var(--ground);
  transition: fill var(--morph-t);
}

.footer-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-grid > div p {
  margin-inline: auto;
}

.footer-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: #f2f4f7;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.15rem;
  font-size: 0.92rem;
}

.footer-links a {
  color: #d6dae1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding-block: 0.3rem;
}
.footer-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Mascot on/off switch (revealed by mascot.js; hidden while JavaScript is unavailable). */
.footer-switch {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #d6dae1;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.footer-switch[hidden] {
  display: none;
}

.footer-switch:hover {
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
}

.footer-switch-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5b616b;
  transition: background-color 150ms var(--ease-out);
}

.footer-switch[aria-pressed="true"] .footer-switch-led {
  background: var(--accent);
}

/* ---------- 14. Floating OLED Cipher Progress HUD & Toast ---------- */
.cipher-hud {
  position: fixed;
  left: 50%;
  bottom: 4.85rem;
  translate: -50% 10px;
  z-index: 59;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.52rem 0.82rem;
  border-radius: 11px;
  background: var(--oled-bg);
  color: var(--oled-ink);
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.55);
  transition:
    opacity 180ms var(--ease-out),
    translate 180ms var(--ease-out),
    border-color 180ms var(--ease-out);
}

.cipher-hud.is-visible {
  opacity: 1;
  translate: -50% 0;
}

.cipher-hud.is-unlocked {
  border-color: var(--accent);
}

.cipher-key {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--oled-muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition:
    background-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.cipher-key.is-lit {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.cipher-hud.is-unlocked .cipher-key.is-lit {
  background: var(--oled-ink);
  color: #141619;
  border-color: var(--oled-ink);
}

.cipher-hud-label {
  margin-left: 0.25rem;
  color: var(--oled-ink);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Toast Notification */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  translate: -50% 12px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.58rem 1rem;
  border-radius: 999px;
  background: var(--oled-bg);
  color: var(--oled-ink);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.55);
  transition: opacity 180ms var(--ease-out), translate 180ms var(--ease-out);
}

.toast.is-on {
  opacity: 1;
  translate: -50% 0;
}

.toast .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .cipher-hud {
    bottom: 5rem;
    padding: 0.45rem 0.65rem;
    gap: 0.3rem;
  }
  .cipher-hud-label {
    width: 100%;
    text-align: center;
    margin-left: 0;
    white-space: normal;
  }
}

/* ---------- 15. Mobile Progress Line (assets/js/scroll.js) ---------- */
/* Built by the scroll engine, so it does not exist without JavaScript.
   Narrow screens get a progress line along the bottom edge of the header. */
@media (min-width: 1020px) {
  /* Equal side columns keep the nav on the page centre. */
  .site-header .wrap {
    grid-template-columns: 1fr auto 1fr;
  }
}

.scroll-line {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  overflow: hidden;
  pointer-events: none;
}

.scroll-line > span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

@media (min-width: 900px) {
  .scroll-line {
    display: none;
  }
}

/* ---------- 16. Scroll-Driven Motion (assets/js/scroll.js) ---------- */
/* The engine writes --e (0 → 1, how far an element has entered the viewport), --press,
   --cov and --wave. Every "before" state below is scoped to html.motion-on, a class the
   engine adds only when it is running and motion is allowed, so the page reads normally
   without JavaScript and under prefers-reduced-motion. */

/* Registered as non-inheriting: writing one of these restyles that single element, not its
   whole subtree. (Browsers without @property simply treat them as ordinary custom properties.) */
@property --e {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}
@property --k {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}
@property --cov {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
@property --wave {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
@property --press {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
@property --press-rx {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@property --press-s {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}

/* --- Entry effects -------------------------------------------------------------------
   Blocks rise into place, teaser cards rise one after another, the PCB trace draws itself,
   the keycaps drop onto the board, and the hero portrait tips back as it leaves.

   Two implementations of the same motion:
   1. Browsers with scroll-driven animations run them as CSS animations on view timelines.
      Transform and opacity are scrubbed by the compositor, so scrolling costs no script and
      no style recalculation at all. Fill is "backwards" wherever the end state is the
      natural one: once an element has landed, the animation lets go of it completely.
   2. Everywhere else the engine writes --e and the same states are computed from it. The
      keyboard is the exception: the engine marks the rig .is-seen and the rows drop once as
      a short staggered animation.
   The keyboard assembles by row, not by key: a keycap is unusually costly to restyle, and
   thirty of them per frame was the single most expensive thing on the page.

   Ranges are written as "cover <length>": the distance an element's top edge has travelled
   up from the bottom of the viewport, which is exactly how the engine computes --e. */
@keyframes m-rise {
  from {
    opacity: 0;
    translate: 0 36px;
  }
  60% {
    opacity: 1;
  }
}

@keyframes trace-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes frame-press {
  to {
    rotate: x 15deg;
    scale: 0.92;
  }
}

@keyframes cap-drop {
  from {
    opacity: 0;
    translate: 0 -34px;
    rotate: x 46deg;
  }
}

/* --i = place in a staggered sequence (teaser cards; the keyboard's key rows, top to bottom). */
.teaser-grid > :nth-child(2),
.kb-upper-matrix > .kb-caps:nth-child(1) {
  --i: 1;
}
.teaser-grid > :nth-child(3),
.kb-upper-matrix > .kb-caps:nth-child(2) {
  --i: 2;
}
.teaser-grid > :nth-child(4),
.kb-row-3 {
  --i: 3;
}
.kb-bottom-row {
  --i: 4;
}

@supports (animation-timeline: view()) {
  html.motion-on .m-rise {
    animation: m-rise linear backwards;
    animation-timeline: view();
    animation-range: cover 8vh cover 50vh;
  }

  html.motion-on .teaser-grid > * {
    animation: m-rise linear backwards;
    animation-timeline: view();
    animation-range: cover calc(8vh + var(--i, 0) * 6vh) cover calc(40vh + var(--i, 0) * 6vh);
  }

  /* The social keys pop up one after another as their row comes into view. */
  html.motion-on .social-grid > li {
    animation: social-pop linear backwards;
    animation-timeline: view();
    animation-range: cover calc(5vh + var(--i, 0) * 1.5vh) cover calc(22vh + var(--i, 0) * 1.5vh);
  }

  html.motion-on .pcb-role-stage {
    view-timeline: --pcb-roles block;
  }
  html.motion-on .pcb-trace-fill {
    animation: trace-draw linear both;
    animation-timeline: --pcb-roles;
    animation-range: cover 8vh cover 70vh;
  }

  /* The key rows ride the rig's own timeline, one strip after another. */
  html.motion-on .hanging-kb-rig {
    view-timeline: --kb-rig block;
  }
  html.motion-on .hanging-kb-rig :is(.kb-top-left, .kb-upper-matrix > .kb-caps, .kb-row-3, .kb-bottom-row) {
    animation: cap-drop linear backwards;
    animation-timeline: --kb-rig;
    animation-range: cover calc(8vh + var(--i, 0) * 5vh) cover calc(30vh + var(--i, 0) * 5vh);
  }

  /* The portrait starts tipping a little before its top reaches the viewport top and holds the
     tilt afterwards. On a page load without the intro it shares the element with hero-enter. */
  html.motion-on .hero-portrait-frame[data-press] {
    animation: frame-press linear both;
    animation-timeline: view();
    animation-range: exit -28vh exit 60%;
  }
  html.motion-on:not(.is-intro-active):not(.is-intro-done) .hero[data-hero-enter] .hero-portrait-frame[data-press] {
    animation:
      hero-enter 680ms var(--ease-out) 110ms both,
      frame-press linear both;
    animation-timeline: auto, view();
    animation-range: normal, exit -28vh exit 60%;
  }
}

@supports not (animation-timeline: view()) {
  html.motion-on .m-rise {
    opacity: clamp(0, calc(var(--e, 1) * 1.7), 1);
    translate: 0 calc((1 - var(--e, 1)) * 36px);
  }

  html.motion-on .teaser-grid > * {
    --k: clamp(0, calc(var(--e, 1) * 1.9 - var(--i, 0) * 0.3), 1);
    opacity: var(--k);
    translate: 0 calc((1 - var(--k)) * 30px);
  }

  /* Mid-entry elements get their own layers for that moment only (class set by the engine). */
  html.motion-on .m-rise.is-entering,
  html.motion-on .teaser-grid.is-entering > * {
    will-change: transform, opacity;
  }

  html.motion-on .pcb-trace-fill {
    stroke-dashoffset: calc(1 - var(--e, 1));
  }

  html.motion-on .hanging-kb-rig:not(.is-seen) :is(.kb-top-left, .kb-upper-matrix > .kb-caps, .kb-row-3, .kb-bottom-row) {
    opacity: 0;
  }
  html.motion-on .hanging-kb-rig.is-seen :is(.kb-top-left, .kb-upper-matrix > .kb-caps, .kb-row-3, .kb-bottom-row) {
    animation: cap-drop 560ms var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 70ms);
  }
}

/* Hero: the name narrows as it slides under the header (font width cannot be composited, so the
   engine steps --press; the portrait's tilt is above, or --press-rx / --press-s as the fallback). */
.hero-name[data-press] {
  font-stretch: calc(var(--stretch-display) - var(--press, 0) * 46%);
  letter-spacing: calc(-0.04em + var(--press, 0) * 0.016em);
}

html.motion-on .hero-name[data-press] {
  transition: color var(--morph-t);
}

html.motion-on .hero-portrait-frame {
  transition:
    background-color var(--morph-t),
    border-color var(--morph-t),
    box-shadow var(--morph-t);
}

/* Odometer counters. */
.odo {
  display: inline-flex;
  height: 1em;
  line-height: 1;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.odo-col {
  display: inline-block;
  height: 1em;
}

.odo-strip {
  display: block;
  white-space: pre;
  line-height: 1;
  transition: transform 340ms cubic-bezier(0.3, 1.3, 0.5, 1);
}

.about-cred-val {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.34rem;
}

.cred-num {
  font-size: 1.62rem;
  font-stretch: var(--stretch-display);
  letter-spacing: -0.03em;
  line-height: 1;
}

/* The PCB trace draws itself down the role list; each role lights as the trace reaches its via. */
.pcb-trace-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

html.motion-on .role-trace-item[data-at] {
  opacity: 0.4;
  translate: 12px 0;
  transition:
    opacity 320ms var(--ease-out),
    translate 460ms cubic-bezier(0.3, 1.4, 0.5, 1),
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out);
}

html.motion-on .role-trace-item[data-at].is-reached {
  opacity: 1;
  translate: 0 0;
}

/* Pinned keyboard scene: the engine sets the scene's height; scroll inside it steps the layers. */
.loadout-scene.is-pinned > .loadout-stage {
  position: sticky;
  top: var(--pin-top, 6rem);
}

/* Carrier wave under the contact address: flows on its own, swells with scroll speed.
   Both motions are transforms on HTML boxes (the span and the svg element itself), so they
   stay on the compositor; animating anything inside the svg would force layout every frame. */
.freq-wave {
  display: block;
  width: 100%;
  max-width: 320px;
  height: 22px;
  margin-top: 0.1rem;
  overflow: hidden;
  opacity: calc(0.62 + var(--wave, 0) * 0.38);
  transform: scaleY(calc(0.4 + var(--wave, 0) * 0.6));
}

.freq-wave svg {
  display: block;
  width: 200%;
  max-width: none;
  height: 100%;
  animation: freq-flow 3s linear infinite;
}

.freq-wave path {
  fill: none;
  stroke: var(--oled-ink);
  stroke-width: 2;
  stroke-linecap: round;
}

@keyframes freq-flow {
  to {
    transform: translateX(-50%);
  }
}

/* ---------- 17. Selected Work Teasers & Case-Study Cards ---------- */
.teaser-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.teaser-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 20px 20px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  color: inherit;
  text-decoration: none;
  transition:
    transform 180ms var(--ease-out),
    border-color 160ms var(--ease-out),
    background-color var(--morph-t);
}

.teaser-card:hover,
.teaser-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.teaser-no {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}

.teaser-card h3 {
  font-size: 1.12rem;
  line-height: 1.2;
}

.teaser-card p {
  font-size: 0.9rem;
  line-height: 1.52;
  color: var(--ink-2);
}

.teaser-foot {
  margin-top: auto;
  padding-top: 0.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.5rem;
}

.teaser-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.teaser-tags .tag {
  font-size: 0.7rem;
}

.teaser-go {
  font-weight: 800;
  line-height: 1.5;
  color: var(--accent-text);
  transition: translate 160ms var(--ease-out);
}

.teaser-card:hover .teaser-go,
.teaser-card:focus-visible .teaser-go {
  translate: 4px 0;
}

.section-cta {
  justify-content: center;
  margin-top: 1.6rem;
}

@media (max-width: 1040px) {
  .teaser-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .teaser-grid {
    grid-template-columns: 1fr;
  }
}

/* Case studies (/work/): a single enclosure per engagement — narrative on the left, an OLED
   spec plate on the right. On wide screens the cards pin and stack as the page scrolls. */
.case-stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.case-card {
  --n: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(230px, 0.85fr);
  gap: 16px;
  padding: 16px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-enclosure);
  transition: background-color var(--morph-t), border-color var(--morph-t);
}

.case-card:target {
  border-color: var(--accent);
}

/* Position in the stack: each pinned card rests a little lower than the one before it. */
.case-stack > :nth-child(2) {
  --n: 1;
}
.case-stack > :nth-child(3) {
  --n: 2;
}
.case-stack > :nth-child(4) {
  --n: 3;
}
.case-stack > :nth-child(5) {
  --n: 4;
}

.case-main {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 24px 26px;
  border-radius: 14px;
  background: var(--surface-2);
  transition: background-color var(--morph-t);
}

.case-no {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}

.case-card h3 {
  font-size: clamp(1.28rem, 2.1vw, 1.66rem);
}

.case-main p {
  font-size: 0.98rem;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 62ch;
}

.case-main .index-meta {
  margin-top: auto;
  padding-top: 0.4rem;
}

.case-spec {
  display: grid;
  align-content: start;
  gap: 0.85rem;
  margin: 0;
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--oled-bg);
  color: var(--oled-ink);
  font-family: var(--mono);
}

.case-spec div {
  display: grid;
  gap: 0.18rem;
}

.case-spec dt {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--oled-muted);
}

.case-spec dd {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.42;
  color: #f2f4f7;
}

.case-spec a {
  color: var(--oled-ink);
}

@media (max-width: 860px) {
  .case-card {
    grid-template-columns: 1fr;
  }
  .case-main {
    padding: 18px 16px;
  }
  .case-spec {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 16px;
  }
}

@media (min-width: 861px) and (min-height: 620px) {
  html.motion-on .case-stack {
    padding-bottom: 8vh;
  }
  html.motion-on .case-card {
    position: sticky;
    top: calc(var(--header-h) + 14px + var(--n) * 14px);
    transform-origin: 50% 0;
    transform: scale(calc(1 - var(--cov, 0) * 0.045));
    filter: brightness(calc(1 - var(--cov, 0) * 0.16));
  }
}

/* ---------- 18. Small Layout Helpers ---------- */
.dispatch-intro .index-desc {
  margin-top: 0.35rem;
}

.patch-grid--spaced {
  margin-top: 1.1rem;
}

.cipher-unlock {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--accent);
}

/* ---------- 19. Reduced Motion & Print ---------- */
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .intro-stage {
    display: none !important;
  }
  .hero[data-hero-enter] .hero-copy > *,
  .hero[data-hero-enter] .hero-portrait-frame {
    animation: none !important;
  }
  .hero-portrait-frame {
    transform: none !important;
  }
  .pcb-trace-line,
  .pcb-pulse-dot,
  .freq-wave svg,
  .arch-schematic-svg.is-pulsing .arch-svg-edge,
  .arch-svg-edge.is-pulsing {
    animation: none !important;
  }
  html[data-mode="dark"] body::after {
    display: none;
  }
}

@media print {
  .scroll-line,
  .intro-stage,
  .toast,
  .cipher-hud,
  .footer-switch {
    display: none !important;
  }
}
