/* =========================================================================
   s7 — Fast, and built to stay that way (SPEED & RELIABILITY)
   Layout archetype: CENTRED, abstract, NO device frame.
   Signature motion (ONE): a single scrubbed proxy --charge (0 -> 1) on .s7-stage.
   Everything derives from it:
     - the speed-meter arc fills (stroke-dashoffset) and the needle swings up
     - the displayed load figure counts down (set in JS from --charge)
     - the WCAG 2.1 AA accessibility credential ignites as the meter charges
   Transform / opacity / stroke-dashoffset only. Reduced motion + no-JS force
   --charge:1 so the section rests fully charged and readable.
   (The shield + protection checks split out into s7s.css — security section.)
   ========================================================================= */

#s7 {
  --charge: 0;            /* 0 cold -> 1 fully charged; JS scrubs it */
  text-align: center;
}

#s7 .wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2.2rem, 5vw, 3.4rem);
}

/* ---- head ------------------------------------------------------------- */
#s7 .s7-head {
  max-width: var(--maxw-prose);
  margin-inline: auto;
}
#s7 .s7-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  justify-content: center;
  margin-bottom: var(--sp-3);
}
#s7 .s7-eyebrow::before,
#s7 .s7-eyebrow::after {
  content: ""; width: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-soft));
}
#s7 .s7-eyebrow::after { background: linear-gradient(90deg, var(--gold-soft), transparent); }
#s7 .s7-title {
  font-size: var(--fs-h2);
  font-weight: 600; line-height: 1.08; letter-spacing: -0.01em;
  color: var(--ice); text-wrap: balance;
  margin: 0;
}
#s7 .s7-title .accent { color: var(--gold-bright); font-style: italic; font-weight: 500; }
#s7 .s7-lead {
  margin: var(--sp-3) auto 0;
  color: var(--parchment-dim);
  font-size: var(--fs-lead);
  line-height: 1.5;
  max-width: 56ch;
  text-wrap: pretty;
}

/* ---- stage (the abstract centrepiece) --------------------------------- */
#s7 .s7-stage {
  position: relative;
  width: 100%;
  max-width: 880px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-items: center;
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  padding: clamp(1.8rem, 4vw, 3rem) clamp(1.2rem, 4vw, 3rem);
  border: 1px solid rgba(110, 118, 132, 0.16);
  border-radius: 22px;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(168, 200, 224, 0.05), transparent 60%),
    linear-gradient(180deg, rgba(20, 24, 32, 0.55), rgba(8, 9, 12, 0.35));
  overflow: hidden;
  isolation: isolate;
}

/* subtle star / edge-node motif: two slow drifting orbit rings + sparks.
   These are decorative; they ease in with charge and drift on transform only. */
#s7 .s7-orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(168, 200, 224, 0.10);
  pointer-events: none;
  z-index: 0;
  opacity: calc(0.25 + var(--charge) * 0.55);
  transition: opacity 0.4s linear;
}
#s7 .s7-orbit--a {
  width: 360px; height: 360px;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(calc(0.9 + var(--charge) * 0.1));
  animation: s7-spin 60s linear infinite;
}
#s7 .s7-orbit--b {
  width: 540px; height: 540px;
  left: 50%; top: 50%;
  border-color: rgba(196, 162, 101, 0.08);
  transform: translate(-50%, -50%);
  animation: s7-spin 90s linear infinite reverse;
}
@keyframes s7-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

#s7 .s7-spark {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--cyan-glow);
  box-shadow: 0 0 6px 1px rgba(168, 200, 224, 0.7);
  z-index: 0;
  pointer-events: none;
  opacity: calc(var(--charge) * 0.8);
  transition: opacity 0.5s linear;
}
#s7 .s7-spark--1 { left: 14%; top: 22%; animation: s7-twinkle 4.2s ease-in-out infinite; }
#s7 .s7-spark--2 { left: 82%; top: 30%; background: var(--gold-soft); box-shadow: 0 0 6px 1px rgba(196,162,101,.7); animation: s7-twinkle 5.6s ease-in-out infinite 0.8s; }
#s7 .s7-spark--3 { left: 70%; top: 78%; animation: s7-twinkle 4.8s ease-in-out infinite 1.6s; }
@keyframes s7-twinkle {
  0%, 100% { transform: scale(0.6); opacity: calc(var(--charge) * 0.35); }
  50%      { transform: scale(1.2); opacity: calc(var(--charge) * 0.95); }
}

/* ---- LEFT: speed meter ------------------------------------------------ */
#s7 .s7-meter {
  position: relative;
  z-index: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}
#s7 .s7-meter__svg {
  width: 100%;
  max-width: 260px;
  height: auto;
  overflow: visible;
}
#s7 .s7-meter__track {
  stroke: rgba(110, 118, 132, 0.22);
}
/* arc length of the semicircle path ~ 289; draw it in from the start */
#s7 .s7-meter__arc {
  stroke-dasharray: 289;
  stroke-dashoffset: calc(289 - 289 * var(--charge));
  filter: drop-shadow(0 0 5px rgba(196, 162, 101, calc(var(--charge) * 0.5)));
}
/* needle pivots at (120,132); swings from -78deg (left/slow) to +78deg (fast) */
#s7 .s7-meter__needle {
  transform: rotate(calc(-78deg + var(--charge) * 156deg));
  transform-origin: 120px 132px;
  transform-box: view-box;
}
#s7 .s7-meter__needle line { stroke: var(--ice); }
#s7 .s7-meter__needle circle { fill: var(--gold-bright); }

#s7 .s7-meter__cap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: -0.4rem;
}
#s7 .s7-meter__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  font-weight: 600;
  color: var(--ice);
  line-height: 1;
  letter-spacing: -0.02em;
}
#s7 .s7-meter__unit { color: var(--gold-bright); margin-left: 1px; }
#s7 .s7-meter__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
}

/* ---- WCAG 2.1 AA accessibility credential (lives with speed/reliability) - */
#s7 .s7-credential {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 44ch;
  margin: 20px 0 0;
  padding: 13px 16px 13px 14px;
  text-align: left;
  border: 1px solid var(--gold-soft);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(196,162,101,0.07), rgba(196,162,101,0.015));
  /* ignites with the shield's final tick (charge > 0.7) */
  opacity: calc(0.35 + clamp(0, (var(--charge) - 0.6) / 0.4, 1) * 0.65);
  transition: opacity var(--t-fast) linear;
}
#s7 .s7-credential__icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  border-radius: 50%;
  background: rgba(196,162,101,0.09);
  box-shadow: inset 0 0 0 1px rgba(196,162,101,0.18);
}
#s7 .s7-credential__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
#s7 .s7-credential__badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--gold-bright);
}
#s7 .s7-credential__txt {
  color: var(--parchment-dim);
  font-size: var(--fs-small);
  line-height: 1.55;
}

/* ---- responsive ------------------------------------------------------- */
@media (max-width: 760px) {
  #s7 .s7-stage {
    grid-template-columns: 1fr;
    gap: clamp(2rem, 8vw, 2.8rem);
    max-width: 460px;
  }
  #s7 .s7-orbit--a { width: 300px; height: 300px; }
  #s7 .s7-orbit--b { width: 440px; height: 440px; }
  #s7 .s7-credential { margin-inline: auto; text-align: left; }
}

/* ---- reduced motion / no-JS resting state: fully charged -------------- */
@media (prefers-reduced-motion: reduce) {
  #s7 { --charge: 1; }
  #s7 .s7-orbit,
  #s7 .s7-spark,
  #s7 .s7-shield__pulse { animation: none; }
}
/* No-JS safety: if the proxy never runs the JS sets --charge:1 on the CDN-fail
   path; this rule guarantees a sane resting figure even before that lands. */
.no-js #s7 { --charge: 1; }
