/* ============================================================
   light-switch.css · v5
   Top-marker block layout · no side rail · refined components
   ============================================================ */

/* Customized premium scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--paper-2);
}
::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 4px;
  border: 2px solid var(--paper-2);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--signal);
}

/* ============================================================
   GLOBAL · block layout pattern
   ============================================================ */
.page > .block { padding: 88px 0 24px; position: relative; }
.page > .block + .block { padding-top: 56px; }
.page > .ls-hero + .block { padding-top: 88px; }

.block-head { margin-bottom: 36px; position: relative; }
.block-head .bh-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  position: relative;
  margin-bottom: 20px;
}
.block-head .bh-row::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--signal);
  transition: width 0.9s cubic-bezier(0.22,1,0.36,1) 0.15s;
}
.block-head .in .bh-row::after,
[data-reveal].in .block-head .bh-row::after { width: 96px; }

.bh-marker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--signal);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.bh-marker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--signal);
  display: inline-block;
}
.bh-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.bh-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 48px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0;
  max-width: 26ch;
  color: var(--ink);
  text-wrap: pretty;
}
.bh-lede {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 64ch;
  margin: 16px 0 0;
}
.bh-lede b { color: var(--ink); font-weight: 500; }

.two-col-prose {
  columns: 2;
  column-gap: 56px;
  max-width: 1024px;
}
.two-col-prose p {
  break-inside: avoid;
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-2);
  max-width: none;
}
.two-col-prose p:last-child { margin-bottom: 0; }
.two-col-prose em { font-style: normal; color: var(--ink); font-weight: 500; }

/* ============================================================
   HERO
   ============================================================ */
.ls-hero {
  position: relative;
  padding: 40px 0 64px;
  border-bottom: 1px solid var(--rule);
}
.ls-hero .crumbs { margin-bottom: 40px; }
.ls-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}
.block-marker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--signal);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.block-marker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--signal);
}
.ls-title {
  font-size: clamp(56px, 8.4vw, 128px);
  letter-spacing: -0.045em;
  line-height: 0.92;
  margin: 16px 0 18px;
  font-weight: 500;
}
.ls-title .ls-dot { color: var(--signal); }
.ls-tagline {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.4;
  color: var(--ink);
  max-width: 36ch;
  margin: 0 0 14px;
}
.ls-sub {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 56ch;
}
.ls-sub strong { color: var(--ink); font-weight: 500; }
.ls-hero-meta {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.ls-hero-meta .m-cell {
  padding: 16px 14px 16px 0;
  border-right: 1px solid var(--rule);
  font-family: var(--font-mono);
  transition: background 0.22s;
}
.ls-hero-meta .m-cell:last-child { border-right: 0; }
.ls-hero-meta .m-cell:hover { background: var(--paper-2); }
.ls-hero-meta .m-cell .k {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 500;
}
.ls-hero-meta .m-cell .v {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: -0.015em;
  color: var(--ink);
  font-weight: 500;
}
.ls-hero-meta .m-cell .v.live { color: var(--signal); display: inline-flex; align-items: center; gap: 8px; }
.ls-hero-meta .m-cell .v.live::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--signal);
  animation: pulseDot 1.6s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.7); }
}

.ls-hero-photo {
  margin: 0;
  position: relative;
  padding: 28px 32px;
  background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
  border: 1px solid var(--rule);
  overflow: hidden;
  isolation: isolate;
}
.ls-hero-photo::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px dashed var(--rule);
  pointer-events: none;
  z-index: 1;
}
.ls-hero-photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 24px 32px rgba(0,0,0,0.10));
  transition: transform 0.7s cubic-bezier(0.22,1,0.36,1);
}
.ls-hero-photo:hover img { transform: scale(1.03) rotate(-0.4deg); }
html[data-theme="dark"] .ls-hero-photo img {
  filter: drop-shadow(0 24px 32px rgba(0,0,0,0.55)) brightness(0.96);
}
.ls-hero-photo figcaption {
  position: relative;
  z-index: 2;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ls-hero-photo figcaption b { color: var(--ink); font-weight: 500; }
.ls-hero-photo figcaption .dim { color: var(--ink-3); opacity: 0.85; }

/* corner ticks */
.frame-tick {
  position: absolute;
  width: 12px; height: 12px;
  border-color: var(--signal);
  border-style: solid;
  z-index: 3;
  pointer-events: none;
}
.frame-tick.tl { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
.frame-tick.tr { top: 6px; right: 6px; border-width: 1px 1px 0 0; }
.frame-tick.bl { bottom: 6px; left: 6px; border-width: 0 0 1px 1px; }
.frame-tick.br { bottom: 6px; right: 6px; border-width: 0 1px 1px 0; }

/* ============================================================
   ARCHITECTURE DIAGRAM
   ============================================================ */
.arch-diagram {
  border: 1px solid var(--rule);
  background:
    radial-gradient(ellipse at 50% 50%, var(--paper) 0%, var(--paper-2) 100%);
  padding: 28px 24px 20px;
  position: relative;
}
.arch-diagram svg { width: 100%; height: auto; display: block; color: var(--ink-3); }
.arch-node rect {
  fill: var(--paper);
  stroke: var(--rule);
  stroke-width: 1.2;
  transition: fill 0.3s, stroke 0.3s;
}
.arch-node.sensor   rect { stroke: var(--ink-3); }
.arch-node.actuator rect { stroke: var(--signal); }
.arch-node.cloud    rect { stroke: var(--ink-3); stroke-dasharray: 4 3; }
.arch-node.mcu      rect { fill: var(--ink); stroke: var(--ink); }
.arch-node.mcu .n-title,
.arch-node.mcu .n-sub,
.arch-node.mcu .n-pin { fill: var(--paper); }
.arch-node:hover rect { fill: var(--signal-soft); }
.arch-node.mcu:hover rect { fill: var(--signal); stroke: var(--signal); }

.arch-node .n-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.010em;
  fill: var(--ink);
}
.arch-node .n-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  fill: var(--ink-2);
  font-weight: 500;
}
.arch-node .n-pin {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  fill: var(--ink-3);
  text-transform: uppercase;
  font-weight: 600;
}
.arch-line {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.8px;
}
.arch-line.signal { stroke: var(--signal); }
.arch-line.dashed { stroke: var(--ink-2); stroke-dasharray: 4 4; opacity: 1; }
.arch-edge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  fill: var(--ink-2);
  text-transform: uppercase;
  font-weight: 600;
}
.arch-edge.sig { fill: var(--signal); }
.arch-edge.dim { fill: var(--ink-3); opacity: 0.85; }

/* Group labels & high contrast background shields */
.arch-edge-label, .sd-edge-label {
  cursor: default;
  pointer-events: none;
}
.arch-edge-label .e-label-bg, .sd-edge-label .e-label-bg {
  fill: var(--paper);
  stroke: var(--rule);
  stroke-width: 1px;
  opacity: 1;
  transition: fill 0.3s, stroke 0.3s;
}

/* gentle hover lift on nodes; no opacity hiding so content is always visible */
.arch-node { transition: transform 0.3s cubic-bezier(0.22,1,0.36,1); transform-box: fill-box; transform-origin: center; }
.arch-node:hover { transform: translateY(-2px); }
.arch-line.dashed { opacity: 0.7; }

.arch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.arch-legend .lg { display: inline-flex; align-items: center; gap: 8px; }
.arch-legend .sw { width: 16px; height: 12px; border: 1px solid var(--rule); display: inline-block; }
.arch-legend .sw.box-sensor   { border-color: var(--ink-3); background: var(--paper); }
.arch-legend .sw.box-actuator { border-color: var(--signal); background: var(--paper); }
.arch-legend .sw.box-cloud    { border-color: var(--ink-3); background: var(--paper); border-style: dashed; }
.arch-legend .sw.box-mcu      { background: var(--ink); border-color: var(--ink); }
.arch-legend .sw.line         { width: 22px; height: 0; border: 0; border-top: 1.4px solid var(--ink-3); }
.arch-legend .sw.line.dashed  { border-top: 1.4px dashed var(--ink-3); }

/* ============================================================
   FEATURE GRID
   ============================================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--rule);
}
.feature-grid .fg-cell {
  padding: 28px 26px 26px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid color-mix(in srgb, var(--rule) 45%, transparent);
  transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}
.feature-grid .fg-cell::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--signal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.22,1,0.36,1);
}
.feature-grid .fg-cell:hover::after { transform: scaleX(1); }
.feature-grid .fg-cell:hover {
  background: color-mix(in srgb, var(--paper-2) 90%, transparent);
  border-color: var(--signal);
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 20px var(--signal-soft);
  z-index: 2;
}
.feature-grid .fg-cell:nth-child(3n) { border-right: 0; }
.feature-grid .fg-cell:nth-last-child(-n+3) { border-bottom: 0; }
.feature-grid .fg-cell .fg-num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  position: absolute;
  top: 18px;
  right: 22px;
  font-weight: 500;
}
.feature-grid .fg-cell .fg-icon {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--signal);
  margin-bottom: 18px;
  display: inline-block;
  line-height: 1;
  transition: color 0.22s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}
.feature-grid .fg-cell:hover .fg-icon { color: var(--signal-2); transform: scale(1.18); }
.feature-grid .fg-cell h4 {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: -0.018em;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
  max-width: 22ch;
}
.feature-grid .fg-cell p {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
  max-width: none;
  margin: 0;
}

/* ============================================================
   LAYOUT FIGURE
   ============================================================ */
.layout-figure {
  position: relative;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 28px 28px 18px;
  overflow: hidden;
  margin: 0;
}
.layout-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: contain;
}
.layout-figure figcaption {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.layout-figure figcaption b { color: var(--ink); font-weight: 500; }



/* ============================================================
   STATE DIAGRAM
   ============================================================ */
.state-diagram {
  border: 1px solid var(--rule);
  background:
    radial-gradient(ellipse at 50% 50%, var(--paper) 0%, var(--paper-2) 100%);
  padding: 36px 32px 24px;
  position: relative;
}
.state-diagram svg { width: 100%; height: auto; display: block; }
.sd-node rect {
  fill: var(--paper);
  stroke: var(--ink-2);
  stroke-width: 1.6;
  transition: fill 0.3s, stroke 0.3s;
}
.sd-node.hub rect  { fill: var(--ink); stroke: var(--ink); }
.sd-node.hub .n-title, .sd-node.hub .n-num, .sd-node.hub .n-pin { fill: var(--paper); }
.sd-node.safe rect { stroke: var(--signal); stroke-dasharray: 5 3; }
.sd-node.start circle { fill: var(--signal); stroke: var(--signal); }
.sd-node.start .n-pin { fill: var(--paper); font-size: 14px; }
.sd-node:hover rect { fill: var(--signal-soft); }
.sd-node.hub:hover rect { fill: var(--signal); stroke: var(--signal); }
.sd-node .n-num   { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.14em; fill: var(--signal); font-weight: 700; }
.sd-node .n-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.015em; fill: var(--ink); }
.sd-node .n-pin   { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em; fill: var(--ink-3); font-weight: 500; }
.sd-node .n-tag   { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.12em; fill: var(--ink-3); font-weight: 600; }

.sd-edge path {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 2px;
  color: var(--ink-2);
  transition: stroke 0.3s, stroke-width 0.3s;
}
.sd-edge.sig path { stroke: var(--signal); color: var(--signal); }
.sd-edge.dashed path { stroke-dasharray: 6 4; opacity: 0.8; }

.sd-edge-label .e-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  fill: var(--ink-2);
  text-transform: uppercase;
  font-weight: 600;
}
.sd-edge-label .e-label.sig { fill: var(--signal); }
.sd-edge-label .e-label.dim { fill: var(--ink-3); }

/* state diagram node lift on hover & active highlights */
.sd-node {
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
  transform-box: fill-box;
  transform-origin: center;
  cursor: pointer;
}
.sd-node:hover { transform: translateY(-2px); }

/* SVG Node active styles */
.sd-node.active rect {
  stroke: var(--signal) !important;
  stroke-width: 2.2px !important;
  fill: var(--signal-soft) !important;
  filter: drop-shadow(0 0 8px var(--signal-soft));
}
.sd-node.active.hub rect {
  fill: var(--signal) !important;
  stroke: var(--signal) !important;
}
.sd-node.active.hub .n-title,
.sd-node.active.hub .n-num,
.sd-node.active.hub .n-pin {
  fill: var(--paper) !important;
}
.sd-node.active .n-title,
.sd-node.active .n-num {
  fill: var(--signal);
  font-weight: bold;
}
.sd-node.active .n-pin {
  fill: var(--ink);
}

.state-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.state-legend .lg { display: inline-flex; align-items: center; gap: 8px; }
.state-legend .sw { width: 22px; height: 12px; display: inline-block; }
.state-legend .sw.sig-line { height: 0; border-top: 1.6px solid var(--signal); }
.state-legend .sw.dashed-line { height: 0; border-top: 1.6px dashed var(--ink-3); }
.state-legend .sw.box-hub { background: var(--ink); border: 1px solid var(--ink); }
.state-legend .sw.box-safe { background: var(--paper); border: 1px dashed var(--signal); }

/* ============================================================
   RADAR VIZ
   ============================================================ */
.radar-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.radar-viz {
  border: 1px solid var(--rule);
  background: radial-gradient(ellipse at 50% 100%, var(--paper-2), var(--paper) 70%);
  padding: 20px 22px 0;
  position: relative;
}
.radar-viz svg { width: 100%; height: auto; display: block; }
.radar-viz .gate { fill: none; stroke: var(--rule); stroke-width: 0.7; }
.radar-viz .gate.active-gate { stroke: var(--signal); stroke-width: 1; stroke-dasharray: 2 3; }
.radar-viz .spoke { stroke: var(--rule-2); stroke-width: 0.7; }
.radar-viz .spoke.axis { stroke: var(--rule); }
.radar-viz .sweep-line {
  stroke: var(--signal);
  stroke-width: 2.2;
  filter: drop-shadow(0 0 10px var(--signal));
}
.radar-viz .sweep-g {
  transform-origin: 180px 220px;
  animation: radarBigSweep 4s ease-in-out infinite;
}
@keyframes radarBigSweep {
  0% { transform: rotate(-88deg); }
  50% { transform: rotate(88deg); }
  100% { transform: rotate(-88deg); }
}

.radar-viz .target .t-dot {
  fill: var(--signal);
  filter: drop-shadow(0 0 6px var(--signal));
}
.radar-viz .target .t-pulse {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1.5;
  transform-origin: center;
  animation: tPulse 1.6s ease-out infinite;
  filter: drop-shadow(0 0 4px var(--signal));
}
@keyframes tPulse {
  0% { r: 5; opacity: 0.9; }
  100% { r: 20; opacity: 0; }
}
.radar-viz .t-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  fill: var(--signal);
  letter-spacing: 0.08em;
  font-weight: 500;
}
.radar-viz .scale text {
  font-family: var(--font-mono);
  font-size: 7px;
  fill: var(--ink-3);
  letter-spacing: 0.06em;
}
.radar-readouts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--rule);
  margin: 12px -22px 0;
  background: var(--paper);
}
.radar-readouts .rr {
  padding: 14px 14px;
  border-right: 1px solid var(--rule);
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.radar-readouts .rr:last-child { border-right: 0; }
.radar-readouts .rk {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.radar-readouts .rv {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.radar-readouts .rv i {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  font-weight: 500;
  margin-left: 2px;
}

/* radar info accordion */
.radar-info { border: 1px solid var(--rule); display: flex; flex-direction: column; }
.acc-row {
  display: grid;
  grid-template-columns: 56px 1fr 28px;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: var(--paper);
  border: 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: -0.012em;
  color: var(--ink);
  font-weight: 500;
  transition: background 0.18s, color 0.18s;
}
.acc-row:hover { background: var(--paper-2); }
.acc-row.open { background: var(--signal-soft); color: var(--signal); }
.acc-row .acc-num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  font-weight: 500;
}
.acc-row.open .acc-num { color: var(--signal); }
.acc-row .acc-arrow {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--ink-3);
  transition: transform 0.32s cubic-bezier(0.22,1,0.36,1), color 0.18s;
  text-align: right;
}
.acc-row.open .acc-arrow { transform: rotate(45deg); color: var(--signal); }
.acc-body {
  display: grid;
  grid-template-rows: 0fr;
  border-bottom: 1px solid var(--rule);
  transition: grid-template-rows 0.36s cubic-bezier(0.22,1,0.36,1);
  background: var(--paper-2);
}
.acc-body > p {
  overflow: hidden;
  padding: 0 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-2);
  margin: 0;
  transition: padding 0.36s ease;
}
.acc-body > p code { color: var(--signal); }
.acc-body.open { grid-template-rows: 1fr; }
.acc-body.open > p { padding: 16px 18px; }
.radar-info .acc-row:last-of-type { border-bottom: 1px solid var(--rule); }
.radar-info .acc-body:last-of-type { border-bottom: 0; }

/* ============================================================
   WIRING & COMPARISON TABLES
   ============================================================ */
.wiring-table, .comp-table {
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12.5px;
  width: 100%;
  border-collapse: collapse;
}
.wiring-table tr, .comp-table tr { border-bottom: 1px solid var(--rule-2); transition: background 0.15s ease; }
.wiring-table tbody tr:hover td,
.comp-table tbody tr:hover td { background: var(--signal-soft); }
.wiring-table tr:last-child, .comp-table tr:last-child { border-bottom: 0; }
.wiring-table thead tr, .comp-table thead tr { background: var(--paper-2); }
.wiring-table th, .comp-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  border-right: 1px solid var(--rule-2);
}
.wiring-table td, .comp-table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-right: 1px solid var(--rule-2);
  color: var(--ink-2);
}
.wiring-table td:last-child, .wiring-table th:last-child,
.comp-table td:last-child, .comp-table th:last-child { border-right: 0; }
.wiring-table td strong { color: var(--ink); font-weight: 500; }
.comp-table td:first-child {
  color: var(--ink);
  font-weight: 500;
  width: 22%;
}
.comp-table td:nth-child(2) { color: var(--ink); }
.comp-table td:nth-child(3),
.comp-table th:nth-child(3) {
  opacity: 0.65;
  background: color-mix(in oklab, var(--paper-2) 40%, transparent);
  border-left: 1px dashed var(--rule);
  transition: opacity 0.3s, background 0.3s;
}
.comp-table tr:hover td:nth-child(3) {
  opacity: 0.85;
  background: color-mix(in oklab, var(--signal-soft) 40%, transparent) !important;
}
.pin {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--paper-3);
  color: var(--signal);
  padding: 2px 8px;
  display: inline-block;
  border: 1px solid var(--rule);
  font-weight: 500;
}
.caption-note {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  line-height: 1.7;
}

/* ============================================================
   SLEEP RINGS
   ============================================================ */
.sleep-wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.45fr);
  gap: 36px;
  align-items: center;
  padding: 36px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
.sleep-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sleep-ring-hero {
  width: 100%;
  max-width: 240px;
  height: auto;
  display: block;
  transform: rotate(-90deg);
}
.sleep-ring-hero .ring-track,
.ring-card .ring-track {
  fill: none;
  stroke: var(--rule);
  stroke-width: 10;
}
.ring-card .ring-track { stroke-width: 6; }
.sleep-ring-hero .ring-fill,
.ring-card .ring-fill {
  fill: none;
  stroke: var(--signal);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 540;
  stroke-dashoffset: 540;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.22,1,0.36,1);
}
.ring-card .ring-fill { stroke-width: 6; stroke-dasharray: 214; stroke-dashoffset: 214; }
.sleep-hero-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.sleep-hero-text .sh-pct {
  font-family: var(--font-display);
  font-size: 60px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sleep-hero-text .sh-of {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  margin-top: -2px;
}
.sleep-hero-text .sh-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--signal);
  margin-top: 10px;
  font-weight: 500;
}
.sleep-rings {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.ring-card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--rule);
  background: var(--paper);
  transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}
.ring-card:hover {
  background: color-mix(in srgb, var(--paper-2) 90%, transparent);
  border-color: var(--signal);
  transform: translateY(-4px) scale(1.005);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.06), 0 0 15px var(--signal-soft);
}
.ring-card svg { width: 76px; height: 76px; transform: rotate(-90deg); }
.ring-meta { display: flex; flex-direction: column; gap: 2px; }
.ring-meta .rm-w {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--signal);
  font-weight: 500;
  text-transform: uppercase;
}
.ring-meta .rm-k {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.ring-meta .rm-d {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  line-height: 1.5;
  margin-top: 2px;
}

.math-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}
.math-card {
  border: 1px solid var(--rule);
  padding: 18px 22px;
  background: var(--paper);
  transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}
.math-card:hover {
  background: color-mix(in srgb, var(--paper-2) 90%, transparent);
  border-color: var(--signal);
  transform: translateY(-4px) scale(1.005);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.06), 0 0 15px var(--signal-soft);
}
.math-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}
.math-card h5 { margin: 0 0 8px; }
.math-note {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 12px;
  max-width: none;
}
.formula {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--ink);
  background: var(--paper-2);
  padding: 12px 14px;
  border-left: 3px solid var(--signal);
  letter-spacing: -0.01em;
  line-height: 1.5;
}
.formula math {
  font-family: "Latin Modern Math", "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 15.5px;
}
html[data-theme="dark"] .formula { background: var(--paper-3); }

.bullets { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.bullets li {
  position: relative;
  padding-left: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
}
.bullets li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--signal);
  font-weight: 500;
}
.bullets li strong { color: var(--ink); font-weight: 500; }

/* ============================================================
   RULES GRID (blind automations)
   ============================================================ */
.rules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--rule);
}
.rules-grid .rule-card {
  border: 0 !important;
}
.rule-card {
  padding: 26px 26px 22px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid color-mix(in srgb, var(--rule) 45%, transparent);
  transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}
.rule-card:nth-child(2n) { border-right: 0; }
.rule-card:nth-last-child(-n+2) { border-bottom: 0; }
.rule-card:hover {
  background: color-mix(in srgb, var(--paper-2) 90%, transparent);
  border-color: var(--signal);
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 20px var(--signal-soft);
  z-index: 2;
}
.rule-card header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--rule);
}
.rule-card .r-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--signal);
  font-weight: 500;
}
.rule-card h4 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.022em;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
.rule-card p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0 0 14px;
  max-width: none;
}
.rule-card p code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--paper-2);
  padding: 1px 5px;
  color: var(--ink);
}
.r-spec {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--rule);
  margin-top: auto;
}
.r-spec > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0 0;
  font-family: var(--font-mono);
}
.r-spec > span + span { padding-left: 16px; border-left: 1px solid var(--rule); margin-left: -1px; padding-left: 16px; }
.r-spec b {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.r-spec i {
  font-style: normal;
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
}

/* ============================================================
   CONNECTIVITY
   ============================================================ */
.conn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--rule);
}
.conn-card {
  padding: 26px 26px 24px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  position: relative;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid color-mix(in srgb, var(--rule) 45%, transparent);
  transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  will-change: transform, box-shadow;
}
.conn-card:nth-child(2n) { border-right: 0; }
.conn-card:hover {
  background: color-mix(in srgb, var(--paper-2) 90%, transparent);
  border-color: var(--signal);
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 20px var(--signal-soft);
  z-index: 2;
}

/* Companion App PWA Premium Glow & Glassmorphism */
.conn-card.pwa-card {
  background: radial-gradient(circle at 10% 10%, color-mix(in srgb, var(--signal-soft) 70%, transparent) 0%, color-mix(in srgb, var(--paper) 82%, transparent) 70%);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid var(--signal-soft);
  box-shadow: 0 0 20px var(--signal-soft);
  position: relative;
  z-index: 1;
}
.conn-card.pwa-card:hover {
  background: radial-gradient(circle at 10% 10%, color-mix(in srgb, var(--signal-soft) 85%, transparent) 20%, color-mix(in srgb, var(--paper-2) 90%, transparent) 80%);
  border-color: var(--signal);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 30px var(--signal-soft);
  transform: translateY(-6px) scale(1.01);
}
.conn-card.span-2 { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
.conn-card:nth-last-child(2):not(.span-2) { border-bottom: 0; }
.conn-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
  border: 1px solid var(--signal);
  padding: 3px 9px;
  margin-bottom: 14px;
  font-weight: 500;
  background: var(--paper);
}
.conn-card.future {
  border: 1px dashed var(--rule);
  background: repeating-linear-gradient(45deg, var(--paper) 0, var(--paper) 6px, var(--paper-2) 6px, var(--paper-2) 12px);
  opacity: 0.85;
}
.conn-card.future::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--ink-3);
  transform: none;
}
.conn-pill.future-pill {
  color: var(--ink-3);
  border-color: var(--ink-3);
}
.conn-card h4 {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 600;
  margin: 0 0 10px;
}
.conn-card p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0;
  max-width: 64ch;
}

/* ============================================================
   WI-FI 6 TWT
   ============================================================ */
.twt-viz {
  border: 1px solid var(--rule);
  background:
    radial-gradient(ellipse at 50% 50%, var(--paper) 0%, var(--paper-2) 100%);
  padding: 28px 24px 16px;
  position: relative;
}
.twt-viz svg { width: 100%; height: auto; display: block; }

.twt-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--rule);
  border-top: 0;
}
.twt-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 22px 24px;
  border-right: 1px solid var(--rule);
  background: var(--paper);
  transition: background 0.3s;
}
.twt-stat:last-child { border-right: 0; }
.twt-stat:hover { background: var(--paper-2); }
.twt-stat-v {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--signal);
  letter-spacing: -0.04em;
  line-height: 1;
}
.twt-stat-v i {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 16px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 2px;
}
.twt-stat-k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 600;
  margin-top: 8px;
}
.twt-stat-n {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  line-height: 1.5;
}
.twt-prose {
  margin-top: 28px;
  columns: 2;
  column-gap: 56px;
  max-width: 1024px;
}
.twt-prose p {
  break-inside: avoid;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-2);
  max-width: none;
  margin: 0 0 16px;
}
.twt-prose p:last-child { margin-bottom: 0; }

/* ============================================================
   SAFETY
   ============================================================ */
.safety-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--rule);
}
.safe-cell {
  padding: 26px 22px 22px;
  border-right: 1px solid var(--rule);
  position: relative;
  background: var(--paper);
  transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}
.safe-cell:last-child { border-right: 0; }
.safe-cell:hover {
  background: color-mix(in srgb, var(--paper-2) 90%, transparent);
  border-color: var(--signal);
  transform: translateY(-4px) scale(1.005);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.06), 0 0 15px var(--signal-soft);
  z-index: 2;
}
.safe-cell .s-num {
  display: block;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  color: var(--signal);
  letter-spacing: -0.045em;
  line-height: 1;
  margin-bottom: 16px;
}
.safe-cell .s-num i {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 18px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 2px;
}
.safe-cell h4 {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 6px;
}
.safe-cell p {
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.65;
  margin: 0;
}

/* EEPROM mirror */
.eeprom-figure {
  margin-top: 24px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 22px 26px;
}
.ef-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
  font-weight: 500;
  margin-bottom: 14px;
}

.eeprom-bar {
  display: grid;
  grid-template-columns: 4fr 0.6fr 4fr 0.6fr 2.5fr;
  gap: 0;
  height: 88px;
  font-family: var(--font-mono);
  border: 1px solid var(--rule);
  background: var(--paper);
  overflow: hidden;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dataBusFlow {
  0% { background-position: 0px 0px; }
  100% { background-position: 40px 40px; }
}
.eeprom-bar::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: linear-gradient(90deg, 
    transparent 0%, 
    transparent 45%, 
    color-mix(in srgb, var(--signal-soft) 18%, transparent) 50%, 
    transparent 55%, 
    transparent 100%
  );
  background-size: 200% 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 1;
}
.eeprom-bar:hover::after {
  opacity: 1;
  animation: dataBusFlow 1.5s linear infinite;
}
.eeprom-bar .slot,
.eeprom-bar .flag {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  position: relative;
  transition: background 0.22s;
  z-index: 2;
}
.eeprom-bar .slot::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: background 0.3s, box-shadow 0.3s;
}
@keyframes pulseLedGreen {
  0%, 100% {
    background-color: var(--signal);
    box-shadow: 0 0 2px var(--signal-soft);
  }
  50% {
    background-color: color-mix(in srgb, var(--signal) 50%, #fff);
    box-shadow: 0 0 8px var(--signal);
  }
}
@keyframes pulseLedYellow {
  0%, 100% {
    background-color: var(--ink-3);
    opacity: 0.4;
  }
  50% {
    background-color: var(--ink-2);
    opacity: 1;
    box-shadow: 0 0 4px var(--ink-2);
  }
}
.eeprom-bar .slot.slot-a::before {
  background: var(--signal);
  animation: pulseLedGreen 2s infinite;
}
.eeprom-bar .slot.slot-b::before {
  background: var(--ink-3);
  animation: pulseLedYellow 3s infinite;
}
.eeprom-bar .slot.slot-a { background: var(--paper); border-right: 1px solid var(--rule); }
.eeprom-bar .slot.slot-b { background: var(--paper-3); border-right: 1px solid var(--rule); }
.eeprom-bar .flag       { background: var(--ink); color: var(--paper); }
.eeprom-bar .pad        {
  background:
    repeating-linear-gradient(45deg, var(--rule-2) 0 4px, var(--paper) 4px 8px);
}
.eeprom-bar .s-k {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-3);
}
.eeprom-bar .slot-a .s-k { color: var(--signal); }
.eeprom-bar .slot-b .s-k { color: var(--ink-3); }
.eeprom-bar .flag .s-k   { color: var(--paper); }
.eeprom-bar .s-meta {
  font-size: 11px;
  color: var(--ink);
  font-weight: 500;
}
.eeprom-bar .flag .s-meta { color: var(--paper); opacity: 0.85; }
.ef-note {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  line-height: 1.65;
}

/* ============================================================
   NEXT PROJECT
   ============================================================ */
.back-link {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.back-link:hover { color: var(--signal); }

/* ============================================================
   REVEAL — block-level pre-reveal soften
   ============================================================ */
/* ============================================================
   REVEAL — block-level pre-reveal soften (Apple-style fluid ease-out)
   ============================================================ */
.block.pre-reveal,
[data-reveal].pre-reveal,
.layout-figure.pre-reveal,
.sleep-wrap.pre-reveal,
.eeprom-figure.pre-reveal {
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  filter: blur(5px);
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 1.2s cubic-bezier(0.16, 1, 0.3, 1),
              filter 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform, filter;
}

.block.in,
[data-reveal].in,
.layout-figure.in,
.sleep-wrap.in,
.eeprom-figure.in {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* ============================================================
   TEXT SELECTABILITY LIMITS & TOGGLE SWITCH
   ============================================================ */
/* By default, lock text selectability to keep blueprint feel */
html, body {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Dynamically enable selectability when toggle is checked */
html.selection-enabled, html.selection-enabled body {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

/* Enable selection for code snippets, shortcuts, inputs, and interactive values */
input, textarea, kbd, code, pre, .pin, .formula {
  user-select: text;
  -webkit-user-select: text;
}

/* Switch Toggle layout in Help Overlay */
.kv.selectability-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}

.switch-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  margin-left: auto;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--rule-2);
  transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 20px;
  border: 1px solid var(--rule);
}

.switch-toggle .slider::before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--paper);
  transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch-toggle input:checked + .slider {
  background-color: var(--signal);
  border-color: var(--signal);
}

.switch-toggle input:checked + .slider::before {
  transform: translateX(18px);
  background-color: var(--paper);
}

/* ============================================================
   ACTIVE SVG TRANSITIONS — simple colour highlight, no animation
   ============================================================ */
.sd-edge.active path {
  stroke: var(--signal) !important;
  stroke-width: 2.8px !important;
  opacity: 1 !important;
  marker-end: url(#sd-arr-sig) !important;
}

.sd-edge-label.active .e-label-bg {
  fill: color-mix(in srgb, var(--paper) 86%, var(--signal)) !important;
  stroke: var(--signal) !important;
  stroke-width: 1.2px !important;
}

.sd-edge-label.active .e-label {
  fill: var(--signal) !important;
  font-weight: 700 !important;
}

/* Card reveal base states */
.feature-grid .fg-cell,
.safety-grid .safe-cell,
.conn-grid .conn-card,
.sleep-rings .ring-card,
.math-wrap .math-card {
  opacity: 0;
  transform: translateY(20px) scale(0.995);
  transition-property: opacity, transform, background, border-color, box-shadow;
  transition-duration: 0.8s, 0.8s, 0.4s, 0.4s, 0.4s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

/* Parent revealed states */
.block.in .fg-cell,
.block.in .safe-cell,
.block.in .conn-card,
.sleep-wrap.in .ring-card,
.block.in .math-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Reset delays on hover instantly */
.fg-cell:hover,
.safe-cell:hover,
.conn-card:hover,
.ring-card:hover,
.math-card:hover {
  transition-delay: 0s !important;
}

/* Stagger entrance delays (only opacity and transform receive delays) */
.block.in .fg-cell:nth-child(1),
.block.in .safe-cell:nth-child(1),
.block.in .conn-card:nth-child(1),
.sleep-wrap.in .ring-card:nth-child(1),
.block.in .math-card:nth-child(1) {
  transition-delay: 0.04s, 0.04s, 0s, 0s, 0s;
}

.block.in .fg-cell:nth-child(2),
.block.in .safe-cell:nth-child(2),
.block.in .conn-card:nth-child(2),
.sleep-wrap.in .ring-card:nth-child(2),
.block.in .math-card:nth-child(2) {
  transition-delay: 0.12s, 0.12s, 0s, 0s, 0s;
}

.block.in .fg-cell:nth-child(3),
.block.in .safe-cell:nth-child(3),
.block.in .conn-card:nth-child(3),
.sleep-wrap.in .ring-card:nth-child(3) {
  transition-delay: 0.20s, 0.20s, 0s, 0s, 0s;
}

.block.in .fg-cell:nth-child(4),
.block.in .safe-cell:nth-child(4),
.block.in .conn-card:nth-child(4),
.sleep-wrap.in .ring-card:nth-child(4) {
  transition-delay: 0.28s, 0.28s, 0s, 0s, 0s;
}

.block.in .fg-cell:nth-child(5),
.block.in .conn-card:nth-child(5) {
  transition-delay: 0.36s, 0.36s, 0s, 0s, 0s;
}

.block.in .fg-cell:nth-child(6),
.block.in .conn-card:nth-child(6) {
  transition-delay: 0.44s, 0.44s, 0s, 0s, 0s;
}



/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .ls-hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .radar-wrap   { grid-template-columns: 1fr; }
  .twt-stats    { grid-template-columns: 1fr; }
  .twt-stats .twt-stat { border-right: 0; border-bottom: 1px solid var(--rule); }
  .twt-stats .twt-stat:last-child { border-bottom: 0; }
  .twt-prose    { columns: 1; }
  .sleep-wrap   { grid-template-columns: 1fr; padding: 28px; }

  .math-wrap    { grid-template-columns: 1fr; }
  .two-col-prose { columns: 1; }
}
@media (max-width: 900px) {
  .page > .block { padding: 56px 0 16px; }
  .block-head { margin-bottom: 24px; }
  .block-head .bh-row { flex-direction: column; align-items: flex-start; gap: 6px; padding-bottom: 10px; margin-bottom: 14px; }
  .bh-meta { font-size: 9.5px; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .feature-grid .fg-cell:nth-child(3n)        { border-right: 1px solid var(--rule); }
  .feature-grid .fg-cell:nth-child(2n)        { border-right: 0; }
  .feature-grid .fg-cell:nth-last-child(-n+3) { border-bottom: 1px solid var(--rule); }
  .feature-grid .fg-cell:nth-last-child(-n+2) { border-bottom: 0; }
  .safety-grid { grid-template-columns: 1fr 1fr; }
  .safety-grid .safe-cell:nth-child(2n) { border-right: 0; }
  .safety-grid .safe-cell:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .conn-grid, .rules-grid { grid-template-columns: 1fr; }
  .conn-card, .rule-card { border-right: 0; }
  .rule-card:nth-last-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .rule-card:last-child { border-bottom: 0; }
  .ls-hero-meta { grid-template-columns: 1fr 1fr; }
  .ls-hero-meta .m-cell:nth-child(2)        { border-right: 0; }
  .ls-hero-meta .m-cell:nth-child(-n+2)     { border-bottom: 1px solid var(--rule); }

  .eeprom-bar { grid-template-columns: 1fr; height: auto; }
  .eeprom-bar .pad { display: none; }
  .eeprom-bar .slot, .eeprom-bar .flag { border-right: 0; border-bottom: 1px solid var(--rule); padding: 14px 16px; }
  .eeprom-bar .flag { border-bottom: 0; }
  .comp-table td:first-child, .comp-table th:first-child { width: auto; }
}
@media (max-width: 640px) {
  .feature-grid, .safety-grid, .sleep-rings { grid-template-columns: 1fr; }
  .feature-grid .fg-cell, .safety-grid .safe-cell { border-right: 0; border-bottom: 1px solid var(--rule); }
  .feature-grid .fg-cell:last-child, .safety-grid .safe-cell:last-child { border-bottom: 0; }
  .ls-title { font-size: clamp(48px, 13vw, 80px); }
  .wiring-table, .comp-table { font-size: 11px; }
  .wiring-table th, .wiring-table td,
  .comp-table th, .comp-table td { padding: 9px 11px; }
  .arch-diagram, .state-diagram { padding: 16px 14px; }
}
