/* =========================================================
   OPERATION IMAGINAL, Viz Layer Styles (Phase 0 scaffolding)
   Namespaced by component. Uses existing design tokens only.
   Prefers-reduced-motion renders final state immediately.

   Namespaces:
     .vla-* lobbyist army
     .vdd-* said vs did
     .vgp-* gut punch
     .vhm-* heatmap reveal
     .vpq-* plane question
     .vtl-* timeline helix
     .vhw-* hand on the wheel progress ring
   ========================================================= */

/* =========================================================
   Shared reveal pattern. Elements default to invisible when
   they carry .js-reveal; .reveal-in restores them with ease.
   If JS never runs, content stays visible (no .js-reveal).
   ========================================================= */
.reveal-start {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.reveal-start.reveal-in {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal-start, .reveal-start.reveal-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* =========================================================
   .vla-*  Lobbyist Army
   A scalable SVG-powered silhouette grid. Two tints: sage
   for "then" and terracotta for the "added" wave.
   ========================================================= */
.vla-section {
  max-width: 1080px;
  margin: 64px auto 32px;
  padding: 0 24px;
  text-align: center;
}
.vla-caption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 12px;
}
.vla-title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 auto 20px;
  max-width: 860px;
  color: var(--ink);
}
.vla-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 16px 0 28px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.vla-legend-item { display: inline-flex; align-items: center; gap: 8px; }
.vla-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 14px;
  border-radius: 2px;
}
.vla-legend-swatch.then  { background: var(--ink-faint); }
.vla-legend-swatch.added { background: var(--accent-2); }

.vla-container {
  position: relative;
  padding: 24px 16px;
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
}
.vla-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 6px);
  gap: 3px 2px;
  justify-content: center;
  align-content: flex-start;
  line-height: 0;
}
.vla-fig {
  display: inline-block;
  width: 6px;
  height: 14px;
  border-radius: 1.5px 1.5px 0 0;
  position: relative;
  background: var(--ink-faint);
  opacity: 0.85;
}
.vla-fig::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: inherit;
}
.vla-fig--added {
  background: var(--accent-2);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.45s ease-out, transform 0.45s ease-out;
  transition-delay: calc(var(--i, 0) * 0.3ms);
}
.vla-container.reveal-in .vla-fig--added {
  opacity: 1;
  transform: translateY(0);
}

.vla-numbers {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(16px, 4vw, 40px);
  margin-top: 32px;
  flex-wrap: wrap;
}
.vla-num {
  font-family: var(--font-serif);
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum' 'lnum';
}
.vla-num.then  { color: var(--ink-faint); }
.vla-num.now   { color: var(--accent-2-deep); }
.vla-num-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 6px;
  font-weight: 400;
}
.vla-arrow {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 48px);
  color: var(--ink-dim);
  align-self: center;
  transform: translateY(-10%);
}
.vla-delta {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2-deep);
}
.vla-source {
  margin: 20px auto 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  max-width: 640px;
  line-height: 1.6;
}
.vla-scale-note {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  font-style: italic;
}

@media (max-width: 720px) {
  .vla-grid { grid-template-columns: repeat(auto-fill, 5px); gap: 2px 2px; }
  .vla-fig  { width: 5px; height: 12px; }
  .vla-fig::before { width: 3px; height: 3px; top: -3px; }
  .vla-container { padding: 16px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .vla-fig--added { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* =========================================================
   .vdd-*  Said vs Did
   Horizontal split: cream/serif quote on left, ink action
   list on right. Portrait straddles the seam.
   ========================================================= */
.vdd-section {
  max-width: 1200px;
  margin: 64px auto;
  padding: 0 24px;
}
.vdd-section-title {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 40px;
}
.vdd-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.vdd-card {
  display: grid;
  grid-template-columns: 1fr 220px 1fr;
  grid-template-rows: 1fr auto;
  gap: 0;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  position: relative;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.vdd-card.reveal-in {
  opacity: 1;
  transform: translateY(0);
}
.vdd-said, .vdd-did {
  padding: clamp(24px, 3.5vw, 44px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.vdd-said {
  background: linear-gradient(135deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  border-right: 1px solid var(--rule);
}
.vdd-did {
  background: var(--ink);
  color: var(--bg-elev);
  border-left: 1px solid rgba(255, 252, 242, 0.1);
}
.vdd-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 16px;
  opacity: 0.75;
}
.vdd-said .vdd-label { color: var(--accent); }
.vdd-did  .vdd-label { color: var(--honey); }
.vdd-quote {
  font-family: var(--font-serif);
  font-size: clamp(19px, 2.2vw, 26px);
  font-style: italic;
  line-height: 1.4;
  color: var(--ink);
  margin: 0;
  font-weight: 500;
  position: relative;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
}
.vdd-action {
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.6vw, 17px);
  line-height: 1.55;
  color: var(--bg-elev);
  margin: 0;
  font-weight: 400;
}
.vdd-hinge {
  grid-row: 1;
  grid-column: 2;
  background: var(--bg);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  text-align: center;
  padding: 32px 12px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.vdd-portrait {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-elev);
  box-shadow: 0 0 0 1.5px var(--rule), 0 8px 22px rgba(28, 38, 32, 0.15);
  filter: grayscale(0.4) contrast(1.02);
  transition: filter 0.6s ease-out;
}
.vdd-card.reveal-in .vdd-portrait { filter: grayscale(0) contrast(1); }
.vdd-name {
  font-family: var(--font-serif);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 18px 0 4px;
  line-height: 1.2;
}
.vdd-cred {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
  line-height: 1.4;
}
.vdd-source {
  grid-column: 1 / -1;
  grid-row: 2;
  padding: 14px clamp(24px, 3vw, 44px);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  background: var(--bg-elev-2);
  border-top: 1px dashed var(--rule);
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .vdd-card { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
  .vdd-hinge {
    grid-row: 1;
    grid-column: 1;
    border: none;
    border-bottom: 1px solid var(--rule);
    padding: 28px 20px 20px;
  }
  .vdd-said {
    grid-row: 2;
    grid-column: 1;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
  .vdd-did  {
    grid-row: 3;
    grid-column: 1;
    border-left: none;
  }
  .vdd-source { grid-row: 4; }
  .vdd-portrait { width: 108px; height: 108px; }
}

/* =========================================================
   .vgp-*  Gut Punch
   Full-bleed quote card. Ink background, serif display text,
   mono attribution. Lives in a normal section flow.
   ========================================================= */
.vgp-wrap {
  margin: 64px auto;
  padding: clamp(48px, 8vw, 96px) 24px;
  background: var(--ink);
  color: var(--bg-elev);
  position: relative;
  overflow: hidden;
}
.vgp-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(217, 119, 66, 0.10) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(107, 142, 90, 0.10) 0%, transparent 45%);
  pointer-events: none;
}
.vgp-card {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}
.vgp-card.reveal-in {
  opacity: 1;
  transform: translateY(0);
}
.vgp-quote {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(30px, 5.6vw, 72px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--bg-elev);
  margin: 0 0 32px;
  padding: 0 12px;
}
.vgp-quote::before { content: '\201C'; color: var(--accent-2); margin-right: 4px; }
.vgp-quote::after  { content: '\201D'; color: var(--accent-2); margin-left: 4px; }
.vgp-attr {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--honey);
  margin: 0;
  line-height: 1.5;
}
.vgp-attr::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--accent-2);
  vertical-align: middle;
  margin-right: 12px;
  transform: translateY(-2px);
}
.vgp-attr::after {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--accent-2);
  vertical-align: middle;
  margin-left: 12px;
  transform: translateY(-2px);
}

/* Soft variant for use on cream sections, not full-bleed */
.vgp-soft .vgp-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 48px 32px;
}
.vgp-soft .vgp-quote { color: var(--ink); }
.vgp-soft .vgp-quote::before,
.vgp-soft .vgp-quote::after { color: var(--accent-2-deep); }
.vgp-soft .vgp-attr { color: var(--ink-dim); }

@media (prefers-reduced-motion: reduce) {
  .vgp-card, .vgp-card.reveal-in { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* =========================================================
   .vhm-*  Heatmap Chorus Reveal
   Leader-by-leader cascade: each cell fades + scales up, with
   a stagger keyed to its row and column. After the waterfall
   completes, the strongest cell per row gets a soft pulse.
   Falls back to static render on reduced-motion or JS-off.
   ========================================================= */
.heatmap.vhm-wait .heatmap-cell {
  opacity: 0;
  transform: scale(0.82);
  transition: opacity 0.45s ease-out, transform 0.45s ease-out;
  transition-delay: calc(var(--row, 0) * 110ms + var(--col, 0) * 28ms);
  will-change: opacity, transform;
}
.heatmap.vhm-wait.reveal-in .heatmap-cell {
  opacity: 1;
  transform: scale(1);
}
.heatmap.vhm-wait .heatmap-cell.vhm-peak {
  animation: vhm-pulse 1.8s ease-in-out 2.6s 1;
}
@keyframes vhm-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(217, 119, 66, 0.35); }
  60%  { box-shadow: 0 0 0 10px rgba(217, 119, 66, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 66, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .heatmap.vhm-wait .heatmap-cell,
  .heatmap.vhm-wait.reveal-in .heatmap-cell {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .heatmap.vhm-wait .heatmap-cell.vhm-peak { animation: none !important; }
}

/* ---------- Consensus Heatmap Visual Enhancements ---------- */
.heatmap-cell[data-intensity="3"] {
  box-shadow: inset 0 0 10px rgba(46, 93, 63, 0.25);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.heatmap-cell[data-intensity="3"]:hover {
  box-shadow: inset 0 0 14px rgba(46, 93, 63, 0.4), 0 2px 8px rgba(46, 93, 63, 0.2);
  transform: scale(1.08);
  z-index: 2;
}

.heatmap-cell[data-intensity="2"]:hover,
.heatmap-cell[data-intensity="1"]:hover {
  transform: scale(1.06);
  z-index: 2;
  transition: transform 0.15s ease;
}

/* =========================================================
   .vpq-*  Plane Question Hero (Phase 2 stub)
   Reserved namespace. Empty for now.
   ========================================================= */

/* =========================================================
   .vtl-*  1000x Double Helix (Phase 4 stub)
   Reserved namespace. Empty for now.
   ========================================================= */

/* =========================================================
   .vhw-*  Hand on the Wheel Progress Ring
   The signature counter as a circular progress band wrapping
   a steering wheel. Outer ring fills clockwise from 12 o'clock
   as signatures rise toward the next goal tier (1K, 5K, 10K,
   100K, 1M). Center shows the live count. Pulses on delta>0.
   ========================================================= */
.vhw-section {
  text-align: center;
  margin: 56px auto;
  padding: 0 24px;
  max-width: 480px;
}
.vhw-instance {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 8px;
  border-radius: 999px;
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.vhw-instance.reveal-in {
  opacity: 1;
  transform: translateY(0);
}
.vhw-ring-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.vhw-ring {
  display: block;
  overflow: visible;
  max-width: 100%;
  height: auto;
}
.vhw-ring-bg {
  stroke: var(--rule);
  opacity: 0.55;
}
.vhw-ring-fg {
  stroke: var(--accent-2);
  filter: drop-shadow(0 0 6px rgba(217, 119, 66, 0.35));
  transition: stroke-dashoffset 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.vhw-wheel {
  color: var(--accent);
  opacity: 0.18;
}
.vhw-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.vhw-count {
  font-family: var(--font-serif);
  font-size: clamp(38px, 6vw, 56px);
  font-weight: 800;
  line-height: 1;
  color: var(--accent-2-deep);
  font-feature-settings: 'tnum' 'lnum';
  letter-spacing: -0.02em;
}
.vhw-of-goal {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-feature-settings: 'tnum';
}
.vhw-of {
  opacity: 0.7;
}
.vhw-goal {
  color: var(--ink);
  font-weight: 500;
}
.vhw-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* Hand-on-wheel: opaque (founding-wave) center. Shown below threshold in
   place of the numeric count + "of N" goal. Paired with the ring-hide rule
   below so the decorative wheel icon carries the visual state without an
   empty progress meter. */
.vhw-opaque {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

/* Pre-threshold, hide the progress ring entirely. An empty ring paired with
   a "Hands on the wheel" label reads as "zero hands on the wheel", which is
   exactly the signal we suppress until the founding wave crosses 1,000. The
   inline <html data-count-state="opaque"> set in <head> means this rule
   applies before /api/count resolves, so there is no flash of empty ring. */
html:not([data-count-state="crossed"]) .vhw-ring-bg,
html:not([data-count-state="crossed"]) .vhw-ring-fg {
  display: none;
}
.vhw-opaque-h {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 600;
  color: var(--accent-2-deep);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.vhw-opaque-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 6px;
}

/* Pulse on signature delta */
@keyframes vhw-pulse-anim {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.035); }
  100% { transform: scale(1); }
}
@keyframes vhw-glow-anim {
  0%   { box-shadow: 0 0 0 0 rgba(217, 119, 66, 0); }
  35%  { box-shadow: 0 0 0 18px rgba(217, 119, 66, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 66, 0); }
}
.vhw-pulse .vhw-ring-wrap {
  animation: vhw-pulse-anim 0.9s ease-out;
}
.vhw-pulse {
  animation: vhw-glow-anim 0.9s ease-out;
}

@media (max-width: 480px) {
  .vhw-section { margin: 40px auto; }
  .vhw-ring { width: 200px !important; height: 200px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .vhw-ring-fg { transition: none !important; }
  .vhw-pulse,
  .vhw-pulse .vhw-ring-wrap { animation: none !important; }
  .vhw-instance, .vhw-instance.reveal-in { opacity: 1 !important; transform: none !important; transition: none !important; }
}
