/* =========================================================
   PASS Worldwide — "By the numbers" rotating infographics
   Integrated into the Impact / Statistics section.
   Uses PASS red palette tokens from styles.css; namespaced
   under .sv-section to avoid collisions.
   ========================================================= */

.sv-section {
  /* Local tokens — mapped to PASS Worldwide palette */
  --sv-red: var(--red-600);
  --sv-red-hover: var(--red-800);
  --sv-red-mid: var(--red-400);
  --sv-red-light: var(--red-200);
  --sv-red-pale: var(--red-50);
  --sv-charcoal: var(--ink-900);
  --sv-charcoal-mid: var(--ink-600);
  --sv-charcoal-light: var(--ink-500);
  --sv-white: var(--white);
  --sv-border: var(--red-200);
  --sv-border-inner: var(--red-100);

  background: var(--paper);
  padding: var(--s-8) var(--s-5);
  position: relative;
  font-family: var(--f-sans);
  color: var(--sv-charcoal);
}

.sv-inner { max-width: var(--container); margin: 0 auto; }

/* ── Header ── */
.sv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-5);
  margin-bottom: var(--s-7);
  flex-wrap: wrap;
}

.sv-eyebrow {
  font-family: var(--f-sans);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red-700);
  margin: 0 0 10px;
}

.sv-title {
  font-family: var(--f-display);
  font-size: var(--fs-h2);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.012em;
  color: var(--ink-900);
  margin: 0;
}

.sv-pause-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--sv-red-light);
  border-radius: 100px;
  background: var(--sv-white);
  font-family: var(--f-sans);
  font-size: 13px;
  color: var(--sv-charcoal-mid);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
  flex-shrink: 0;
}
.sv-pause-btn:hover { border-color: var(--sv-red); color: var(--sv-charcoal); }
.sv-pause-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sv-red);
  animation: sv-pulsate 1.6s ease-in-out infinite;
}
.sv-pause-btn.paused .pulse-dot { animation: none; background: var(--sv-charcoal-light); }
@keyframes sv-pulsate {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .3; transform: scale(.75); }
}

/* ── Grid ── */
.sv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.sv-grid .span2 { grid-column: 1 / -1; }

/* ── Card base ── */
.sv-card {
  background: var(--sv-white);
  border: 1px solid var(--sv-border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 22px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s ease, transform .55s ease;
}
.sv-card.visible { opacity: 1; transform: translateY(0); }

.card-eyebrow {
  font-family: var(--f-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sv-charcoal-light);
  margin: 0 0 22px;
}

.card-source {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--sv-border-inner);
  font-size: 11px;
  color: var(--sv-charcoal-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-source a {
  color: var(--sv-red);
  text-decoration: none;
  font-weight: 600;
}
.card-source a:hover { text-decoration: underline; }
.card-source .updated { color: var(--sv-charcoal-light); font-style: italic; }

/* ── Card 1: Clock ── */
.clock-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0;
  flex: 1;
  margin-bottom: 20px;
}
.clock-rate { text-align: center; padding: 0 32px 0 0; }
.clock-rate-num {
  font-family: var(--f-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.5rem, 4vw, 4rem);
  font-weight: 600;
  color: var(--sv-red);
  line-height: 1;
  letter-spacing: -0.03em;
}
.clock-rate-label {
  font-size: 14px;
  color: var(--sv-charcoal-mid);
  margin-top: 6px;
  line-height: 1.4;
}
.clock-divider { width: 1px; height: 100px; background: var(--sv-border); flex-shrink: 0; }
.clock-counter { text-align: center; padding: 0 0 0 32px; }
.clock-count-num {
  font-family: var(--f-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.5rem, 4vw, 4rem);
  font-weight: 600;
  color: var(--sv-charcoal);
  line-height: 1;
  letter-spacing: -0.03em;
  min-width: 3ch;
}
.clock-count-label {
  font-size: 13px;
  color: var(--sv-charcoal-mid);
  margin-top: 6px;
  line-height: 1.4;
}
.clock-note {
  font-size: 11px;
  color: var(--sv-charcoal-light);
  font-style: italic;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 16px;
}

/* ── Card 2: Donut ── */
.donut-body {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
  margin-bottom: 18px;
}
.donut-wrap { position: relative; flex-shrink: 0; }
.donut-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.donut-pct {
  font-family: var(--f-display);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 600;
  color: var(--sv-red);
  line-height: 1;
}
.donut-pct-sub { font-size: 10px; color: var(--sv-charcoal-light); margin-top: 2px; }

.legend-headline {
  font-family: var(--f-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--sv-charcoal);
  line-height: 1.35;
  margin: 0 0 16px;
  letter-spacing: -0.005em;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.legend-swatch {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-text { font-size: 13px; color: var(--sv-charcoal-mid); }
.legend-val {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--sv-charcoal);
  margin-left: auto;
}

/* ── Card 3: Bar chart ── */
.bar-headline {
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--sv-charcoal);
  margin: 0 0 24px;
  letter-spacing: -0.005em;
}
.bar-row { margin-bottom: 18px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}
.bar-name { font-size: 13px; font-weight: 600; color: var(--sv-charcoal); }
.bar-val {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
}
.bar-track {
  height: 10px;
  background: var(--sv-red-pale);
  border-radius: 100px;
  overflow: hidden;
  border: 1px solid var(--sv-border-inner);
}
.bar-fill {
  height: 100%;
  border-radius: 100px;
  width: 0;
  transition: width 1.4s cubic-bezier(.16,1,.3,1);
}
.bar-sub {
  font-size: 12px;
  color: var(--sv-charcoal-light);
  margin-top: 6px;
}

/* ── Card 4: Pictograph ── */
.pict-headline {
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--sv-charcoal);
  margin: 0 0 22px;
  letter-spacing: -0.005em;
}
.pict-group { margin-bottom: 18px; }
.pict-group:last-of-type { margin-bottom: 0; }
.pict-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--sv-charcoal-light);
  margin: 0 0 8px;
}
.pict-row { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; }
.pict-ratio {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--sv-charcoal-mid);
  margin-left: 10px;
}

/* ── Card 5: Counter ── */
.counter-num {
  font-family: var(--f-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 600;
  color: var(--sv-red);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.counter-label {
  font-family: var(--f-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--sv-charcoal);
  line-height: 1.35;
  margin: 0 0 8px;
  letter-spacing: -0.005em;
}
.counter-sub { font-size: 14px; color: var(--sv-charcoal-mid); line-height: 1.5; margin: 0; }

/* ── Card 6: World ── */
.world-body {
  display: flex;
  align-items: center;
  gap: 40px;
  flex: 1;
  margin-bottom: 20px;
}
.world-num-block { flex-shrink: 0; text-align: right; }
.world-num {
  font-family: var(--f-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 600;
  color: var(--sv-red);
  line-height: 1;
  letter-spacing: -0.04em;
}
.world-unit {
  font-family: var(--f-sans);
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 600;
  color: var(--sv-red-mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  text-align: right;
}
.world-headline {
  font-family: var(--f-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--sv-charcoal);
  margin: 0 0 12px;
  letter-spacing: -0.005em;
}
.world-sub {
  font-size: 14px;
  color: var(--sv-charcoal-mid);
  line-height: 1.6;
  margin: 0;
}

/* ── Section footer ── */
.sv-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--sv-charcoal-light);
  text-align: center;
  flex-wrap: wrap;
}
.sv-footer-dot { color: var(--sv-red-light); }
#last-updated { font-style: italic; }
#data-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}
#data-badge.live {
  background: #EAF3DE;
  border-color: #C0DD97;
  color: #3B6D11;
}
#data-badge.fallback {
  background: var(--sv-red-pale);
  border-color: var(--sv-red-light);
  color: var(--sv-red-hover);
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .sv-section { padding: var(--s-7) var(--s-4); }
  .sv-title { font-size: 1.65rem; }
  .sv-grid { grid-template-columns: 1fr; }
  .sv-grid .span2 { grid-column: 1; }
  .sv-card { padding: 22px 20px 18px; }
  .clock-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 20px;
  }
  .clock-divider { width: 60px; height: 1px; margin: 0 auto; }
  .clock-rate { padding: 0; }
  .clock-counter { padding: 0; }
  .world-body { flex-direction: column; gap: 20px; align-items: flex-start; }
  .world-num-block { text-align: left; }
  .world-unit { text-align: left; }
  .donut-body { flex-direction: column; align-items: flex-start; }
  .donut-wrap { align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot { animation: none; }
  .bar-fill { transition: none; }
  .sv-card { opacity: 1; transform: none; transition: none; }
}
