/* ==========================================================================
   Hugo DIY Lab | The Workbench Schematic
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --lab-navy: #0E2236;
  --deep-bench: #071521;
  --coolant-teal: #2FC4D6;
  --volt-yellow: #FFD21F;
  --wire-red: #E8333A;
  --solder-silver: #C9D3DC;

  /* Derived */
  --ink: #EEF3F7;                 /* headings: 14.6:1 on navy */
  --wire-red-fill: #D0262E;       /* button fill, keeps white label at 5.2:1 (AA) */
  --wire-red-hover: #DA2B33;
  --teal-08: rgba(47, 196, 214, .08);
  --teal-20: rgba(47, 196, 214, .2);
  --teal-40: rgba(47, 196, 214, .4);
  --silver-15: rgba(201, 211, 220, .15);
  --panel: rgba(10, 27, 43, .88);

  --font-head: "Chakra Petch", "Bahnschrift", "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;

  --step--1: clamp(.875rem, .85rem + .12vw, .9375rem);
  --step-0: clamp(1rem, .97rem + .15vw, 1.0938rem);
  --step-1: clamp(1.0938rem, 1.03rem + .3vw, 1.25rem);
  --step-2: clamp(1.1875rem, 1.1rem + .4vw, 1.375rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  --step-4: clamp(2rem, 1.5rem + 2.2vw, 3.25rem);
  --step-hero: clamp(2.25rem, 1.35rem + 3.4vw, 4rem);

  --radius: 14px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --header-h: 76px;
  --gutter: 16px;
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1100px 620px at 82% -8%, rgba(47, 196, 214, .12), transparent 62%), var(--lab-navy);
  color: var(--solder-silver);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

p { margin: 0; }
a { color: var(--coolant-teal); }

:focus-visible {
  outline: 3px solid var(--volt-yellow);
  outline-offset: 3px;
  border-radius: 6px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--volt-yellow); color: var(--deep-bench); }

section[id] { scroll-margin-top: 72px; }

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

.skip-link {
  position: fixed;
  left: 16px; top: 12px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--volt-yellow);
  color: var(--deep-bench);
  font-family: var(--font-head);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .2s var(--ease-out);
}
.skip-link:focus { transform: none; }

.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Background: blueprint grid, noise, cursor glow ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 130% 95% at 50% 15%, #000 35%, rgba(0, 0, 0, .35) 100%);
  mask-image: radial-gradient(ellipse 130% 95% at 50% 15%, #000 35%, rgba(0, 0, 0, .35) 100%);
}

.bg__grid {
  position: absolute;
  inset: -120px;
  background-image:
    linear-gradient(rgba(47, 196, 214, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 196, 214, .075) 1px, transparent 1px),
    linear-gradient(rgba(47, 196, 214, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 196, 214, .035) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  animation: grid-drift 60s linear infinite;
  will-change: transform;
}

.bg__noise {
  position: absolute;
  inset: 0;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.cursor-glow {
  position: fixed;
  left: 0; top: 0;
  z-index: -1;
  width: 560px; height: 560px;
  margin: -280px 0 0 -280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 196, 214, .14) 0%, rgba(47, 196, 214, .05) 34%, transparent 66%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s ease;
  will-change: transform;
}
.cursor-glow.is-on { opacity: 1; }

@media (hover: none), (pointer: coarse) {
  .cursor-glow { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 48px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--btn-h);
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: .01em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn:active { transform: scale(.96); }

.btn--red {
  background: var(--wire-red-fill);
  border-color: var(--wire-red);
  color: #fff;
}
.btn--red::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(232, 51, 58, .45), 0 10px 32px -8px rgba(232, 51, 58, .85);
  opacity: .5;
  transition: opacity .25s ease;
}
.btn--red:hover { background: var(--wire-red-hover); }
.btn--red:hover::before { opacity: 1; }

.btn--ghost {
  background: var(--teal-08);
  border-color: rgba(47, 196, 214, .55);
  color: var(--coolant-teal);
}
.btn--ghost:hover {
  background: rgba(47, 196, 214, .16);
  border-color: var(--coolant-teal);
  color: var(--ink);
}

.btn--sm { --btn-h: 40px; padding: 0 16px; font-size: .9375rem; }
.btn--lg { --btn-h: 54px; padding: 0 26px; font-size: 1.0625rem; }

.btn__icon { width: 18px; height: 18px; flex: none; }

/* Magnetic wrapper: the hit zone is padded so the pull starts before the button. */
.magnet {
  display: inline-flex;
  padding: 14px;
  margin: -14px;
  transition: transform .4s var(--ease-out);
}
.magnet.is-pulling { transition-duration: .12s; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  transition: transform .35s var(--ease-out);
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(7, 21, 33, .86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(47, 196, 214, .2);
  opacity: 0;
  transition: opacity .35s ease;
}
.site-header::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 180px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--coolant-teal), transparent);
  opacity: 0;
  transition: opacity .35s ease;
}
.site-header.is-scrolled { transform: translateY(-12px); }
.site-header.is-scrolled::before { opacity: 1; }
.site-header.is-scrolled::after { opacity: .9; animation: header-current 5s linear infinite; }

.site-header__row {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform .35s var(--ease-out);
}
.site-header.is-scrolled .site-header__row { transform: translateY(6px); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand__mark {
  position: relative;
  flex: none;
  width: 40px; height: 40px;
  transform-origin: left center;
  transition: transform .35s var(--ease-out);
}
.site-header.is-scrolled .brand__mark { transform: scale(.86); }
.brand__mark img {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 10px;
  color: transparent;   /* hides alt text while a missing file is detected */
  font-size: 0;
}
.brand__fallback { display: none; width: 100%; height: 100%; }
.brand__mark.is-fallback img { display: none; }
.brand__mark.is-fallback .brand__fallback { display: block; }

.site-nav { margin-left: auto; }
.site-nav__list {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav__list a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--solder-silver);
  font-weight: 600;
  text-decoration: none;
  transition: color .2s ease;
}
.site-nav__list a::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 7px;
  height: 2px;
  background: var(--coolant-teal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease-out);
}
.site-nav__list a:hover { color: var(--ink); }
.site-nav__list a:hover::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1.5px solid rgba(47, 196, 214, .45);
  border-radius: 10px;
  background: transparent;
  color: var(--coolant-teal);
  cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .25s var(--ease-out), opacity .2s ease;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { transform: translateY(-6px); }
.nav-toggle__bars::after { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: rotate(-45deg); }

@media (max-width: 859px) {
  .nav-toggle { display: inline-flex; }
  .site-nav__list {
    position: absolute;
    top: calc(100% + 4px);
    left: var(--gutter); right: var(--gutter);
    flex-direction: column;
    gap: 0;
    padding: 8px;
    border: 1px solid rgba(47, 196, 214, .3);
    border-radius: var(--radius);
    background: rgba(7, 21, 33, .97);
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .25s var(--ease-out), visibility 0s linear .25s;
  }
  .site-nav__list.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }
  .site-nav__list a { width: 100%; min-height: 48px; font-size: 1.0625rem; }
  .site-nav__list a::after { display: none; }
}

@media (max-width: 359px) {
  .brand__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: calc(var(--header-h) + clamp(20px, 5vh, 64px)) 0 clamp(32px, 6vh, 72px);
  overflow: hidden;
}

.hero__wire {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
}
.hero__wire-path {
  fill: none;
  stroke: var(--coolant-teal);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .7;
}
.hero__wire-end { opacity: 0; transition: opacity .4s ease; }
.hero__wire-end-dot { fill: var(--volt-yellow); }
.hero__wire.is-drawn .hero__wire-end { opacity: 1; }
.hero__wire-pulse { opacity: 0; }
.hero__wire.is-running .hero__wire-pulse { opacity: 1; }
.boot .hero__wire:not(.is-drawn):not(.is-running) .hero__wire-path { opacity: 0; }

.gear { color: var(--coolant-teal); transform-origin: 50% 50%; }
.gear--hero {
  position: absolute;
  right: -110px; top: 70px;
  z-index: 0;
  width: 380px; height: 380px;
  opacity: .06;
  pointer-events: none;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
}

.hero__title {
  font-size: var(--step-hero);
  line-height: 1.02;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.hero__accent {
  color: var(--volt-yellow);
  text-shadow: 0 0 28px rgba(255, 210, 31, .28);
}
.hero__lede {
  max-width: 40ch;
  margin-top: clamp(14px, 2vw, 22px);
  font-size: var(--step-1);
  font-weight: 500;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(22px, 3vw, 34px);
}

.hero__visual { position: relative; }

@media (min-width: 960px) {
  .hero__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); }
}

/* ---------- Schematic ---------- */
.schematic {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
  aspect-ratio: 560 / 420;
}
.schematic__svg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  overflow: visible;
}

.schematic .board {
  fill: rgba(7, 21, 33, .55);
  stroke: rgba(47, 196, 214, .25);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}
.schematic .trace {
  fill: none;
  stroke: var(--coolant-teal);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.schematic .trace.chip { fill: #081a28; }
.schematic .sym {
  fill: none;
  stroke: var(--coolant-teal);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.schematic .sym--thick { stroke-width: 4; }
.schematic .label {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  fill: var(--solder-silver);
}
.schematic .label--dim { fill: rgba(201, 211, 220, .7); }
.schematic .label--big { font-size: 17px; fill: var(--coolant-teal); }

.node__halo { fill: url(#node-halo); opacity: 0; transition: opacity .25s ease; }
.node__dot { fill: var(--lab-navy); stroke: var(--coolant-teal); stroke-width: 2; }
.node__hot { fill: var(--volt-yellow); opacity: 0; transition: opacity .2s ease; }
.node--term .node__hot { opacity: .9; }
.node.is-near .node__halo,
.node.is-near .node__hot { opacity: 1; }

.pulse__core { fill: #FFF6CC; }

/* U1 socket: holds the newest video */
.socket {
  position: absolute;
  left: 27.857%; top: 26.429%;
  width: 55%; height: 41.25%;
  border-radius: 3px;
  overflow: hidden;
  background: #06121c;
  container-type: inline-size;
}
.socket__slot { position: absolute; inset: 0; }
.socket__link {
  position: absolute;
  inset: 0;
  display: block;
  color: var(--ink);
  text-decoration: none;
}
.socket__link:focus-visible { outline-offset: -3px; }

.socket__media { position: absolute; inset: 0; overflow: hidden; }
.socket__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease-out);
}
.socket__play {
  position: absolute;
  left: 50%; top: 42%;
  width: 52px; height: 36px;
  margin: -18px 0 0 -26px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(208, 38, 46, .92);
  box-shadow: 0 6px 24px -6px rgba(232, 51, 58, .8);
  transition: transform .3s var(--ease-out);
}
.socket__play svg { width: 18px; height: 18px; fill: #fff; }
.socket__caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: grid;
  gap: 1px;
  padding: 26px 12px 9px;
  background: linear-gradient(180deg, transparent, rgba(7, 21, 33, .94) 52%);
}
.socket__tag {
  font-family: var(--font-head);
  font-size: .75rem;
  font-weight: 600;
  color: var(--volt-yellow);
}
.socket__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.25;
}
@container (max-width: 250px) {
  .socket__title { -webkit-line-clamp: 1; line-clamp: 1; font-size: .8125rem; }
  .socket__play { width: 40px; height: 28px; margin: -14px 0 0 -20px; }
}
@media (hover: hover) {
  .socket__link:hover .socket__media img { transform: scale(1.05); }
  .socket__link:hover .socket__play { transform: scale(1.08); }
}

.socket__empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  text-align: center;
  background:
    repeating-linear-gradient(0deg, rgba(47, 196, 214, .05) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 50% 40%, rgba(47, 196, 214, .16), transparent 70%),
    #06121c;
}
.socket__play-icon {
  width: clamp(30px, 18cqi, 52px);
  height: auto;
  margin-bottom: 4px;
  color: var(--wire-red);
  transition: transform .3s var(--ease-out);
}
.socket__hint {
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink);
}
.socket__link--empty:hover .socket__play-icon { transform: scale(1.08); }

.socket__led {
  position: absolute;
  top: 7px; right: 7px;
  z-index: 2;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #33424f;
  box-shadow: inset 0 0 0 1px rgba(201, 211, 220, .3);
  pointer-events: none;
}
.socket__led::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--volt-yellow);
  box-shadow: 0 0 10px 2px rgba(255, 210, 31, .75);
  opacity: 0;
  transition: opacity .3s ease;
}
.socket.is-plugged .socket__led::after { opacity: 1; }
.socket.is-plugged .socket__link { animation: plug-in .6s var(--ease-out) both; }

.socket.is-loading .socket__slot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(47, 196, 214, .22), transparent);
  transform: translateY(-100%);
  animation: scan 1.3s linear infinite;
}

/* ---------- Section connectors ---------- */
.connector {
  position: relative;
  height: clamp(44px, 6vw, 72px);
  pointer-events: none;
}
.connector__seg {
  position: absolute;
  background: var(--coolant-teal);
  opacity: .65;
}
.connector__seg--v1 { left: var(--a); top: 0; width: 2px; height: 50%; transform-origin: top; }
.connector__seg--h {
  top: calc(50% - 1px);
  left: min(var(--a), var(--b));
  width: calc(max(var(--a), var(--b)) - min(var(--a), var(--b)) + 2px);
  height: 2px;
  transform-origin: left;
}
.connector--rtl .connector__seg--h { transform-origin: right; }
.connector__seg--v2 { left: var(--b); top: 50%; width: 2px; height: 50%; transform-origin: top; }
.connector__node {
  position: absolute;
  width: 10px; height: 10px;
  margin: -5px 0 0 -4px;
  border: 2px solid var(--coolant-teal);
  border-radius: 50%;
  background: var(--lab-navy);
}
.connector__node--a { left: var(--a); top: 0; }
.connector__node--b { left: var(--b); top: 100%; }

.js .connector .connector__seg--v1,
.js .connector .connector__seg--v2 { transform: scaleY(0); }
.js .connector .connector__seg--h { transform: scaleX(0); }
.js .connector .connector__node { opacity: 0; }
.js .connector.is-visible .connector__seg { transform: none; transition: transform .3s var(--ease-out); }
.js .connector.is-visible .connector__seg--h { transition-duration: .4s; transition-delay: .26s; }
.js .connector.is-visible .connector__seg--v2 { transition-delay: .62s; }
.js .connector.is-visible .connector__node { opacity: 1; transition: opacity .3s ease; }
.js .connector.is-visible .connector__node--b { transition-delay: .85s; }

/* ---------- Sections ---------- */
.section {
  position: relative;
  padding-block: clamp(52px, 7vw, 96px);
}
.section--bench {
  background: rgba(7, 21, 33, .8);
  border-block: 1px solid rgba(47, 196, 214, .12);
}

.section-head {
  display: flex;
  align-items: flex-start;
  gap: clamp(14px, 2vw, 20px);
  margin-bottom: clamp(28px, 4vw, 48px);
}
.section-title { font-size: var(--step-3); }
.section-lede {
  max-width: 56ch;
  margin-top: 8px;
  font-size: var(--step-1);
}
.gear--head {
  flex: none;
  width: clamp(38px, 4.4vw, 52px);
  height: auto;
  margin-top: 2px;
  opacity: .9;
}
#videos-title:focus-visible { outline-offset: 6px; }

/* Reveal */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- What we build ---------- */
.builds {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(22px, 2.2vw, 28px);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) { .builds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .builds { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.build {
  position: relative;
  padding: 26px 22px 24px;
  border: 1px solid rgba(47, 196, 214, .24);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16, 38, 58, .92), rgba(8, 23, 36, .92));
}
.build::before,
.build::after {
  content: "";
  position: absolute;
  left: 24px; right: 24px;
  height: 7px;
  background: repeating-linear-gradient(90deg, rgba(201, 211, 220, .5) 0 6px, transparent 6px 20px);
}
.build::before { top: -8px; border-radius: 2px 2px 0 0; }
.build::after { bottom: -8px; border-radius: 0 0 2px 2px; }

.build__icon {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  margin-bottom: 18px;
  border: 1px solid rgba(47, 196, 214, .38);
  border-radius: 12px;
  background: var(--teal-08);
  color: var(--coolant-teal);
}
.build__icon svg {
  width: 34px; height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.build__icon .accent { stroke: var(--volt-yellow); }
.build h3 { font-size: var(--step-2); font-weight: 600; }
.build p { margin-top: 10px; }

.build { transition: translate .35s var(--ease-out), border-color .3s ease; }
.js .build.reveal {
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out), translate .35s var(--ease-out), border-color .3s ease;
  transition-delay: calc(var(--i, 0) * 90ms), calc(var(--i, 0) * 90ms), 0s, 0s;
}
@media (hover: hover) {
  .build:hover { translate: 0 -4px; border-color: rgba(47, 196, 214, .65); }
  .build:hover .build__icon { border-color: var(--volt-yellow); }
}

/* ---------- Lab Log: grid + cards ---------- */
.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(18px, 2vw, 28px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.video-grid[hidden] { display: none; }
@media (min-width: 640px) { .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card { min-width: 0; }

.js .video-grid:not(.is-visible) .card { opacity: 0; }
.video-grid.is-visible .card { animation: card-plug-in .55s var(--ease-out) calc(var(--i, 0) * 55ms) both; }
.video-grid .card.is-unplugging { animation: card-unplug .24s ease-in calc(var(--i, 0) * 25ms) both; pointer-events: none; }

.card__body {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(47, 196, 214, .22);
  border-radius: var(--radius);
  background: var(--panel);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift));
  transition: transform .55s var(--ease-out), border-color .3s ease;
}
.card__body.is-tilting { --lift: -4px; transition-duration: .12s, .3s; }
.card__body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(340px circle at var(--mouse-x, 50%) var(--mouse-y, 0%), rgba(47, 196, 214, .17), transparent 62%);
  opacity: 0;
  transition: opacity .3s ease;
}
.card__body:active { transform: perspective(900px) scale(.985); transition-duration: .1s; }

.card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #06121c;
  border-bottom: 1px solid rgba(47, 196, 214, .18);
}
.card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease-out);
}

.card__led {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #2b3a47;
  box-shadow: inset 0 0 0 1px rgba(201, 211, 220, .4), 0 0 0 3px rgba(7, 21, 33, .55);
}
.card__led::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--volt-yellow);
  box-shadow: 0 0 12px 3px rgba(255, 210, 31, .75);
  opacity: 0;
  transition: opacity .18s ease;
}

.card__content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 18px;
}
.card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-height: 2.6em;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}
.card__date { font-size: .9375rem; }
.card__watch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--wire-red);
  border-radius: 8px;
  background: var(--wire-red-fill);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s ease;
}
.card__watch svg { width: 14px; height: 14px; fill: currentColor; }
.card__watch::after {            /* the whole card is clickable */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
}
.card__body:has(.card__watch:focus-visible) { border-color: var(--volt-yellow); }
.card__body:has(.card__watch:focus-visible) .card__led::after { opacity: 1; }

@media (hover: hover) {
  .card__body:hover { border-color: rgba(47, 196, 214, .6); }
  .card__body:hover::before { opacity: 1; }
  .card__body:hover .card__led::after { opacity: 1; }
  .card__body:hover .card__media img { transform: scale(1.05); }
  .card__body:hover .card__watch { background: var(--wire-red-hover); }
}

/* CSS-only thumbnail (mock data and broken thumbnails) */
.thumb-ph {
  --h: 190;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 28% 38%, hsla(var(--h), 70%, 55%, .38), transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(255, 210, 31, .14), transparent 45%),
    repeating-linear-gradient(0deg, rgba(47, 196, 214, .12) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, rgba(47, 196, 214, .12) 0 1px, transparent 1px 22px),
    linear-gradient(135deg, #0c2b42, #071521);
}
.thumb-ph::before {
  content: "";
  width: 30%;
  aspect-ratio: 1;
  border: 3px solid rgba(47, 196, 214, .75);
  border-radius: 50%;
  box-shadow: inset 0 0 0 10px rgba(7, 21, 33, .6), inset 0 0 0 13px rgba(47, 196, 214, .35), 0 0 30px rgba(47, 196, 214, .25);
}
.thumb-ph__label {
  position: absolute;
  left: 12px; bottom: 9px;
  font-family: var(--font-head);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--volt-yellow);
}

/* Loading skeleton */
.card--skeleton .card__body { pointer-events: none; }
.skeleton-bar {
  position: relative;
  overflow: hidden;
  height: 14px;
  border-radius: 6px;
  background: rgba(201, 211, 220, .1);
}
.skeleton-bar--wide { width: 90%; height: 18px; }
.skeleton-bar--short { width: 40%; }
.skeleton-bar::after,
.card--skeleton .card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(47, 196, 214, .16), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s ease-in-out infinite;
}

/* ---------- Pagination (toggle switches) ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(32px, 4vw, 52px);
}
.pager[hidden] { display: none; }
.pager__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pager__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 48px;
  min-height: 52px;
  padding: 0 16px;
  border: 1.5px solid rgba(47, 196, 214, .5);
  border-radius: 10px;
  background: transparent;
  color: var(--coolant-teal);
  font-family: var(--font-head);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s ease, transform .15s ease;
}
.pager__step svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pager__step:hover:not(:disabled) { background: var(--teal-08); }
.pager__step:active:not(:disabled) { transform: scale(.95); }
.pager__step:disabled { opacity: .38; cursor: not-allowed; }

.pager__page {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 46px;
  min-height: 52px;
  padding: 0;
  border: 1px solid rgba(201, 211, 220, .2);
  border-radius: 10px;
  background: rgba(7, 21, 33, .65);
  color: var(--solder-silver);
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s ease, transform .15s ease;
}
.pager__page:active { transform: scale(.95); }
.pager__switch {
  position: relative;
  width: 26px; height: 12px;
  border-radius: 6px;
  background: rgba(201, 211, 220, .16);
  box-shadow: inset 0 0 0 1px rgba(201, 211, 220, .28);
}
.pager__switch::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--coolant-teal);
  box-shadow: 0 0 10px rgba(47, 196, 214, .6);
  opacity: 0;
  transition: opacity .25s ease;
}
.pager__knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--solder-silver);
  transition: transform .3s var(--ease-out);
}
.pager__page:hover { border-color: rgba(47, 196, 214, .6); }
.pager__page:hover .pager__knob { transform: translateX(4px); }
.pager__page[aria-current="page"] { border-color: var(--coolant-teal); color: var(--ink); cursor: default; }
.pager__page.is-on .pager__switch::before { opacity: 1; }
.pager__page.is-on .pager__knob { transform: translateX(14px); background: var(--deep-bench); }
.pager__gap {
  min-width: 18px;
  font-family: var(--font-head);
  font-weight: 600;
  text-align: center;
}

@media (max-width: 559px) {
  .pager { gap: 6px; }
  .pager__step { padding: 0; width: 44px; min-width: 44px; }
  .pager__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pager__page { width: 42px; }
}

/* ---------- Fallback panel ---------- */
.fallback {
  position: relative;
  display: grid;
  gap: 24px;
  align-items: center;
  padding: clamp(24px, 4vw, 44px);
  border: 1px dashed rgba(47, 196, 214, .5);
  border-radius: var(--radius);
  background: rgba(7, 21, 33, .72);
}
.fallback[hidden] { display: none; }
@media (min-width: 720px) { .fallback { grid-template-columns: auto 1fr; gap: 40px; } }

.scope { width: clamp(140px, 22vw, 200px); height: auto; }
.scope__frame { fill: #06121c; stroke: var(--teal-40); stroke-width: 2; }
.scope__grid { fill: none; stroke: rgba(47, 196, 214, .14); stroke-width: 1; }
.scope__wave {
  fill: none;
  stroke: var(--volt-yellow);
  stroke-width: 2.5;
  stroke-linecap: round;
  animation: scope-run 1.8s linear infinite;
}
.fallback__copy { display: grid; gap: 12px; justify-items: start; }
.fallback__title { font-size: var(--step-2); }
.fallback__copy p { max-width: 52ch; }
.fallback__copy .btn { margin-top: 6px; white-space: normal; }

/* ---------- Safety strip ---------- */
.safety {
  position: relative;
  overflow: hidden;
  padding-bottom: clamp(36px, 5vw, 64px);
  background: rgba(7, 21, 33, .85);
  border-block: 1px solid rgba(255, 210, 31, .18);
}
.tape {
  position: relative;
  height: 50px;
  margin: 26px -30px 34px;
  overflow: hidden;
  background: var(--volt-yellow);
  transform: rotate(-1.2deg);
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .8);
}
.tape__track {
  --tape-sets: 6;               /* number of .tape__group copies in index.html */
  display: flex;
  width: max-content;
  height: 100%;
  animation: tape-run 32s linear infinite;   /* 32s per set, same speed as before */
}
.tape__group { display: flex; flex: none; align-items: center; height: 100%; }
.tape__stripes {
  width: 132px;
  height: 100%;
  background: repeating-linear-gradient(-45deg, var(--deep-bench) 0 15px, var(--volt-yellow) 15px 30px);
}
.tape__text {
  padding: 0 24px;
  color: var(--deep-bench);
  font-family: var(--font-head);
  font-size: 1.0625rem;
  font-weight: 700;
  white-space: nowrap;
}
.tape--thin {
  height: 12px;
  margin: clamp(32px, 4vw, 48px) -30px 0;
  background: repeating-linear-gradient(-45deg, var(--deep-bench) 0 10px, var(--volt-yellow) 10px 20px);
  transform: rotate(.6deg);
  opacity: .9;
}

.safety__inner {
  display: grid;
  gap: 18px;
  align-items: start;
  max-width: 920px;
}
@media (min-width: 720px) { .safety__inner { grid-template-columns: auto 1fr; gap: 28px; } }
.safety__icon { width: clamp(52px, 6vw, 68px); height: auto; filter: drop-shadow(0 0 18px rgba(255, 210, 31, .3)); }
.safety__inner p { max-width: 64ch; margin-top: 12px; }

/* ---------- Subscribe CTA ---------- */
.cta__panel {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 28px;
  align-items: center;
  padding: clamp(26px, 5vw, 64px);
  border: 1px solid rgba(47, 196, 214, .3);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 85% 15%, rgba(47, 196, 214, .16), transparent 55%),
    linear-gradient(160deg, rgba(16, 40, 62, .96), rgba(7, 21, 33, .96));
}
@media (min-width: 880px) { .cta__panel { grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); } }

.cta__copy { position: relative; z-index: 1; }
.cta__title { font-size: var(--step-4); }
.cta__copy p { max-width: 46ch; margin-top: 14px; font-size: var(--step-1); }
.cta__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: clamp(22px, 3vw, 32px);
}

.gear--cta-a,
.gear--cta-b { position: absolute; opacity: .08; pointer-events: none; }
.gear--cta-a { width: 230px; height: 230px; right: -60px; bottom: -80px; }
.gear--cta-b { width: 150px; height: 150px; right: 140px; bottom: -86px; }

.cta__switch {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  justify-self: center;
}
.cta__trace { fill: none; stroke: var(--coolant-teal); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.cta__base { fill: #0a1c2b; stroke: var(--solder-silver); stroke-width: 2; }
.cta__lamp { fill: #13293b; stroke: var(--volt-yellow); stroke-width: 2.5; }
.cta__filament { fill: none; stroke: var(--volt-yellow); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .5; transition: opacity .3s ease .5s; }
.cta__glow { opacity: 0; transition: opacity .5s ease .45s; }
.cta__pivot { fill: var(--solder-silver); }
.cta__lever {
  fill: var(--wire-red);
  transform-box: view-box;
  transform-origin: 100px 146px;
  transform: rotate(-38deg);
  transition: transform .55s cubic-bezier(.5, -0.4, .3, 1.5) .25s;
}
.cta__pulse { opacity: 0; transition: opacity .3s ease .7s; }
.cta__switch.is-visible .cta__lever { transform: rotate(0deg); }
.cta__switch.is-visible .cta__glow,
.cta__switch.is-visible .cta__pulse { opacity: 1; }
.cta__switch.is-visible .cta__filament { opacity: 1; }

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 34px 40px;
  border-top: 1px solid rgba(47, 196, 214, .16);
  background: var(--deep-bench);
}
.site-footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 32px;
}
.footer-yt {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 600;
  text-decoration: none;
}
.footer-yt svg { width: 30px; height: auto; transition: transform .2s ease; }
.footer-yt:hover svg { transform: scale(1.08); }
.site-footer__copy,
.site-footer__note { font-size: .9375rem; }
.site-footer__note { flex-basis: 100%; }
@media (min-width: 900px) {
  .site-footer__note { flex-basis: auto; margin-left: auto; }
}

/* ---------- Spark burst ---------- */
.spark-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow: hidden;
  pointer-events: none;
}
.spark {
  position: absolute;
  width: 12px; height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--volt-yellow);
  box-shadow: 0 0 6px rgba(255, 210, 31, .9);
  transform-origin: 0 50%;
  animation: spark .5s cubic-bezier(.12, .75, .3, 1) forwards;
}
.spark--teal { background: #9BEFF8; box-shadow: 0 0 6px rgba(47, 196, 214, .9); }

/* ---------- Power-on sequence (only while html.boot is set) ---------- */
.boot .schematic .trace {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: trace-draw .55s cubic-bezier(.6, .05, .3, 1) var(--d, 0ms) forwards;
}
.boot .schematic .sym,
.boot .schematic .labels,
.boot .schematic .nodes { opacity: 0; animation: fade-in .45s ease-out var(--d, 0ms) forwards; }
.boot .socket { opacity: 0; animation: fade-in .5s ease-out .55s forwards; }
.boot .hero__title { animation: power-on 1.55s linear both; }
.boot .hero__lede { animation: rise-in .6s var(--ease-out) .2s both; }
.boot .hero__actions { animation: rise-in .6s var(--ease-out) .32s both; }

/* ---------- Keyframes ---------- */
@keyframes grid-drift { to { transform: translate3d(120px, 120px, 0); } }
@keyframes trace-draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes power-on {
  0%, 80% { opacity: .22; }
  83% { opacity: 1; }
  86% { opacity: .4; }
  90%, 100% { opacity: 1; }
}
@keyframes plug-in {
  from { opacity: 0; transform: translateY(-12%) scale(.96); }
  to { opacity: 1; transform: none; }
}
@keyframes card-plug-in {
  from { opacity: 0; transform: translateY(-18px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes card-unplug {
  to { opacity: 0; transform: translateY(14px) scale(.97); }
}
@keyframes scan { to { transform: translateY(100%); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes tape-run { to { transform: translateX(calc(-100% / var(--tape-sets))); } }
@keyframes scope-run { to { transform: translateX(80px); } }
@keyframes header-current {
  from { transform: translateX(-200px); }
  to { transform: translateX(100vw); }
}
@keyframes spark {
  from { opacity: 1; transform: rotate(var(--a)) translateX(4px) scaleX(1); }
  to { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scaleX(.2); }
}

/* ---------- Reduced motion: opacity only, traces fully drawn ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bg__grid,
  .tape__track,
  .scope__wave,
  .skeleton-bar::after,
  .card--skeleton .card__media::after,
  .socket.is-loading .socket__slot::after,
  .site-header.is-scrolled::after { animation: none; }
  .cursor-glow,
  .spark-layer,
  .schematic .pulses,
  .cta__pulse { display: none; }

  .site-header,
  .site-header__row,
  .brand__mark,
  .magnet { transition: none; }
  .site-header.is-scrolled,
  .site-header.is-scrolled .site-header__row,
  .site-header.is-scrolled .brand__mark { transform: none; }

  .js .reveal { transform: none; transition: opacity .4s ease; transition-delay: 0s; }
  .js .connector .connector__seg,
  .js .connector.is-visible .connector__seg { transform: none; transition: none; }
  .js .connector .connector__node { opacity: 1; }

  .btn:active,
  .pager__step:active:not(:disabled),
  .pager__page:active,
  .card__body:active { transform: none; }
  .build:hover { translate: none; }
  .site-nav__list,
  .site-nav__list.is-open { transform: none; }
  .site-nav__list a::after,
  .nav-toggle__bars,
  .nav-toggle__bars::before,
  .nav-toggle__bars::after { transition: none; }

  .card__body,
  .card__body.is-tilting { transform: none; transition: border-color .2s ease; }
  .card__body:hover .card__media img,
  .socket__link:hover .socket__media img,
  .socket__link:hover .socket__play,
  .socket__link--empty:hover .socket__play-icon,
  .footer-yt:hover svg { transform: none; }
  .video-grid.is-visible .card { animation-name: fade-in; animation-delay: 0s; }
  .video-grid .card.is-unplugging { animation-name: fade-out; animation-delay: 0s; }
  .socket.is-plugged .socket__link { animation-name: fade-in; }

  .pager__knob,
  .pager__page:hover .pager__knob { transition: none; }
  .pager__page:hover:not(.is-on) .pager__knob { transform: none; }
  .gear { transform: none !important; }
  .cta__lever { transition: none; }
}
