/* =========================================================
   Stats page
   Full drop-in: wwwroot/css/stats.css
   ========================================================= */

:root{
  --stats-maxw: 1100px;
  --stats-gap: clamp(1.25rem, 4vw, 2.25rem);
  --stats-radius: 18px;

  --stats-card-border: rgba(122, 167, 255, 0.22);
  --stats-soft-border: rgba(255,255,255,0.10);

  --stats-shadow: 0 18px 55px rgba(0,0,0,0.55);
}

.stats-page{
  max-width: var(--stats-maxw);
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

/* Hero */
.stats-hero{
  margin-top: 1.25rem;
  margin-bottom: clamp(1.25rem, 4vw, 2.25rem);
}

.stats-hero__inner{
  border-radius: var(--stats-radius);
  padding: clamp(1.25rem, 3.5vw, 2.1rem);
  border: 1px solid var(--stats-soft-border);
  box-shadow: var(--stats-shadow);
  background:
    radial-gradient(900px 520px at 15% 0%, rgba(122,167,255,0.16), transparent 55%),
    linear-gradient(180deg, rgba(18, 20, 28, 0.86), rgba(12, 14, 18, 0.72));
}

.stats-hero__eyebrow{
  margin: 0 0 0.6rem 0;
  font-size: 0.85rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
}

.stats-hero__title{
  margin: 0 0 0.75rem 0;
  font-size: clamp(2rem, 4.2vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stats-hero__subtitle{
  margin: 0;
  color: rgba(255,255,255,0.75);
  max-width: 80ch;
}

/* Sections wrapper (tightened) */
.stats-sections{
  display: grid;
  gap: clamp(1.4rem, 4vw, 2.4rem);
}

/* Alternating layout */
.stats-section{
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: var(--stats-gap);
  align-items: center;
  padding: clamp(0.25rem, 1.2vw, 0.6rem) 0; /* tightened */
}

.stats-section--flip{
  grid-template-columns: 1.25fr 1fr;
}

.stats-section--flip .stats-viz{ order: 1; }
.stats-section--flip .stats-copy{ order: 2; }

/* Copy */
.stats-copy{ min-width: 0; }

.stats-title{
  margin: 0 0 0.35rem 0; /* tightened */
  font-size: clamp(1.4rem, 2.2vw, 1.8rem);
  letter-spacing: -0.01em;
  border: 0;
  padding: 0;
}

.stats-lede{
  margin: 0;
  color: rgba(255,255,255,0.78);
  max-width: 70ch;
}

/* Viz */
.stats-viz{
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

.stats-section--flip .stats-viz{
  justify-content: flex-start;
}

/* Placeholder cards */
.stats-card{
  width: min(620px, 100%);
  border-radius: var(--stats-radius);
  border: 1px solid var(--stats-card-border);
  box-shadow: var(--stats-shadow);
  background:
    radial-gradient(800px 480px at 20% 0%, rgba(122,167,255,0.18), transparent 60%),
    linear-gradient(180deg, rgba(20, 22, 30, 0.88), rgba(14, 16, 22, 0.78));
  overflow: hidden;
}

.stats-card--placeholder{
  display: grid;
  place-items: center;
  min-height: clamp(220px, 26vw, 320px);
  color: rgba(255,255,255,0.55);
}

/* Click-to-zoom */
.stats-zoom{
  width: min(760px, 100%);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  position: relative;
  border-radius: var(--stats-radius);
  overflow: hidden;
  box-shadow: var(--stats-shadow);
  border: 1px solid var(--stats-card-border);
  outline: none;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.stats-zoom:hover{
  transform: translateY(-2px);
  border-color: rgba(122,167,255,0.35);
}

.stats-zoom:focus-visible{
  box-shadow: 0 0 0 3px rgba(122,167,255,0.35), var(--stats-shadow);
}

.stats-chart{
  display: block;
  width: 100%;
  height: auto;
}

.stats-zoom__hint{
  position: absolute;
  right: 14px;
  bottom: 12px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.stats-zoom:hover .stats-zoom__hint{
  opacity: 1;
  transform: translateY(0);
}

/* Lightbox */
.stats-lightbox{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.stats-lightbox.is-open{
  display: block;
}

.stats-lightbox__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(10px);
  opacity: 0;
  animation: statsFadeIn 180ms ease forwards;
}

.stats-lightbox__dialog{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2rem);
}

.stats-lightbox__panel{
  width: min(1200px, 96vw);
  max-height: 86vh;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10, 12, 16, 0.72);
  box-shadow: 0 30px 90px rgba(0,0,0,0.70);
  transform: translateY(18px) scale(0.965);
  opacity: 0;
  animation: statsPopIn 260ms cubic-bezier(.16,1,.3,1) forwards;
}

.stats-lightbox__close{
  position: absolute;
  margin: 14px;
  right: 0;
  top: 0;
  z-index: 2;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.85);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.stats-lightbox__close:focus-visible{
  outline: 2px solid rgba(122,167,255,0.55);
  outline-offset: 2px;
}

.stats-lightbox__img{
  display: block;
  width: 100%;
  height: auto;
  max-height: 86vh;
  object-fit: contain;
  background: #0b0d12;
}

/* =========================================================
   Pronounced reveal
   - bigger movement
   - stronger blur
   - noticeable easing
   - slight stagger between copy and viz
   ========================================================= */

.stats-reveal{
  opacity: 0;
  transform: translateY(42px) scale(0.965);
  filter: blur(10px);
  transition:
    opacity 950ms cubic-bezier(.12,1,.22,1),
    transform 950ms cubic-bezier(.12,1,.22,1),
    filter 950ms cubic-bezier(.12,1,.22,1);
  will-change: opacity, transform, filter;
}

/* Stagger internals (feels more "premium") */
.stats-reveal .stats-copy{
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 850ms cubic-bezier(.12,1,.22,1), transform 850ms cubic-bezier(.12,1,.22,1);
  transition-delay: 80ms;
}

.stats-reveal .stats-viz{
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 900ms cubic-bezier(.12,1,.22,1), transform 900ms cubic-bezier(.12,1,.22,1);
  transition-delay: 170ms;
}

.stats-reveal.is-visible{
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.stats-reveal.is-visible .stats-copy,
.stats-reveal.is-visible .stats-viz{
  opacity: 1;
  transform: translateY(0);
}

/* Keyframes */
@keyframes statsFadeIn{
  to { opacity: 1; }
}
@keyframes statsPopIn{
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media (max-width: 900px){
  .stats-section,
  .stats-section--flip{
    grid-template-columns: 1fr;
  }

  .stats-viz,
  .stats-section--flip .stats-viz{
    justify-content: stretch;
  }

  .stats-section--flip .stats-viz{ order: 2; }
  .stats-section--flip .stats-copy{ order: 1; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .stats-reveal,
  .stats-reveal .stats-copy,
  .stats-reveal .stats-viz{
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
    transition-delay: 0ms !important;
  }

  .stats-zoom,
  .stats-zoom__hint{
    transition: none !important;
  }

  .stats-lightbox__backdrop,
  .stats-lightbox__panel{
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
