/**
 * Schumann Resonance Live — Cinematic splash + hero entrance + layout guard
 */

/* ── Layout: no horizontal drift ── */
html {
  overflow-x: clip;
  scroll-behavior: smooth;
}

.sr-site {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
}

.sr-site .site-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  min-width: 0;
}

.sr-site img,
.sr-site video,
.sr-site canvas,
.sr-site svg:not(.brand-spectrum):not(.nav-pill-icon) {
  max-width: 100%;
  height: auto;
}

.sr-site .spectro-container img,
.sr-site #spectro-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.sr-site .hero-visual-h1 {
  font-size: clamp(1.3rem, 4.2vw, 2.35rem) !important;
  line-height: 1.12 !important;
  letter-spacing: -0.03em;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-inline: 0.35rem;
}

.sr-site .hero-stage-shell,
.sr-site .hero-readout-wrap,
.sr-site .hero-audience-wrap,
.sr-site .hero-features-strip {
  max-width: 100%;
  min-width: 0;
}

.sr-site .hero-audience-countline {
  min-width: 0;
}

.sr-site .hero-audience-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sr-site .chart-tab-row {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sr-site .chart-tab-row::-webkit-scrollbar {
  display: none;
}

@media (max-width: 420px) {
  .sr-site .hero-stats-row {
    flex-wrap: wrap !important;
    max-width: 100% !important;
    gap: 0.4rem !important;
  }

  .sr-site .hero-stats-row .card {
    flex: 1 1 calc(50% - 0.25rem) !important;
    min-width: calc(50% - 0.25rem) !important;
  }
}

@media (max-width: 359px) {
  .sr-site .hero-stats-row .card {
    flex: 1 1 100% !important;
    min-width: 100% !important;
  }
}


/* ── Splash screen ── */
.sr-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #0a1628 0%, #030712 55%, #010409 100%);
  transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.65s;
  overflow: hidden;
}

.sr-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sr-splash.is-skip {
  display: none;
}

.sr-splash-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sr-splash-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 1px solid rgba(45, 212, 191, 0.25);
  animation: srSplashRing 2.4s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.sr-splash-ring-2 { animation-delay: 0.55s; border-color: rgba(99, 102, 241, 0.2); }
.sr-splash-ring-3 { animation-delay: 1.1s; border-color: rgba(167, 139, 250, 0.15); }

@keyframes srSplashRing {
  0% { transform: scale(0.35); opacity: 0.85; }
  100% { transform: scale(4.2); opacity: 0; }
}

.sr-splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: srSplashOrb 8s ease-in-out infinite;
}

.sr-splash-orb-a {
  width: 280px; height: 280px;
  top: 15%; left: 10%;
  background: rgba(45, 212, 191, 0.18);
}

.sr-splash-orb-b {
  width: 220px; height: 220px;
  bottom: 10%; right: 8%;
  background: rgba(99, 102, 241, 0.14);
  animation-delay: -3s;
}

@keyframes srSplashOrb {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(18px, -22px); }
}

.sr-splash-core {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  animation: srSplashCoreIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes srSplashCoreIn {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sr-splash-wave {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.15), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(45, 212, 191, 0.35);
  box-shadow: 0 0 48px rgba(45, 212, 191, 0.25);
  color: #2dd4bf;
  font-size: 1.75rem;
  animation: srSplashWavePulse 2s ease-in-out infinite;
}

@keyframes srSplashWavePulse {
  0%, 100% { box-shadow: 0 0 48px rgba(45, 212, 191, 0.25); transform: scale(1); }
  50% { box-shadow: 0 0 64px rgba(45, 212, 191, 0.45); transform: scale(1.04); }
}

.sr-splash-freq {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.sr-splash-freq-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: clamp(2.5rem, 10vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #f0fdfa 0%, #2dd4bf 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
}

.sr-splash-freq-unit {
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(45, 212, 191, 0.75);
  letter-spacing: 0.08em;
}

.sr-splash-brand {
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.sr-splash-tagline {
  font-size: 0.8125rem;
  color: #64748b;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.75rem;
}

.sr-splash-progress {
  width: min(220px, 70vw);
  height: 3px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.sr-splash-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #2dd4bf, #818cf8);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.6);
  transition: width 0.15s linear;
}

/* ── Page lock during splash ── */
body.sr-splash-active {
  overflow: hidden !important;
  height: 100vh;
  height: 100dvh;
}

body.sr-splash-active .site-wrapper {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

body.sr-page-ready .site-wrapper {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.05s,
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.05s;
}

body.sr-splash-active .nav-glass {
  opacity: 0;
  transform: translateY(-8px);
}

body.sr-page-ready .nav-glass {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease 0.15s, transform 0.55s ease 0.15s;
}

/* ── Hero stagger entrance ── */
.sr-hero-in {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(6px);
  transition:
    opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--sr-i, 0) * 0.09s + 0.12s);
}

body.sr-page-ready .sr-hero-in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Repeat visits: show hero immediately (no splash) */
html:not(.sr-splash-pending) .sr-hero-in {
  opacity: 1;
  transform: none;
  filter: none;
  transition: none;
}

html.sr-splash-pending .sr-hero-in {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(6px);
}

html.sr-splash-pending body.sr-page-ready .sr-hero-in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  transition:
    opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--sr-i, 0) * 0.09s + 0.12s);
}

.sr-hero-in-freq {
  --sr-i: 3;
  transform: translateY(28px) scale(0.92);
}

body.sr-page-ready .sr-hero-in-freq {
  transform: translateY(0) scale(1);
}

/* Section scroll reveal (fixed — no forced visible) */
.sr-site .fade-up {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.sr-site .fade-up.is-visible,
.sr-site .fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.sr-site .sr-ui-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Override GPM forced-visible fade-up — restore scroll reveal */
.sr-site #dashboard .fade-up:not(.is-visible):not(.visible),
.sr-site #guide .fade-up:not(.is-visible):not(.visible),
.sr-site #about .fade-up:not(.is-visible):not(.visible),
.sr-site .card.fade-up:not(.is-visible):not(.visible) {
  opacity: 0 !important;
  transform: translateY(22px) !important;
  visibility: visible !important;
}

.sr-site #dashboard .fade-up.is-visible,
.sr-site #dashboard .fade-up.visible,
.sr-site #guide .fade-up.is-visible,
.sr-site #about .fade-up.is-visible,
.sr-site .card.fade-up.is-visible {
  opacity: 1 !important;
  transform: none !important;
}

/* First paint: hide content until splash script runs */
html.sr-splash-pending body {
  overflow: hidden !important;
}

html.sr-splash-pending #sr-splash,
body.sr-splash-active #sr-splash {
  display: flex;
}

html.sr-splash-pending .site-wrapper {
  opacity: 0;
  visibility: hidden;
}

html.sr-splash-pending #sr-splash {
  display: flex;
}

html:not(.sr-splash-pending) #sr-splash.is-skip {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .sr-splash { display: none !important; }
  body.sr-splash-active { overflow: auto !important; height: auto !important; }
  body.sr-splash-active .site-wrapper,
  body.sr-page-ready .site-wrapper {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .sr-hero-in,
  .sr-site .fade-up {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
  .sr-splash-ring,
  .sr-splash-orb,
  .sr-splash-wave {
    animation: none !important;
  }
}
