/* ==========================================================================
   ElectOrchestrator — landing page
   Builds on base.css. One showpiece — the exploded board — and everything
   around it stays typographic: no icon tiles, no gradients, no glow.
   ========================================================================== */

body.landing {
  background: var(--bg);
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  color: var(--fg-3);
  font-size: 13px;
  font-weight: 500;
}

.lamp {
  display: inline-block;
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-4);
}

.lamp--ok {
  background: var(--success);
}

.lamp--warn {
  background: var(--warning);
}

.lamp--bad {
  background: var(--danger);
}

/* ── Nav ───────────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 60px;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav__links {
  display: flex;
  gap: 24px;
  margin-right: auto;
}

.nav__links a {
  color: var(--fg-3);
  font-size: 13.5px;
  text-decoration: none;
  transition: color 0.12s var(--ease);
}

.nav__links a:hover {
  color: var(--fg);
}

/* ── Hero ──────────────────────────────────────────────────────────────── */

.hero {
  padding-top: 104px;
  padding-bottom: 56px;
  text-align: center;
}

.hero h1 {
  margin: 16px auto 0;
  max-width: 820px;
  font-size: clamp(40px, 6.2vw, 64px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.lead {
  margin: 20px auto 0;
  max-width: 600px;
  color: var(--fg-3);
  font-size: 17px;
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
}

/* ── Exploded view ─────────────────────────────────────────────────────── */

.stage {
  padding-bottom: 24px;
}

/* Camera and stack are driven from landing.js, one frame at a time:
   --rx/--rz orbit, --zoom dolly, --zc re-centres the stack, --xp is how far
   apart it is (0 assembled, 1 exploded), --g0/--gh place the guides. */
.xv {
  --rx: 56deg;
  --rz: -34deg;
  --zoom: 1;
  --zc: 0px;
  --xp: 0;
  --g0: 0px;
  --gh: 0px;
  --t: 7px; /* board thickness */

  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg-app);
  overflow: hidden;
}

.xv__bar,
.xv__foot {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
}

.xv__bar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* The prompt the board is "generated" from, typed live. */
.xv__prompt {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  max-width: 560px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-app);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
}

.xv__prompt-mark {
  margin-right: 8px;
  color: var(--fg-4);
  font-family: var(--mono);
}

.xv__prompt-text {
  overflow: hidden;
  color: var(--fg);
}

.xv__prompt-placeholder {
  display: none;
  margin-left: 2px;
  color: var(--fg-4);
}

.xv__prompt-text:empty ~ .xv__prompt-placeholder {
  display: inline;
}

/* Caret: solid while text is arriving, blinking while it waits. */
.xv__caret {
  display: inline-block;
  flex-shrink: 0;
  width: 1.5px;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: -0.2em;
  background: var(--accent);
  animation: caret-blink 1.05s steps(2, start) infinite;
}

.is-typing > .xv__caret,
[data-typing] > .xv__caret {
  animation: none;
}

@keyframes caret-blink {
  to {
    visibility: hidden;
  }
}

.xv__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.xv__muted {
  color: var(--fg-4);
  font-size: 12px;
}

.xv__foot {
  border-top: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-3);
  font-size: 12px;
}

.xv__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 18px;
  white-space: nowrap;
  overflow: hidden;
}

.xv__status .xv__caret {
  display: none;
  margin-left: -7px;
}

.xv__status[data-typing] .xv__caret {
  display: inline-block;
}

.xv__lamp {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--fg-4);
}

.xv__status[data-tone="idle"] .xv__lamp {
  visibility: hidden;
}

.xv__status[data-tone="busy"] .xv__lamp {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.xv__status[data-tone="ok"] .xv__lamp {
  background: var(--success);
}

/* CAD-style camera readout, in fixed-width digits so it does not jitter. */
.xv__telemetry {
  color: var(--fg-4);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: pre;
}

.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--r);
  background: var(--bg-subtle);
}

.seg__btn {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg-3);
  font-size: 12.5px;
  font-weight: 500;
}

.seg__btn[aria-pressed="true"] {
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.xv__viewport {
  position: relative;
  height: 640px;
}

/* Soft contact shadow under the board. */
.xv__viewport::before {
  content: "";
  position: absolute;
  left: 38%;
  top: calc(72% + var(--xp) * 9%); /* follows the bottom of the stack */
  width: 420px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.22), transparent);
  transform: translate(-50%, -50%) scale(var(--zoom));
  opacity: calc(1 - var(--xp) * 0.45);
  filter: blur(6px);
  pointer-events: none;
}

html[data-theme="dark"] .xv__viewport::before {
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent);
}

.xv__camera {
  position: absolute;
  left: 38%;
  top: 52%;
  width: 0;
  height: 0;
  perspective: 2200px;
  perspective-origin: 0 0;
  transform: scale(var(--zoom));
}

.xv__scene {
  position: absolute;
  left: -170px;
  top: -110px;
  width: 340px;
  height: 220px;
  transform-style: preserve-3d;
  /* Re-centred on the middle of the stack, so exploding grows it both ways. */
  transform: rotateX(var(--rx)) rotateZ(var(--rz)) translateZ(var(--zc));
}

/* A plane of the stack. --z (set per layer from landing.js) is its height. */
.xv__layer {
  --z: 0px;

  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateZ(var(--z));
  transition: opacity 0.25s var(--ease);
}

.xv__layer svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.xv__layer.is-dim {
  opacity: 0.12;
}

/* Edge midpoints. As the board turns, the leader line follows whichever edge
   currently faces the label column. */
.xv__anchor {
  position: absolute;
  width: 1px;
  height: 1px;
}

.xv__anchor[data-side="e"] {
  left: 100%;
  top: 50%;
}

.xv__anchor[data-side="w"] {
  left: 0;
  top: 50%;
}

.xv__anchor[data-side="n"] {
  left: 50%;
  top: 0;
}

.xv__anchor[data-side="s"] {
  left: 50%;
  top: 100%;
}

.xv__layer[data-layer="core"] .xv__anchor {
  transform: translateZ(var(--t));
}

/* Boxes: a top face and four sides that fold up out of the plane. */
.xv-box {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--d);
  transform-style: preserve-3d;
}

.xv-box > i {
  position: absolute;
  display: block;
}

.xv-box .f-top {
  inset: 0;
  background: var(--c);
  transform: translateZ(var(--h));
  border-radius: var(--rr, 0.5px);
}

.xv-box .f-s {
  left: 0;
  top: 100%;
  width: 100%;
  height: var(--h);
  background: color-mix(in srgb, var(--c), #000 24%);
  transform-origin: top;
  transform: rotateX(90deg);
}

.xv-box .f-n {
  left: 0;
  bottom: 100%;
  width: 100%;
  height: var(--h);
  background: color-mix(in srgb, var(--c), #000 30%);
  transform-origin: bottom;
  transform: rotateX(-90deg);
}

.xv-box .f-e {
  top: 0;
  left: 100%;
  width: var(--h);
  height: 100%;
  background: color-mix(in srgb, var(--c), #000 46%);
  transform-origin: left;
  transform: rotateY(-90deg);
}

.xv-box .f-w {
  top: 0;
  right: 100%;
  width: var(--h);
  height: 100%;
  background: color-mix(in srgb, var(--c), #000 36%);
  transform-origin: right;
  transform: rotateY(90deg);
}

/* Part details */
.xv-box .f-top b {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--mono);
  font-size: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.xv-box[data-kind="ic"] .f-top::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.xv-box[data-kind="ic"] .f-top {
  background: linear-gradient(135deg, color-mix(in srgb, var(--c), #fff 7%), var(--c));
}

.xv-box[data-kind="res"] .f-top,
.xv-box[data-kind="cap"] .f-top,
.xv-box[data-kind="led"] .f-top {
  background: linear-gradient(90deg, #cfd2d6 0 22%, var(--c) 22% 78%, #cfd2d6 78%);
}

.xv-box[data-kind="res"][data-axis="y"] .f-top,
.xv-box[data-kind="cap"][data-axis="y"] .f-top {
  background: linear-gradient(180deg, #cfd2d6 0 22%, var(--c) 22% 78%, #cfd2d6 78%);
}

.xv-box[data-kind="usbc"] .f-top {
  background: linear-gradient(180deg, #dfe2e6, #b9bdc3);
  border-radius: 3px;
}

/* The receptacle mouth faces off the board edge. */
.xv-box[data-kind="usbc"] .f-w::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 14%;
  bottom: 14%;
  border-radius: 999px;
  background: #1a1b1e;
}

.xv-box[data-kind="button"] .f-top::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: #202124;
  box-shadow: inset 0 0 0 1.5px #3a3b3f;
}

.xv-box[data-kind="led"] .f-top::after {
  content: "";
  position: absolute;
  left: 26%;
  right: 26%;
  top: 12%;
  bottom: 12%;
  border-radius: 1px;
  background: #60a5fa;
  box-shadow: 0 0 10px 3px rgba(96, 165, 250, 0.55);
}

/* Dashed alignment guides through the mounting holes. */
.xv-guide {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 0;
  height: var(--gh);
  border-left: 1px dashed color-mix(in srgb, var(--fg-3) 55%, transparent);
  transform-origin: top;
  transform: translateZ(var(--g0)) rotateX(90deg);
  opacity: var(--xp);
}

/* Leader lines + labels */
.xv__leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.xv__leaders line {
  stroke: var(--fg-4);
  stroke-width: 1;
}

.xv__leaders circle {
  fill: var(--bg);
  stroke: var(--fg-3);
  stroke-width: 1.2;
}

.xv__leaders .is-active line {
  stroke: var(--accent);
}

.xv__leaders .is-active circle {
  stroke: var(--accent);
  fill: var(--accent);
}

.xv__labels {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.xv__label {
  position: absolute;
  left: 0;
  top: 0;
  width: 220px;
  pointer-events: auto;
}

.xv__label.is-hidden {
  pointer-events: none;
}

.xv__label button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  text-align: left;
  transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease);
}

.xv__label button:hover,
.xv__label button:focus-visible,
.xv__label.is-active button {
  border-color: var(--border);
  background: var(--bg);
  outline: none;
}

.xv__label strong {
  display: block;
  color: var(--fg);
  min-height: 1.4em;
  font-size: 13px;
  font-weight: 500;
}

.xv__label span {
  display: block;
  min-height: 1.4em;
  color: var(--fg-3);
  font-size: 12px;
}

/* The line being written carries the caret. */
.xv__label[data-typing="name"] strong::after,
.xv__label[data-typing="note"] span::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.18em;
  background: var(--accent);
}

/* ── Sections ──────────────────────────────────────────────────────────── */

.section {
  padding-top: 120px;
}

.section__head {
  max-width: 640px;
}

.section h2,
.cta h2 {
  margin-top: 10px;
  font-size: clamp(28px, 3.4vw, 36px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.section__lead {
  margin-top: 14px;
  color: var(--fg-3);
  font-size: 16px;
  line-height: 1.65;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}

.step {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.step__num {
  color: var(--fg-4);
  font-family: var(--mono);
  font-size: 12px;
}

.step h3,
.feature h3 {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.step p,
.feature p {
  margin-top: 6px;
  color: var(--fg-3);
  font-size: 14px;
  line-height: 1.65;
}

/* Grounding: copy beside a datasheet extract */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  color: var(--fg-2);
  font-size: 14px;
}

.checks li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.sheet__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.sheet__part {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.sheet__src {
  color: var(--fg-3);
  font-size: 12px;
  text-align: right;
}

.sheet__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sheet__table th {
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}

.sheet__table td {
  padding: 7px 18px;
  color: var(--fg-2);
}

.sheet__table tr + tr td {
  border-top: 1px solid var(--border);
}

.sheet__table td:nth-child(-n + 2) {
  font-family: var(--mono);
  font-size: 12px;
}

.sheet__table td:nth-child(2) {
  color: var(--fg);
}

.sheet__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--fg-3);
  font-size: 12.5px;
}

/* Output */
.features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 48px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.feature {
  padding: 24px;
}

.feature + .feature {
  border-left: 1px solid var(--border);
}

.feature__tag {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
}

.feature code {
  font-size: 12.5px;
  color: var(--fg-2);
}

/* Closing call to action */
.cta {
  padding-top: 128px;
  padding-bottom: 128px;
  text-align: center;
}

.cta p {
  margin: 12px 0 28px;
  color: var(--fg-3);
  font-size: 16px;
}

.footer {
  border-top: 1px solid var(--border);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  color: var(--fg-4);
  font-size: 13px;
}

.footer__brand {
  color: var(--fg-2);
  font-weight: 500;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .xv__camera,
  .xv__viewport::before {
    left: 50%;
  }

  .xv__labels,
  .xv__leaders,
  .xv__muted,
  .xv__telemetry {
    display: none;
  }

  .xv__viewport {
    height: 480px;
  }

  .split {
    grid-template-columns: 1fr;
    gap: 40px;
  }

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

  .feature:nth-child(3) {
    border-left: 0;
  }

  .feature:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 720px) {
  .nav__links {
    display: none;
  }

  .nav__inner {
    justify-content: space-between;
  }

  .hero {
    padding-top: 64px;
  }

  .xv__viewport {
    height: 400px;
  }

  .xv__camera {
    transform: scale(calc(var(--zoom) * 0.72));
  }

  .xv__bar {
    flex-wrap: wrap;
  }

  .xv__prompt {
    flex-basis: 100%;
    max-width: none;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 28px;
  }

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

  .feature + .feature {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .xv__foot {
    font-size: 11.5px;
  }
}

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