.page-home {
  --home-gap: clamp(12px, 1.6vw, 20px);
  --home-pad: clamp(18px, 2.6vw, 30px);
  --home-clay-ink: #0B1220;
  display: block;
}

.page-home img {
  max-width: 100%;
  height: auto;
  display: block;
}

.page-home a:focus-visible,
.page-home span:focus-visible,
.page-home li:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Hero collage ---------- */

.page-home .home-hero {
  padding-top: clamp(16px, 3vw, 34px);
  padding-bottom: clamp(28px, 4.4vw, 52px);
}

.page-home .hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--home-gap);
}

.page-home .hero-lead {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(22px, 3.2vw, 40px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(55, 245, 228, 0.16), transparent 58%),
    radial-gradient(90% 110% at 100% 100%, rgba(155, 92, 255, 0.16), transparent 60%),
    linear-gradient(158deg, var(--ink-800), var(--ink-900));
}

.page-home .hero-lead::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--violet) 52%, var(--lava));
  opacity: 0.85;
}

.page-home .hero-context {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
}

.page-home .ctx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(55, 245, 228, 0.16);
}

.page-home h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--fog);
  text-wrap: balance;
}

.page-home .hero-lede {
  margin: 0;
  max-width: 46ch;
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  line-height: 1.85;
  color: rgba(242, 245, 247, 0.82);
}

.page-home .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.page-home .hero-shot {
  margin: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--ink-800);
}

.page-home .hero-shot img {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  aspect-ratio: 16 / 11;
}

.page-home .hero-shot figcaption {
  padding: 12px 16px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgba(242, 245, 247, 0.7);
  background: var(--ink-850);
  border-top: 1px solid var(--line);
}

.page-home .hero-preview {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
}

.page-home .preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.page-home .preview-code {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--rock);
}

.page-home .preview-svg {
  width: 100%;
  height: auto;
  display: block;
}

.page-home .preview-foot {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.7;
  color: rgba(242, 245, 247, 0.72);
}

.page-home .hero-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.page-home .fact {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  background: var(--ink-850);
}

.page-home .fact-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--cyan);
}

.page-home .fact-label {
  font-size: 0.78rem;
  color: var(--rock);
}

/* ---------- Layout: stream + rail ---------- */

.page-home .home-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  padding-bottom: clamp(48px, 7vw, 96px);
}

.page-home .home-stream {
  display: grid;
  gap: 0;
  min-width: 0;
}

.page-home .home-rail {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

/* ---------- Section scaffolding ---------- */

.page-home .home-sec {
  padding-block: clamp(30px, 4.6vw, 56px);
  border-top: 1px solid var(--line);
  min-width: 0;
}

.page-home .sec-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(12px, 2vw, 24px);
  align-items: start;
  margin-bottom: clamp(20px, 3vw, 34px);
}

.page-home .sec-num {
  display: block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.9rem, 4.6vw, 3.2rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--cyan);
}

.page-home .sec-head-copy {
  min-width: 0;
}

.page-home .sec-kicker {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--rock);
}

.page-home .sec-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.45rem, 3.2vw, 2.25rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--fog);
  text-wrap: balance;
}

.page-home .sec-lede {
  margin: 12px 0 0;
  max-width: 62ch;
  font-size: 0.98rem;
  line-height: 1.85;
  color: rgba(242, 245, 247, 0.78);
}

.page-home .sec-tail {
  margin: clamp(18px, 2.6vw, 28px) 0 0;
}

.page-home .text-link {
  display: inline-block;
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.94rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(55, 245, 228, 0.4);
  padding-bottom: 2px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.page-home .text-link:hover {
  color: var(--fog);
  border-bottom-color: var(--violet);
}

/* ---------- 01 steps ---------- */

.page-home .step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--home-gap);
}

.page-home .step {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: var(--home-pad);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(170deg, var(--ink-800), var(--ink-900));
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}

.page-home .step:hover {
  transform: translateY(-4px);
  border-color: rgba(55, 245, 228, 0.45);
  box-shadow: 0 0 0 1px rgba(55, 245, 228, 0.2), 0 20px 34px -24px rgba(0, 0, 0, 0.95);
}

.page-home .step-index {
  justify-self: start;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(55, 245, 228, 0.35);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
}

.page-home .step h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.06rem;
  line-height: 1.3;
  color: var(--fog);
}

.page-home .step p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.8;
  color: rgba(242, 245, 247, 0.74);
}

/* ---------- 02 replay ---------- */

.page-home .replay-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--home-gap);
  padding: clamp(16px, 2.4vw, 28px);
  border-radius: var(--radius-xl);
  background: var(--paper);
  color: var(--paper-ink);
}

.page-home .replay-shot {
  margin: 0;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.page-home .replay-shot img {
  width: 100%;
  border-radius: var(--radius-lg);
  object-fit: cover;
  aspect-ratio: 14 / 9;
}

.page-home .replay-shot figcaption {
  font-size: 0.78rem;
  line-height: 1.6;
  color: rgba(11, 18, 32, 0.62);
}

.page-home .replay-side {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.page-home .replay-text {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.9;
  color: rgba(11, 18, 32, 0.84);
}

.page-home .speed-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-home .speed-chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(11, 18, 32, 0.22);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(11, 18, 32, 0.72);
  background: rgba(255, 255, 255, 0.5);
}

.page-home .speed-chip.is-on {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--cyan-ink);
  font-weight: 700;
}

.page-home .speed-chip.speed-loop {
  border-style: dashed;
  border-color: rgba(255, 107, 53, 0.6);
  color: #A63C15;
}

.page-home .readout-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: rgba(11, 18, 32, 0.14);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.page-home .readout {
  display: grid;
  gap: 2px;
  padding: 12px 10px;
  background: var(--paper);
}

.page-home .readout-num {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 700;
  line-height: 1.1;
  color: #0B1220;
}

.page-home .readout-label {
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(11, 18, 32, 0.6);
}

.page-home .replay-note {
  margin: 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(11, 18, 32, 0.2);
  font-size: 0.82rem;
  line-height: 1.75;
  color: rgba(11, 18, 32, 0.66);
}

/* ---------- 03 devices ---------- */

.page-home .device-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--home-gap);
}

.page-home .device-card {
  padding: var(--home-pad);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(175deg, var(--ink-800), var(--ink-900));
}

.page-home .device-tag {
  margin: 0 0 8px;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--violet);
}

.page-home .device-card h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--fog);
}

.page-home .device-card p {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.85;
  color: rgba(242, 245, 247, 0.76);
}

.page-home .device-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.page-home .device-list li {
  position: relative;
  padding-left: 16px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: rgba(242, 245, 247, 0.68);
}

.page-home .device-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lava);
}

.page-home .device-figure {
  margin: var(--home-gap) 0 0;
  display: grid;
  gap: 8px;
}

.page-home .device-figure img {
  width: 100%;
  border-radius: var(--radius-lg);
  object-fit: cover;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
}

.page-home .device-figure figcaption {
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--rock);
}

.page-home .diff-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: clamp(14px, 2vw, 20px);
}

.page-home .diff-chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 107, 53, 0.55);
  background: rgba(255, 107, 53, 0.12);
  color: #FFB795;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.page-home .diff-note {
  flex: 1 1 220px;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--rock);
}

/* ---------- 04 favorites (clay band) ---------- */

.page-home .sec-clay {
  margin-block: clamp(14px, 2.4vw, 26px);
  padding: clamp(22px, 3.4vw, 40px);
  border-top: 0;
  border-radius: var(--radius-xl);
  background: linear-gradient(150deg, #D8CDBB, #C7B9A3);
  color: var(--home-clay-ink);
}

.page-home .sec-clay .sec-num {
  color: #9A5330;
}

.page-home .sec-clay .sec-kicker {
  color: rgba(11, 18, 32, 0.58);
}

.page-home .sec-clay .sec-title {
  color: var(--home-clay-ink);
}

.page-home .sec-clay .sec-lede {
  color: rgba(11, 18, 32, 0.78);
}

.page-home .fav-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--home-gap);
}

.page-home .fav-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(11, 18, 32, 0.16);
  background: rgba(255, 255, 255, 0.42);
}

.page-home .fav-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.35;
  color: #16233A;
}

.page-home .fav-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.8;
  color: rgba(11, 18, 32, 0.78);
}

.page-home .sec-clay .text-link {
  color: #6B3315;
  border-bottom-color: rgba(107, 51, 21, 0.45);
}

.page-home .sec-clay .text-link:hover {
  color: #16233A;
  border-bottom-color: var(--lava);
}

/* ---------- 05 support ---------- */

.page-home .support-figure {
  margin: 0 0 var(--home-gap);
}

.page-home .support-figure img {
  width: 100%;
  border-radius: var(--radius-lg);
  object-fit: cover;
  aspect-ratio: 12 / 7;
  border: 1px solid var(--line);
}

.page-home .flow-row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.page-home .flow-node {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--ink-850);
}

.page-home .flow-node h3 {
  margin: 8px 0 4px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--fog);
}

.page-home .flow-node p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.7;
  color: rgba(242, 245, 247, 0.68);
}

.page-home .flow-dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.page-home .flow-node.is-submitted .flow-dot {
  background: var(--rock);
}

.page-home .flow-node.is-working .flow-dot {
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(55, 245, 228, 0.16);
}

.page-home .flow-node.is-pending .flow-dot {
  background: var(--lava);
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.16);
}

.page-home .flow-node.is-done .flow-dot {
  background: var(--moss);
  box-shadow: 0 0 0 4px rgba(111, 143, 106, 0.22);
}

.page-home .support-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: clamp(16px, 2.4vw, 24px);
  padding: clamp(16px, 2.4vw, 24px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(16, 26, 44, 0.95), rgba(7, 11, 20, 0.95));
}

.page-home .support-stat {
  display: grid;
  gap: 2px;
}

.page-home .support-stat-num {
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--cyan);
}

.page-home .support-stat-label {
  font-size: 0.78rem;
  color: var(--rock);
}

.page-home .support-copy {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.85;
  color: rgba(242, 245, 247, 0.76);
}

/* ---------- Rail ---------- */

.page-home .rail-card {
  display: grid;
  gap: 2px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--ink-850);
}

.page-home .rail-card--alt {
  background: linear-gradient(170deg, rgba(16, 26, 44, 0.9), rgba(7, 11, 20, 0.9));
}

.page-home .rail-title {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--rock);
}

.page-home .rail-link {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  border-left: 2px solid transparent;
  font-size: 0.86rem;
  line-height: 1.5;
  color: rgba(242, 245, 247, 0.78);
  text-decoration: none;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.page-home .rail-link:hover,
.page-home .rail-link:focus-visible {
  background: rgba(155, 92, 255, 0.16);
  border-left-color: var(--violet);
  color: var(--fog);
}

/* ---------- Responsive ---------- */

@media (min-width: 720px) {
  .page-home .hero-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .page-home .step-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-home .fav-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-home .flow-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .page-home .support-bottom {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-home .support-copy {
    grid-column: 1 / -1;
  }
}

@media (min-width: 860px) {
  .page-home .replay-panel {
    grid-template-columns: 1.12fr 1fr;
    align-items: start;
  }

  .page-home .device-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .page-home .hero-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: stretch;
  }

  .page-home .hero-lead {
    grid-column: 1 / 8;
    grid-row: 1;
  }

  .page-home .hero-shot {
    grid-column: 8 / 13;
    grid-row: 1 / 3;
  }

  .page-home .hero-preview {
    grid-column: 1 / 8;
    grid-row: 2;
  }

  .page-home .hero-facts {
    grid-column: 1 / 13;
    grid-row: 3;
  }
}

@media (min-width: 1040px) {
  .page-home .home-body {
    grid-template-columns: minmax(0, 1fr) 208px;
    align-items: start;
  }

  .page-home .home-rail {
    position: sticky;
    top: calc(var(--header-h) + 20px);
  }
}

@media (max-width: 420px) {
  .page-home .readout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-home .readout:last-child {
    grid-column: 1 / -1;
  }

  .page-home .diff-chip {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-home .step,
  .page-home .rail-link,
  .page-home .text-link {
    transition: none;
  }

  .page-home .step:hover {
    transform: none;
  }
}
