/* ============================================
   RTE Index Auto v2 — Industrial Data Terminal
   Teko + Outfit + JetBrains Mono
   ============================================ */

/* ---- Variables ---- */
:root {
  --bg: #0B0D11;
  --surface: #151921;
  --elevated: #1D222C;
  --accent: #00C853;
  --accent-dim: rgba(0, 200, 83, 0.12);
  --danger: #FF4545;
  --danger-dim: rgba(255, 69, 69, 0.12);
  --text: #E4E8ED;
  --text-muted: #7C8494;
  --text-dim: #454B58;
  --border: rgba(255, 255, 255, 0.06);
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(0, 200, 83, 0.25);
  color: var(--text);
}

/* ---- Loader ---- */
#loader {
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---- Header ---- */
.header-blur {
  background: rgba(11, 13, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

/* ---- Hero ---- */
.hero-grid {
  background-image:
    linear-gradient(rgba(0,200,83,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,200,83,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
}

.hero-headline {
  font-family: 'Teko', sans-serif;
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.01em;
}

.hero-headline span:first-child {
  font-size: clamp(2.5rem, 5.5vw, 4.5rem);
}

.hero-headline span:last-child {
  font-size: clamp(3.5rem, 9vw, 7rem);
}

/* ---- Hero Staggered Reveal ---- */
.hero-reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: hero-in 0.6s ease-out forwards;
}

@keyframes hero-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Danger Pulse (headline $$ amount) ---- */
.danger-pulse {
  animation: danger-glow 2.5s ease-in-out infinite;
}

@keyframes danger-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 69, 69, 0.25), 0 0 40px rgba(255, 69, 69, 0.08); }
  50% { text-shadow: 0 0 35px rgba(255, 69, 69, 0.45), 0 0 70px rgba(255, 69, 69, 0.15); }
}

/* ---- Gauge (hero badge — red for low score) ---- */
.gauge-glow {
  filter: drop-shadow(0 0 20px rgba(255, 69, 69, 0.15));
}

.gauge-arc {
  animation: gauge-fill 1.8s ease-out 0.8s forwards;
}

@keyframes gauge-fill {
  from { stroke-dashoffset: 377; }
  to { stroke-dashoffset: 200; }
}

/* ---- Hero Illustration ---- */
.hero-illustration {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

.hero-illustration img,
.hero-illustration video {
  display: block;
  width: 100%;
  height: auto;
}

/* ---- CTA Button ---- */
.cta-primary {
  position: relative;
  box-shadow: 0 0 30px rgba(0, 200, 83, 0.15), 0 0 60px rgba(0, 200, 83, 0.06);
}

.cta-primary:hover {
  box-shadow: 0 0 40px rgba(0, 200, 83, 0.25), 0 0 80px rgba(0, 200, 83, 0.1);
  transform: translateY(-1px);
}

/* ---- How It Works ---- */
.hiw-step {
  opacity: 0;
  transform: translateY(16px);
}

.hiw-step.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ---- Fade-in Sections ---- */
.fade-in-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Quiz ---- */
.quiz-screen {
  display: none;
  animation: quiz-fade 0.35s ease-out;
}

.quiz-screen.active {
  display: block;
}

@keyframes quiz-fade {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 1.5rem 1rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 44px;
}

.quiz-option:hover {
  border-color: rgba(0, 200, 83, 0.3);
  background: rgba(0, 200, 83, 0.03);
}

.quiz-option.selected {
  border-color: var(--accent);
  background: rgba(0, 200, 83, 0.07);
  box-shadow: 0 0 20px rgba(0, 200, 83, 0.08);
}

.quiz-option-wide {
  flex-direction: row;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  text-align: left;
}

/* ---- FAQ ---- */
.faq-item.open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  animation: faq-open 0.3s ease-out;
}

@keyframes faq-open {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 200px; }
}

/* ---- Results ---- */
#results-container {
  text-align: center;
}

.result-score-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 2rem;
}

.result-score-value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.result-score-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
}

.result-score-label {
  font-size: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.result-total-leak {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--danger);
}

.leak-bar-wrap {
  margin-top: 2rem;
}

.leak-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.leak-bar-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 110px;
  text-align: right;
  flex-shrink: 0;
}

.leak-bar-track {
  flex: 1;
  height: 6px;
  background: var(--elevated);
  border-radius: 3px;
  overflow: hidden;
}

.leak-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--danger), #FFB800);
  width: 0;
  transition: width 1s ease-out;
}

.leak-bar-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--danger);
  font-weight: 600;
  width: 80px;
  text-align: left;
  flex-shrink: 0;
}

/* ---- Spinner ---- */
.animate-spin-slow {
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
  .hero-headline span:last-child {
    font-size: clamp(3rem, 12vw, 4.5rem);
  }

  .leak-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .leak-bar-label {
    width: 100%;
    text-align: left;
  }

  .quiz-option {
    min-height: 56px;
    padding: 1.25rem;
  }

  .quiz-option-wide {
    padding: 1rem 1.25rem;
  }
}

/* ---- Utility ---- */
.text-gradient-green {
  background: linear-gradient(135deg, #00C853, #00E676);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}