/* ============================================================
   .s-flywheel — Act 3 closer / bridge to Act IV.
   Background: developer-in-exoskeleton scene (assistive AI metaphor).
   Build 0: title + quote, scene visible full-bleed.
   Build 1: flywheel diagram fades in over a right-side scrim.
   Same chrome / scrim language as .s-amplifier.
   ============================================================ */

.s-flywheel {
  background: #04081F;
  color: var(--fg);
}

/* Layer 1 — background scene */
.s-flywheel .scene {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.s-flywheel image-slot.scene-slot {
  display: block;
  width: 100%;
  height: 100%;
}

/* Layer 2a — atmospheric base scrim (always on).
   Right side gets the heavier lift now: the right column holds the
   title + quote and overlaps the source image's holographic panels. */
.s-flywheel .scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    /* top/bottom darken for chrome legibility */
    linear-gradient(180deg,
      rgba(4,8,31,0.55) 0%,
      rgba(4,8,31,0.20) 16%,
      rgba(4,8,31,0.10) 50%,
      rgba(4,8,31,0.20) 82%,
      rgba(4,8,31,0.65) 100%),
    /* push the right-side holograms back so the text reads */
    linear-gradient(270deg,
      rgba(4,8,31,0.58) 0%,
      rgba(4,8,31,0.36) 28%,
      rgba(4,8,31,0.10) 52%,
      rgba(4,8,31,0.00) 100%);
}

/* Layer 2b — radial darken + backdrop blur behind the flywheel,
   revealed on step 1. Anchored to the LEFT half now so the wheel,
   which sits over the figure, becomes the focal element. */
.s-flywheel .scrim-wheel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 64%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 700ms ease-out, backdrop-filter 700ms ease-out;
  /* Atmospheric darken only — the cards/center carry their own glass.
     Lighter values keep the figure visible through the wheel. */
  background:
    radial-gradient(70% 95% at 42% 50%,
      rgba(4,8,31,0.55) 0%,
      rgba(4,8,31,0.45) 30%,
      rgba(4,8,31,0.30) 56%,
      rgba(4,8,31,0.12) 78%,
      rgba(4,8,31,0.00) 100%);
}
.s-flywheel[data-step="1"] .scrim-wheel {
  opacity: 1;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  /* mask the (lighter) blur to the same radial shape so the right edge
     stays sharp */
  -webkit-mask-image: radial-gradient(70% 95% at 42% 50%, #000 0%, #000 56%, rgba(0,0,0,0.4) 78%, transparent 100%);
  mask-image: radial-gradient(70% 95% at 42% 50%, #000 0%, #000 56%, rgba(0,0,0,0.4) 78%, transparent 100%);
}

/* Chrome rails — same recipe as .s-amplifier so the slide reads as part
   of the act 3 family. */
.s-flywheel .chrome-top {
  background: linear-gradient(
    to bottom,
    rgba(4, 8, 31, 0.78) 0%,
    rgba(4, 8, 31, 0.62) 70%,
    rgba(4, 8, 31, 0.00) 100%
  );
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: rgba(230, 232, 244, 0.82);
}
.s-flywheel .chrome-bottom {
  background: linear-gradient(
    to top,
    rgba(4, 8, 31, 0.78) 0%,
    rgba(4, 8, 31, 0.62) 70%,
    rgba(4, 8, 31, 0.00) 100%
  );
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  color: rgba(230, 232, 244, 0.82);
}
.s-flywheel .chrome-bottom .brand-mark { color: rgba(245, 247, 255, 0.92); }

/* Body — LEFT wheel column + RIGHT lead column.
   Figure in the source image lives on the left, so the wheel reveals
   over the figure (turning the metaphor into the explanation). Title +
   quote sit in the right-hand negative space. */
.s-flywheel .body {
  position: absolute;
  inset: 56px 0 56px 0;
  z-index: 2;
  padding: 56px var(--pad-x) 60px var(--pad-x);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 540px);
  gap: 40px;
  align-items: center;
}

/* ============================================================
   Right column — title + callout + Java hints (right-aligned)
   ============================================================ */
.s-flywheel .lead {
  text-align: right;
  margin-left: auto;
}
.s-flywheel .lead .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--cyan);
  opacity: 0.92;
  margin-bottom: 22px;
  text-shadow: 0 1px 8px rgba(4,8,31,0.85);
}
.s-flywheel .lead .title {
  font-size: 84px;
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 28px 0;
  color: var(--fg);
  text-shadow: 0 2px 24px rgba(0,0,0,0.65);
}
.s-flywheel .lead .title em {
  font-style: normal;
  color: var(--pink);
}
.s-flywheel .lead .callout {
  font-size: 28px;
  line-height: 1.34;
  letter-spacing: -0.005em;
  color: rgba(255,255,255,0.94);
  margin: 0 0 28px 0;
  max-width: 540px;
  margin-left: auto;
  text-wrap: pretty;
  text-shadow: 0 2px 18px rgba(0,0,0,0.65);
}
.s-flywheel .lead .callout .hl {
  color: var(--cyan);
  font-weight: 600;
}

/* Java-flavor hint chips — now legible: brighter cyan-tinted text,
   deeper backdrop, light cyan border. */
.s-flywheel .lead .hints {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 10px;
}
.s-flywheel .lead .hints li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--cyan);
  padding: 6px 12px;
  border: 1px solid rgba(91, 233, 240, 0.45);
  border-radius: 6px;
  background: rgba(4, 8, 31, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow:
    0 1px 0 rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
.s-flywheel .lead .hints li .k { color: inherit; }

/* ============================================================
   Right column — flywheel diagram (revealed on step 1)
   ============================================================ */
.s-flywheel .wheel {
  position: relative;
  width: 940px;
  height: 620px;
  max-width: 100%;
  margin: 0 auto;
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  transform-origin: 50% 50%;
  transition: opacity 600ms ease-out, transform 700ms cubic-bezier(.2,.7,.2,1);
  color: var(--cyan);
}
.s-flywheel[data-step="1"] .wheel {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* SVG ring stays square and centered inside the wider container; the
   extra horizontal room is where the side nodes breathe outside the ring. */
.s-flywheel .wheel-svg {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 620px;
  height: 620px;
  pointer-events: none;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.55));
}

/* animate the ring drawing in once the wheel becomes visible.
   Each arc spans 90° at radius 240 → length ≈ 377px (round up to 400). */
.s-flywheel .wheel-svg .arc {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  transition: stroke-dashoffset 1100ms cubic-bezier(.4,.0,.2,1);
}
.s-flywheel[data-step="1"] .wheel-svg .arc-1 { transition-delay: 80ms;  stroke-dashoffset: 0; }
.s-flywheel[data-step="1"] .wheel-svg .arc-2 { transition-delay: 220ms; stroke-dashoffset: 0; }
.s-flywheel[data-step="1"] .wheel-svg .arc-3 { transition-delay: 360ms; stroke-dashoffset: 0; }
.s-flywheel[data-step="1"] .wheel-svg .arc-4 { transition-delay: 500ms; stroke-dashoffset: 0; }

/* center label */
.s-flywheel .wheel-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  text-align: center;
  pointer-events: none;
}
.s-flywheel .wheel-center .c-title {
  font-size: 28px;
  line-height: 1.18;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.005em;
  text-shadow: 0 2px 16px rgba(4,8,31,0.85);
}

/* Node cards — "leader flag" style: a cyan-tinted vertical strip on
   one side holds the big number, the right of the card holds the
   title + mono sub. Cards sit at the four cardinal positions; the
   leader-strip side faces the ring. */
.s-flywheel .node {
  position: absolute;
  width: 340px;
  min-height: 88px;
  display: grid;
  grid-template-columns: 46px 1fr;
  grid-template-rows: 1fr 1fr;
  column-gap: 14px;
  align-items: center;
  padding: 12px 18px 12px 0;
  background:
    linear-gradient(90deg,
      rgba(91, 233, 240, 0.10) 0%,
      rgba(8, 10, 28, 0.90) 22%,
      rgba(8, 10, 28, 0.90) 100%);
  border: 1px solid rgba(91, 233, 240, 0.40);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 18px 32px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.06);
  opacity: 0;
  transition: opacity 500ms ease-out, transform 500ms ease-out;
  text-align: left;
}
.s-flywheel[data-step="1"] .node {
  opacity: 1;
}
.s-flywheel[data-step="1"] .node-1 { transition-delay: 280ms; }
.s-flywheel[data-step="1"] .node-2 { transition-delay: 420ms; }
.s-flywheel[data-step="1"] .node-3 { transition-delay: 560ms; }
.s-flywheel[data-step="1"] .node-4 { transition-delay: 700ms; }

.s-flywheel .node .num {
  /* num column spans both rows so title + sub stack in the second column.
     Negative top/bottom margins pull the strip past the card's vertical
     padding so it paints from the card's top edge to its bottom edge. */
  grid-row: 1 / span 2;
  align-self: stretch;
  margin: -12px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--bg);
  background: var(--cyan);
  border-radius: 9px 0 0 9px;
  letter-spacing: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.s-flywheel .node .n-title {
  grid-column: 2;
  align-self: end;
  font-size: 21px;
  line-height: 1.18;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
  margin-bottom: 4px;
}
.s-flywheel .node .n-sub {
  grid-column: 2;
  align-self: start;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: rgba(91, 233, 240, 0.90);
  line-height: 1.32;
  white-space: nowrap;
}

/* Placement — node-1 (top) and node-3 (bottom) hover above/below the
   ring on its vertical axis. node-2 (right) and node-4 (left) sit
   OUTSIDE the SVG ring, in the spare horizontal padding the 900-wide
   container gives us beyond the 620-wide SVG.
   SVG ring radius = 240px (in 620 viewBox); ring spans x ∈ [50%-310, 50%+310]. */
.s-flywheel .node-1 { /* top */
  top: 0;
  left: 50%;
  transform: translate(-50%, -10px);
}
.s-flywheel[data-step="1"] .node-1 { transform: translate(-50%, 0); }

.s-flywheel .node-3 { /* bottom */
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 10px);
}
.s-flywheel[data-step="1"] .node-3 { transform: translate(-50%, 0); }

.s-flywheel .node-2 { /* right — sits to the right of the SVG ring */
  top: 50%;
  right: 0;
  transform: translate(10px, calc(-50% + 10px));
  text-align: left;
}
.s-flywheel[data-step="1"] .node-2 { transform: translate(0, -50%); }

.s-flywheel .node-4 { /* left — sits to the left of the SVG ring */
  top: 50%;
  left: 0;
  transform: translate(-10px, calc(-50% + 10px));
  text-align: left;
}
.s-flywheel[data-step="1"] .node-4 { transform: translate(0, -50%); }

/* ============================================================
   Tag-line — bottom takeaway, revealed on step 1.
   Inner block left-aligns the "// takeaway" label with the quote
   so the `//` sits directly above the `E` of "Every".
   ============================================================ */
.s-flywheel .tag-line {
  position: absolute;
  left: var(--pad-x);
  right: var(--pad-x);
  bottom: 90px;
  z-index: 2;
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
  transition-delay: 850ms;
}
.s-flywheel .tag-line .tag-inner {
  text-align: left;
  max-width: 1100px;
}
.s-flywheel[data-step="1"] .tag-line {
  opacity: 1;
  transform: translateY(0);
}
.s-flywheel .tag-line .lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-bottom: 8px;
}
.s-flywheel .tag-line .quote {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.005em;
  color: var(--fg);
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}
.s-flywheel .tag-line .quote .hl { color: var(--pink); }

/* Print: drop heavy box-shadows that Chromium's page.pdf rasterises
   as opaque rectangles (same workaround as .s-amplifier). */
@media print {
  .s-flywheel .node {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  }
  .s-flywheel .wheel-svg { filter: none; }
}
