/* Homepage-only "Build the System" presentation. Core content remains usable
   without this file or its JavaScript companion. */

:root {
  --layer-seasonal: 0;
  --layer-canvas: 1;
  --layer-decoration: 2;
  --layer-content: 3;
  --layer-controls: 20;
  --layer-navigation: 100;
  --home-max-width: 1280px;
  --scene-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --trace-width: 1.5px;
  --depth-shadow: 0 34px 100px rgba(0, 0, 0, 0.28);
}

body[data-page="home"] {
  --core-metal: color-mix(in srgb, var(--surface-strong) 84%, var(--text) 16%);
  --core-line: color-mix(in srgb, var(--accent) 72%, transparent);
  --core-dim: color-mix(in srgb, var(--text-faint) 45%, transparent);
  --blueprint-line: color-mix(in srgb, var(--accent) 10%, transparent);
  background-size: 64px 64px, 64px 64px, auto, auto;
}

body[data-page="home"] > main {
  position: relative;
}

body[data-page="home"] .container {
  width: min(calc(100% - 2.5rem), var(--home-max-width));
}

body[data-page="home"] .nav-shell {
  width: min(calc(100% - 2.5rem), var(--home-max-width));
}

body[data-page="home"] .section {
  min-height: 0;
  padding-block: clamp(5rem, 10vw, 9rem);
}

body[data-page="home"] .section[id],
body[data-page="home"] .project-story {
  scroll-margin-top: 0;
}

body[data-page="home"] #about {
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

body[data-page="home"] .section-heading {
  max-width: 760px;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.project-stage > .section-heading,
.capabilities-section > .section-heading,
.experience-section > .section-heading,
.education-blueprint > .section-heading {
  margin-inline: auto;
  text-align: center;
}

.project-stage > .section-heading > .eyebrow,
.capabilities-section > .section-heading > .eyebrow,
.experience-section > .section-heading > .eyebrow,
.education-blueprint > .section-heading > .eyebrow {
  justify-self: center;
}

.project-stage > .section-heading p,
.capabilities-section > .section-heading p,
.experience-section > .section-heading p {
  text-align: left;
}

.hero-system > *,
.project-stage > *,
.capability-system,
.experience-system,
.visual-card-grid,
.about-grid,
.about-system {
  min-width: 0;
}

@media (min-width: 1121px) {
  body[data-page="home"] .primary-nav {
    gap: 0.05rem;
  }

  body[data-page="home"] .nav-link {
    padding-inline: 0.5rem;
    font-size: 0.86rem;
  }

  body[data-page="home"] .theme-switcher {
    margin-left: 0.25rem;
  }

}

/* Opening story ----------------------------------------------------------- */

.home-story {
  --scene-progress: 0;
  position: relative;
}

.home-intro {
  position: relative;
  display: grid;
  min-height: calc(100svh - var(--header-height));
  padding-block: clamp(0.8rem, 2vh, 1.5rem) clamp(1.8rem, 4vh, 3rem);
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(0.9rem, 2vh, 1.5rem);
}

.quote-card {
  position: relative;
  z-index: var(--layer-controls);
  padding: 0.72rem 1rem;
  border-color: color-mix(in srgb, var(--border) 72%, transparent);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(16px);
}

.hero-system {
  min-height: 0;
  padding: 0;
  grid-template-columns: minmax(0, 1.04fr) minmax(390px, 0.96fr);
  gap: clamp(2rem, 5vw, 5.5rem);
}

.hero-system .hero-copy {
  align-self: center;
}

.hero-name {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text);
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.015em;
}

.hero-system h1 {
  max-width: 13ch;
  margin-block: 0.8rem 1rem;
  font-size: clamp(3rem, min(5.4vw, 8vh), 5.4rem);
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero-system .hero-summary {
  max-width: 62ch;
}

.scroll-cue {
  position: absolute;
  z-index: var(--layer-controls);
  right: max(1.25rem, calc((100vw - var(--home-max-width)) / 2));
  bottom: 1rem;
  display: flex;
  align-items: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  gap: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scroll-cue i {
  display: block;
  width: 34px;
  height: 1px;
  overflow: hidden;
  background: var(--border-strong);
}

.scroll-cue i::after {
  display: block;
  width: 48%;
  height: 100%;
  background: var(--accent);
  content: "";
  animation: scroll-cue 2.4s ease-in-out infinite;
}

@keyframes scroll-cue {
  0%, 100% { transform: translateX(-110%); }
  50% { transform: translateX(220%); }
}

/* Engineering Core -------------------------------------------------------- */

.engineering-core {
  position: relative;
  width: min(100%, 620px);
  margin: 0;
  align-self: center;
  justify-self: end;
}

.engineering-core figcaption {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
}

.core-stage {
  position: relative;
  width: min(100%, 580px);
  aspect-ratio: 1;
  margin-inline: auto;
  perspective: 1050px;
  transform-style: preserve-3d;
}

.core-stage::before,
.core-stage::after {
  position: absolute;
  border: 1px solid var(--core-dim);
  border-radius: 50%;
  content: "";
  inset: 8%;
  opacity: 0.62;
}

.core-stage::after {
  inset: 19%;
  border-style: dashed;
  transform: rotate(23deg);
}

.core-traces {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  filter: drop-shadow(0 0 12px var(--glow));
}

.core-traces path,
.core-traces circle {
  fill: none;
  stroke: var(--core-line);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.core-traces circle {
  fill: var(--accent);
}

.core-layer,
.core-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  border: 1px solid var(--border-strong);
  border-radius: 18%;
  background:
    linear-gradient(var(--core-dim) 1px, transparent 1px),
    linear-gradient(90deg, var(--core-dim) 1px, transparent 1px),
    linear-gradient(145deg, color-mix(in srgb, var(--surface-strong) 92%, var(--accent) 8%), var(--bg-elevated));
  background-size: 22px 22px, 22px 22px, auto;
  box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--surface) 80%, transparent), var(--depth-shadow);
  place-items: center;
  transform-style: preserve-3d;
}

.core-layer {
  width: 48%;
  aspect-ratio: 1;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: clamp(0.55rem, 1vw, 0.72rem);
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.core-layer span {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elevated) 86%, transparent);
}

.core-layer-software {
  transform: translate(-50%, -50%) translateZ(72px) rotateZ(45deg);
}

.core-layer-connected {
  width: 43%;
  transform: translate(-50%, -50%) translateZ(36px) rotateZ(45deg);
}

.core-layer-hardware {
  width: 38%;
  transform: translate(-50%, -50%) translateZ(-34px) rotateZ(45deg);
}

.core-layer-sensors {
  width: 52%;
  transform: translate(-50%, -50%) translateZ(-70px) rotateZ(45deg);
}

.core-layer > span {
  transform: rotateZ(-45deg);
}

.core-chip {
  z-index: 6;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 20%;
  background:
    radial-gradient(circle at 36% 30%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 50%),
    var(--bg-elevated);
  color: var(--accent);
  box-shadow: inset 0 0 0 6px var(--surface), 0 20px 54px rgba(0, 0, 0, 0.35), 0 0 44px var(--glow);
  text-align: center;
  transform: translate(-50%, -50%) translateZ(118px) rotateZ(45deg);
}

.core-chip span,
.core-chip small {
  display: block;
  transform: rotateZ(-45deg);
}

.core-chip span {
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 3vw, 2.3rem);
  font-weight: 850;
  line-height: 1;
}

.core-chip small {
  position: absolute;
  width: 180%;
  top: 68%;
  left: -40%;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: clamp(0.42rem, 0.72vw, 0.58rem);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.core-port {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px var(--glow), 0 0 20px var(--accent);
}

.core-port-a { top: 11%; left: 49%; }
.core-port-b { top: 49%; right: 11%; }
.core-port-c { bottom: 11%; left: 49%; }
.core-port-d { top: 49%; left: 11%; }

.core-callouts {
  display: grid;
  padding: 0;
  margin: -0.65rem 0 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
  gap: 0.55rem;
}

.core-callouts li {
  display: grid;
  min-width: 0;
  min-height: 4.1rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  color: var(--text-faint);
  font-size: 0.64rem;
  line-height: 1.35;
  gap: 0.25rem;
  place-content: center;
  text-align: center;
  transition: border-color 320ms ease, background 320ms ease, color 320ms ease, box-shadow 320ms ease, transform 320ms var(--scene-ease);
}

.core-callouts span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.core-callouts strong {
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 680;
}

.core-callouts li.is-core-active {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface-strong) 84%, var(--accent) 16%);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--glow), 0 12px 30px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.engineering-core.is-core-complete .core-callouts li {
  border-color: var(--border-strong);
}

/* Project Cover Flow ------------------------------------------------------ */

.project-story {
  position: relative;
  overflow-x: clip;
}

.project-stage {
  position: relative;
  padding-block: clamp(5rem, 9vw, 8rem);
  outline: none;
}

.project-stage:focus-visible {
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 3px var(--focus);
}

.project-carousel[data-home-cover-flow] {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

html.home-enhanced .project-carousel[data-home-cover-flow] .project-browse {
  position: absolute;
  z-index: var(--layer-controls);
  top: clamp(5.5rem, 10vw, 9rem);
  right: 0;
}

.project-carousel[data-home-cover-flow] .project-position {
  color: var(--accent);
  font-size: 0.78rem;
}

.project-cover-frame {
  display: block;
  width: 100%;
  min-width: 0;
}

.project-carousel[data-home-cover-flow] .project-track {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0 1.25rem;
}

.project-carousel[data-home-cover-flow] .project-card {
  overflow: clip;
}

.project-carousel[data-home-cover-flow] .project-visual {
  display: grid;
  padding: clamp(0.65rem, 1.5vw, 1rem);
  background:
    radial-gradient(circle at 50% 45%, var(--glow), transparent 70%),
    var(--surface-strong);
  place-items: center;
}

.project-carousel[data-home-cover-flow] .project-visual picture {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.project-carousel[data-home-cover-flow] .project-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-carousel[data-home-cover-flow] [data-project-id="orbit-shift"] .project-visual img {
  position: absolute;
  inset: 0;
  padding: 1rem;
}

.project-carousel[data-home-cover-flow] .project-visual-flexin img {
  width: min(48%, 190px);
  height: auto;
}


.project-controls {
  position: relative;
  z-index: var(--layer-controls);
  display: none;
  align-items: center;
  justify-content: center;
  gap: clamp(0.8rem, 2vw, 1.5rem);
}

html.home-enhanced .project-controls {
  display: flex;
}

.project-controls .project-arrow:disabled {
  opacity: 0.3;
}

.project-dots {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.project-dots button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.project-dots button::before {
  display: block;
  width: 6px;
  height: 6px;
  margin: auto;
  border-radius: 50%;
  background: var(--text-faint);
  content: "";
  transition: width var(--transition-fast), border-radius var(--transition-fast), background var(--transition-fast);
}

.project-dots button[aria-pressed="true"]::before {
  width: 18px;
  border-radius: 999px;
  background: var(--accent);
}

.project-dots button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* Connected capabilities ------------------------------------------------- */

.capabilities-section {
  position: relative;
}

.capabilities-section::before,
.education-blueprint::before {
  position: absolute;
  z-index: -1;
  top: 4rem;
  bottom: 4rem;
  left: 50%;
  width: 100vw;
  background:
    linear-gradient(var(--blueprint-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--blueprint-line) 1px, transparent 1px);
  background-size: 64px 64px;
  content: "";
  mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent);
  transform: translateX(-50%);
}

.capability-system {
  position: relative;
}

.capability-trace {
  position: absolute;
  z-index: 0;
  top: -3.75rem;
  left: 0;
  width: 100%;
  height: 10rem;
  overflow: visible;
}

.capability-trace path,
.capability-trace circle {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: var(--trace-width);
  vector-effect: non-scaling-stroke;
}

.capability-trace path {
  stroke: var(--accent);
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.capability-trace circle {
  fill: var(--surface);
  transform-box: fill-box;
  transform-origin: center;
}

.capabilities-section .skills-grid {
  position: relative;
  z-index: 2;
}

.capabilities-section .skill-card {
  position: relative;
  overflow: hidden;
  padding-top: 2.1rem;
}

.capabilities-section .skill-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  content: "";
  opacity: 1;
  transform: scaleX(1);
  transform-origin: left;
  transition: opacity 500ms ease, transform 700ms var(--scene-ease);
}

.capabilities-section .skill-card::after {
  position: absolute;
  top: -6px;
  left: 1.5rem;
  width: 12px;
  height: 12px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px var(--glow), 0 0 22px var(--accent);
  content: "";
  transition: background 400ms ease, box-shadow 400ms ease;
}

/* Experience, education, about, contact ---------------------------------- */

.experience-system {
  position: relative;
  padding-top: 3.25rem;
}

.experience-rail {
  position: absolute;
  top: 0;
  right: 12.5%;
  left: 12.5%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong) 8%, var(--border-strong) 92%, transparent);
}

.experience-rail-progress {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  inset: -1px 0 auto;
  transform: scaleX(1);
  transform-origin: left;
}

.experience-node {
  position: absolute;
  top: -6px;
  display: block;
  width: 13px;
  height: 13px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px var(--glow);
}

.experience-node:nth-of-type(1) { left: 24%; }
.experience-node:nth-of-type(2) { right: 24%; }

.experience-milestone {
  position: relative;
}

.experience-milestone::before {
  position: absolute;
  top: -3.25rem;
  left: 50%;
  width: 1px;
  height: 3.25rem;
  background: var(--border-strong);
  content: "";
}

.education-blueprint {
  isolation: isolate;
}

.education-blueprint::after {
  position: absolute;
  z-index: -1;
  right: 1rem;
  bottom: 3rem;
  width: 8rem;
  height: 8rem;
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  content: "";
  opacity: 0.5;
  transform-origin: right bottom;
  transition: opacity 700ms ease, transform 700ms var(--scene-ease);
}

.education-grid .visual-link-card {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
}

.experience-grid .visual-link-card-image picture,
.education-grid .visual-link-card-image picture {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0.65rem;
  background:
    radial-gradient(circle at 50% 50%, var(--glow), transparent 76%),
    var(--surface-strong);
}

.experience-grid .visual-link-card-image img,
.education-grid .visual-link-card-image img {
  object-fit: contain;
}

.experience-grid .visual-link-card:hover img,
.education-grid .visual-link-card:hover img {
  transform: none;
}

.about-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  gap: clamp(2rem, 7vw, 6rem);
}

.about-system {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(180px, 0.72fr) minmax(220px, 1fr);
  gap: 1rem;
}

.about-portrait {
  z-index: 2;
  transform: rotate(-2deg);
}

.about-portrait:hover,
.about-portrait:focus-visible {
  transform: translateY(-3px) rotate(0deg);
}

.about-principles {
  position: relative;
  z-index: 1;
  margin-left: -2rem;
  padding-left: 3rem;
}

.contact-connector {
  display: grid;
  width: min(70%, 640px);
  height: 5.5rem;
  margin: -2rem auto 0;
  place-items: center;
}

.contact-connector span {
  width: 1px;
  height: 100%;
  background: linear-gradient(var(--border-strong), var(--accent));
}

.contact-connector i {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 10px var(--glow), 0 0 30px var(--accent);
}

#contact .contact-card {
  overflow: hidden;
  border-color: var(--border-strong);
  background:
    radial-gradient(circle at 50% 0%, var(--glow), transparent 28rem),
    linear-gradient(150deg, color-mix(in srgb, var(--surface) 96%, var(--accent) 4%), var(--surface));
  text-align: center;
}

#contact .contact-card > p {
  margin-inline: auto;
}

#contact .contact-card .eyebrow {
  margin-inline: auto;
}

#contact .contact-actions {
  justify-content: center;
}

/* Connected section story ------------------------------------------------ */

[data-story-section] {
  position: relative;
}

.story-connector {
  position: absolute;
  top: 0;
  left: 50%;
  display: grid;
  width: 2rem;
  height: clamp(3.25rem, 6vw, 5rem);
  pointer-events: none;
  place-items: start center;
  transform: translateX(-50%);
}

.story-connector span {
  display: block;
  width: 1px;
  height: 100%;
  background: linear-gradient(var(--border-strong), var(--accent));
  transform: scaleY(1);
  transform-origin: top;
}

.story-connector i {
  position: absolute;
  bottom: -5px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px var(--glow);
}

[data-story-step] {
  opacity: 1;
  transition: opacity 600ms ease, transform 600ms var(--scene-ease), border-color var(--transition), box-shadow var(--transition);
}

html.story-motion-ready[data-motion="full"] [data-story-section]:not(.is-story-active) [data-story-step] {
  opacity: 0;
  transform: translateY(14px);
}

html.story-motion-ready[data-motion="full"] [data-story-section].is-story-active [data-story-step] {
  transition-delay: calc(var(--story-index, 0) * 90ms);
}

html.story-motion-ready[data-motion="full"] [data-story-section]:not(.is-story-active) .story-connector span {
  transform: scaleY(0);
}

html.story-motion-ready[data-motion="full"] [data-story-section]:not(.is-story-active) .story-connector i {
  opacity: 0;
  transform: scale(0.35);
}

.story-connector span,
.story-connector i {
  transition: opacity 420ms ease, transform 650ms var(--scene-ease);
}

html.story-motion-ready[data-motion="full"] .capabilities-section:not(.is-story-active) .capability-trace path {
  stroke-dashoffset: 1;
}

html.story-motion-ready[data-motion="full"] .capabilities-section:not(.is-story-active) .capability-trace circle {
  opacity: 0;
  transform: scale(0.35);
}

.capability-trace path {
  transition: stroke-dashoffset 850ms var(--scene-ease);
}

.capability-trace circle {
  transition: opacity 420ms ease, transform 520ms var(--scene-ease);
}

.capability-trace circle:nth-of-type(1) { transition-delay: 100ms; }
.capability-trace circle:nth-of-type(2) { transition-delay: 220ms; }
.capability-trace circle:nth-of-type(3) { transition-delay: 340ms; }
.capability-trace circle:nth-of-type(4) { transition-delay: 460ms; }

html.story-motion-ready[data-motion="full"] .capabilities-section:not(.is-story-active) .skill-card::before {
  opacity: 0.3;
  transform: scaleX(0.12);
}

html.story-motion-ready[data-motion="full"] .capabilities-section:not(.is-story-active) .skill-card::after {
  background: var(--text-faint);
  box-shadow: none;
}

.experience-rail-progress,
.experience-node {
  transition: opacity 420ms ease, transform 700ms var(--scene-ease), box-shadow 420ms ease;
}

html.story-motion-ready[data-motion="full"] .experience-section:not(.is-story-active) .experience-rail-progress {
  transform: scaleX(0);
}

html.story-motion-ready[data-motion="full"] .experience-section:not(.is-story-active) .experience-node {
  opacity: 0;
  transform: scale(0.35);
}

.experience-node:nth-of-type(1) { transition-delay: 330ms; }
.experience-node:nth-of-type(2) { transition-delay: 650ms; }

.education-blueprint::before {
  opacity: 0.55;
  transition: opacity 800ms ease;
}

html.story-motion-ready[data-motion="full"] .education-blueprint:not(.is-story-active)::before {
  opacity: 0.12;
}

html.story-motion-ready[data-motion="full"] .education-blueprint:not(.is-story-active)::after {
  opacity: 0;
  transform: scale(0.25);
}

html.story-motion-ready[data-motion="full"] .about-section:not(.is-story-active) .about-portrait {
  transform: translateY(10px) rotate(-4deg);
}

.about-section .principles > div {
  transition: opacity 520ms ease, transform 520ms var(--scene-ease), color 320ms ease;
}

.about-section.is-story-active .principles dt {
  color: var(--accent);
}

.contact-connector span {
  transform: scaleY(1);
  transform-origin: top;
  transition: transform 600ms var(--scene-ease);
}

.contact-connector i {
  transition: opacity 420ms ease, transform 520ms var(--scene-ease);
}

html.story-motion-ready[data-motion="full"] .contact-section:not(.is-story-active) .contact-connector span {
  transform: scaleY(0);
}

html.story-motion-ready[data-motion="full"] .contact-section:not(.is-story-active) .contact-connector i {
  opacity: 0;
  transform: scale(0.35);
}

html.story-motion-ready[data-motion="full"] .contact-section.is-story-active .contact-connector i {
  animation: signal-pulse 650ms 520ms ease-out 1;
}

html.story-motion-ready[data-motion="full"] [data-story-section].is-story-complete [data-story-step],
html.story-motion-ready[data-motion="full"] [data-story-section].is-story-complete [data-story-line],
html.story-motion-ready[data-motion="full"] [data-story-section].is-story-complete [data-story-node] {
  will-change: auto;
}

@keyframes signal-pulse {
  0%, 100% { box-shadow: 0 0 0 10px var(--glow), 0 0 30px var(--accent); }
  48% { box-shadow: 0 0 0 18px transparent, 0 0 42px var(--accent); }
}

/* Scroll-enhanced desktop state ------------------------------------------ */

@media (min-width: 1024px) and (min-height: 650px) and (hover: hover) and (pointer: fine) {
  html[data-scroll-experience="story"] .home-story {
    height: 180svh;
  }

  html[data-scroll-experience="story"] .home-intro {
    position: sticky;
    top: var(--header-height);
    height: calc(100svh - var(--header-height));
    min-height: 0;
  }

  html[data-scroll-experience="story"] .quote-card {
    opacity: var(--quote-opacity, 1);
    transform: translateY(var(--quote-shift, 0)) scale(var(--quote-scale, 1));
    transform-origin: top center;
  }

  html[data-scroll-experience="story"] .hero-copy {
    opacity: var(--hero-opacity, 1);
    transform: translateY(var(--hero-shift, 0));
  }

  html[data-scroll-experience="story"] .core-stage {
    transform: rotateX(var(--core-tilt-x, 0deg)) rotateY(var(--core-tilt-y, 0deg));
  }

  html[data-scroll-experience="story"] .core-traces {
    opacity: var(--trace-opacity, 1);
    transform: scale(var(--trace-scale, 1));
  }

  html[data-scroll-experience="story"] .core-layer-software {
    transform: translate(-50%, -50%) translate3d(var(--software-x, 0), var(--software-y, 0), var(--software-z, 72px)) rotateZ(var(--software-rotation, 45deg));
  }

  html[data-scroll-experience="story"] .core-layer-connected {
    transform: translate(-50%, -50%) translate3d(var(--connected-x, 0), var(--connected-y, 0), var(--connected-z, 36px)) rotateZ(var(--connected-rotation, 45deg));
  }

  html[data-scroll-experience="story"] .core-layer-hardware {
    transform: translate(-50%, -50%) translate3d(var(--hardware-x, 0), var(--hardware-y, 0), var(--hardware-z, -34px)) rotateZ(var(--hardware-rotation, 45deg));
  }

  html[data-scroll-experience="story"] .core-layer-sensors {
    transform: translate(-50%, -50%) translate3d(var(--sensors-x, 0), var(--sensors-y, 0), var(--sensors-z, -70px)) rotateZ(var(--sensors-rotation, 45deg));
  }

  html[data-scroll-experience="story"] .core-chip {
    transform: translate(-50%, -50%) translateZ(var(--chip-z, 118px)) rotateZ(var(--chip-rotation, 45deg));
  }

  html[data-scroll-experience="story"] .core-callouts li {
    color: var(--text-soft);
  }

  html[data-scroll-experience="story"] .scroll-cue {
    opacity: var(--cue-opacity, 1);
  }

  html[data-scroll-experience="story"] .project-story {
    height: var(--project-story-height, 592svh);
  }

  html[data-scroll-experience="story"] .project-stage {
    position: sticky;
    top: var(--header-height);
    display: grid;
    height: calc(100svh - var(--header-height));
    padding-block: clamp(1.25rem, 3vh, 2.5rem);
    align-content: center;
    grid-template-rows: auto minmax(0, 1fr);
  }

  html[data-scroll-experience="story"] .project-stage .section-heading {
    margin-bottom: clamp(0.75rem, 2vh, 1.5rem);
  }

  html[data-scroll-experience="story"] .project-stage .section-heading p {
    display: none;
  }

  html[data-scroll-experience="story"] .project-carousel[data-home-cover-flow] .project-browse {
    top: clamp(1.5rem, 4vh, 3rem);
  }

  html[data-scroll-experience="story"] .project-cover-frame {
    position: relative;
    height: clamp(350px, 52svh, 500px);
    perspective: 1400px;
    perspective-origin: 50% 44%;
  }

  html[data-scroll-experience="story"] .project-carousel[data-home-cover-flow] .project-track {
    position: absolute;
    overflow: visible;
    inset: 0;
    scroll-snap-type: none;
    transform-style: flat;
    pointer-events: none;
  }

  html[data-scroll-experience="story"] .project-carousel[data-home-cover-flow] .project-card {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    width: min(68vw, 880px);
    height: auto;
    min-height: clamp(330px, 48svh, 460px);
    opacity: 1;
    filter: brightness(var(--project-opacity, 1));
    pointer-events: auto;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    grid-template-rows: minmax(0, 1fr);
    transform: translateX(-50%) perspective(1400px) translate3d(var(--project-x, 0), -50%, var(--project-z, -300px)) rotateY(var(--project-yaw, 0deg)) scale(var(--project-scale, 0.8));
    transform-origin: center;
    transition: border-color var(--transition), box-shadow var(--transition);
  }

  html[data-scroll-experience="story"] .project-card.is-distant {
    visibility: hidden;
    pointer-events: none;
  }

  html[data-scroll-experience="story"] .project-story.is-scene-active .project-card.is-nearby {
    will-change: transform, opacity;
  }

  html[data-scroll-experience="story"] .project-card .project-visual {
    height: 100%;
    aspect-ratio: auto;
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }

  html[data-scroll-experience="story"] .project-card-body {
    padding: clamp(1rem, 2.2vh, 1.5rem);
  }

  html[data-scroll-experience="story"] .project-card-body p {
    margin-bottom: 0.7rem;
  }

  html[data-scroll-experience="story"] .project-card:hover,
  html[data-scroll-experience="story"] .project-card:focus-within {
    transform: translateX(-50%) perspective(1400px) translate3d(var(--project-x, 0), -50%, var(--project-z, -300px)) rotateY(var(--project-yaw, 0deg)) scale(var(--project-scale, 0.8));
  }

  html[data-scroll-experience="story"] .project-card:hover .project-visual img {
    transform: none;
  }
}

/* Responsive and motion-safe presentation -------------------------------- */

@media (max-width: 1120px) {
  .hero-system {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.82fr);
  }

  .core-stage {
    max-width: 500px;
  }
}

@media (min-width: 1121px) and (max-width: 1500px) {
  body[data-page="home"] .brand-name {
    display: none;
  }
}

@media (min-width: 1024px) and (min-height: 650px) and (max-height: 950px) {
  .home-intro {
    padding-block: 0.55rem 0.9rem;
    gap: 0.65rem;
  }

  .quote-card {
    padding-block: 0.58rem;
  }

  .hero-system {
    gap: clamp(1.5rem, 3.5vw, 3.5rem);
  }

  .hero-system h1 {
    margin-block: 0.55rem 0.7rem;
    font-size: clamp(3rem, min(4.8vw, 6.8vh), 4.6rem);
  }

  .hero-system .hero-summary {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .core-stage {
    width: min(100%, 440px);
  }

  .core-callouts li {
    min-height: 3.3rem;
    padding: 0.45rem 0.55rem;
  }

  .core-callouts strong {
    font-size: 0.63rem;
  }
}

@media (max-width: 1023px), (max-height: 649px), (hover: none), (pointer: coarse) {
  .home-story,
  .project-story {
    height: auto !important;
  }

  .home-intro,
  .project-stage {
    position: relative !important;
    top: auto !important;
    height: auto !important;
  }

  .home-intro {
    padding-block: 1rem 4rem;
  }

  .hero-system {
    padding-block: 2rem 0;
  }

  .project-stage {
    padding-block: clamp(5rem, 10vw, 8rem);
  }

  html.home-enhanced .project-carousel[data-home-cover-flow] .project-browse {
    top: clamp(5.5rem, 10vw, 9rem);
  }

  .project-carousel[data-home-cover-flow] .project-track {
    display: flex;
    overflow-x: auto;
    padding-inline: 6%;
    scroll-padding-inline: 6%;
    scroll-snap-type: x mandatory;
    gap: 1rem;
  }

  .project-carousel[data-home-cover-flow] .project-card {
    position: relative;
    width: auto;
    height: auto;
    min-width: 0;
    opacity: 1 !important;
    flex: 0 0 100%;
    scroll-snap-align: center;
    transform: none !important;
  }

  .project-carousel[data-home-cover-flow] .project-card.is-distant {
    visibility: visible;
    pointer-events: auto;
  }
}

@media (max-width: 760px) {
  body[data-page="home"] .container {
    width: min(calc(100% - 1.25rem), var(--home-max-width));
  }

  body[data-page="home"] .section,
  .project-stage {
    padding-block: 4.5rem;
  }

  .home-intro {
    display: grid;
    padding-block: 0.75rem 3.5rem;
  }

  .quote-card {
    margin-inline: 0;
  }

  .hero-system {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .hero-system h1 {
    font-size: clamp(2.7rem, 12vw, 4.1rem);
  }

  .engineering-core {
    width: min(100%, 470px);
    justify-self: center;
  }

  .core-stage {
    width: min(100%, 430px);
  }

  .core-layer span,
  .core-chip small {
    display: none;
  }

  .core-callouts {
    margin-top: -0.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scroll-cue {
    display: none;
  }

  html.home-enhanced .project-carousel[data-home-cover-flow] .project-browse {
    position: static;
    justify-content: flex-start;
  }

  .project-carousel[data-home-cover-flow] .project-track {
    margin-inline: 0;
    padding-inline: 6%;
    scroll-padding-inline: 6%;
  }

  .project-carousel[data-home-cover-flow] .project-card {
    flex-basis: 100%;
    max-width: calc(100vw - 1.75rem);
  }

  .project-controls {
    justify-content: space-between;
  }

  .project-dots {
    gap: 0.1rem;
  }

  .project-dots button {
    width: 28px;
    height: 28px;
  }

  .capability-trace {
    display: none;
  }

  .capabilities-section .skill-card {
    padding-top: 1.7rem;
  }

  .experience-system {
    padding-top: 0;
    padding-left: 1.4rem;
  }

  .experience-rail {
    top: 0;
    bottom: 0;
    left: 0;
    width: 1px;
    height: auto;
    background: linear-gradient(var(--border-strong), transparent);
  }

  .experience-rail-progress {
    top: 0;
    right: auto;
    bottom: 0;
    left: -1px;
    width: 2px;
    height: auto;
    transform: scaleY(1);
    transform-origin: top;
  }

  html.story-motion-ready[data-motion="full"] .experience-section:not(.is-story-active) .experience-rail-progress {
    transform: scaleY(0);
  }

  .experience-node {
    left: -6px !important;
    right: auto !important;
  }

  .experience-node:nth-of-type(1) { top: 22%; }
  .experience-node:nth-of-type(2) { top: 73%; }

  .experience-milestone::before {
    top: 50%;
    left: -1.4rem;
    width: 1.4rem;
    height: 1px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-system {
    max-width: 560px;
    margin-inline: auto;
    grid-template-columns: minmax(150px, 0.75fr) minmax(190px, 1fr);
  }

  .about-principles {
    margin-left: -1rem;
    padding-left: 2rem;
  }

  html.story-motion-ready[data-motion="full"] [data-story-section]:not(.is-story-active) [data-story-step] {
    transform: translateY(8px);
  }
}

@media (max-width: 480px) {
  .hero-actions .button {
    width: 100%;
  }

  .about-system {
    grid-template-columns: 1fr;
  }

  .about-portrait {
    width: min(80%, 270px);
    margin-inline: auto;
  }

  .about-principles {
    margin: -1.5rem 0 0;
    padding: 2.5rem 1.1rem 1.1rem;
  }

}

/* Refined portfolio story ------------------------------------------------ */

body[data-page="home"] {
  overflow-x: clip;
}

.quote-card {
  padding: 0.58rem 0.85rem;
  border-color: color-mix(in srgb, var(--border) 58%, transparent);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.08);
}

.quote-mark {
  font-size: clamp(2rem, 3vw, 2.65rem);
  opacity: 0.78;
}

.quote-copy {
  font-size: clamp(0.82rem, 1.1vw, 0.94rem);
}

/* Four factual engineering modules stay centered and keep their geometry. */

.core-stage::before {
  inset: 10%;
}

.core-stage::after {
  inset: 27%;
}

.core-layer {
  width: 44%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  isolation: isolate;
}

.core-layer-software {
  z-index: 5;
  top: 27%;
  left: 27%;
  width: 35%;
  transform: translate(-50%, -50%) translateZ(72px);
}

.core-layer-connected {
  z-index: 4;
  top: 28%;
  left: 73%;
  width: 35%;
  transform: translate(-50%, -50%) translateZ(36px);
}

.core-layer-hardware {
  z-index: 3;
  top: 72%;
  left: 27%;
  width: 43%;
  transform: translate(-50%, -50%) translateZ(-34px);
}

.core-layer-sensors {
  z-index: 2;
  top: 73%;
  left: 73%;
  width: 48%;
  transform: translate(-50%, -50%) translateZ(-70px);
}

.core-art {
  display: grid;
  width: 100%;
  height: 100%;
  pointer-events: none;
  place-items: center;
}

.core-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.24));
}

.core-layer > span {
  position: absolute;
  z-index: 2;
  bottom: -0.2rem;
  left: 50%;
  padding: 0.32rem 0.52rem;
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  transform: translateX(-50%);
}

.core-chip {
  width: 16%;
}

.core-callouts {
  margin-top: 0.4rem;
}

.project-dots button {
  width: 44px;
  height: 44px;
}

.project-arrow {
  min-width: 44px;
  min-height: 44px;
}

.project-track {
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  touch-action: pan-x pan-y;
}

/* The handoff is static by default and becomes an overlay only in story mode. */

.project-stage {
  padding-bottom: 0;
}

.project-handoff {
  --handoff-progress: 1;
  position: relative;
  display: grid;
  width: 100%;
  height: clamp(17rem, 36vw, 30rem);
  margin-top: clamp(1.5rem, 4vw, 3rem);
  overflow: visible;
  pointer-events: none;
  place-items: center;
}

.project-handoff-circuit {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 12px var(--glow));
}

.project-handoff-circuit path,
.project-handoff-circuit rect,
.project-handoff-circuit circle {
  vector-effect: non-scaling-stroke;
}

.handoff-module-shell,
.handoff-driver-shell {
  fill: color-mix(in srgb, var(--surface) 91%, transparent);
  stroke: var(--border-strong);
  stroke-width: 2;
}

.handoff-module-shell {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.handoff-port,
.handoff-convergence-node {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
}

.handoff-trace {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.handoff-driver-shell {
  stroke: var(--accent);
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.handoff-svg-label {
  overflow: visible;
  color: var(--text);
}

.handoff-label-body {
  display: grid;
  height: 100%;
  align-content: center;
  justify-items: center;
  font-family: var(--font-mono);
  gap: 7px;
  text-align: center;
}

.handoff-label-body strong {
  font-size: 26px;
  font-weight: 820;
  letter-spacing: 0.04em;
  line-height: 1;
}

.handoff-label-body span {
  color: var(--text-faint);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.15;
  text-transform: uppercase;
}

.handoff-output-label .handoff-label-body {
  align-content: start;
  justify-items: start;
  text-align: left;
}

/* Capability cards sit on a real, keyed circuit instead of a fake board. */

.capabilities-section {
  isolation: isolate;
}

.capabilities-section::before {
  z-index: -1;
}

.capability-system {
  position: relative;
  min-height: 42rem;
  isolation: isolate;
}

.capability-trace {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.capability-trace .capability-trunk {
  stroke: color-mix(in srgb, var(--border-strong) 82%, transparent);
  stroke-dasharray: 0.02 0.018;
  stroke-dashoffset: 0;
  opacity: 0.75;
}

.capability-trace g path {
  stroke: var(--accent);
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  opacity: 0.55;
  transition: stroke-dashoffset 700ms var(--scene-ease), opacity 300ms ease;
}

.capability-trace g circle {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
  opacity: 0.7;
  transition: opacity 280ms ease, transform 420ms var(--scene-ease);
}

html.home-enhanced.story-motion-ready[data-motion="full"] .capability-trace g:not(.is-active):not(.is-visited) path {
  stroke-dashoffset: 1;
  opacity: 0.18;
}

html.home-enhanced.story-motion-ready[data-motion="full"] .capability-trace g:not(.is-active):not(.is-visited) circle {
  opacity: 0.25;
  transform: scale(0.72);
}

.capability-trace g.is-active path,
.capability-trace g.is-visited path {
  stroke-dashoffset: 0;
}

.capability-trace g.is-active path {
  opacity: 1;
  filter: drop-shadow(0 0 7px var(--accent));
}

.capability-trace g.is-active circle {
  opacity: 1;
}

.capability-grid {
  position: relative;
  z-index: 1;
  display: grid;
  padding: 3.25rem clamp(1.25rem, 4vw, 3.5rem);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(4.5rem, 8vw, 7rem) clamp(7rem, 14vw, 12rem);
}

.capability-grid .skill-card {
  position: relative;
  min-height: 14rem;
  padding: 1.4rem;
  overflow: visible;
  border-color: color-mix(in srgb, var(--border) 88%, transparent);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  transition: border-color 280ms ease, box-shadow 280ms ease, transform 280ms var(--scene-ease);
}

.capability-grid .skill-card:nth-child(even) {
  transform: translateY(3.5rem);
}

.capability-grid .skill-card::before {
  top: 0;
  height: 2px;
}

.capability-grid .skill-card::after {
  top: 50%;
  left: auto;
  right: -8px;
  width: 14px;
  height: 14px;
  border-width: 3px;
  transform: translateY(-50%);
}

.capability-grid .skill-card:nth-child(even)::after {
  right: auto;
  left: -8px;
}

.capability-grid .skill-card.is-active {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px var(--glow), var(--shadow-lg);
}

.capability-grid .skill-card:nth-child(even).is-active {
  transform: translateY(calc(3.5rem - 2px));
}

.capability-grid .skill-card:nth-child(odd).is-active {
  transform: translateY(-2px);
}

.capability-grid .skill-card.is-active::before,
.capability-grid .skill-card.is-visited::before {
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary), transparent 88%);
}

.capability-grid .skill-card.is-pulsing::after {
  animation: capability-node-pulse 620ms ease-out 1;
}

.capability-card-heading {
  display: flex;
  margin-bottom: 1rem;
  align-items: baseline;
  gap: 0.7rem;
}

.capability-card-heading span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
}

.capability-card-heading h3 {
  margin: 0;
  transition: color 240ms ease;
}

.capability-grid .skill-card.is-active .capability-card-heading h3 {
  color: var(--accent);
}

@keyframes capability-node-pulse {
  0%, 100% { box-shadow: 0 0 0 7px var(--glow), 0 0 22px var(--accent); }
  50% { box-shadow: 0 0 0 16px transparent, 0 0 34px var(--accent); }
}

/* Timeline nodes are physically nested in their own milestone. */

.experience-system {
  padding-top: 0;
}

.experience-timeline {
  position: relative;
  display: grid;
  padding: 0;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 5vw, 4rem);
  list-style: none;
}

.experience-timeline::before {
  position: absolute;
  top: 6px;
  right: 25%;
  left: 25%;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--border-strong) 48%, var(--accent-secondary));
  content: "";
}

.experience-item {
  position: relative;
  display: grid;
  min-width: 0;
  padding-top: 3.25rem;
}

.experience-item > .experience-node {
  position: absolute;
  z-index: 3;
  top: 0;
  right: auto;
  left: 50%;
  width: 13px;
  height: 13px;
  opacity: 1;
  transform: translateX(-50%);
}

.experience-milestone {
  height: 100%;
  opacity: 1;
  transform: none;
  transition: border-color 280ms ease, box-shadow 280ms ease;
}

.experience-milestone::before {
  position: absolute;
  top: -3.25rem;
  left: 50%;
  width: 1px;
  height: 3.25rem;
  background: var(--border-strong);
  content: "";
}

.experience-milestone.is-active {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px var(--glow), var(--shadow-lg);
}

.experience-item:has(.experience-milestone.is-active) > .experience-node {
  box-shadow: 0 0 0 12px transparent, 0 0 28px var(--accent);
  animation: experience-node-pulse 620ms ease-out 1;
}

.experience-timeline .visual-link-card-image picture {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0.65rem;
  background:
    radial-gradient(circle at 50% 50%, var(--glow), transparent 76%),
    var(--surface-strong);
}

.experience-timeline .visual-link-card-image img {
  object-fit: contain;
}

.experience-timeline .visual-link-card:hover img {
  transform: none;
}

@keyframes experience-node-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  48% { transform: translateX(-50%) scale(1.35); }
}

/* Education carries the center trace into a restrained blueprint. */

.education-blueprint {
  isolation: isolate;
}

.education-blueprint::before {
  z-index: -1;
  opacity: 0.46;
}

.education-grid .visual-link-card:first-child {
  border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm);
}

.education-grid .project-kicker {
  line-height: 1.55;
}

/* About remains calm and readable; only direct interaction moves the portrait. */

.about-section .story-connector span,
.about-section .story-connector i,
.about-section .principles > div {
  animation: none;
  transition: none;
}

.about-section .about-portrait {
  transform: rotate(-1deg);
}

.about-section .about-portrait:hover,
.about-section .about-portrait:focus-visible {
  transform: translateY(-3px) rotate(0deg);
}

/* Contact content is always visible. Only its final trace draws on arrival. */

.contact-card,
.contact-actions,
[data-contact-action] {
  opacity: 1;
  transform: none;
}

html.home-enhanced.story-motion-ready[data-motion="full"] .contact-section .contact-connector span {
  transform: scaleY(0);
}

html.home-enhanced.story-motion-ready[data-motion="full"] .contact-section .contact-connector i {
  opacity: 0;
  animation: none;
  transform: scale(0.35);
}

html.home-enhanced.story-motion-ready[data-motion="full"] .contact-section.is-story-in-view .contact-connector span {
  transform: scaleY(1);
}

html.home-enhanced.story-motion-ready[data-motion="full"] .contact-section.is-story-in-view .contact-connector i {
  opacity: 1;
  animation: signal-pulse 650ms 520ms ease-out 1;
  transform: scale(1);
}

@media (min-width: 1024px) and (min-height: 650px) and (hover: hover) and (pointer: fine) {
  html[data-scroll-experience="story"] .core-layer-software {
    transform: translate(-50%, -50%) translate3d(var(--software-x, 0), var(--software-y, 0), var(--software-z, 72px));
  }

  html[data-scroll-experience="story"] .core-layer-connected {
    transform: translate(-50%, -50%) translate3d(var(--connected-x, 0), var(--connected-y, 0), var(--connected-z, 36px));
  }

  html[data-scroll-experience="story"] .core-layer-hardware {
    transform: translate(-50%, -50%) translate3d(var(--hardware-x, 0), var(--hardware-y, 0), var(--hardware-z, -34px));
  }

  html[data-scroll-experience="story"] .core-layer-sensors {
    transform: translate(-50%, -50%) translate3d(var(--sensors-x, 0), var(--sensors-y, 0), var(--sensors-z, -70px));
  }

  html[data-scroll-experience="story"] .project-handoff {
    --handoff-progress: 0;
    position: absolute;
    z-index: calc(var(--layer-controls) + 2);
    height: 100%;
    margin: 0;
    opacity: 0;
    inset: 0;
  }

  html[data-scroll-experience="story"] .project-handoff.is-handoff-active,
  html[data-scroll-experience="story"] .project-handoff.is-handoff-complete {
    opacity: 1;
  }

  html[data-scroll-experience="story"] .project-handoff-circuit {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

}

@media (min-width: 761px) and (max-width: 1023px) {
  .capability-system {
    min-height: 38rem;
  }

  .capability-grid {
    padding-inline: 1.25rem;
    gap: 3rem 4rem;
  }

  .capability-grid .skill-card:nth-child(even) {
    transform: translateY(2rem);
  }

  .capability-grid .skill-card:nth-child(even).is-active {
    transform: translateY(calc(2rem - 2px));
  }
}

@media (max-width: 760px) {
  .project-handoff {
    height: 18rem;
    margin-top: 1rem;
  }

  .project-handoff-circuit {
    width: 150%;
    max-width: none;
  }

  .capability-system {
    min-height: 0;
  }

  .capability-trace {
    display: none;
  }

  .capability-grid {
    padding: 1rem 0 1rem 2.5rem;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .capability-grid::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 6px;
    width: 1px;
    background: linear-gradient(var(--accent), var(--border-strong) 88%, transparent);
    content: "";
  }

  .capability-grid .skill-card,
  .capability-grid .skill-card:nth-child(even),
  .capability-grid .skill-card:nth-child(odd).is-active,
  .capability-grid .skill-card:nth-child(even).is-active {
    min-height: 0;
    transform: none;
  }

  .capability-grid .skill-card::after,
  .capability-grid .skill-card:nth-child(even)::after {
    top: 2rem;
    right: auto;
    left: calc(-2.5rem + 6px);
    transform: translate(-50%, -50%);
  }

  .capability-card-heading::before {
    position: absolute;
    top: 2rem;
    left: calc(-2.5rem + 6px);
    width: calc(2.5rem - 6px);
    height: 1px;
    background: var(--border-strong);
    content: "";
    transform: scaleX(1);
    transform-origin: left center;
  }

  html.story-motion-ready[data-motion="full"] .capability-card-heading::before {
    transform: scaleX(0);
    transition: transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  html.story-motion-ready[data-motion="full"] .skill-card:is(.is-active, .is-visited) .capability-card-heading::before {
    transform: scaleX(1);
  }

  .experience-timeline {
    padding-left: 2.5rem;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }

  .experience-system {
    padding-left: 0;
  }

  .experience-timeline::before {
    top: 0;
    right: auto;
    bottom: 0;
    left: 6px;
    width: 1px;
    height: auto;
    background: linear-gradient(var(--accent), var(--border-strong) 88%, transparent);
  }

  .experience-item {
    padding-top: 0;
  }

  .experience-item > .experience-node {
    top: 2.25rem;
    right: auto;
    left: calc(-2.5rem + 6px) !important;
    transform: translate(-50%, -50%);
  }

  .experience-milestone::before {
    top: 2.25rem;
    left: calc(-2.5rem + 6px);
    width: calc(2.5rem - 6px);
    height: 1px;
  }

  .experience-item:has(.experience-milestone.is-active) > .experience-node {
    animation: none;
    transform: translate(-50%, -50%) scale(1.2);
  }

  .experience-timeline .visual-link-card-image {
    min-height: 12rem;
  }
}

@media (max-width: 480px) {
  .project-handoff {
    height: 17rem;
  }

  .project-handoff-circuit {
    width: 160%;
  }

  .handoff-label-body span {
    display: none;
  }

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

  .project-arrow,
  .project-dots button {
    min-width: 44px;
    min-height: 44px;
  }

  html.home-enhanced .project-controls {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 0.35rem;
  }

  .project-dots {
    display: grid;
    justify-content: center;
    grid-template-columns: repeat(4, 44px);
    gap: 0;
  }

  .capability-grid .skill-card {
    padding: 1.15rem;
  }

  .education-grid,
  .experience-timeline,
  #contact .contact-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  #contact .contact-actions > * {
    width: 100%;
  }
}

/* Continuous portfolio schematic ---------------------------------------- */

/* The dedicated homepage mark uses the same dimensional visual language as
   the other core renders without changing Flexin's official app icon. */

.project-carousel[data-home-cover-flow] .project-visual-flexin {
  background:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 58%),
    radial-gradient(circle at 50% 78%, rgba(212, 152, 30, 0.16), transparent 42%),
    var(--surface-strong);
}

.project-carousel[data-home-cover-flow] .project-visual-flexin img {
  width: min(78%, 330px);
  height: auto;
  max-height: 88%;
  filter:
    drop-shadow(0 27px 22px rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 24px color-mix(in srgb, var(--accent) 22%, transparent));
}

html[data-theme="light"] .project-carousel[data-home-cover-flow] .project-visual-flexin img {
  filter:
    drop-shadow(0 24px 20px rgba(41, 57, 64, 0.2))
    drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 15%, transparent));
}

/* Desktop and mobile handoffs share the same staged classes. Only their
   geometry differs, so the controller can update either without branching. */

.handoff-layout-desktop {
  display: block;
}

.handoff-layout-mobile {
  display: none;
}

/* One uninterrupted blueprint surface sits behind section-local SVGs. */

.schematic-story {
  --schematic-guide-color: color-mix(in srgb, var(--text-soft) 34%, transparent);
  --schematic-signal-color: var(--accent);
  --schematic-module-surface: color-mix(in srgb, var(--surface) 96%, transparent);
  position: relative;
  overflow-x: clip;
  isolation: isolate;
}

.schematic-story::before {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--glow) 48%, transparent) 50%, transparent);
  content: "";
  opacity: 0.68;
  pointer-events: none;
  transform: translateX(-50%);
}

.schematic-section {
  position: relative;
  min-height: clamp(42rem, 76vw, 64rem);
  margin-block: 0;
  padding-block: clamp(5.5rem, 9vw, 8rem);
  isolation: isolate;
}

.schematic-section.capabilities-section::before,
.schematic-section.education-blueprint::before,
.schematic-section.education-blueprint::after,
.schematic-section .experience-timeline::before {
  content: none;
}

.schematic-segment {
  position: absolute;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  inset: 0;
}

.schematic-handoff-bridge {
  --bridge-progress: 1;
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}

.schematic-handoff-bridge path {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.schematic-bridge-guide {
  stroke: var(--schematic-guide-color);
  stroke-dasharray: 5 8;
  stroke-linecap: square;
  stroke-width: 2;
  opacity: 0.72;
}

.schematic-bridge-signal {
  stroke: var(--schematic-signal-color);
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  stroke-linecap: square;
  stroke-width: 2.5;
  opacity: clamp(0, calc(var(--bridge-progress) * 1000), 1);
  filter: drop-shadow(0 0 5px var(--glow));
}

.schematic-bridge-current {
  stroke: color-mix(in srgb, white 76%, var(--accent));
  stroke-dasharray: 0.08 0.92;
  stroke-dashoffset: calc(1 - var(--bridge-progress));
  stroke-linecap: round;
  stroke-width: 6;
  opacity: 0;
  filter: drop-shadow(0 0 10px var(--accent));
}

.schematic-handoff-bridge.is-current .schematic-bridge-current {
  opacity: 1;
}

html:not(.js) .schematic-handoff-bridge {
  display: none;
}

.schematic-segment path,
.schematic-segment circle {
  vector-effect: non-scaling-stroke;
}

.schematic-route,
.schematic-branch {
  fill: none;
  stroke-linejoin: round;
}

.schematic-route {
  stroke-linecap: butt;
  stroke-width: 2;
}

.schematic-branch {
  stroke-linecap: round;
  stroke-width: 1.75;
}

.schematic-route-guide,
.schematic-branch-guide {
  stroke: var(--schematic-guide-color);
  stroke-dasharray: 5 8;
  opacity: 0.72;
}

.schematic-route-signal,
.schematic-branch-signal {
  stroke: var(--schematic-signal-color);
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 5px var(--glow));
}

.schematic-route-signal {
  stroke-width: 2.5;
}

.schematic-branch-signal {
  stroke-width: 2.25;
}

.schematic-junction,
.schematic-terminal {
  fill: var(--surface);
  stroke: var(--schematic-signal-color);
  stroke-width: 2;
  opacity: 1;
  transform-box: fill-box;
  transform-origin: center;
}

.schematic-terminal {
  filter: none;
}

html.schematic-motion-ready[data-motion="full"] .schematic-route-signal {
  stroke-dashoffset: calc(1 - var(--segment-progress, 0));
  opacity: clamp(0, calc(var(--segment-progress, 0) * 1000), 1);
}

html.schematic-motion-ready[data-motion="full"] [data-schematic-branch] .schematic-branch-signal {
  stroke-dashoffset: calc(1 - var(--branch-progress, 0));
  opacity: clamp(0, calc(var(--branch-progress, 0) * 1000), 1);
}

html.schematic-motion-ready[data-motion="full"] [data-schematic-branch] .schematic-junction,
html.schematic-motion-ready[data-motion="full"] [data-schematic-branch] .schematic-terminal {
  opacity: var(--branch-node-opacity, 0.2);
  transform: scale(var(--branch-node-scale, 0.62));
}

[data-schematic-branch].is-powered .schematic-terminal,
html:not(.js) .schematic-terminal {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 3;
  filter: drop-shadow(0 0 7px var(--accent));
}

[data-schematic-branch].is-pulsing .schematic-terminal {
  animation: schematic-terminal-pulse 620ms ease-out 1;
}

@keyframes schematic-terminal-pulse {
  0%, 100% { filter: drop-shadow(0 0 7px var(--accent)); }
  48% { filter: drop-shadow(0 0 18px var(--accent)); }
}

/* Content stays legible and interactive at every scroll position. */

.schematic-heading,
.schematic-module-grid {
  position: relative;
  z-index: 2;
}

.schematic-heading {
  width: min(100%, 760px);
  margin-inline: auto;
  padding: 0.8rem clamp(0.8rem, 2vw, 1.35rem);
  border: 1px solid color-mix(in srgb, var(--border) 74%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  text-align: center;
  box-shadow: 0 12px 40px color-mix(in srgb, var(--bg) 36%, transparent);
  backdrop-filter: blur(12px);
}

.schematic-heading > .eyebrow {
  justify-self: center;
}

.schematic-heading p {
  margin-inline: auto;
  color: var(--text-soft);
  text-align: center;
}

.schematic-module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(3rem, 6vw, 5rem) clamp(6rem, 13vw, 11rem);
}

.schematic-module-grid > *,
.schematic-module {
  min-width: 0;
}

.schematic-module {
  position: relative;
  opacity: 1;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 34%),
    var(--schematic-module-surface);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transform: none;
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease,
    transform 220ms var(--scene-ease),
    background-color 220ms ease;
}

.schematic-section .schematic-module::before {
  position: absolute;
  top: 0;
  right: 1.25rem;
  left: 1.25rem;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary), transparent 88%);
  content: "";
  opacity: 0.64;
  transform: none;
  transform-origin: left;
}

.schematic-section .schematic-module:is(:hover, :focus-visible, :focus-within, .is-powered, .is-visited, .is-active, .is-current) {
  border-color: var(--border-strong);
  color: inherit;
  box-shadow: 0 0 0 1px var(--glow), var(--shadow-lg);
}

.schematic-section .schematic-module:is(:hover, :focus-visible, .is-current, .is-active) {
  transform: none;
}

.schematic-section .schematic-module:is(.is-powered, .is-visited, .is-active, .is-current)::before {
  opacity: 1;
}

.schematic-module:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.schematic-module-link {
  display: inline-flex;
  min-height: 44px;
  margin-top: auto;
  padding-top: 1rem;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.4;
}

.schematic-section .capability-grid {
  min-height: 0;
  padding: 1.5rem 0 3.5rem;
}

.schematic-section .capability-grid .skill-card {
  display: flex;
  min-height: 15rem;
  padding: 1.4rem;
  overflow: visible;
  flex-direction: column;
}

/* The SVG owns every schematic node; suppress the capability system's legacy dot. */
.schematic-section .capability-grid .skill-card::after {
  content: none;
}

.schematic-section .capability-grid > .skill-card:nth-child(even) {
  margin-top: 3.5rem;
  transform: none;
}

.schematic-section .capability-grid > .skill-card:nth-child(even):is(:hover, :focus-visible, .is-current, .is-active) {
  transform: none;
}

.schematic-section .capability-card-heading {
  align-items: center;
}

.schematic-section .capability-card-heading h3 {
  margin: 0;
}

.schematic-section .skill-list li {
  color: var(--text-soft);
}

.schematic-pair-grid {
  padding-block: 1.5rem 3.5rem;
}

.education-blueprint.schematic-section {
  min-height: 0;
  padding-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.education-blueprint .schematic-pair-grid {
  padding-bottom: 0;
}

.schematic-pair-grid > :nth-child(even) {
  margin-top: 4rem;
}

.schematic-section .experience-timeline {
  margin: 0;
  padding-inline: 0;
  list-style: none;
}

.schematic-section .experience-timeline > li {
  position: relative;
  display: block;
  padding: 0;
}

.schematic-section .experience-timeline .experience-milestone {
  height: 100%;
  padding-top: 0;
  overflow: hidden;
}

.schematic-section .experience-timeline .experience-milestone::before {
  content: none;
}

.schematic-section .visual-link-card-image picture {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0.65rem;
  background:
    radial-gradient(circle at 50% 50%, var(--glow), transparent 76%),
    var(--surface-strong);
}

.schematic-section .visual-link-card-image img {
  object-fit: contain;
}

.schematic-section .visual-link-card:hover img,
.schematic-section .visual-link-card:focus-visible img {
  transform: none;
}

.contact-system-layout {
  align-items: start;
}

.about-profile-module {
  display: grid;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  gap: 1.25rem;
}

.about-profile-heading {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(108px, 0.42fr) minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 1.5rem);
}

.about-profile-heading h3,
.about-profile-heading p {
  margin-bottom: 0.45rem;
}

.about-profile-heading p,
.about-profile-principles dd {
  color: var(--text-soft);
}

.about-profile-portrait {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius-lg) - 0.35rem);
  background: var(--surface-strong);
  aspect-ratio: 4 / 5;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.about-profile-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-profile-principles {
  gap: 0.55rem;
}

.about-profile-principles div {
  padding-bottom: 0.55rem;
}

#contact .contact-card.schematic-module {
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  border-color: color-mix(in srgb, var(--border-strong) 78%, var(--border));
  text-align: left;
}

#contact .contact-card.schematic-module > .eyebrow,
#contact .contact-card.schematic-module > p {
  margin-inline: 0;
}

#contact .contact-card.schematic-module h3 {
  max-width: 14ch;
}

#contact .contact-card.schematic-module .contact-actions {
  justify-content: flex-start;
}

@media (min-width: 761px) and (max-width: 1023px) {
  .project-handoff {
    height: clamp(21rem, 52vw, 30rem);
  }

  .schematic-section {
    min-height: clamp(40rem, 84vw, 55rem);
  }

  .schematic-module-grid {
    gap: 3rem clamp(4rem, 10vw, 6.5rem);
  }

  .schematic-section .capability-grid > .skill-card:nth-child(even),
  .schematic-pair-grid > :nth-child(even) {
    margin-top: 2.25rem;
  }
}

@media (max-width: 760px) {
  .handoff-layout-desktop {
    display: none;
  }

  .handoff-layout-mobile {
    display: block;
  }

  .project-handoff {
    width: 100%;
    height: clamp(30rem, 145vw, 42rem);
    margin-top: 1rem;
    aspect-ratio: auto;
  }

  .project-handoff-circuit,
  .handoff-layout-mobile {
    width: 100%;
    max-width: 30rem;
    height: 100%;
    margin-inline: auto;
  }

  .handoff-label-body {
    gap: 5px;
  }

  .handoff-label-body strong {
    font-size: 24px;
  }

  .handoff-label-body span {
    display: block;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.2;
  }

  .schematic-story {
    --schematic-mobile-rail: 1rem;
  }

  .schematic-section {
    min-height: 0;
    padding-block: 4.5rem;
  }

  .schematic-heading {
    width: calc(100% - 3.25rem);
    margin-right: 0;
    margin-left: 3.25rem;
    text-align: left;
  }

  .schematic-heading > .eyebrow {
    justify-self: start;
  }

  .schematic-heading p {
    margin-inline: 0;
    text-align: left;
  }

  .schematic-module-grid,
  .schematic-section .capability-grid,
  .schematic-section .experience-timeline {
    padding: 1.25rem 0 2rem 3.25rem;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .schematic-section .capability-grid > .skill-card,
  .schematic-section .capability-grid > .skill-card:nth-child(even),
  .schematic-pair-grid > :nth-child(even) {
    min-height: 0;
    margin-top: 0;
    transform: none;
  }

  .schematic-section .schematic-module:is(:hover, :focus-visible, .is-current, .is-active),
  .schematic-section .capability-grid > .skill-card:nth-child(even):is(:hover, :focus-visible, .is-current, .is-active) {
    transform: none;
  }

  .schematic-section .experience-timeline .visual-link-card-image {
    min-height: 12rem;
  }

  .contact-system-layout {
    padding-bottom: 0;
  }

  .about-profile-heading {
    grid-template-columns: minmax(90px, 0.34fr) minmax(0, 1fr);
  }

  html:not(.js) .schematic-segment {
    display: none;
  }

  html:not(.js) .schematic-section::after {
    position: absolute;
    z-index: 0;
    top: 0;
    bottom: 0;
    left: var(--schematic-mobile-rail);
    width: 2px;
    background: linear-gradient(var(--accent), var(--border-strong));
    content: "";
    pointer-events: none;
  }

  html:not(.js) .schematic-section .schematic-module::before {
    top: 50%;
    right: auto;
    left: -2.25rem;
    width: 2.25rem;
    height: 1px;
    background: var(--schematic-guide-color);
    opacity: 0.86;
    transform: translateY(-50%);
  }
}

@media (max-width: 480px) {
  .schematic-heading {
    width: calc(100% - 2.75rem);
    margin-left: 2.75rem;
    padding-inline: 0.75rem;
  }

  .schematic-module-grid,
  .schematic-section .capability-grid,
  .schematic-section .experience-timeline {
    padding-left: 2.75rem;
  }

  html:not(.js) .schematic-section .schematic-module::before {
    left: -1.75rem;
    width: 1.75rem;
  }

  .schematic-section .capability-grid .skill-card,
  .about-profile-module,
  #contact .contact-card.schematic-module {
    padding: 1rem;
  }

  .about-profile-heading {
    align-items: start;
    grid-template-columns: minmax(76px, 0.3fr) minmax(0, 1fr);
    gap: 0.8rem;
  }

  .about-profile-heading h3 {
    font-size: 1.05rem;
  }

  .about-profile-heading p {
    font-size: 0.9rem;
  }
}

/* Scroll-built SR latch and load switch ---------------------------------- */

.project-handoff {
  --handoff-source-build: 1;
  --handoff-logic-build: 1;
  --handoff-wiring-build: 1;
  --handoff-switch-progress: 1;
  --handoff-switch-angle: 26deg;
  --handoff-switch-glow-radius: 8px;
  --handoff-mosfet-progress: 1;
  --handoff-current-source: 1;
  --handoff-current-r2: 1;
  --handoff-current-latch: 1;
  --handoff-current-gate: 1;
  --handoff-current-output: 1;
  --handoff-head-source: 0;
  --handoff-head-r2: 0;
  --handoff-head-latch: 0;
  --handoff-head-output: 0;
  background: radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 56%);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.project-handoff-circuit {
  overflow: visible;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--glow) 76%, transparent));
}

.project-handoff-circuit path,
.project-handoff-circuit rect,
.project-handoff-circuit circle {
  vector-effect: non-scaling-stroke;
}

.handoff-source-stage { --handoff-stage-progress: var(--handoff-source-build); }
.handoff-logic-stage { --handoff-stage-progress: var(--handoff-logic-build); }
.handoff-wiring-stage { --handoff-stage-progress: var(--handoff-wiring-build); }
.handoff-driver-stage { --handoff-stage-progress: var(--handoff-wiring-build); }

.project-handoff [data-handoff-stage] {
  opacity: var(--handoff-stage-progress);
}

.handoff-module-shell,
.handoff-driver-shell {
  fill: color-mix(in srgb, var(--surface) 94%, transparent);
  stroke: color-mix(in srgb, var(--text-soft) 74%, var(--border));
  stroke-width: 2;
}

.handoff-source-shell {
  fill: color-mix(in srgb, var(--surface-strong) 88%, var(--accent) 12%);
}

.handoff-source-symbol,
.handoff-gate {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 78%, var(--text-soft));
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.handoff-switch-base,
.handoff-switch-blade,
.handoff-resistor,
.handoff-mosfet {
  fill: none;
  stroke: color-mix(in srgb, var(--text-soft) 72%, var(--border));
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.handoff-switch-contact,
.handoff-port,
.handoff-convergence-node {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
}

.handoff-switch-contact {
  stroke: color-mix(in srgb, var(--text-soft) 72%, var(--border));
}

.handoff-switch-blade {
  transform: rotate(var(--handoff-switch-angle));
  transform-box: fill-box;
  transform-origin: left bottom;
}

.handoff-reset-switch .handoff-switch-blade {
  transform: none;
}

.handoff-switch-contact {
  fill: var(--accent);
  fill-opacity: var(--handoff-switch-progress);
  filter: drop-shadow(0 0 var(--handoff-switch-glow-radius) var(--accent));
}

.handoff-reset-switch .handoff-switch-contact {
  fill-opacity: 0;
  filter: none;
}

.handoff-trace {
  fill: none;
  stroke: color-mix(in srgb, var(--text-soft) 54%, transparent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.handoff-feedback-trace,
.handoff-logic-trace,
.handoff-driver-trace {
  stroke: color-mix(in srgb, var(--accent-secondary) 58%, var(--text-faint));
}

.handoff-driver-shell {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.handoff-mosfet-channel {
  fill: none;
  stroke: color-mix(in srgb, var(--text-soft) 58%, var(--border));
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  opacity: 1;
  filter: none;
}

.handoff-mosfet-enable {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.5;
  opacity: var(--handoff-mosfet-progress);
  filter: drop-shadow(0 0 9px var(--accent));
}

.handoff-label-plate {
  fill: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  stroke: color-mix(in srgb, var(--border-strong) 74%, transparent);
  stroke-width: 1;
}

.handoff-device-pin {
  font-size: 11px;
}

.handoff-svg-label,
.handoff-wire-label {
  fill: var(--text);
  font-family: var(--font-mono);
  paint-order: stroke;
  stroke: color-mix(in srgb, var(--bg) 92%, transparent);
  stroke-linejoin: round;
  stroke-width: 5px;
}

.handoff-svg-title {
  font-size: 24px;
  font-weight: 820;
  letter-spacing: 0.035em;
}

.handoff-svg-detail {
  fill: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.handoff-wire-label {
  fill: var(--accent-strong);
  font-size: 13px;
  font-weight: 820;
  letter-spacing: 0.1em;
  stroke-width: 4px;
}

.handoff-current-layer {
  pointer-events: none;
}

.handoff-low-state {
  fill: none;
  stroke: var(--accent-secondary);
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--handoff-current-gate));
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  opacity: var(--handoff-current-gate);
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent-secondary) 78%, transparent));
}

[data-current-stage="source"] {
  --handoff-current-progress: var(--handoff-current-source);
  --handoff-head-opacity: var(--handoff-head-source);
}

[data-current-stage="r2"] {
  --handoff-current-progress: var(--handoff-current-r2);
  --handoff-head-opacity: var(--handoff-head-r2);
}

[data-current-stage="latch"] {
  --handoff-current-progress: var(--handoff-current-latch);
  --handoff-head-opacity: var(--handoff-head-latch);
}

[data-current-stage="output"] {
  --handoff-current-progress: var(--handoff-current-output);
  --handoff-head-opacity: var(--handoff-head-output);
}

.handoff-current-trail,
.handoff-current-head,
.handoff-logic-state-trail,
.handoff-logic-state-head {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.handoff-current-trail,
.handoff-current-head {
  stroke: var(--accent);
  filter: drop-shadow(0 0 7px var(--accent));
}

.handoff-current-trail,
.handoff-logic-state-trail {
  stroke-width: 4;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--handoff-current-progress));
  opacity: clamp(0, calc(var(--handoff-current-progress) * 1000), 1);
}

/* Once the switched output energizes, keep its full descent cyan while the
   brighter head continues to show the live position. */
.handoff-current-trail[data-current-stage="output"] {
  stroke-dashoffset: 0;
}

.handoff-current-head,
.handoff-logic-state-head {
  stroke: color-mix(in srgb, white 74%, var(--accent));
  stroke-width: 7;
  stroke-dasharray: 0.035 0.965;
  stroke-dashoffset: calc(1 - var(--handoff-current-progress));
  opacity: var(--handoff-head-opacity);
  filter: drop-shadow(0 0 11px var(--accent));
}

.handoff-logic-state-trail {
  stroke: var(--accent-secondary);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent-secondary) 74%, transparent));
}

.handoff-logic-state-head {
  stroke: color-mix(in srgb, white 58%, var(--accent-secondary));
  filter: drop-shadow(0 0 10px var(--accent-secondary));
}

.project-handoff.is-handoff-complete :is(.handoff-current-head, .handoff-logic-state-head) {
  opacity: 0;
}

@media (min-width: 1024px) and (min-height: 650px) and (hover: hover) and (pointer: fine) {
  html[data-scroll-experience="story"] .project-handoff {
    opacity: 0;
    mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  }

  html[data-scroll-experience="story"] .project-handoff:is(.is-handoff-active, .is-handoff-complete) {
    opacity: var(--handoff-source-build);
  }

  html[data-scroll-experience="story"] .project-story .project-carousel,
  html[data-scroll-experience="story"] .project-story .section-heading {
    opacity: calc(1 - var(--handoff-project-fade, 0));
  }

  html[data-scroll-experience="story"] .project-story.is-handoff-active .project-carousel,
  html[data-scroll-experience="story"] .project-story.is-handoff-active .section-heading {
    opacity: calc(1 - var(--handoff-project-fade, 0));
  }
}

/* A short bright dash rides the retained powered trail through every section. */

.schematic-route-current,
.schematic-branch-current {
  fill: none;
  stroke: color-mix(in srgb, white 76%, var(--accent));
  stroke-linecap: round;
  stroke-width: 6;
  opacity: 0;
  filter: drop-shadow(0 0 10px var(--accent));
}

.schematic-route-current {
  stroke-dasharray: 0.018 0.982;
  stroke-dashoffset: calc(1 - var(--segment-progress, 0));
}

.schematic-branch-current {
  stroke-dasharray: 0.055 0.945;
  stroke-dashoffset: calc(1 - var(--branch-progress, 0));
}

.schematic-section.is-schematic-current > .schematic-segment > .schematic-route-current,
[data-schematic-branch].is-current > .schematic-branch-current {
  opacity: 1;
}

.schematic-section .schematic-module:is(.is-current, .is-powered) {
  transform: none;
}

.schematic-section .schematic-module:is(:hover, :focus-visible, :focus-within) {
  transform: none;
}

/* The powered portfolio line makes a real return to ground before Contact. */

.schematic-ground {
  --ground-progress: 1;
  --ground-glow-radius: 11px;
  position: relative;
  z-index: 3;
  display: grid;
  width: 100%;
  min-height: 0;
  margin: clamp(0.75rem, 1.8vw, 1.35rem) auto 0;
  justify-items: center;
}

.schematic-ground-diagram {
  display: block;
  width: min(100%, 230px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 18px 35px rgba(0, 0, 0, 0.2));
}

.schematic-ground-diagram path,
.schematic-ground-diagram circle {
  vector-effect: non-scaling-stroke;
}

.handoff-output-anchor,
.schematic-entry-anchor,
.schematic-ground-entry {
  fill: transparent;
  stroke: none;
  opacity: 0;
  pointer-events: none;
}

.schematic-ground-feed,
.schematic-ground-current,
.schematic-ground-head,
.schematic-ground-symbol {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.schematic-ground-feed,
.schematic-ground-symbol {
  stroke: var(--schematic-guide-color);
  stroke-width: 2;
}

.schematic-ground-current {
  stroke: var(--accent);
  stroke-width: 4;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--ground-progress));
  filter: drop-shadow(0 0 8px var(--accent));
}

.schematic-ground-head {
  stroke: color-mix(in srgb, white 76%, var(--accent));
  stroke-width: 7;
  stroke-dasharray: 0.08 0.92;
  stroke-dashoffset: calc(1 - var(--ground-progress));
  opacity: 0;
  filter: drop-shadow(0 0 11px var(--accent));
}

.schematic-ground.is-current .schematic-ground-head {
  opacity: 1;
}

.schematic-ground.is-powered .schematic-ground-symbol {
  stroke: var(--accent);
  stroke-width: 4;
  filter: drop-shadow(0 0 var(--ground-glow-radius) var(--accent));
}

.final-contact-section {
  min-height: auto;
  margin-block: 0;
  padding-block: clamp(2.5rem, 5vw, 4rem) clamp(5rem, 8vw, 7rem);
}

.final-contact-section .contact-system-layout {
  position: relative;
  z-index: 2;
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.final-contact-section .contact-card {
  margin: 0;
}

/* Standard/touch presentation uses the vertical circuit at every width,
   including tablets whose coarse pointer keeps the project carousel in flow. */

.project-handoff[data-handoff-presentation="mobile"] {
  min-height: 43.2rem;
  height: clamp(43.2rem, 210vw, 64.8rem);
  margin-top: 1.5rem;
}

.project-handoff[data-handoff-presentation="mobile"] .handoff-layout-desktop {
  display: none;
}

.project-handoff[data-handoff-presentation="mobile"] .handoff-layout-mobile {
  display: block;
  width: 100%;
  max-width: 30rem;
  height: 100%;
  margin-inline: auto;
}

/* With no script, keep the complete circuit visibly energized. */

html:not(.js) :is(.handoff-current-head, .handoff-logic-state-head) {
  opacity: 0;
}

html:not(.js) .schematic-ground-symbol {
  stroke: var(--accent);
  stroke-width: 4;
  filter: drop-shadow(0 0 11px var(--accent));
}

@media (max-width: 760px) {
  html:not(.js) .schematic-ground::before {
    position: absolute;
    top: 0;
    left: var(--schematic-mobile-rail);
    width: calc(50% - var(--schematic-mobile-rail));
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--schematic-guide-color));
    content: "";
    pointer-events: none;
  }
}

@media (max-width: 760px) {
  .project-handoff {
    min-height: 43.2rem;
    height: clamp(43.2rem, 210vw, 64.8rem);
    margin-top: 1.5rem;
    mask-image: linear-gradient(90deg, transparent, #000 1.5%, #000 98.5%, transparent);
  }

  .handoff-svg-title {
    font-size: 25px;
  }

  .handoff-svg-detail {
    font-size: 19px;
  }

  .handoff-wire-label {
    font-size: 19px;
  }

  .handoff-current-trail,
  .handoff-logic-state-trail {
    stroke-width: 3;
  }

  .handoff-current-head,
  .handoff-logic-state-head {
    stroke-width: 5;
  }

  .schematic-ground-diagram {
    width: min(100%, 190px);
  }

  .final-contact-section .contact-system-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .schematic-section .schematic-module:is(:hover, :focus-visible, :focus-within) {
    transform: none;
  }

}

/* Phones use the content-first layout with no circuit rails, nodes, handoff,
   or terminal ground. The 64px body grid remains the only page grid. */
@media (max-width: 760px) {
  .project-handoff,
  .schematic-handoff-bridge,
  .schematic-segment,
  .schematic-ground {
    display: none !important;
  }

  .project-handoff {
    width: 0;
    min-height: 0;
    height: 0 !important;
    margin: 0 !important;
  }

  .schematic-heading {
    width: 100%;
    margin-inline: 0;
  }

  .schematic-module-grid,
  .schematic-section .capability-grid,
  .schematic-section .experience-timeline {
    padding-inline: 0;
  }

  .schematic-section .schematic-module::before,
  .capability-grid::before,
  .capability-grid .skill-card::after,
  .capability-card-heading::before,
  html:not(.js) .schematic-section::after {
    display: none;
    content: none;
  }

  .education-blueprint.schematic-section {
    padding-bottom: 4.5rem;
  }
}
