/* ============================================================
   Utsab Dahal Portfolio
   Design: Modern Editorial — warm off-white, orange-brown accent
   ============================================================ */

:root {
  --surface: #fcf9f4;
  --surface-lowest: #ffffff;
  --surface-low: #f6f3ee;
  --surface-mid: #f0ede9;
  --surface-high: #ebe8e3;
  --surface-highest: #e5e2dd;
  --on-surface: #1c1c19;
  --on-surface-variant: #444748;
  --outline: #747878;
  --outline-variant: #c4c7c7;
  --primary: #000000;
  --primary-container: #1c1b1b;
  --on-primary: #ffffff;
  --on-primary-container: #858383;
  --secondary: #914c1e;
  --secondary-container: #ffa671;
  --secondary-fixed-dim: #ffb68c;
  --on-secondary: #ffffff;
  --on-secondary-container: #78390c;
  --radius-sm: 0.375rem;
  --radius-md: 1rem;
  --radius-lg: 2rem;
  --radius-full: 9999px;
  --maxw: 1280px;
  --pad-x: clamp(1.25rem, 4vw, 3.5rem);
  --font-display: "Newsreader", "Times New Roman", serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-code: "Space Grotesk", "SF Mono", "Fira Code", monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

/* Dark theme */
.dark {
  --surface: #1a1a1a;
  --surface-lowest: #111111;
  --surface-low: #1e1e1e;
  --surface-mid: #242424;
  --surface-high: #2c2c2c;
  --surface-highest: #363636;
  --on-surface: #faf9f6;
  --on-surface-variant: #b0b0b0;
  --outline: #8a8a8a;
  --outline-variant: #3a3a3a;
  --primary: #faf9f6;
  --primary-container: #1c1b1b;
  --on-primary: #1a1a1a;
  --on-primary-container: #858383;
  --secondary: #ffa671;
  --secondary-container: #914c1e;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

html, body {
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .4s var(--ease), color .4s var(--ease);
}

::selection { background: var(--secondary-container); color: #fff; }
a { color: inherit; text-decoration: none; }
em { font-style: italic; color: var(--secondary); }

/* Grain overlay */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 200;
  opacity: 0.02; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.dark .grain { mix-blend-mode: overlay; opacity: 0.03; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem var(--pad-x);
  background: rgba(252, 249, 244, 0.88);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  transition: background .4s, border-color .4s;
}
.dark .nav {
  background: rgba(26, 26, 26, 0.88);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
.brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.5rem; letter-spacing: -0.03em;
}
.brand span { color: var(--secondary); }
.nav-links { display: none; gap: 2rem; align-items: center; }
.nav-links a {
  font-family: var(--font-display); font-size: 1.05rem;
  color: var(--outline); transition: color .25s;
}
.nav-links a:hover { color: var(--on-surface); }
@media (min-width: 820px) { .nav-links { display: flex; } }
.nav-tools { display: flex; align-items: center; gap: 0.6rem; }
.nav-cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--primary); color: var(--on-primary);
  padding: 0.6rem 1.3rem; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  transition: transform .2s, opacity .2s;
}
.nav-cta:hover { transform: scale(1.03); opacity: 0.9; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  background: transparent; cursor: pointer;
  color: var(--on-surface);
  transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: var(--surface-high); border-color: var(--outline); }
.icon-btn .material-symbols-outlined { font-size: 18px; }
.t-dark { display: none; }
.t-light { display: block; }
.dark .t-dark { display: block; }
.dark .t-light { display: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
main { padding: 0 var(--pad-x); max-width: var(--maxw); margin: 0 auto; }
section { padding: clamp(6.5rem, 13vw, 10rem) 0 clamp(5rem, 10vw, 7.5rem); position: relative; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 600; color: var(--on-surface-variant);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--secondary);
}
.sec-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end; gap: 1.5rem;
  padding-top: 2.5rem;
  padding-bottom: 1.75rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
  border-bottom: 1px solid var(--outline-variant);
  position: relative;
}
.sec-head .idx {
  font-family: var(--font-display);
  font-style: italic; font-size: 1.1rem;
  color: var(--secondary);
}
.sec-head h2 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.75rem, 4vw, 3rem);
  letter-spacing: -0.01em; line-height: 1.2; margin: 0;
}
.sec-meta {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600; color: var(--outline);
  white-space: nowrap;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding-top: clamp(8rem, 16vh, 11rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
  position: relative; isolation: isolate;
}
.hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%; z-index: -1;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse at 70% 30%, #000 45%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 30%, #000 45%, transparent 85%);
  pointer-events: none;
}
.hero-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 3rem; align-items: center;
}
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: 1fr 1fr; gap: 4rem; }
}

/* Availability badge */
.avail-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--surface-high);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--outline-variant);
  margin-bottom: 1.75rem;
}
.avail-label {
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.hero-text { display: flex; flex-direction: column; }
.display {
  font-family: var(--font-display); font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.08;
  margin: 0 0 1.5rem;
  font-size: clamp(2.4rem, 6vw, 5rem);
}
.display em { font-style: italic; font-weight: 300; color: inherit; }
.hero-body {
  font-size: clamp(1rem, 1.15vw, 1.125rem);
  line-height: 1.65; color: var(--on-surface-variant);
  max-width: 42ch; margin: 0 0 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--primary); color: var(--on-primary);
  padding: 0.9rem 1.75rem; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  transition: transform .2s, opacity .2s;
}
.btn-primary:hover { transform: scale(1.03); opacity: 0.9; }
.btn-primary .material-symbols-outlined { font-size: 16px; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: transparent; color: var(--primary);
  border: 1px solid var(--outline-variant);
  padding: 0.9rem 1.75rem; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  transition: background .2s, border-color .2s;
}
.btn-outline:hover { background: var(--surface-high); border-color: var(--outline); }

/* ============================================================
   TERMINAL — polished macOS-style window
   ============================================================ */
.hero-terminal-wrap { width: 100%; }
.terminal {
  background: var(--primary-container);
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}
.terminal-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px;
  background: #2a2929;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.terminal-dot {
  width: 12px; height: 12px;
  border-radius: 50%; flex-shrink: 0;
}
.terminal-dot.red    { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green  { background: #27c93f; }
.terminal-body {
  padding: 24px;
  font-family: var(--font-code);
  font-size: 14px; line-height: 1.7;
  color: #a0a0a0;
  display: flex; flex-direction: column; gap: 20px;
}
.term-line { }
.term-prompt {
  color: var(--secondary-container);
  font-weight: 500;
}
.term-cmd {
  color: #e8e8e8;
  font-weight: 500;
}
.term-output {
  margin-top: 4px;
  color: #b0b0b0;
  display: flex; flex-direction: column; gap: 2px;
}
.term-check {
  color: #27c93f;
  margin-right: 6px;
}
.term-cursor {
  display: inline-block;
  width: 9px; height: 18px;
  background: var(--secondary-container);
  margin-left: 8px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   TRUST BADGES
   ============================================================ */
.trust-section {
  display: flex; flex-direction: column;
  align-items: center; gap: 1.25rem;
  margin-top: clamp(4rem, 8vw, 6rem);
  padding-top: clamp(3rem, 5vw, 4rem);
  border-top: 1px solid var(--outline-variant);
}
.trust-label {
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--outline);
}
.trust-badges {
  display: flex; flex-wrap: wrap;
  justify-content: center; gap: 0.6rem;
}
.badge {
  display: inline-flex; align-items: center;
  background: var(--surface-lowest);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--outline-variant);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--on-surface);
}

/* ============================================================
   METRICS
   ============================================================ */
.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin: clamp(3rem, 6vw, 4rem) 0 0;
  background: var(--outline-variant);
  border-radius: var(--radius-md);
  overflow: hidden;
}
@media (min-width: 640px) {
  .metrics { grid-template-columns: repeat(4, 1fr); }
}
.metric {
  text-align: center;
  display: flex; flex-direction: column;
  align-items: center; gap: 0.4rem;
  padding: 1.75rem 1rem;
  background: var(--surface);
  transition: background .3s;
  transform-style: preserve-3d;
  position: relative; overflow: hidden;
}
.metric:hover { background: var(--surface-low); }
.metric b {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric b em { color: var(--secondary); }
.metric span {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--outline);
}

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--outline-variant);
  border-bottom: 1px solid var(--outline-variant);
  padding: 1.5rem 0;
  margin: 0 calc(-1 * var(--pad-x));
}
.marquee-track {
  display: flex; gap: 3rem;
  animation: marquee 40s linear infinite;
  width: max-content;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  font-weight: 500; font-style: italic;
  color: var(--outline);
  white-space: nowrap;
}
.marquee-track span {
  display: inline-flex; align-items: center; gap: 3rem;
}
.marquee-track span::after {
  content: "\00B7"; font-style: normal; opacity: 0.5;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid; grid-template-columns: 1fr; gap: 2.5rem;
}
@media (min-width: 960px) {
  .about-grid { grid-template-columns: 7fr 5fr; gap: 4rem; }
}
.about-lead {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.35; margin: 0;
}
.about-body {
  font-size: 0.95rem; line-height: 1.7;
  color: var(--on-surface-variant);
  max-width: 42ch; margin: 0;
}
.pills {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  list-style: none; padding: 0; margin: 2rem 0 0;
}
.pills li {
  padding: 0.45rem 0.9rem;
  background: var(--surface-high);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: var(--radius-full);
  border: 1px solid var(--outline-variant);
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.skill-card {
  background: var(--surface-low);
  padding: clamp(1.5rem, 2.5vw, 2.25rem);
  border-radius: var(--radius-md);
  border: 1px solid var(--outline-variant);
  display: flex; flex-direction: column; gap: 0.8rem;
  transition: background .3s, transform .3s, box-shadow .3s;
  position: relative; overflow: hidden;
  transform-style: preserve-3d;
}
.skill-card:hover {
  background: var(--surface-high);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}
.skill-card.offset { transform: translateY(1.5rem); }
.skill-card.offset:hover { transform: translateY(calc(1.5rem - 3px)); }
.skill-card .sym {
  color: var(--secondary); font-size: 28px;
  margin-bottom: 0.5rem;
}
.skill-card h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1.35rem; margin: 0;
}
.skill-card p {
  font-size: 0.88rem; color: var(--on-surface-variant);
  line-height: 1.65; margin: 0;
}
/* Tilt glow */
.skill-card::after, .pub::after, .contact-form::after, .metric::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%),
              rgba(145, 76, 30, 0.08), transparent 45%);
  opacity: 0; pointer-events: none;
  transition: opacity .3s; border-radius: inherit;
}
.skill-card.tilt-on::after, .pub.tilt-on::after,
.contact-form.tilt-on::after, .metric.tilt-on::after { opacity: 1; }
.skill-card.offset.tilt-on {
  transform: perspective(900px) translateY(1.5rem)
             rotateX(var(--rx, 0)) rotateY(var(--ry, 0));
}

/* ============================================================
   WORK
   ============================================================ */
.work-filters {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin: 0 0 2rem;
}
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1.15rem;
  background: transparent;
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all .25s var(--ease);
}
.chip:hover {
  color: var(--on-surface);
  border-color: var(--outline);
  background: var(--surface-high);
}
.chip.is-active {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
}
.chip em {
  font-style: normal; opacity: 0.6; color: inherit;
}

.work-list { display: flex; flex-direction: column; }
.work-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start; gap: 2rem;
  padding: clamp(1.75rem, 3vw, 2.25rem) 0;
  border-bottom: 1px solid var(--outline-variant);
  transition: padding-left .4s var(--ease), opacity .3s;
  position: relative;
}
.work-item::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(145, 76, 30, 0.04), transparent 40%);
  opacity: 0; transition: opacity .4s; pointer-events: none;
}
.work-item:hover::before { opacity: 1; }
.work-item:hover { padding-left: 1.25rem; }
.work-item.minor { opacity: 0.72; }
.work-item.minor:hover { padding-left: 0; }
.work-item.minor:hover::before { opacity: 0; }
.work-item.is-filtered-out {
  opacity: 0.1; filter: grayscale(1); pointer-events: none;
}
.w-num {
  font-family: var(--font-display); font-style: italic;
  font-size: 0.95rem; color: var(--secondary);
  padding-top: 0.4rem; min-width: 2.5ch;
}
.w-body h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.3rem, 2.4vw, 1.85rem);
  letter-spacing: -0.01em; line-height: 1.2;
  margin: 0 0 0.5rem;
  transition: color .25s;
}
.work-item:not(.minor):hover .w-body h3 { color: var(--secondary); }
.w-body p {
  font-size: 0.9rem; color: var(--on-surface-variant);
  line-height: 1.65; max-width: 55ch; margin: 0 0 0.75rem;
}
.w-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.w-tags span {
  padding: 0.25rem 0.6rem;
  background: var(--surface-high);
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--on-surface-variant);
}
.w-arrow {
  font-size: 22px; color: var(--outline);
  padding-top: 0.4rem;
  transition: color .25s, transform .25s;
}
.work-item:not(.minor):hover .w-arrow {
  color: var(--secondary); transform: translate(3px, -3px);
}
.work-item.big { padding: clamp(2.25rem, 4vw, 3rem) 0; }
/* Left accent on hover */
.work-item:not(.minor)::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--secondary);
  transform: scaleY(0); transition: transform .35s var(--ease);
}
.work-item:not(.minor):hover::after { transform: scaleY(0.5); }

/* ============================================================
   PUBLICATIONS
   ============================================================ */
.pub {
  background: var(--surface-low);
  padding: clamp(2rem, 4vw, 3rem);
  border-radius: var(--radius-md);
  border: 1px solid var(--outline-variant);
  max-width: 880px;
  position: relative; overflow: hidden;
  transition: transform .3s, box-shadow .3s;
  transform-style: preserve-3d;
}
.pub:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}
.pub-meta {
  display: flex; gap: 1.5rem;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--secondary); margin-bottom: 1.25rem;
}
.pub-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  line-height: 1.25; margin: 0 0 1rem;
}
.pub-body {
  font-size: 0.95rem; color: var(--on-surface-variant);
  line-height: 1.7; margin: 0; max-width: 60ch;
}

/* ============================================================
   EDUCATION
   ============================================================ */
.edu-row {
  display: grid; grid-template-columns: 1fr;
  gap: 1rem; padding: 2rem 0;
  border-bottom: 1px solid var(--outline-variant);
}
@media (min-width: 640px) {
  .edu-row { grid-template-columns: 200px 1fr; gap: 3rem; }
}
.edu-when {
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--outline); padding-top: 0.3rem;
}
.edu-what h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1.5rem; margin: 0 0 0.4rem;
}
.edu-what h3 span { font-weight: 400; color: var(--outline); }
.edu-deg {
  font-size: 0.95rem; color: var(--secondary);
  margin: 0 0 0.5rem;
}
.edu-course {
  font-size: 0.85rem; color: var(--outline);
  margin: 0; line-height: 1.7;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact { padding-bottom: clamp(5rem, 10vw, 8rem); }
.contact-grid {
  display: grid; grid-template-columns: 1fr; gap: 3rem;
}
@media (min-width: 820px) {
  .contact-grid { grid-template-columns: 5fr 6fr; gap: 4rem; }
}
.contact-left { display: flex; flex-direction: column; gap: 1rem; }
.contact-left .display { font-size: clamp(2.5rem, 6vw, 4.5rem); }
.contact-lede {
  font-size: 0.95rem; color: var(--on-surface-variant);
  line-height: 1.6; max-width: 38ch; margin: 0.5rem 0 0;
}
.contact-links {
  list-style: none; padding: 0; margin: 1.5rem 0 0;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.contact-links a {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 0.95rem; color: var(--on-surface-variant);
  transition: color .25s;
}
.contact-links a:hover { color: var(--secondary); }
.contact-links .material-symbols-outlined {
  font-size: 20px; color: var(--secondary);
}
.contact-form {
  display: flex; flex-direction: column; gap: 1.5rem;
  background: var(--surface-low);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border-radius: var(--radius-md);
  border: 1px solid var(--outline-variant);
  position: relative; overflow: hidden;
  transform-style: preserve-3d;
}
.contact-form label {
  display: flex; flex-direction: column; gap: 0.35rem;
}
.contact-form label span {
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--outline);
}
.contact-form input,
.contact-form textarea {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-family: var(--font-body); font-size: 0.95rem;
  color: var(--on-surface);
  outline: none; resize: vertical;
  transition: border-color .25s;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--secondary); }
.contact-form button {
  display: inline-flex; align-items: center;
  justify-content: center; gap: 0.5rem;
  background: var(--primary); color: var(--on-primary);
  padding: 0.9rem 1.75rem;
  border: none; border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer;
  transition: transform .2s, opacity .2s;
  align-self: flex-start;
}
.contact-form button:hover { transform: scale(1.03); opacity: 0.9; }

/* ============================================================
   FOOTER
   ============================================================ */
.foot {
  border-top: 1px solid var(--outline-variant);
  padding: 0 var(--pad-x);
  max-width: var(--maxw); margin: 0 auto;
}
.foot-row {
  display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: center;
  padding: 2.5rem 0; gap: 1.5rem;
}
.foot-sign { display: flex; flex-direction: column; gap: 0.5rem; }
.foot-sign p { font-size: 13px; color: var(--outline); margin: 0; }
.foot-links { display: flex; align-items: center; gap: 1.5rem; }
.foot-links a, .foot-link-btn {
  font-family: var(--font-display); font-size: 0.9rem;
  color: var(--outline);
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0; transition: color .25s;
}
.foot-links a:hover, .foot-link-btn:hover { color: var(--on-surface); }
.foot-link-btn .material-symbols-outlined { font-size: 14px; }
.sig { width: 160px; height: auto; color: var(--on-surface); opacity: 0.3; }
.sig path {
  transition: stroke-dashoffset 1.8s cubic-bezier(0.65, 0, 0.35, 1);
}
.sig.is-drawn path { stroke-dashoffset: 0 !important; }

/* ============================================================
   REPEL TEXT
   ============================================================ */
.repel { display: block; }
.repel .repel-u {
  display: inline-block; will-change: transform;
  transition: transform 360ms cubic-bezier(0.2, 0.7, 0.1, 1), color 200ms;
}
.repel .repel-u.hot {
  transition-duration: 80ms; color: var(--secondary);
}

/* ============================================================
   SCROLL PROGRESS
   ============================================================ */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 110;
  background: rgba(196, 199, 199, 0.15);
  pointer-events: none;
}
.scroll-progress-fill {
  height: 100%; width: 100%;
  transform-origin: 0 50%; transform: scaleX(0);
  background: var(--secondary);
}

/* ============================================================
   SECTION RAIL
   ============================================================ */
.section-rail {
  position: fixed; right: 1rem; top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: none; flex-direction: column; gap: 0.75rem;
}
@media (min-width: 960px) { .section-rail { display: flex; } }
.section-rail a {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 600;
  color: var(--outline); transition: color .25s;
  text-decoration: none;
}
.section-rail a:hover,
.section-rail a.is-active { color: var(--on-surface); }
.rail-num { display: none; }
.rail-tick {
  width: 16px; height: 2px;
  background: var(--outline-variant);
  transition: width .25s, background .25s;
}
.section-rail a.is-active .rail-tick {
  width: 32px; background: var(--secondary);
}
.rail-label {
  opacity: 0; transform: translateX(-4px);
  transition: opacity .25s, transform .25s;
}
.section-rail a:hover .rail-label,
.section-rail a.is-active .rail-label {
  opacity: 1; transform: none;
}

/* ============================================================
   REVEAL
   ============================================================ */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ============================================================
   CLOCK
   ============================================================ */
.clock-time { font-variant-numeric: tabular-nums; }
.clock-tz {
  font-size: 9px; letter-spacing: 0.2em; color: var(--outline);
  padding: 2px 5px;
  border: 1px solid var(--outline-variant); border-radius: 2px;
  margin-left: 0.3rem;
}

/* ============================================================
   MAGNETIC
   ============================================================ */
[data-magnetic], .nav-cta, .contact-form button {
  transition: transform .25s cubic-bezier(0.2, 0.7, 0.1, 1),
              background .2s, color .2s, border-color .25s;
}
.mag-on { transition-duration: 60ms !important; }

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmdk { position: fixed; inset: 0; z-index: 300; display: none; }
.cmdk.is-open { display: block; }
.cmdk-backdrop {
  position: absolute; inset: 0;
  background: rgba(28, 28, 25, 0.45);
  backdrop-filter: blur(6px);
  animation: fadeIn .2s ease;
}
.dark .cmdk-backdrop { background: rgba(0, 0, 0, 0.55); }
@keyframes fadeIn { from { opacity: 0; } }
.cmdk-panel {
  position: absolute; top: 16vh; left: 50%;
  transform: translateX(-50%);
  width: min(520px, 90vw);
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  animation: popIn .2s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}
.cmdk-input-wrap {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--outline-variant);
}
.cmdk-input-wrap .material-symbols-outlined {
  font-size: 20px; color: var(--outline);
}
.cmdk-input-wrap input {
  flex: 1; border: none; background: transparent;
  font-family: var(--font-body); font-size: 0.95rem;
  color: var(--on-surface); outline: none;
}
.cmdk-input-wrap input::placeholder { color: var(--outline); }
.cmdk-input-wrap kbd {
  font-family: var(--font-code); font-size: 11px;
  padding: 2px 6px; background: var(--surface-high);
  border-radius: 4px; color: var(--outline);
  margin-left: auto;
}
.cmdk-list {
  list-style: none; padding: 0.5rem 0; margin: 0;
  max-height: 300px; overflow-y: auto;
}
.cmdk-list li {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center; gap: 1rem;
  padding: 0.6rem 1rem;
  cursor: pointer; transition: background .12s;
}
.cmdk-list li:hover,
.cmdk-list li.is-cursor { background: var(--surface-high); }
.cmdk-type {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-high); color: var(--outline);
  text-align: center;
  border: 1px solid var(--outline-variant);
}
.cmdk-label { font-size: 0.9rem; }
.cmdk-hint {
  font-size: 11px; color: var(--outline);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.cmdk-foot {
  display: flex; gap: 1.5rem; padding: 0.6rem 1rem;
  justify-content: flex-end;
  border-top: 1px solid var(--outline-variant);
  font-size: 11px; color: var(--outline);
  background: var(--surface-low);
}
.cmdk-foot kbd {
  font-family: var(--font-code); font-size: 10px;
  padding: 1px 4px; background: var(--surface-high);
  border-radius: 3px;
}
kbd, .kbd {
  display: inline-block; padding: 1px 5px; border-radius: 3px;
  background: var(--surface-high); color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
  font-family: var(--font-code); font-size: 10px;
  margin: 0 2px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--primary); color: var(--on-primary);
  padding: 0.7rem 1.4rem; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 500;
  z-index: 400; opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   INTRO SIGIL
   ============================================================ */
html.is-intro { overflow: hidden; }
.intro {
  position: fixed; inset: 0; z-index: 500;
  background: var(--surface-lowest);
  display: grid; place-items: center;
}
.intro.is-out {
  animation: introOut .7s ease forwards;
}
@keyframes introOut { to { opacity: 0; visibility: hidden; } }
.intro-mark {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(3.5rem, 10vw, 7rem);
  letter-spacing: -0.02em;
}
.intro-dot { color: var(--secondary); }
.intro-u, .intro-d {
  display: inline-block;
  animation: introChar .9s var(--ease) both;
}
.intro-d { animation-delay: 0.12s; }
@keyframes introChar {
  from { opacity: 0; transform: translateY(40%); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
.intro-line {
  position: absolute; bottom: 28vh; left: 50%;
  transform: translateX(-50%);
  width: min(360px, 50vw); height: 1px;
  background: var(--outline-variant); overflow: hidden;
}
.intro-line span {
  display: block; height: 100%;
  background: var(--secondary);
  animation: introLine 1.1s var(--ease) 0.2s both;
  transform-origin: 0 50%;
}
@keyframes introLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.intro-tag {
  position: absolute; bottom: 20vh; left: 50%;
  transform: translateX(-50%);
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--outline);
  animation: introTag .8s var(--ease) 0.5s both;
}
@keyframes introTag {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
   SPOTLIGHT
   ============================================================ */
.spotlight {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(420px circle at var(--sx, 50%) var(--sy, 50%),
              rgba(145, 76, 30, 0.03), transparent 70%);
}
.dark .spotlight {
  background: radial-gradient(420px circle at var(--sx, 50%) var(--sy, 50%),
              rgba(255, 166, 113, 0.04), transparent 70%);
}

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999;
  mix-blend-mode: difference;
  transform: translate3d(-100px, -100px, 0);
}
.cursor-dot {
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  background: #000; border-radius: 50%;
}
.dark .cursor-dot { background: #fff; }
.cursor-ring {
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  transition: width .25s var(--ease), height .25s var(--ease),
              margin .25s var(--ease), border-color .25s var(--ease),
              background .25s var(--ease);
}
.dark .cursor-ring { border-color: rgba(255, 255, 255, 0.4); }
.cursor-ring.is-hot {
  width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-color: rgba(145, 76, 30, 0.7);
  background: rgba(145, 76, 30, 0.06);
}
@media (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }

/* Kursor (multimodal cursor) */
.kursor {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999;
}
.kursor > * {
  position: fixed; top: 0; left: 0;
  pointer-events: none; will-change: transform;
}
.k-dot {
  width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px;
  background: currentColor; color: #000;
  border-radius: 50%; mix-blend-mode: difference;
}
.dark .k-dot { color: #fff; }
.k-ring {
  width: 32px; height: 32px; margin: -16px 0 0 -16px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 50%; mix-blend-mode: difference;
  transition: width .25s var(--ease), height .25s var(--ease),
              margin .25s var(--ease), border-color .25s var(--ease),
              background .25s var(--ease), opacity .25s;
}
.dark .k-ring { border-color: rgba(255, 255, 255, 0.4); }
.kursor.is-hot .k-ring {
  width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-color: rgba(145, 76, 30, 0.7);
  background: rgba(145, 76, 30, 0.06);
}
.k-cross {
  width: 80px; height: 80px; margin: -40px 0 0 -40px;
  opacity: 0; transition: opacity .25s;
  mix-blend-mode: difference;
}
.kursor-crosshair .k-cross { opacity: 1; }
.kursor-crosshair .k-ring { opacity: 0; }
.k-blob {
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,
              rgba(145, 76, 30, 0.5), rgba(145, 76, 30, 0.2) 55%, transparent 72%);
  filter: blur(0.5px);
  opacity: 0;
  transition: opacity .25s, width .25s, height .25s, margin .25s;
}
.kursor-magnet .k-blob { opacity: 1; }
.kursor-magnet .k-ring { opacity: 0.25; }
.kursor-dialog .k-ring {
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50% 50% 50% 6px;
  border-color: rgba(145, 76, 30, 0.5);
  background: rgba(252, 249, 244, 0.3);
  backdrop-filter: blur(4px);
  mix-blend-mode: normal;
}
.k-label {
  padding: 3px 8px; margin: 16px 0 0 16px;
  font-family: var(--font-body);
  font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase;
  background: rgba(252, 249, 244, 0.85);
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
  border-radius: 2px;
  opacity: 0; transition: opacity .2s;
}
.dark .k-label { background: rgba(26, 26, 26, 0.85); }
.kursor.has-label .k-label { opacity: 1; }
.k-readout {
  position: fixed; top: auto; left: auto; bottom: 1rem; right: 1rem;
  width: max-content; height: max-content;
  display: none; gap: 0.75rem;
  font-family: var(--font-code);
  font-size: 10px; color: var(--outline);
  background: rgba(252, 249, 244, 0.5);
  padding: 4px 8px;
  border: 1px solid var(--outline-variant);
  border-radius: 2px; z-index: 9998;
}
.dark .k-readout { background: rgba(26, 26, 26, 0.5); }
.kursor-crosshair .k-readout { display: flex; }

@media (pointer: coarse) { .kursor { display: none !important; } }

/* Hide default cursor when custom cursor is active */
@media (hover: hover) and (pointer: fine) {
  html.is-booted body, html.is-booted a, html.is-booted button,
  html.is-booted input, html.is-booted textarea,
  html.is-booted [data-magnetic],
  html.is-booted .work-item, html.is-booted .skill-card,
  html.is-booted .chip {
    cursor: none;
  }
}

/* ============================================================
   BOOT CONSOLE
   ============================================================ */
html.is-intro body > :not(.boot):not(.grain) {
  opacity: 0; pointer-events: none;
}
.boot {
  position: fixed; inset: 0; z-index: 10000;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(145, 76, 30, 0.06), transparent 55%),
    #0a0a0a;
  color: #b0b0a8;
  font-family: var(--font-code);
  animation: bootIn .35s var(--ease);
}
.boot.is-out { animation: bootOut .7s cubic-bezier(.5, 0, .2, 1) forwards; }
@keyframes bootIn  { from { opacity: 0; } }
@keyframes bootOut { to { opacity: 0; clip-path: inset(50% 0 50% 0); } }
.boot-frame {
  width: min(620px, calc(100vw - 2.5rem));
  border: 1px solid rgba(255, 166, 113, 0.12);
  background: #0e0e0e;
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.9);
  position: relative;
}
.boot-frame::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    180deg, rgba(255, 166, 113, 0.015) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
.boot-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid rgba(255, 166, 113, 0.08);
  background: linear-gradient(180deg, rgba(255, 166, 113, 0.03), transparent);
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
}
.boot-brand { display: flex; align-items: center; gap: 0.6rem; color: #e6e2dc; }
.boot-glyph { color: var(--secondary-container); font-size: 12px; }
.boot-title { letter-spacing: 0.28em; }
.boot-meta { display: flex; align-items: center; gap: 0.6rem; color: #7b7b75; }
.boot-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #27c93f;
  box-shadow: 0 0 10px #27c93f;
  animation: bootPulse 1.4s ease-in-out infinite;
}
@keyframes bootPulse { 50% { opacity: 0.4; } }
.boot-sep { opacity: 0.4; }
.boot-time { font-variant-numeric: tabular-nums; color: #7b7b75; }
.boot-log {
  margin: 0; padding: 1rem 1.2rem;
  height: clamp(240px, 44vh, 360px);
  overflow: auto;
  font-size: 12px; line-height: 1.65;
  color: #b0b0a8;
  white-space: pre-wrap; word-break: break-word;
  scroll-behavior: smooth;
}
.boot-log::-webkit-scrollbar { width: 4px; }
.boot-log::-webkit-scrollbar-thumb {
  background: rgba(255, 166, 113, 0.15); border-radius: 2px;
}
.boot-row {
  display: grid; grid-template-columns: 18px 1fr auto; gap: 0.6rem;
  align-items: baseline;
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.boot-row.is-in { opacity: 1; transform: none; }
.boot-mark { color: #6d7a6d; font-weight: 600; }
.boot-msg::after {
  content: "\2588"; margin-left: 2px;
  animation: blink 0.8s steps(1) infinite;
  color: var(--secondary-container);
}
.boot-row:not(:last-child) .boot-msg::after { content: ""; }
.boot-tick { color: #4b4b45; font-size: 10px; }
.boot-row.k-boot  .boot-mark { color: var(--secondary-container); }
.boot-row.k-info  .boot-mark { color: #7b7b75; }
.boot-row.k-mod   .boot-mark { color: #ffd27f; }
.boot-row.k-ok    .boot-mark { color: #27c93f; }
.boot-row.k-ready .boot-mark { color: var(--secondary-container); }
.boot-row.k-ok    .boot-msg  { color: #d0f5dc; }
.boot-row.k-ready .boot-msg  { color: #ffd8b8; font-weight: 500; }
.boot-bar {
  height: 2px; background: rgba(255, 166, 113, 0.08);
  position: relative; overflow: hidden;
}
.boot-bar span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--secondary), var(--secondary-container));
  box-shadow: 0 0 10px rgba(255, 166, 113, 0.4);
  transition: width .25s linear;
}
.boot-foot {
  display: flex; justify-content: space-between;
  padding: 0.65rem 1.1rem;
  border-top: 1px solid rgba(255, 166, 113, 0.08);
  font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase;
  color: #6d6d65;
}
.boot-hint::before { content: "\25E6 "; color: var(--secondary-container); }

/* ============================================================
   HELP OVERLAY
   ============================================================ */
.help { position: fixed; inset: 0; z-index: 290; display: none; }
.help.is-open { display: block; }
.help-backdrop {
  position: absolute; inset: 0;
  background: rgba(28, 28, 25, 0.45);
  backdrop-filter: blur(6px);
  animation: fadeIn .2s ease;
}
.dark .help-backdrop { background: rgba(0, 0, 0, 0.5); }
.help-panel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(540px, calc(100vw - 2rem));
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.2);
  animation: popIn .25s var(--ease);
}
.help-panel header { margin-bottom: 1.5rem; }
.help-panel h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1.75rem; margin: 0.5rem 0 0;
  letter-spacing: -0.015em;
}
.help-panel ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 0.75rem;
}
.help-panel li {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center; gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--outline-variant);
  font-size: 0.92rem; color: var(--on-surface-variant);
}
.help-panel li:last-child { border-bottom: none; }
.help-panel footer {
  margin-top: 1.5rem;
  font-family: var(--font-display); font-style: italic;
  color: var(--outline); font-size: 0.85rem; text-align: center;
}

/* ============================================================
   HUD TELEMETRY
   ============================================================ */
.hud {
  position: fixed;
  right: clamp(1rem, 2vw, 1.5rem);
  bottom: clamp(1rem, 2vw, 1.5rem);
  z-index: 80; min-width: 200px;
  padding: 0.7rem 0.85rem 0.9rem;
  font-family: var(--font-code);
  font-size: 10px; letter-spacing: 0.06em;
  color: var(--outline);
  background: rgba(252, 249, 244, 0.6);
  border: 1px solid var(--outline-variant);
  border-radius: 3px;
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 10px 40px -20px rgba(0, 0, 0, 0.1);
  opacity: 0.75;
  transition: opacity .3s, transform .3s;
}
.dark .hud {
  background: rgba(26, 26, 26, 0.6);
  box-shadow: 0 10px 40px -20px rgba(0, 0, 0, 0.5);
}
.hud.is-hidden { opacity: 0; transform: translateY(120%); pointer-events: none; }
.hud:hover { opacity: 1; }
.hud-row { display: flex; align-items: baseline; gap: 0.7rem; padding: 2px 0; }
.hud-top {
  border-bottom: 1px dashed var(--outline-variant);
  padding-bottom: 5px; margin-bottom: 4px;
}
.hud-top .hud-label {
  color: var(--on-surface); letter-spacing: 0.22em;
  text-transform: uppercase; font-size: 9px;
}
.hud-led {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--secondary);
  box-shadow: 0 0 8px var(--secondary);
  animation: hudLed 1.6s ease-in-out infinite;
}
@keyframes hudLed { 50% { opacity: 0.35; } }
.hud-sep { color: var(--outline-variant); }
.hud-session { color: var(--secondary); font-variant-numeric: tabular-nums; }
.hud-k {
  color: var(--outline); min-width: 54px;
  text-transform: uppercase; font-size: 9px;
  letter-spacing: 0.22em;
}
.hud-v { color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.hud-bar {
  margin-top: 6px; height: 2px;
  background: rgba(196, 199, 199, 0.12);
  padding: 0; overflow: hidden; border-radius: 1px;
}
.hud-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--secondary), var(--secondary-container));
  transition: width .1s linear;
}
@media (max-width: 640px) { .hud { display: none; } }

/* ============================================================
   NARRATOR
   ============================================================ */
section { position: relative; }
.narrator {
  position: absolute; left: 0;
  top: clamp(6.5rem, 13vw, 10rem);
  transform: translateY(-100%) translateY(-1.2rem);
  display: flex; align-items: center; gap: 1rem;
  padding: 0.5rem 0;
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--outline);
  opacity: 0;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  pointer-events: none;
}
.narrator.is-reading { opacity: 1; transform: translateY(-100%); }
.narrator-idx {
  font-family: var(--font-display);
  font-style: italic; font-weight: 300;
  letter-spacing: 0; text-transform: none;
  color: var(--secondary); font-size: 0.82rem;
}
.narrator-idx::after {
  content: ""; display: inline-block;
  width: 24px; height: 1px;
  background: currentColor; vertical-align: middle;
  margin: 0 0.5rem; opacity: 0.5;
}
.narrator-txt { color: var(--on-surface-variant); }
@media (max-width: 820px) { .narrator { display: none; } }

/* ============================================================
   MICRO-INTERACTIONS
   ============================================================ */
button, .nav-cta, .chip, .icon-btn, .btn-primary, .btn-outline {
  position: relative; overflow: hidden; isolation: isolate;
}
.ripple {
  position: absolute; width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor; opacity: 0.18;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple 0.7s cubic-bezier(0.2, 0.7, 0.1, 1) forwards;
  pointer-events: none; z-index: 0;
}
@keyframes ripple {
  to { transform: translate(-50%, -50%) scale(40); opacity: 0; }
}

.sec-head { position: relative; }
.sec-head.pulse::before {
  content: ""; position: absolute; left: 0; right: 0; top: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--secondary), transparent 80%);
  animation: headPulse 1.4s var(--ease) forwards;
  transform-origin: 0 50%; transform: scaleX(0);
}
@keyframes headPulse {
  50%  { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

.hero .display em {
  transition: color .2s linear;
}

/* ============================================================
   THEME SWAP
   ============================================================ */
html.theme-swapping, html.theme-swapping * {
  transition: background-color .35s var(--ease),
              color .35s var(--ease),
              border-color .35s var(--ease),
              fill .35s var(--ease),
              stroke .35s var(--ease) !important;
}

/* ============================================================
   FOCUS
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 3px;
  border-radius: 2px;
}
a:focus-visible, button:focus-visible { outline-offset: 4px; }

/* ============================================================
   BLUEPRINT MODE (konami)
   ============================================================ */
html.blueprint {
  --surface: #0a2540;
  --surface-lowest: #07192e;
  --surface-low: #0f2f52;
  --surface-mid: #143966;
  --surface-high: #1a4478;
  --surface-highest: #225294;
  --on-surface: #d7e6ff;
  --on-surface-variant: #9cb7dd;
  --outline: #6d8ec0;
  --outline-variant: #2f4e7a;
  --primary: #ffffff;
  --on-primary: #0a2540;
}
html.blueprint body {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--surface);
}
html.blueprint em { color: #ffcc66; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .hero-grid { gap: 2rem; }
  .display { font-size: clamp(2rem, 9vw, 3rem); }
  .sec-head { grid-template-columns: 1fr; gap: 0.5rem; }
  .sec-meta { justify-self: start; }
  .work-item { grid-template-columns: auto 1fr; }
  .w-arrow { display: none; }
  .foot-row { flex-direction: column; text-align: center; }
}
@media (max-width: 560px) {
  .icon-btn#cmdk-open { display: none; }
  .nav-tools { gap: 0.5rem; }
}

/* ============================================================
   REDUCED MOTION & PRINT
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .marquee-track { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
}

html.no-motion *, html.no-motion *::before, html.no-motion *::after {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

/* ============================================================
   CHATBOT WIDGET
   ============================================================ */
.chatbot {
  position: fixed;
  bottom: 1.5rem;
  right: clamp(14rem, 18vw, 18rem);
  z-index: 9000;
  font-family: var(--font-body);
}
@media (max-width: 640px) {
  .chatbot { right: 1rem; }
}

/* Toggle button */
.chatbot-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  background: var(--surface-lowest);
  color: var(--on-surface);
  font: 500 0.85rem/1 var(--font-body);
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s;
}
.chatbot-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(0,0,0,.12);
}
.chatbot-toggle .material-symbols-outlined { font-size: 1.15rem; }
.chatbot-icon-close { display: none; }
.chatbot.is-open .chatbot-icon-chat { display: none; }
.chatbot.is-open .chatbot-icon-close { display: inline; }
.chatbot.is-open .chatbot-toggle-label { display: none; }

/* Chat window */
.chatbot-window {
  position: absolute;
  bottom: calc(100% + 0.75rem);
  right: 0;
  width: min(380px, calc(100vw - 2rem));
  max-height: min(520px, calc(100dvh - 8rem));
  border-radius: var(--radius-md);
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  box-shadow: 0 12px 48px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.96);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.chatbot.is-open .chatbot-window {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--outline-variant);
  background: var(--surface-low);
}
.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.chatbot-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--on-secondary);
  display: grid;
  place-items: center;
  font: 700 0.8rem/1 var(--font-body);
  flex-shrink: 0;
}
.chatbot-header strong {
  font-size: 0.85rem;
  color: var(--on-surface);
}
.chatbot-status {
  font-size: 0.7rem;
  color: var(--on-surface-variant);
}
.chatbot-minimize {
  background: none;
  border: none;
  color: var(--on-surface-variant);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.chatbot-minimize:hover { background: var(--surface-mid); }

/* Messages */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 180px;
  max-height: 340px;
}
.chatbot-msg p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
}
.chatbot-msg.bot p {
  background: var(--surface-low);
  color: var(--on-surface);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm) var(--radius-md) var(--radius-md) var(--radius-md);
  max-width: 88%;
}
.chatbot-msg.user p {
  background: var(--secondary);
  color: var(--on-secondary);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md) var(--radius-sm) var(--radius-md) var(--radius-md);
  margin-left: auto;
  max-width: 88%;
}

/* Typing indicator */
.chatbot-msg.typing {
  display: flex;
  gap: 0.3rem;
  padding: 0.7rem 0.85rem;
  background: var(--surface-low);
  border-radius: var(--radius-sm) var(--radius-md) var(--radius-md) var(--radius-md);
  width: fit-content;
}
.chatbot-msg.typing .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--on-surface-variant);
  animation: chatbot-bounce .6s infinite alternate;
}
.chatbot-msg.typing .dot:nth-child(2) { animation-delay: .15s; }
.chatbot-msg.typing .dot:nth-child(3) { animation-delay: .3s; }
@keyframes chatbot-bounce {
  to { opacity: .3; transform: translateY(-4px); }
}

/* Input form */
.chatbot-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--outline-variant);
  background: var(--surface-low);
}
.chatbot-form input {
  flex: 1;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.85rem;
  font: 0.82rem var(--font-body);
  color: var(--on-surface);
  background: var(--surface-lowest);
  outline: none;
  transition: border-color .2s;
}
.chatbot-form input:focus { border-color: var(--secondary); }
.chatbot-form button {
  background: var(--secondary);
  color: var(--on-secondary);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.chatbot-form button:hover { background: var(--on-secondary-container); }
.chatbot-form button .material-symbols-outlined { font-size: 1rem; }

/* Mobile */
@media (max-width: 600px) {
  .chatbot { bottom: 1rem; right: 1rem; }
  .chatbot-window { width: calc(100vw - 2rem); }
  .chatbot-toggle-label { display: none; }
}

/* ============================================================
   CIRCUIT BENCH — interactive SVG schematic
   ============================================================ */
.lab-lede {
  max-width: 62ch;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.65;
  color: var(--on-surface-variant);
  margin: 0 0 2.5rem;
}
.bench-svg { width: 100%; height: auto; display: block; }

.bench-svg .wire,
.bench-svg .body {
  stroke: var(--on-surface);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .25s, filter .25s;
}
.bench-svg .node { fill: var(--on-surface); transition: fill .25s; }
.bench-svg .hit { fill: transparent; stroke: none; }
.bench-svg .lbl {
  font: 500 11.5px var(--font-code);
  fill: var(--on-surface-variant);
  text-anchor: middle;
  pointer-events: none;
}
.bench-svg .lbl-left  { text-anchor: start; }
.bench-svg .lbl-right { text-anchor: end; }
.bench-svg .lbl-val   { fill: var(--secondary); font-weight: 700; }

.comp { cursor: pointer; }
.comp.is-hot .body { stroke: var(--secondary); filter: drop-shadow(0 0 5px rgba(255, 143, 62, 0.55)); }
.comp.is-hot .node { fill: var(--secondary); }
.comp.is-hot .lbl  { fill: var(--secondary); }

/* switch lever */
.sw-lever {
  transform-origin: 140px 110px;
  transform: rotate(-26deg);
  transition: transform .28s var(--ease);
}
.bench.is-on .sw-lever { transform: rotate(0deg); }

/* animated current */
.flow {
  stroke: var(--secondary);
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 3 15;
  opacity: 0;
  transition: opacity .45s;
  pointer-events: none;
}
.bench.is-on .flow { opacity: 1; animation: bench-dash var(--dash-dur, 1.4s) linear infinite; }
.bench.is-on .flow-cap { animation-duration: calc(var(--dash-dur, 1.4s) * 1.6); opacity: 0.7; }
@keyframes bench-dash { to { stroke-dashoffset: -180; } }
@media (prefers-reduced-motion: reduce) {
  .bench.is-on .flow { animation: none; stroke-dasharray: none; opacity: 0.5; }
}

/* LED */
.led-glow { opacity: 0; transition: opacity .5s; pointer-events: none; }
.led-rays { stroke: var(--on-surface); stroke-width: 1.6; fill: var(--on-surface); opacity: 0.25; transition: opacity .4s, stroke .4s, fill .4s; }
.bench.is-on .led-rays { stroke: #ff8f3e; fill: #ff8f3e; opacity: 1; }

/* probe tooltip */
.bench-tip {
  position: absolute;
  left: 0; top: 0;
  transform: translate(-50%, -115%);
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: 0.6rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  padding: 0.55rem 0.8rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
  z-index: 5;
  max-width: 240px;
  white-space: normal;
}
.bench-tip.is-show { opacity: 1; }
.bench-tip b {
  display: block;
  font: 700 11px var(--font-code);
  letter-spacing: 0.05em;
  color: var(--secondary);
  margin-bottom: 2px;
}
.bench-tip span { font-size: 12px; line-height: 1.45; color: var(--on-surface-variant); }

/* side panel */
.bench-scope {
  background: #101312;
  border: 1px solid #283230;
  border-radius: var(--radius-md);
  padding: 0.9rem;
}
.scope-head {
  display: flex; align-items: center; gap: 0.5rem;
  font: 600 10.5px var(--font-code);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #6cf0c2;
  margin-bottom: 0.7rem;
}
.scope-led {
  width: 7px; height: 7px; border-radius: 50%;
  background: #41544c;
  transition: background .3s, box-shadow .3s;
}
.bench.is-on .scope-led { background: #6cf0c2; box-shadow: 0 0 8px #6cf0c2; }
.scope-mode { margin-left: auto; color: #4d6b5f; }
.scope-svg { width: 100%; height: auto; display: block; border-radius: 0.4rem; }
.scope-bg { fill: #0b0e0d; }
.scope-trace {
  fill: none;
  stroke: #6cf0c2;
  stroke-width: 2.5;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(108, 240, 194, 0.6));
}
.scope-read {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem; margin-top: 0.8rem;
}
.scope-read div { text-align: center; }
.scope-read b {
  display: block;
  font: 700 0.95rem var(--font-code);
  color: #d7efe5;
  font-variant-numeric: tabular-nums;
}
.scope-read span { font-size: 10px; color: #5e7d70; letter-spacing: 0.04em; }

.bench-controls {
  background: var(--surface-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.bench-power {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  border: 1px solid var(--outline-variant);
  background: var(--surface-lowest);
  color: var(--on-surface);
  border-radius: var(--radius-full);
  padding: 0.7rem 1.4rem;
  font: 700 12px var(--font-body);
  letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: background .25s, color .25s, border-color .25s, transform .15s;
}
.bench-power:hover { transform: translateY(-1px); }
.pw-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--outline);
  transition: background .3s, box-shadow .3s;
}
.bench.is-on .bench-power { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.bench.is-on .pw-dot { background: #ff8f3e; box-shadow: 0 0 9px #ff8f3e; }

.bench-pot-wrap { display: flex; flex-direction: column; gap: 0.45rem; }
.pot-head { font: 600 11px var(--font-code); letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-surface-variant); }
.pot-head b { color: var(--secondary); }
#bench-pot {
  width: 100%;
  accent-color: var(--secondary);
  cursor: ew-resize;
}
.pot-scale { display: flex; justify-content: space-between; }
.pot-scale i { font: 500 10px var(--font-code); font-style: normal; color: var(--outline); }
.bench-note { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--on-surface-variant); }

/* dark-theme tuning for the labs */
.dark .bench-board { background: var(--surface-low); }
.dark .bench-tip { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5); }

/* ============================================================
   FIELD TEST — hand-drawn photo through the pipeline
   ============================================================ */
.ftest {
  margin-top: 0.5rem;
}
.ftest-head { max-width: 64ch; margin-bottom: 1.75rem; }
.ftest-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0.6rem 0 0.75rem;
}
.ftest-head p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--on-surface-variant);
}

/* the frame — every layer pinned to one 4:3 box */
.ftest-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--outline-variant);
  background: #14110c;
  isolation: isolate;
  transition: background 1s var(--ease);
}
.ftest-frame img,
.ftest-frame .ft-overlay,
.ftest-frame .ft-bench {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.ftest-frame img { object-fit: cover; display: block; }

.ft-raw { z-index: 1; transition: filter .8s var(--ease), opacity .8s var(--ease); }
.ft-thresh { z-index: 2; opacity: 0; transition: opacity .9s var(--ease); }
.ft-overlay { z-index: 4; pointer-events: none; transition: opacity .5s var(--ease); }

/* the live bench layer — same letterbox geometry as the morph target */
.ft-bench {
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s var(--ease);
}
.ft-bench .bench-svg { width: 100%; height: 100%; display: block; }
[data-state="live"] .ft-bench { opacity: 1; pointer-events: auto; }
[data-state="live"] .ft-overlay { opacity: 0; }
[data-state="live"] .ft-scan { display: none; }

/* frame becomes the board */
[data-state="morph"].ftest-frame,
[data-state="live"].ftest-frame {
  background: var(--surface-lowest);
}
.dark [data-state="morph"].ftest-frame,
.dark [data-state="live"].ftest-frame {
  background: var(--surface-low);
}
[data-state="live"].ftest-frame::after {
  content: "fig. 03 — series RLC · driven at f₀ · read from my sketch";
  position: absolute; left: 1.25rem; bottom: 0.8rem;
  font: 600 10px/1 var(--font-code);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--outline);
  pointer-events: none;
}

/* scanline */
.ft-scan {
  position: absolute; inset: 0; z-index: 3;
  pointer-events: none; opacity: 0;
}
.ft-scan::before {
  content: "";
  position: absolute; left: 0; right: 0; top: -12%;
  height: 12%;
  background: linear-gradient(to bottom, transparent, rgba(108, 240, 194, 0.18) 65%, rgba(108, 240, 194, 0.75));
  box-shadow: 0 2px 18px rgba(108, 240, 194, 0.5);
}
[data-state="scanning"] .ft-scan { opacity: 1; }
[data-state="scanning"] .ft-scan::before { animation: ft-sweep 1.4s linear both; }
@keyframes ft-sweep { to { top: 100%; } }

/* state plumbing */
[data-state="thresh"] .ft-thresh,
[data-state="detect"] .ft-thresh { opacity: 1; }
[data-state="vector"] .ft-thresh { opacity: 0.16; }
[data-state="morph"] .ft-thresh,
[data-state="live"] .ft-thresh { opacity: 0; }
[data-state="vector"] .ft-raw { opacity: 0.35; filter: saturate(0.3) brightness(0.55); }
[data-state="morph"] .ft-raw,
[data-state="live"] .ft-raw { opacity: 0; filter: saturate(0.3) brightness(0.55); }

/* detect boxes */
.ftb { opacity: 0; }
[data-state="detect"] .ftb,
[data-state="vector"] .ftb {
  opacity: 1;
  transition: opacity .3s;
  transition-delay: calc(var(--i) * 140ms);
}
[data-state="vector"] .ftb { opacity: 0.13; }
[data-state="morph"] .ftb,
[data-state="live"] .ftb { opacity: 0; transition: opacity .4s; }
.ftb-box {
  fill: rgba(255, 143, 62, 0.07);
  stroke: #ff8f3e;
  stroke-width: 7;
  stroke-dasharray: 34 20;
}
.ftb-tag { fill: #ff8f3e; }
.ftb text {
  font: 600 86px "Space Grotesk", monospace;
  fill: #16130e;
  letter-spacing: 0.02em;
}
.ftb-txt .ftb-box {
  stroke: #6cf0c2;
  fill: rgba(108, 240, 194, 0.06);
  stroke-dasharray: 16 16;
  stroke-width: 5;
}
.ftb-txt text { fill: #6cf0c2; font-size: 74px; font-style: italic; }

/* wire traces */
.ftw {
  stroke: #6cf0c2;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  filter: drop-shadow(0 0 10px rgba(108, 240, 194, 0.6));
}
[data-state="detect"] .ftw,
[data-state="vector"] .ftw {
  opacity: 1;
  animation: ft-draw .5s var(--ease) both;
  animation-delay: calc(1.1s + var(--i) * 110ms);
}
[data-state="vector"] .ftw { opacity: 0.12; animation-delay: 0s; }
[data-state="morph"] .ftw,
[data-state="live"] .ftw { opacity: 0; transition: opacity .4s; }
@keyframes ft-draw { to { stroke-dashoffset: 0; } }

/* clean vector redraw */
.ftc {
  fill: none;
  stroke: #ffd9a8;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  filter: drop-shadow(0 0 14px rgba(255, 180, 94, 0.35));
}
[data-state="vector"] .ftc {
  opacity: 1;
  animation: ft-draw .6s var(--ease) both;
  animation-delay: calc(var(--i) * 55ms);
}
/* morph — every stroke glides to its fig. 03 position; colors settle to ink */
[data-state="morph"] .ftc,
[data-state="live"] .ftc {
  opacity: 1;
  stroke-dasharray: none;
  stroke-dashoffset: 0;
  stroke: var(--on-surface);
  filter: none;
  transition:
    d 1.45s cubic-bezier(0.65, 0, 0.18, 1),
    stroke 1s var(--ease),
    filter 1s var(--ease);
}
.ftc-lbl {
  font: italic 500 96px "Newsreader", Georgia, serif;
  fill: #ffd9a8;
  text-anchor: middle;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
[data-state="vector"] .ftc-lbl {
  animation: ft-fade .6s var(--ease) both;
  animation-delay: calc(var(--i) * 55ms + .4s);
}
[data-state="morph"] .ftc-lbl,
[data-state="live"] .ftc-lbl {
  opacity: 0.95;
  fill: var(--on-surface-variant);
  font-style: normal;
  font-family: "Space Grotesk", monospace;
  font-size: 66px;
  transition:
    transform 1.45s cubic-bezier(0.65, 0, 0.18, 1),
    fill 1s var(--ease),
    font-size 1.45s cubic-bezier(0.65, 0, 0.18, 1);
}
@keyframes ft-fade { to { opacity: 0.95; } }
@media (prefers-reduced-motion: reduce) {
  .ftw, .ftc { animation-duration: .01s !important; animation-delay: 0s !important; }
  [data-state="morph"] .ftc, [data-state="live"] .ftc,
  [data-state="morph"] .ftc-lbl, [data-state="live"] .ftc-lbl { transition: none !important; }
  [data-state="detect"] .ftb { transition-delay: 0s; }
}

/* the button */
.ft-go {
  position: absolute; z-index: 6;
  left: 50%; top: 50%;
  translate: -50% -50%;
  display: inline-flex; align-items: center; gap: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(16, 14, 10, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  color: #fff;
  font: 700 13px var(--font-body);
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 1rem 1.9rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform .2s var(--ease), background .25s, opacity .35s, scale .35s;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.ft-go:hover { transform: scale(1.05); background: rgba(16, 14, 10, 0.75); }
.ft-go .material-symbols-outlined { font-size: 20px; }
.ft-go.is-hidden { opacity: 0; scale: 0.85; pointer-events: none; }
.ft-go.is-replay {
  left: auto; top: auto; right: 1rem; bottom: 1rem;
  translate: 0 0;
  padding: 0.6rem 1.1rem;
  font-size: 11px;
}

/* status line */
.ft-status {
  position: absolute; z-index: 7;
  left: 1rem; bottom: 1rem;
  font: 600 11px var(--font-code);
  letter-spacing: 0.08em;
  color: #6cf0c2;
  background: rgba(11, 14, 13, 0.82);
  border: 1px solid rgba(108, 240, 194, 0.25);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.8rem;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.ft-status:not(:empty) { opacity: 1; }
[data-state="idle"] .ft-status { opacity: 0; }
[data-state="live"] .ft-status { opacity: 0; transition-delay: 2.6s; }

/* stage list */
.ft-stages {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem;
  list-style: none;
  margin: 1.1rem 0 0; padding: 0;
}
.ft-stages li {
  font: 600 11px var(--font-code);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--outline);
  transition: color .3s;
  position: relative;
}
.ft-stages li.is-on { color: var(--secondary); }
.ft-stages li.is-done { color: var(--on-surface-variant); }
.ft-stages li.is-done::after { content: " ✓"; color: var(--secondary); }
@media (max-width: 640px) {
  .ftb text { font-size: 120px; }
  .ft-status { font-size: 10px; }
}

/* ============================================================
   BENCH DEPLOY — frame shrinks, sim panel docks in from the right
   ============================================================ */
.lab-flow {
  display: grid;
  grid-template-columns: 1fr 0fr;
  gap: 0rem;
  align-items: start;
  transition: grid-template-columns 1.1s cubic-bezier(0.65, 0, 0.18, 1), gap 1.1s cubic-bezier(0.65, 0, 0.18, 1);
}
.bench.is-built .lab-flow {
  grid-template-columns: 1.45fr 1fr;
  gap: 1.5rem;
}
.lab-flow > .ftest { min-width: 0; }

.bench-stage {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  opacity: 0;
  transform: translateX(46px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .6s var(--ease), transform .9s cubic-bezier(0.65, 0, 0.18, 1), visibility 0s .9s;
}
.bench.is-built .bench-stage {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
  transition: opacity .7s .35s var(--ease), transform 1s .35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
}
.bench-lede {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
}
.bench.is-built .bench-lede     { animation: bench-rise .6s .45s var(--ease) both; }
.bench.is-built .bench-scope    { animation: bench-rise .7s .6s var(--ease) both; }
.bench.is-built .bench-controls { animation: bench-rise .7s .75s var(--ease) both; }
@keyframes bench-rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 960px) {
  .lab-flow,
  .bench.is-built .lab-flow { display: block; }
  .bench-stage { display: none; transform: translateY(30px); }
  .bench.is-built .bench-stage { display: flex; margin-top: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lab-flow, .bench-stage { transition: none !important; }
  .bench.is-built .bench-lede,
  .bench.is-built .bench-scope,
  .bench.is-built .bench-controls {
    animation-duration: .01s !important;
    animation-delay: 0s !important;
  }
}

@media print {
  .nav, .section-rail, .scroll-progress, .cursor-dot, .cursor-ring,
  .kursor, .hud, .boot,
  .hero-canvas, .grain, .cmdk, .toast, .marquee, .intro, .narrator,
  .chatbot,
  .bench-side, .bench-tip, .ft-go, .ft-scan, .ft-stages {
    display: none !important;
  }
  html, body { background: #fff !important; color: #111 !important; }
  a { color: #111 !important; }
  section { padding: 1.5rem 0 !important; page-break-inside: avoid; }
}
