/* Landing page: shared palette, focused editorial layout. */
body.home-page { display: flex; flex-direction: column; height: auto; min-height: 100%; }
.home-page { --landing-muted: #b3aa9b; }
[data-theme="light"] .home-page { --landing-muted: #665e51; }
body.home-page .topbar { position: relative; min-height: 64px; height: auto; padding: 16px max(24px, calc((100vw - 1040px) / 2)); }
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: .02em; }
.home-page .topbar-right { gap: 12px; }
.home-page .btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 20px; width: auto; text-decoration: none; white-space: nowrap; }
.home-page .btn-primary.sm { padding: 10px 14px; font-size: 12px; }
.home-page .btn-primary.lg { min-height: 46px; padding: 12px 22px; font-size: 14px; }
.home-page .hero-action { background: var(--primary); color: var(--primary-ink); }
.home-page .hero-action:hover { background: var(--primary-hi); }
.landing { max-width: 1040px; width: 100%; margin: 0 auto; padding: 0 28px; }
.lead { padding: 64px 0 44px; text-align: center; }
.eyebrow { margin: 0 0 18px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--landing-muted); }
.lead h1 { margin: 0 0 22px; font-size: clamp(40px, 5.2vw, 64px); line-height: 1.04; letter-spacing: -.045em; font-weight: 650; }
.lede { max-width: 60ch; margin: 0 auto 26px; font-size: 16px; line-height: 1.65; color: var(--landing-muted); }
.pipeline { padding-bottom: 12px; }
.pipeline-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px 14px; }
.pipeline-heading h2 { margin: 0; font-size: 14px; font-weight: 550; }
.vision-label { font-size: 12px; color: var(--landing-muted); }
.build-view { background: var(--viewport-bg); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stage-art { margin: 0; padding: 12px 24px 0; }
.stage-art svg { display: block; width: 100%; height: clamp(240px, 34vw, 400px); }
.stage-art .w-can, .stage-art .w-cap { stroke: var(--landing-muted); }
.stage-art.is-paused .g-bridge, .stage-art.is-paused .g-carriage, .stage-art.is-paused .g-flash { animation-play-state: paused; }

/* --- cumulative reveal ---------------------------------------------------
   Stage N shows everything stages 1..N built, so the sequence reads as one
   pack coming together rather than five separate slides. */

.stage-art .s {
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.stage-art[data-stage] .s-cells { opacity: 1; }

.stage-art:is([data-stage="2"], [data-stage="3"], [data-stage="4"], [data-stage="5"])
  :is(.s-plates, .s-weld) { opacity: 1; transform: none; }

.stage-art:is([data-stage="3"], [data-stage="4"], [data-stage="5"])
  :is(.s-insul, .s-flex, .s-ntc) { opacity: 1; transform: none; }

.stage-art:is([data-stage="4"], [data-stage="5"])
  :is(.s-case, .s-term) { opacity: 1; transform: none; }

.stage-art[data-stage="5"] .s-gantry { opacity: 1; }

/* Entrance offsets: collectors land from above, enclosure closes inward. */
.s-plates, .s-weld { transform: translateY(-16px); }
.s-term { transform: translateY(8px); }
.s-case { transform: scale(1.05); transform-origin: 240px 172px; }
.s-ntc { transform: scale(0.4); transform-origin: 240px 180px; }

/* --- wireframe part styling ----------------------------------------------
   Line art rather than filled blocks: thin strokes, open interiors, and the
   details that identify a real part (terminal caps, weld spots, sense leads)
   instead of solid silhouettes. */

.w-can, .w-cap {
  fill: none;
  stroke: var(--ink-faint);
}
.w-can { stroke-width: 1.2; }
.w-cap { stroke-width: 1; opacity: 0.8; }

.s-cells use {
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.stage-art .s-cells use { opacity: 0; transform: scale(0.55); transform-origin: center; }
.stage-art[data-stage] .s-cells use { opacity: 1; transform: none; }
/* Row-by-row so the array appears to get laid out, not pasted in. */
.s-cells use:nth-child(n + 7):nth-child(-n + 12) { transition-delay: 0.09s; }
.s-cells use:nth-child(n + 13) { transition-delay: 0.18s; }

.s-plates rect {
  fill: var(--primary); fill-opacity: 0.08;
  stroke: var(--primary); stroke-width: 1.3;
}

.w-slit { fill: none; stroke: var(--primary); stroke-width: 1.2; }
.w-spot { fill: none; stroke: var(--weld); stroke-width: 1.1; }

.w-insul {
  fill: none;
  stroke: var(--accent); stroke-width: 1.2;
  stroke-dasharray: 5 5; opacity: 0.7;
}

/* Two edges make a ribbon read as a flex circuit rather than a fat cable. */
.w-flex {
  fill: none;
  stroke: var(--series); stroke-width: 1.3; stroke-linecap: round;
  /* The path declares pathLength="100", so the dash maths is in percent and
     stays correct however the ribbon is rerouted. */
  stroke-dasharray: 100; stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.8s ease 0.1s;
}
.stage-art:is([data-stage="3"], [data-stage="4"], [data-stage="5"]) .w-flex {
  stroke-dashoffset: 0;
}
.w-conn { fill: none; stroke: var(--series); stroke-width: 1.3; }

.w-ntc rect, .w-ntc path {
  fill: none;
  stroke: var(--ok); stroke-width: 1.2; stroke-linecap: round;
}

.w-case { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; }
.w-case-in { fill: none; stroke: var(--ink-faint); stroke-width: 1; opacity: 0.6; }

.w-term path, .w-term circle { fill: none; stroke-width: 1.4; }
.w-neg path, .w-neg circle { stroke: var(--bminus); }
.w-pos path, .w-pos circle { stroke: var(--bplus); }

/* --- stage 05: spot welding on an X-Y gantry ----------------------------
   The bridge indexes down the cell rows while the head sweeps across each
   one, so the motion reads as a real raster weld program. */

.g-rail, .g-beam, .g-head {
  fill: none;
  stroke-width: 1.3;
}
.g-rail { stroke: var(--ink-faint); }
.g-beam { stroke: var(--ink-soft); }
.g-head { stroke: var(--ink-soft); fill: var(--viewport-bg); }
.g-electrode { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; }
.g-tip { fill: var(--primary-hi); }

.g-bridge { animation: gantry-rows 4.2s cubic-bezier(0.6, 0, 0.35, 1) infinite; }
.g-carriage { animation: gantry-sweep 1.4s linear infinite alternate; }

.g-flash {
  fill: none;
  stroke: var(--accent); stroke-width: 1.6;
  opacity: 0;
  /* Circles sit at the group's local origin, so scale about 0 0 — the SVG
     default origin is the centre of the view box, which would fling them. */
  transform-origin: 0 0;
  animation: weld-flash 0.2333s linear infinite;
}
.g-flash-wide {
  stroke: var(--primary-hi); stroke-width: 1.1;
  animation-duration: 0.4666s;
}

@keyframes gantry-rows {
  0%, 31% { transform: translateY(135px); }
  34%, 64% { transform: translateY(181px); }
  67%, 100% { transform: translateY(227px); }
}
@keyframes gantry-sweep {
  from { transform: translateX(120px); }
  to { transform: translateX(360px); }
}
@keyframes weld-flash {
  0% { opacity: 0.95; transform: scale(0.35); }
  70% { opacity: 0; transform: scale(1.35); }
  100% { opacity: 0; transform: scale(1.35); }
}


/* Captions and compact, directly selectable stages. */
.stage-controls { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 28px 24px; }
.stage-caption { min-width: 0; }
.stage-current { margin: 0 0 8px; font-family: var(--mono); font-size: 12px; color: var(--ink); }
#stageCaption { margin: 0; color: var(--landing-muted); font-size: 14px; line-height: 1.5; min-height: 42px; max-width: 54ch; }
.playback { display: flex; gap: 6px; flex-shrink: 0; }
.playback button { font: inherit; font-size: 12px; min-height: 44px; min-width: 56px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: transparent; cursor: pointer; }
.playback button:hover { background: var(--elevated); }
.stage-progress { height: 2px; background: var(--line); }
.stage-progress i { display: block; width: 20%; height: 100%; background: var(--primary); transition: width .4s ease; }
.stage-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0; }
.stage-list button { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 58px; padding: 12px 8px; border: 0; background: transparent; color: var(--landing-muted); font: inherit; cursor: pointer; }
.stage-list button:hover { background: var(--elevated); }
.st-idx { font-family: var(--mono); font-size: 11px; }
.st-name { font-size: 13px; }
.stage-list .is-active button { background: var(--surface-2); color: var(--ink); }
.stage-list .is-active .st-idx, .stage-list .is-done .st-idx { color: var(--primary-hi); }
.stage-list button:focus-visible { outline-offset: -3px; }
.closing { max-width: 700px; margin: 0 auto; padding: 72px 0 64px; text-align: center; }
.closing h2 { margin: 0 0 20px; font-size: clamp(28px, 3.4vw, 38px); line-height: 1.15; letter-spacing: -.03em; font-weight: 600; }
.goal-copy { max-width: 62ch; margin: 0 auto; font-size: 16px; line-height: 1.7; color: var(--landing-muted); }
.project-status { margin: 30px 0; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; }
.project-status p { display: grid; grid-template-columns: 145px 1fr; gap: 16px; margin: 0; color: var(--landing-muted); font-size: 13px; line-height: 1.6; }
.project-status p + p { margin-top: 12px; }
.project-status strong { color: var(--ink); font-weight: 550; }
.home-footer { max-width: 1040px; width: 100%; margin: 0 auto; padding: 24px 28px 32px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 24px; color: var(--landing-muted); font-size: 12px; }
.resources { text-align: right; }
.resources summary { cursor: pointer; min-height: 32px; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; padding-top: 12px; }
.foot-links a { color: var(--landing-muted); text-decoration: none; }
.foot-links a:hover { color: var(--ink); }
@media (max-width: 600px) {
  body.home-page .topbar { padding: 14px 18px; gap: 10px; }
  .home-page .topbar-right { gap: 8px; }
  .home-page .theme-btn { padding: 9px; }
  .home-page .theme-label { display: none; }
  .home-page .brand { gap: 8px; }
  .home-page .btn-primary.sm { padding: 10px; font-size: 11px; }
  .landing { padding: 0 20px; }
  .lead { padding: 44px 0 36px; }
  .lede { font-size: 15px; }
  .pipeline-heading { flex-direction: column; gap: 6px; padding-bottom: 12px; }
  .stage-art { padding: 0 4px; }
  .stage-art svg { height: auto; aspect-ratio: 400 / 270; }
  .stage-controls { flex-direction: column; align-items: stretch; gap: 12px; padding: 0 18px 18px; }
  #stageCaption { min-height: 42px; }
  .playback { justify-content: flex-end; }
  .stage-list button { min-height: 48px; }
  .st-name { display: none; }
  .closing { padding: 48px 0; }
  .project-status p { grid-template-columns: 1fr; gap: 3px; }
  .home-footer { padding: 22px 20px; flex-wrap: wrap; gap: 14px; }
  .resources { text-align: left; }
  .foot-links { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .stage-art *, .stage-progress i { transition: none !important; animation: none !important; }
  .s-plates, .s-weld, .s-term, .s-case, .s-ntc, .stage-art .s-cells use { transform: none; }
  .w-flex { stroke-dashoffset: 0; }
  .g-bridge { transform: translateY(181px); }
  .g-carriage { transform: translateX(240px); }
  .g-flash { opacity: 0; }
}

@media (max-width: 360px) {
  body.home-page .topbar { padding: 12px; gap: 8px; }
  .home-page .brand { gap: 6px; }
  .brand-name { font-size: 13px; }
  .home-page .brand .logo { width: 28px; height: 28px; }
  .home-page .btn-primary.sm { padding: 9px 7px; }
}

.closing > .btn-primary { margin-top: 30px; }
