/* ============================================================
   Interlude · Proof
   A live node network behind four panels of real numbers. The
   "Simulate a traffic spike" button scatters the network and it
   re-forms on its own while the self-healing loop steps through.
   Motion: js/proof.js.
   ============================================================ */

.proof {
  --light-64: rgba(244, 241, 234, 0.64);
  --light-40: rgba(244, 241, 234, 0.42);
  --gold-16: rgba(201, 168, 107, 0.16);
  --gold-30: rgba(201, 168, 107, 0.3);

  position: relative;
  z-index: 10;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: #060908;
  color: var(--text-light);
}
.proof-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%; /* js/proof.js caps it to ~one screen on tall layouts */
  display: block;
  z-index: 0;
}
/* Location marks, placed by js/proof.js from the 3D scene */
.pf-marks {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.pf-mark {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transform: translate3d(-999px, -999px, 0);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(201, 168, 107, 0.75);
  translate: -50% -100%;
  transition: color 0.3s ease, opacity 0.3s ease;
}
.pf-mark::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.pf-mark.is-fail { color: #e0795a; }
.pf-mark.is-diag { color: #e8b04a; }
.pf-mark.is-ok { color: #6acb8f; }
.pf-mark.is-scale { color: #f6ead0; }
.proof.pf-no3d .pf-marks {
  display: none;
}

.proof-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(52% 42% at 50% 44%, rgba(6, 9, 8, 0.6) 0%, rgba(6, 9, 8, 0.18) 60%, transparent 80%),
    radial-gradient(circle at center, transparent 35%, #060908 96%),
    linear-gradient(180deg, #060908 0%, transparent 14%, transparent 86%, #060908 100%);
}

/* ─── Layout: core in the middle, a panel in each corner ─── */
.proof-layout {
  position: relative;
  z-index: 2;
  min-height: inherit;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 44rem) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "tl . tr"
    ". core ."
    "bl . br";
  gap: 1.5rem;
  padding: clamp(5.5rem, 12vh, 7rem) var(--pad-x) clamp(2rem, 5vh, 3rem);
}

.proof-core {
  grid-area: core;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.proof-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent-gold);
}
.proof-eyebrow::before,
.proof-eyebrow::after {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gold-30);
}
.proof-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(2.8rem, 6.4vw, 6.1rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: var(--text-light);
}
.pt-line {
  display: block;
  overflow: hidden;
  padding: 0.03em 0.08em 0.1em;
  margin: -0.03em -0.08em -0.1em;
}
.pt-in {
  display: inline-block;
  will-change: transform;
}
.pt-serif {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.06em;
  letter-spacing: -0.03em;
  text-transform: none;
}
.pt-serif em {
  color: var(--accent-gold);
}
.proof-desc {
  text-shadow: 0 1px 14px #060908, 0 0 2px #060908;
  max-width: 34rem;
  margin: clamp(1.4rem, 3vh, 2rem) 0 clamp(1.5rem, 3.4vh, 2.2rem);
  font-size: clamp(1rem, 1.12vw, 1.1rem);
  line-height: 1.62;
  color: var(--light-64);
}

/* ─── Simulations: two scenarios and a four-step status ─── */
.proof-sim {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}
.ps-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}
.ps-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.25rem;
  border: 1px solid var(--gold-30);
  border-radius: 99px;
  background: rgba(6, 9, 8, 0.55);
  color: var(--text-light);
  font-size: 0.88rem;
  font-weight: 600;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    opacity 0.3s ease,
    transform 0.16s ease-out;
}
.ps-btn:active {
  transform: scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
  .ps-btn:hover {
    background: rgba(201, 168, 107, 0.14);
    border-color: var(--accent-gold);
  }
}
.ps-btn[disabled] {
  opacity: 0.4;
}
.ps-btn.is-running {
  opacity: 1;
  border-color: var(--accent-gold);
  background: rgba(201, 168, 107, 0.16);
}
.ps-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-gold);
}
.ps-btn.is-running .ps-dot {
  animation: psPulse 0.9s ease-out infinite;
}
@keyframes psPulse {
  0% { box-shadow: 0 0 0 0 rgba(201, 168, 107, 0.6); }
  100% { box-shadow: 0 0 0 9px rgba(201, 168, 107, 0); }
}
.ps-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.6rem; /* reserved, so the layout never jumps */
}
.ps-bar {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.proof-sim.is-running .ps-bar,
.proof-sim.is-done .ps-bar {
  opacity: 1;
}
.ps-bar span {
  width: 42px;
  height: 3px;
  border-radius: 2px;
  background: rgba(244, 241, 234, 0.14);
  transition: background-color 0.35s ease;
}
.ps-bar span.is-on {
  background: var(--accent-gold);
}
.proof-sim.is-done .ps-bar span {
  background: #6acb8f;
}
.ps-text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--light-40);
  text-shadow: 0 1px 10px #060908;
}
.proof-sim.is-running .ps-text {
  color: var(--accent-cream);
}
.proof-sim.is-done .ps-text {
  color: #6acb8f;
}

/* ─── Panels ─── */
.pf-panel {
  position: relative;
  width: clamp(230px, 21vw, 300px);
  padding: 1.1rem 1.25rem 1.2rem;
  border: 1px solid var(--gold-16);
  border-radius: 12px;
  background: rgba(9, 13, 12, 0.62);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.pf-tl { grid-area: tl; justify-self: start; align-self: start; }
.pf-tr { grid-area: tr; justify-self: end; align-self: start; }
.pf-bl { grid-area: bl; justify-self: start; align-self: end; }
.pf-br { grid-area: br; justify-self: end; align-self: end; }

.pf-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(201, 168, 107, 0.12);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--light-40);
}
.pf-tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-gold);
}
.pf-value {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.3rem, 3.3vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-variant-numeric: lining-nums tabular-nums;
}
.pf-unit {
  color: var(--accent-gold);
}
.pf-note {
  margin: 0.55rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--light-64);
}
.pf-note strong {
  color: var(--text-light);
  font-weight: 600;
}
.pf-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pf-stack li {
  padding: 0.32rem 0.6rem;
  border: 1px solid var(--gold-16);
  border-radius: 6px;
  background: rgba(201, 168, 107, 0.05);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--accent-cream);
}

/* Self-healing loop: one step lights at a time */
.pf-loop {
  counter-reset: step;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pf-loop li {
  counter-increment: step;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.32rem 0;
  font-size: 0.82rem;
  color: var(--light-40);
  transition: color 0.35s ease;
}
.pf-loop li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 241, 234, 0.18);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  transition:
    background-color 0.35s ease,
    border-color 0.35s ease,
    color 0.35s ease;
}
.pf-loop li.is-done {
  color: var(--light-64);
}
.pf-loop li.is-done::before {
  border-color: rgba(106, 203, 143, 0.6);
  color: #6acb8f;
}
.pf-loop li.is-on {
  color: var(--text-light);
}
.pf-loop li.is-on::before {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #0b100f;
}
.pf-br .pf-note {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(201, 168, 107, 0.12);
}

/* ─── Tablet & phone: the panels become a grid under the headline ─── */
@media (max-width: 960px) {
  .proof {
    min-height: auto;
  }
  .proof-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    grid-template-areas:
      "core core"
      "tl tr"
      "bl br";
    gap: 0.9rem;
    padding-top: clamp(5rem, 12vh, 6.5rem);
    padding-bottom: clamp(4rem, 10vh, 5.5rem);
  }
  .proof-core {
    margin-bottom: 2.5rem;
  }
  .pf-panel {
    width: auto;
    justify-self: stretch;
    align-self: stretch;
  }
}
@media (max-width: 560px) {
  .proof-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "core" "tl" "tr" "bl" "br";
  }
  .ps-bar span {
    width: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ps-btn.is-running .ps-dot {
    animation: none;
  }
}
