:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: #111722;
  --panel-soft: rgba(17, 23, 34, 0.72);
  --text: #f4f7fb;
  --muted: #a6b2c3;
  --line: rgba(255, 255, 255, 0.12);
  --cyan: #58d5e8;
  --green: #83e7b0;
  --amber: #7cc8ff;
  --red: #ef7d7d;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
  --path-hue: 190;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(88, 213, 232, 0.18), transparent 32rem),
    radial-gradient(circle at 80% 4%, rgba(131, 231, 176, 0.14), transparent 30rem),
    linear-gradient(180deg, #080a0f 0%, #0d1018 58%, #080a0f 100%);
  background-attachment: fixed;
  background-size: 100vw 100vh;
  background-repeat: no-repeat;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body.is-loading {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1.4rem;
  background:
    radial-gradient(circle at 50% 42%, rgba(88, 213, 232, 0.2), transparent 22rem),
    #080a0f;
  transition: opacity 520ms ease, visibility 520ms ease;
}

body.is-loaded .page-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-board {
  position: relative;
  width: 8rem;
  aspect-ratio: 1.45;
  border: 1px solid rgba(88, 213, 232, 0.62);
  background: linear-gradient(135deg, rgba(88, 213, 232, 0.16), rgba(131, 231, 176, 0.08));
  box-shadow: 0 0 54px rgba(88, 213, 232, 0.24);
  animation: loader-float 1400ms ease-in-out infinite;
}

.loader-board::before {
  content: "";
  position: absolute;
  inset: 31% 34%;
  border: 1px solid rgba(244, 247, 251, 0.62);
  background: rgba(244, 247, 251, 0.08);
}

.loader-board span {
  position: absolute;
  width: 0.55rem;
  aspect-ratio: 1;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(88, 213, 232, 0.8);
  animation: loader-pulse 900ms ease-in-out infinite;
}

.loader-board span:nth-child(1) {
  top: 18%;
  left: 14%;
}

.loader-board span:nth-child(2) {
  top: 20%;
  right: 15%;
  animation-delay: 120ms;
}

.loader-board span:nth-child(3) {
  bottom: 19%;
  left: 20%;
  animation-delay: 240ms;
}

.loader-board span:nth-child(4) {
  right: 18%;
  bottom: 17%;
  animation-delay: 360ms;
}

.page-loader p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

@keyframes loader-float {
  0%,
  100% {
    transform: translateY(0) rotateX(58deg) rotateZ(-10deg);
  }

  50% {
    transform: translateY(-0.65rem) rotateX(58deg) rotateZ(-6deg);
  }
}

@keyframes loader-pulse {
  0%,
  100% {
    opacity: 0.32;
  }

  50% {
    opacity: 1;
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 0 5vw;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 15, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 750;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid rgba(88, 213, 232, 0.48);
  background: linear-gradient(135deg, rgba(88, 213, 232, 0.24), rgba(131, 231, 176, 0.16));
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 800;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.menu-toggle {
  display: none;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 1px solid rgba(88, 213, 232, 0.34);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 1.15rem;
  height: 2px;
  grid-area: 1 / 1;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.menu-toggle span:nth-child(1) {
  transform: translateY(-0.42rem);
}

.menu-toggle span:nth-child(3) {
  transform: translateY(0.42rem);
}

.site-header.is-menu-open .menu-toggle span:nth-child(1) {
  transform: rotate(45deg);
}

.site-header.is-menu-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}

.site-header.is-menu-open .menu-toggle span:nth-child(3) {
  transform: rotate(-45deg);
}

.top-nav a {
  padding: 0.64rem 0.78rem;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.top-nav .nav-cv {
  border-color: rgba(88, 213, 232, 0.42);
  background: var(--cyan);
  color: #071015;
  font-weight: 800;
}

.top-nav .nav-cv:hover {
  border-color: rgba(131, 231, 176, 0.58);
  background: var(--green);
  color: #071015;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
}

.lang-switch button {
  min-width: 2.25rem;
  min-height: 2rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  transition: background 180ms ease, color 180ms ease;
}

.lang-switch button:hover,
.lang-switch button[aria-pressed="true"] {
  background: var(--cyan);
  color: #071015;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5.5rem);
  min-height: calc(100vh - 72px);
  padding: 5rem 5vw 3rem;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1.3rem;
  font-size: clamp(3rem, 7vw, 6.9rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4.6vw, 4.6rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  font-size: 1.28rem;
  line-height: 1.16;
}

.lead {
  max-width: 58ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.45vw, 1.35rem);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.1rem;
  border: 1px solid var(--line);
  font-weight: 760;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

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

.button.primary {
  border-color: rgba(88, 213, 232, 0.42);
  background: var(--cyan);
  color: #071015;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.hero-visual {
  position: relative;
  min-height: clamp(420px, 54vh, 620px);
  overflow: visible;
  transform:
    perspective(1200px)
    rotateX(var(--tilt-x, 0deg))
    rotateY(var(--tilt-y, 0deg));
  transform-style: preserve-3d;
  transition: transform 180ms ease-out;
}

.embedded-device {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(74%, 480px);
  aspect-ratio: 1.45;
  z-index: 3;
  transform:
    translate(-50%, -50%)
    rotateX(var(--device-x, 58deg))
    rotateY(var(--device-y, 0deg))
    rotateZ(var(--device-z, -14deg));
  transform-style: preserve-3d;
  transition: transform 120ms ease-out;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.embedded-device::before {
  content: "";
  position: absolute;
  inset: 18% 8% 8%;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(88, 213, 232, 0.28), rgba(88, 213, 232, 0.08) 42%, transparent 68%);
  filter: blur(26px);
  transform: translateZ(-34px);
  opacity: 0.72;
  pointer-events: none;
}

.embedded-device:active {
  cursor: grabbing;
}

.pcb-board {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(88, 213, 232, 0.58);
  background:
    linear-gradient(90deg, rgba(88, 213, 232, 0.14) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(0deg, rgba(88, 213, 232, 0.1) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(135deg, #102b36, #0b1720 62%, #081018);
  box-shadow:
    0 24px 58px rgba(0, 0, 0, 0.42),
    0 0 22px rgba(88, 213, 232, 0.1);
  transform-style: preserve-3d;
}

.pcb-board::before,
.pcb-board::after {
  content: "";
  position: absolute;
  inset: 0;
  border: inherit;
  background: #050a0e;
  transform: translateZ(-18px);
}

.pcb-board::after {
  inset: auto 0 -18px;
  height: 18px;
  background: #04080c;
  transform: rotateX(-90deg);
  transform-origin: top;
}

.chip,
.port,
.trace,
.pin-row,
.status-led {
  position: absolute;
  transform: translateZ(16px);
}

.chip {
  border: 1px solid rgba(244, 247, 251, 0.28);
  background: linear-gradient(135deg, #182532, #090d14);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

.main-chip {
  left: 34%;
  top: 30%;
  width: 28%;
  height: 34%;
}

.main-chip::before {
  content: "MCU";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(244, 247, 251, 0.7);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.radio-chip {
  right: 13%;
  top: 18%;
  width: 18%;
  height: 18%;
}

.port {
  background: linear-gradient(135deg, #d7e7f2, #6e8799);
}

.usb-port {
  left: 4%;
  top: 39%;
  width: 14%;
  height: 22%;
}

.sensor-port {
  right: 7%;
  bottom: 16%;
  width: 20%;
  height: 10%;
}

.trace {
  height: 2px;
  background: rgba(88, 213, 232, 0.68);
  box-shadow: 0 0 16px rgba(88, 213, 232, 0.5);
  transform: translateZ(17px);
}

.trace-a {
  left: 18%;
  top: 46%;
  width: 16%;
}

.trace-b {
  left: 58%;
  top: 38%;
  width: 25%;
  transform: translateZ(17px) rotate(-16deg);
}

.trace-c {
  left: 41%;
  bottom: 22%;
  width: 36%;
}

.trace-d {
  left: 22%;
  top: 24%;
  width: 20%;
  transform: translateZ(17px) rotate(28deg);
}

.pin-row {
  top: 8%;
  bottom: 8%;
  width: 0.38rem;
  background: repeating-linear-gradient(
    to bottom,
    rgba(244, 247, 251, 0.8) 0 0.5rem,
    transparent 0.5rem 1rem
  );
}

.row-left {
  left: 8%;
}

.row-right {
  right: 8%;
}

.status-led {
  width: 0.72rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 20px rgba(88, 213, 232, 0.72);
  animation: led-blink 1500ms ease-in-out infinite;
}

.led-one {
  left: 24%;
  bottom: 18%;
}

.led-two {
  left: 29%;
  bottom: 18%;
  animation-delay: 250ms;
}

.led-three {
  left: 34%;
  bottom: 18%;
  animation-delay: 500ms;
}

@keyframes led-blink {
  0%,
  80%,
  100% {
    opacity: 0.38;
  }

  35% {
    opacity: 1;
  }
}

.stats-band,
.story-section,
.projects-section,
.stack-section,
.project-page {
  padding-inline: 5vw;
}

.stats-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border-block: 1px solid var(--line);
  background: var(--line);
}

.stats-band div {
  display: grid;
  gap: 0.25rem;
  padding: 1.35rem;
  background: rgba(8, 10, 15, 0.84);
}

.stats-band strong {
  font-size: 1.28rem;
}

.stats-band span {
  color: var(--muted);
  font-size: 0.92rem;
}

.story-section,
.projects-section,
.stack-section {
  overflow-x: clip;
  padding-top: clamp(5rem, 10vw, 8rem);
  padding-bottom: clamp(4rem, 8vw, 7rem);
}

.section-heading {
  max-width: 850px;
  margin-bottom: 2rem;
}

.timeline-item,
.project-card,
.project-main,
.project-side {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(120px, 16vw, 220px) minmax(0, 1fr);
  row-gap: clamp(9rem, 16vw, 14rem);
  column-gap: clamp(2.5rem, 6vw, 5rem);
  --timeline-pad: clamp(5rem, 10vw, 8rem);
  padding-block: var(--timeline-pad);
  --timeline-progress: 0;
}

.timeline-path {
  position: absolute;
  top: var(--timeline-pad);
  left: 50%;
  width: clamp(120px, 16vw, 220px);
  height: calc(100% - (var(--timeline-pad) * 2));
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.timeline-path path {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.timeline-path-base {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 2;
  stroke-dasharray: 2.6 4.2;
}

.timeline-path-progress {
  stroke: hsl(var(--path-hue), 88%, 66%);
  stroke-width: 2.6;
  stroke-dasharray: 2.6 4.2;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 10px rgba(88, 213, 232, 0.55));
}

.timeline-item {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  min-height: 250px;
  padding: clamp(1.2rem, 2.4vw, 1.8rem);
  opacity: 0;
  transform: translateX(var(--fly-after, -110vw)) translateY(4rem) scale(0.9);
  transition:
    opacity 520ms ease,
    transform 680ms cubic-bezier(0.2, 0.86, 0.22, 1),
    border-color 280ms ease,
    background 280ms ease,
    box-shadow 280ms ease;
}

.timeline-item:nth-of-type(odd) {
  grid-column: 1;
  --fly-before: 110vw;
  --fly-after: -110vw;
}

.timeline-item:nth-of-type(even) {
  grid-column: 3;
  --fly-before: -110vw;
  --fly-after: 110vw;
}

.timeline-item:nth-of-type(1) {
  grid-row: 1;
}

.timeline-item:nth-of-type(2) {
  grid-row: 2;
}

.timeline-item:nth-of-type(3) {
  grid-row: 3;
}

.timeline-item:nth-of-type(4) {
  grid-row: 4;
}

.timeline-item:nth-of-type(5) {
  grid-row: 5;
}

.timeline-item.is-onstage {
  opacity: 0.48;
  transform: translateX(0) translateY(0) scale(0.96);
}

.timeline-item.is-before {
  opacity: 0;
  transform: translateX(var(--fly-before)) translateY(-4rem) scale(0.9);
}

.timeline-item.is-after {
  opacity: 0;
  transform: translateX(var(--fly-after)) translateY(4rem) scale(0.9);
}

.timeline-item.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  border-color: rgba(88, 213, 232, 0.44);
  background: rgba(17, 29, 42, 0.82);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.32), 0 0 42px rgba(88, 213, 232, 0.08);
}

.timeline-item h3 {
  max-width: 18ch;
  margin-bottom: 0.1rem;
  font-size: clamp(1.35rem, 2.1vw, 2.05rem);
}

.timeline-item p {
  max-width: 58ch;
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.62;
}

.timeline-date,
.project-index,
.card-link {
  color: var(--amber);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timeline-item p,
.project-card p,
.project-main p,
.project-main li {
  color: var(--muted);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.project-card {
  display: grid;
  align-content: space-between;
  min-height: 310px;
  padding: 1.35rem;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(88, 213, 232, 0.42);
  background: rgba(18, 29, 42, 0.82);
}

.stack-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.72rem;
}

.stack-cloud span {
  padding: 0.72rem 0.92rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-weight: 680;
}

.stack-cloud.compact span {
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 5vw;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer div {
  display: grid;
  gap: 0.3rem;
}

.site-footer strong {
  color: var(--text);
}

.footer-links {
  text-align: right;
}

.footer-links a:hover {
  color: var(--cyan);
}

.project-page {
  min-height: calc(100vh - 72px);
  padding-top: clamp(4rem, 8vw, 7rem);
  padding-bottom: clamp(4rem, 8vw, 7rem);
}

.contact-page {
  min-height: calc(100vh - 72px);
  padding: clamp(4rem, 8vw, 7rem) 5vw clamp(4rem, 8vw, 7rem);
}

.contact-hero,
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: clamp(1rem, 4vw, 3rem);
}

.contact-hero > *,
.contact-layout > * {
  min-width: 0;
}

.contact-hero {
  align-items: end;
  margin-bottom: 1rem;
}

.contact-hero h1 {
  max-width: 920px;
}

.contact-direct,
.contact-form,
.contact-note {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
}

.contact-direct {
  display: grid;
  gap: 0.45rem;
  padding: 1.25rem;
}

.contact-direct span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.contact-direct a:hover {
  color: var(--cyan);
}

.contact-direct a,
.contact-note p,
.form-status,
.stack-cloud span {
  overflow-wrap: anywhere;
}

.contact-note h2 {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

html[lang="uk"] .contact-note h2 {
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1.08;
}

.contact-form,
.contact-note {
  padding: clamp(1.1rem, 2.6vw, 1.65rem);
}

.contact-form {
  display: grid;
  gap: 1rem;
}

.form-row {
  display: grid;
  gap: 0.45rem;
}

.form-row label {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 760;
}

.form-row input,
.form-row textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  padding: 0.85rem 0.95rem;
  outline: none;
  resize: vertical;
}

.form-row input:focus,
.form-row textarea:focus {
  border-color: rgba(88, 213, 232, 0.64);
  box-shadow: 0 0 0 3px rgba(88, 213, 232, 0.11);
}

.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-status.is-success {
  color: var(--green);
}

.form-status.is-error {
  color: var(--red);
}

.project-hero {
  max-width: 980px;
  margin-bottom: 2rem;
}

.project-hero-with-media {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, clamp(320px, 30vw, 520px));
  align-items: center;
  gap: clamp(1.5rem, 4.5vw, 4.25rem);
  max-width: none;
  min-height: min(660px, calc(100vh - 130px));
}

.project-hero-copy {
  max-width: 980px;
}

.project-hero-media {
  position: relative;
  overflow: hidden;
  width: fit-content;
  max-width: 100%;
  justify-self: center;
  border: 1px solid rgba(88, 213, 232, 0.34);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.3);
}

.project-hero-media img {
  display: block;
  width: auto;
  max-width: 100%;
  height: min(72vh, 720px);
  object-fit: contain;
}

/* The source is a full phone screenshot with a large empty browser area below
   the camera UI. Keep the original asset, but show only its useful content. */
.vision-project-page .project-hero-media {
  width: 100%;
  max-width: 576px;
  aspect-ratio: 576 / 830;
}

.vision-project-page .project-hero-media img {
  width: 100%;
  height: auto;
  max-width: none;
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1rem;
}

.project-main,
.project-side {
  padding: 1.5rem;
}

.project-main ul {
  margin: 0;
  padding-left: 1.2rem;
}

.project-main li + li {
  margin-top: 0.65rem;
}

.feature-list,
.project-facts {
  display: grid;
  gap: 0.8rem;
}

.feature-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1.4rem;
}

.feature-list div,
.project-facts div {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
  padding: 1rem;
}

.feature-list strong,
.project-facts strong {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text);
  font-size: 0.98rem;
}

.feature-list p,
.project-facts span {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.project-facts {
  margin-top: 1.2rem;
}

.project-facts strong {
  color: var(--cyan);
  font-size: 1.25rem;
}

.vision-project-page {
  padding-top: clamp(1.5rem, 4vw, 3.5rem);
}

.vision-selector-wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(440px, 1.2fr);
  align-items: end;
  gap: clamp(1.5rem, 5vw, 5rem);
  margin-bottom: clamp(3rem, 7vw, 6rem);
}

.vision-selector-copy h1 {
  max-width: 760px;
  margin-bottom: clamp(1.8rem, 3vw, 2.8rem);
  font-size: clamp(2.4rem, 5vw, 5.8rem);
}

.vision-selector-copy > p:not(.eyebrow) {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.vision-selector-copy .vision-selector-note {
  margin-top: 1rem;
  color: rgba(166, 178, 195, 0.76);
  font-size: 0.9rem;
}

.project-context {
  max-width: 900px;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.25vw, 1.08rem);
  line-height: 1.75;
}

.npu-performance {
  display: grid;
  grid-template-columns: minmax(150px, 0.32fr) minmax(0, 1fr);
  gap: 1.2rem;
  align-items: center;
  max-width: 900px;
  margin-top: 1.4rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(131, 231, 176, 0.34);
  background: linear-gradient(135deg, rgba(131, 231, 176, 0.1), rgba(88, 213, 232, 0.045));
}

.npu-performance strong {
  color: var(--green);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
}

.npu-performance p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.vision-switch {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 96px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.035)),
    rgba(9, 14, 23, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 22px 70px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.vision-switch::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 20% 0%, rgba(88, 213, 232, 0.2), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(131, 231, 176, 0.12), transparent 44%);
  pointer-events: none;
}

.vision-switch-droplet {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 7px;
  z-index: -1;
  width: calc(50% - 7px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 24px 28px 26px 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(88, 213, 232, 0.11) 55%, rgba(255, 255, 255, 0.08));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.3),
    inset 0 -10px 30px rgba(88, 213, 232, 0.08),
    0 8px 28px rgba(0, 0, 0, 0.24),
    0 0 32px rgba(88, 213, 232, 0.1);
  transform: translateX(0) rotate(-0.35deg);
  will-change: transform;
  transition:
    transform 760ms cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 620ms ease,
    background 620ms ease,
    box-shadow 620ms ease;
}

.vision-switch[data-active="esp8266"] .vision-switch-droplet {
  border-radius: 29px 24px 30px 25px;
  transform: translateX(100%) rotate(0.35deg);
}

.vision-switch button {
  display: grid;
  align-content: center;
  gap: 0.28rem;
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 480ms ease, transform 480ms ease;
}

.vision-switch button:hover {
  color: var(--text);
}

.vision-switch button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -5px;
  border-radius: 23px;
}

.vision-switch button[aria-selected="true"] {
  color: var(--text);
}

.vision-switch button small {
  color: var(--cyan);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.vision-switch button span {
  overflow: hidden;
  font-size: clamp(0.86rem, 1.4vw, 1.05rem);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-variant[hidden] {
  display: none;
}

.project-variant.is-entering-next {
  animation: vision-panel-next 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.project-variant.is-entering-prev {
  animation: vision-panel-prev 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes vision-panel-next {
  from { opacity: 0; transform: translateX(48px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes vision-panel-prev {
  from { opacity: 0; transform: translateX(-48px); }
  to { opacity: 1; transform: translateX(0); }
}

.project-display-title {
  max-width: 1050px;
  margin: 0 0 1rem;
  font-size: clamp(2.6rem, 6.5vw, 7.2rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.vision-architecture {
  margin: 0 0 1rem;
  padding: clamp(1.3rem, 3vw, 2.2rem);
  border: 1px solid rgba(88, 213, 232, 0.22);
  background:
    linear-gradient(135deg, rgba(88, 213, 232, 0.07), transparent 52%),
    rgba(17, 23, 34, 0.72);
  box-shadow: var(--shadow);
}

.architecture-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.architecture-heading h2 {
  max-width: 760px;
  margin: 0;
}

.architecture-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 0.65rem;
}

.architecture-node {
  display: grid;
  align-content: space-between;
  min-width: 0;
  min-height: 150px;
  padding: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.architecture-node.is-accent {
  border-color: rgba(131, 231, 176, 0.42);
  background: rgba(131, 231, 176, 0.08);
}

.node-number {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.76rem;
}

.architecture-node strong {
  margin: 1.5rem 0 0.35rem;
  font-size: clamp(0.92rem, 1.4vw, 1.08rem);
}

.architecture-node small {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.architecture-link {
  align-self: center;
  color: var(--cyan);
  font-size: 1.3rem;
}

.project-main > h2:not(:first-child) {
  margin-top: clamp(2.6rem, 5vw, 4.5rem);
}

.feature-list.protocol-list,
.feature-list.software-feature-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.processing-pipeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}

.processing-pipeline li {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  margin: 0 !important;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
}

.processing-pipeline li:last-child {
  grid-column: 1 / -1;
}

.processing-pipeline strong {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82rem;
}

.processing-pipeline span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

@media (max-width: 980px) {
  .vision-selector-wrap {
    grid-template-columns: 1fr;
  }

  .architecture-flow {
    grid-template-columns: 1fr;
  }

  .architecture-node {
    min-height: 120px;
  }

  .architecture-link {
    justify-self: center;
    transform: rotate(90deg);
  }

  .processing-pipeline {
    grid-template-columns: 1fr;
  }

  .processing-pipeline li:last-child {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .vision-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 1fr;
    min-height: 104px;
    border-radius: 24px;
  }

  .vision-switch-droplet {
    right: auto;
    bottom: 7px;
    width: calc(50% - 7px);
    height: auto;
    border-radius: 18px;
  }

  .vision-switch[data-active="esp8266"] .vision-switch-droplet {
    border-radius: 18px;
    transform: translateX(100%);
  }

  .vision-switch button {
    padding: 0.7rem 0.65rem;
  }

  .vision-switch button small {
    font-size: 0.57rem;
    letter-spacing: 0.07em;
  }

  .vision-switch button span {
    overflow: visible;
    font-size: 0.78rem;
    text-overflow: clip;
    white-space: normal;
  }

  .architecture-heading {
    display: block;
  }

  .project-display-title {
    font-size: clamp(2.25rem, 13vw, 3.6rem);
  }

  .feature-list.protocol-list,
  .feature-list.software-feature-list {
    grid-template-columns: 1fr;
  }

  .npu-performance {
    grid-template-columns: 1fr;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline .timeline-item.is-visible.is-before {
  opacity: 0;
  transform: translateX(var(--fly-before)) translateY(-4rem) scale(0.9);
}

.timeline .timeline-item.is-visible.is-after {
  opacity: 0;
  transform: translateX(var(--fly-after)) translateY(4rem) scale(0.9);
}

.timeline .timeline-item.is-visible.is-onstage {
  opacity: 0.48;
  transform: translateX(0) translateY(0) scale(0.96);
}

.timeline .timeline-item.is-visible.is-active {
  opacity: 1;
  transform: translateX(0) translateY(0) scale(1);
}

@media (max-width: 980px) {
  .site-header {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    padding-block: 0.85rem;
  }

  .menu-toggle {
    display: grid;
    margin-left: auto;
  }

  .top-nav {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 5vw;
    left: auto;
    display: grid;
    width: min(20rem, calc(100vw - 10vw));
    max-width: 20rem;
    gap: 0.35rem;
    padding: 0.65rem;
    border: 1px solid var(--line);
    background: rgba(8, 12, 18, 0.96);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-0.6rem);
    transition: opacity 180ms ease, transform 180ms ease;
    backdrop-filter: blur(18px);
  }

  .site-header.is-menu-open .top-nav {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .top-nav a,
  .lang-switch {
    width: 100%;
  }

  .top-nav a {
    display: block;
  }

  .lang-switch {
    justify-content: space-between;
  }

  .lang-switch button {
    flex: 1;
  }

  .hero,
  .project-hero-with-media,
  .project-layout,
  .contact-hero,
  .contact-layout {
    grid-template-columns: 1fr;
  }

  .project-hero-with-media {
    min-height: auto;
    align-items: start;
    gap: 2rem;
  }

  .project-hero-media {
    width: fit-content;
    max-width: min(100%, 460px);
    justify-self: start;
  }

  .project-hero-media img {
    width: 100%;
    height: auto;
  }

  .project-page {
    padding-top: clamp(3rem, 10vw, 5rem);
  }

  .contact-page {
    padding-top: clamp(3rem, 10vw, 5rem);
  }

  .contact-hero {
    align-items: start;
  }

  .project-hero {
    max-width: none;
    margin-bottom: 1.4rem;
  }

  .project-layout {
    gap: 0.85rem;
  }

  .project-main,
  .project-side {
    padding: clamp(1rem, 3.5vw, 1.35rem);
  }

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

  .hero {
    min-height: auto;
    padding-top: 3.5rem;
  }

  .hero-visual {
    min-height: 460px;
  }

  .timeline {
    grid-template-columns: 1fr;
    row-gap: 2.2rem;
    --timeline-pad: 2rem;
    padding-block: var(--timeline-pad);
    padding-left: clamp(2.4rem, 9vw, 3.5rem);
  }

  .timeline-path {
    display: block;
    top: var(--timeline-pad);
    left: clamp(0.9rem, 4vw, 1.35rem);
    width: 2.5rem;
    height: calc(100% - (var(--timeline-pad) * 2));
    transform: none;
  }

  .timeline-item:nth-of-type(odd),
  .timeline-item:nth-of-type(even) {
    grid-column: 1;
    margin-top: 0;
  }

  .timeline-item {
    min-height: auto;
    transform: translateY(1.4rem) scale(0.98);
    --fly-before: 0;
    --fly-after: 0;
  }

  .timeline-item h3 {
    max-width: 100%;
  }

  .timeline .timeline-item.is-visible.is-before,
  .timeline .timeline-item.is-visible.is-after,
  .timeline .timeline-item.is-visible.is-onstage {
    opacity: 0.86;
    transform: translateX(0) translateY(0) scale(0.99);
  }

  .timeline .timeline-item.is-visible.is-active {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
  }

  .stats-band,
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .stats-band,
  .story-section,
  .projects-section,
  .stack-section,
  .project-page,
  .contact-page {
    padding-inline: 1rem;
  }

  .site-header {
    padding-inline: 1rem;
  }

  .top-nav {
    right: 1rem;
    left: auto;
    width: min(18rem, calc(100vw - 2rem));
    max-width: 18rem;
  }

  .brand {
    white-space: normal;
  }

  .top-nav a {
    padding: 0.55rem 0.62rem;
    font-size: 0.84rem;
  }

  .hero {
    padding-top: 2.5rem;
  }

  h1 {
    font-size: clamp(2.3rem, 13vw, 3.6rem);
  }

  .project-page h1 {
    font-size: clamp(2.15rem, 12vw, 3.35rem);
  }

  .lead {
    font-size: 1.02rem;
  }

  .hero-visual {
    min-height: 360px;
  }

  .project-hero-with-media {
    gap: 1.45rem;
  }

  .project-hero-media {
    max-width: min(100%, 360px);
    justify-self: center;
  }

  .project-main,
  .project-side,
  .contact-form,
  .contact-note,
  .contact-direct {
    padding: 1rem;
  }

  .project-main p,
  .project-main li {
    font-size: 0.96rem;
    line-height: 1.68;
  }

  .feature-list div,
  .project-facts div {
    padding: 0.9rem;
  }

  .stack-cloud {
    gap: 0.55rem;
  }

  .stack-cloud.compact span {
    padding: 0.55rem 0.65rem;
    font-size: 0.84rem;
  }

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

  .stats-band,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .footer-links {
    text-align: left;
  }
}

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

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