/* ============================================
   R-Zero ODCV V2 - Side-by-Side Comparison
   ============================================ */

/* --- CSS Variables (R-Zero Brand) --- */
:root {
  --rz-blue: #1796ff;
  --rz-teal: #2e86ab;
  --rz-dark: #222222;
  --rz-medium: #434343;
  --rz-light: #666666;
  --rz-white: #ffffff;
  --rz-bg: #f8f9fa;
  --rz-bg-alt: #f1f5f9;
  --rz-waste-red: #ef4444;
  --rz-waste-orange: #f97316;
  --rz-savings-blue: #1796ff;
  --rz-savings-teal: #2e86ab;
  --rz-border: #e2e8f0;
  --rz-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --rz-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --font-primary: 'Poppins', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-primary);
  color: var(--rz-dark);
  background: var(--rz-bg);
  line-height: 1.6;
  overflow-x: hidden;
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rz-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.site-header .logo {
  height: 28px;
  width: auto;
}

.site-header .header-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rz-medium);
  letter-spacing: 0.02em;
}

/* --- Scrollytelling Layout --- */
.scroll-container {
  margin-top: 56px;
}

.scroll-section {
  position: relative;
  min-height: 100svh;
}

/* Section backgrounds */
.section-vacant { background: #fffbf7; }
.section-hybrid { background: var(--rz-white); }
.section-fulltime { background: #f0f9ff; }

/* Sticky figure panel */
.scroll-section .graphic-panel {
  position: sticky;
  top: 56px;
  height: calc(100svh - 56px);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 1;
  background: var(--rz-white);
}

.graphic-panel .panel-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
}

/* Steps that scroll over the sticky graphic */
.scroll-section .steps-container {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.scroll-section .step {
  min-height: 80svh;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 24px 10svh;
  pointer-events: auto;
}

.scroll-section .step:first-child {
  padding-top: 30svh;
}

.scroll-section .step:last-child {
  min-height: 50svh;
}

/* Day progression step: long scroll for full 6AM-10PM playback */
.scroll-section .step[data-step-index="1"] {
  min-height: 350svh;
}

/* Step cards */
.step-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--rz-border);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 380px;
  box-shadow: var(--rz-shadow);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.step-card h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--rz-dark);
  margin-bottom: 8px;
  line-height: 1.3;
}

.step-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--rz-blue);
  margin-bottom: 6px;
}

.step-card p {
  font-size: 0.875rem;
  color: var(--rz-medium);
  line-height: 1.55;
}

.step-card .highlight {
  color: var(--rz-blue);
  font-weight: 600;
}

.step-card .highlight-red {
  color: var(--rz-waste-red);
  font-weight: 600;
}

.step.is-active .step-card {
  opacity: 1;
  transform: translateY(0);
}

/* --- Timeline Bar --- */
.timeline-bar {
  width: 100%;
  height: 40px;
  background: var(--rz-bg-alt);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rz-border);
}

.timeline-progress {
  height: 100%;
  background: rgb(59, 130, 246); /* blue-500 default; overridden by JS */
  border-radius: 8px 0 0 8px;
  transition: width 0.1s linear, background 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  min-width: 60px;
}

.timeline-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rz-white);
  white-space: nowrap;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.625rem;
  color: var(--rz-light);
  margin-top: 4px;
  padding: 0 4px;
}

/* --- Side by Side --- */
.side-by-side {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  width: 100%;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.side-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
}

.side-panel .counter-grid {
  margin-top: 20px;
}

.side-panel.baseline-side {
  background: linear-gradient(135deg, #fef2f2, #fff);
}

.side-panel.odcv-side {
  background: linear-gradient(135deg, #eff6ff, #fff);
}

.side-panel-title {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding: 6px 16px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.baseline-side .side-panel-title {
  background: #fecaca;
  color: var(--rz-waste-red);
}

.odcv-side .side-panel-title {
  background: #bfdbfe;
  color: var(--rz-blue);
}

.savings-divider {
  width: 140px;
  background: var(--rz-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 8px;
  border-left: 2px solid var(--rz-border);
  border-right: 2px solid var(--rz-border);
}

.savings-divider .divider-label {
  font-size: 0.875rem;   /* was 0.6875rem; larger than counter-label (0.75rem) */
  font-weight: 600;
  color: var(--rz-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.savings-divider .savings-value {
  font-size: 2rem;        /* was 1.25rem; larger than counter-value (1.5rem) */
  font-weight: 700;
  color: var(--rz-savings-teal);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.savings-divider .savings-unit {
  font-size: 0.875rem;   /* was 0.625rem */
  color: var(--rz-light);
  text-align: center;
}

/* --- Counters --- */
.counter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 12px;
}

.counter-card {
  background: var(--rz-white);
  border: 1px solid var(--rz-border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--rz-shadow);
}

.counter-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rz-dark);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-align: center;
}

.counter-value.savings {
  color: var(--rz-savings-blue);
}

.counter-value.waste {
  color: var(--rz-waste-red);
}

.counter-unit {
  font-size: 0.75rem;
  color: var(--rz-light);
  margin-top: 2px;
}

.counter-label {
  font-size: 0.75rem;
  color: var(--rz-medium);
  margin-top: 4px;
  font-weight: 500;
}

/* --- AHU Schematic --- */
.ahu-schematic-container {
  width: 100%;
  max-width: 100%;
  aspect-ratio: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ahu-compact-container {
  max-width: 100%;
  aspect-ratio: auto;
  padding: 0 34px; /* 34px + 16px panel = 50px total per side */
}

.ahu-schematic {
  width: 100%;
  height: auto;
  max-height: 100%;
}

.ahu-full {
  max-width: 960px;
}

.ahu-compact {
  max-width: 100%;
}

/* AHU casing */
.ahu-casing rect {
  transition: fill 0.3s ease;
}

/* Damper blades */
.oa-blade,
.ra-blade,
.ea-blade {
  transition: transform 0.4s ease-out;
  will-change: transform;
}

/* Mixing plenum */
.mix-box {
  transition: opacity 0.3s ease;
}

/* Coil transitions */
.coil-bg { transition: opacity 0.4s ease; }
.coil-fin { transition: opacity 0.3s ease; }
.coil-tube { transition: opacity 0.3s ease; }
.coil-glow-rect { transition: opacity 0.5s ease; }

/* Occupant figures */
.occupant-figure {
  transition: opacity 0.4s ease;
}

/* Space grid */
.space-group line {
  pointer-events: none;
}

/* Fan spin */
@keyframes fan-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.supply-fan-blades {
  animation: fan-spin 2s linear infinite;
}

.mini-fan-blades {
  animation: fan-spin 3s linear infinite;
}

/* AHU off state: fan stopped */
.ahu-off .supply-fan-blades {
  animation-play-state: paused;
}

/* Temperature colors */
.temp-hot { color: var(--rz-waste-red); }
.temp-warm { color: var(--rz-waste-orange); }
.temp-mixed { color: #f59e0b; }
.temp-cool { color: #38bdf8; }
.temp-cold { color: var(--rz-savings-blue); }

/* Waste pulse */
@keyframes waste-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.waste-pulse {
  animation: waste-pulse 2s ease-in-out infinite;
}

/* Particle groups */
.airflow-particle {
  will-change: cx, opacity;
}

.supply-particle,
.return-particle,
.recirc-particle,
.exhaust-particle {
  will-change: transform, opacity;
}

/* Condensation */
.condensation-drop {
  will-change: transform, opacity;
}

/* --- Section Title Row --- */
.section-title-row {
  width: 100%;
  max-width: 1100px;
  padding: 0 16px;
  margin-bottom: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-ahu-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--rz-medium);
  white-space: nowrap;
  padding: 4px 12px;
  background: var(--rz-bg-alt);
  border-radius: 6px;
  border: 1px solid var(--rz-border);
}

/* --- Section Dividers (title screens between sections) --- */
.section-divider {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--rz-white);
  text-align: center;
  padding: 48px 24px;
}

.section-divider h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--rz-dark);
  margin-bottom: 12px;
}

.section-divider p {
  font-size: 1rem;
  color: var(--rz-light);
  max-width: 480px;
}

/* Trailing spacer step: lets the last card scroll off screen */
.step-spacer {
  min-height: 80svh !important;
  pointer-events: none;
}

/* --- Utility --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .site-header {
    padding: 10px 16px;
    height: 48px;
  }

  .site-header .logo {
    height: 22px;
  }

  .scroll-container {
    margin-top: 48px;
  }

  .scroll-section .graphic-panel {
    top: 48px;
    height: calc(100svh - 48px);
  }

  .step-card {
    max-width: 300px;
    padding: 16px 20px;
  }

  .step-card h2 {
    font-size: 1rem;
  }

  .step-card p {
    font-size: 0.8125rem;
  }

  .side-by-side {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }

  .savings-divider {
    width: 100%;
    flex-direction: row;
    gap: 16px;
    border-left: none;
    border-right: none;
    border-top: 2px solid var(--rz-border);
    border-bottom: 2px solid var(--rz-border);
    padding: 12px 16px;
  }

  .counter-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ahu-schematic-container {
    max-width: 100%;
    aspect-ratio: auto;
    max-height: 360px;
  }

  .ahu-compact-container {
    max-height: 260px;
  }
}

@media (max-width: 480px) {
  .counter-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .supply-fan-blades,
  .mini-fan-blades {
    animation: none;
  }

  .condensation-drop {
    display: none;
  }

  .supply-particle,
  .return-particle,
  .recirc-particle,
  .exhaust-particle {
    display: none;
  }

  .oa-blade,
  .ra-blade,
  .ea-blade {
    transition: none;
  }
}

/* --- Print --- */
@media print {
  .site-header { display: none; }
  .scroll-section .step { min-height: auto; }
  .scroll-section .graphic-panel { position: relative; height: auto; }
}
