/* ══════════════════════════════════════════════
   StockWise — Modern Dark Theme (TradingView-inspired)
   ══════════════════════════════════════════════ */

/* ── Google Fonts loaded via HTML ── */

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

:root {
  /* Palette */
  --bg:           #131722;
  --bg-deep:      #0c0e15;
  --surface:      #1e222d;
  --surface-2:    #252a37;
  --surface-hover: #2a3042;
  --border:       #2a2e39;
  --border-light: #363a45;

  --text:         #d1d4dc;
  --text-strong:  #f0f2f5;
  --text-muted:   #787b86;

  --accent:       #2962ff;
  --accent-light: #5b8def;
  --accent-glow:  rgba(41, 98, 255, 0.25);
  --accent-dim:   rgba(41, 98, 255, 0.08);

  --green:        #26a69a;
  --green-bg:     rgba(38, 166, 154, 0.12);
  --red:          #ef5350;
  --red-bg:       rgba(239, 83, 80, 0.12);

  --gradient-hero: linear-gradient(135deg, #131722 0%, #1a1f35 40%, #1e1a30 70%, #131722 100%);
  --gradient-btn:  linear-gradient(135deg, #2962ff 0%, #5b8def 100%);

  --radius:   10px;
  --radius-lg: 16px;
  --nav-h:    60px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--accent-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: #fff; }

strong { color: var(--text-strong); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ══════════════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════════════ */
#topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 3vw, 3rem);
  background: rgba(19, 23, 34, 0.82);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  z-index: 200;
}

.logo {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo:hover { color: var(--accent-light); }
.logo-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-glow);
}

#topnav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}
#topnav ul a {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}
#topnav ul a:hover {
  color: var(--text-strong);
  background: var(--surface);
}
#topnav ul a.active {
  color: var(--text-strong);
  background: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ── Mobile hamburger ── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  border-radius: 2px;
  transition: 0.3s;
}

/* ══════════════════════════════════════════════
   TICKER TAPE
   ══════════════════════════════════════════════ */
.ticker-tape {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  height: 36px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  z-index: 190;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: flex;
  gap: 2.5rem;
  animation: tickerScroll 40s linear infinite;
  white-space: nowrap;
  padding-left: 100%;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.ticker-symbol {
  color: var(--text-strong);
  font-weight: 600;
}
.ticker-price { color: var(--text-muted); }
.ticker-change {
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
}
.ticker-change.up   { color: var(--green); background: var(--green-bg); }
.ticker-change.down { color: var(--red);   background: var(--red-bg); }

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Offset content below ticker */
body { padding-top: calc(var(--nav-h) + 36px); }
html  { scroll-padding-top: calc(var(--nav-h) + 36px + 16px); }

/* ══════════════════════════════════════════════
   HERO
   ══════════════════════════════════════════════ */
#hero {
  min-height: calc(100vh - var(--nav-h) - 36px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--gradient-hero);
  position: relative;
  overflow: hidden;
}

/* Animated grid bg */
#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.15;
  animation: gridPulse 8s ease-in-out infinite alternate;
}

@keyframes gridPulse {
  from { opacity: 0.08; }
  to   { opacity: 0.18; }
}

/* Glow orbs */
#hero::after {
  content: "";
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: -200px; right: -100px;
  pointer-events: none;
  animation: orbFloat 12s ease-in-out infinite alternate;
}

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-80px, 60px) scale(1.15); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid rgba(41, 98, 255, 0.2);
  color: var(--accent-light);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  letter-spacing: 0.03em;
}
.hero-badge-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}

.hero-content h1 {
  font-size: clamp(2.5rem, 5.5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--text-strong);
  margin-bottom: 1.25rem;
}

.accent {
  background: var(--gradient-btn);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  border-radius: 8px;
  background: var(--gradient-btn);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
  color: #fff;
}

.cta-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.cta-secondary:hover {
  border-color: var(--border-light);
  background: var(--surface-2);
  box-shadow: none;
  color: var(--text-strong);
}

/* ── Hero Stats Bar ── */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.hero-stat {
  text-align: center;
}
.hero-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-strong);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}
.hero-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.2rem;
}

/* ══════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════ */
#content {
  width: 100%;
}

/* ══════════════════════════════════════════════
   TWO-COLUMN SECTIONS
   ══════════════════════════════════════════════ */
.topic-section {
  position: relative;
  border-top: 1px solid var(--border);
}

.topic-section-inner {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  min-height: 80vh;
  padding: 5rem clamp(1rem, 3vw, 3rem);
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ── Mouse-following glow per section ── */
.section-glow {
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(120px);
  opacity: 0;
  transition: opacity 0.4s ease;
  transform: translate(-50%, -50%);
  z-index: 0;
}

.topic-section:hover .section-glow {
  opacity: 0.09;
}

#stocks .section-glow  { background: #2962ff; }
#etfs .section-glow    { background: #26a69a; }
#risks .section-glow   { background: #ef5350; }
#simulation .section-glow { background: #7c4dff; }
#quiz .section-glow    { background: #2962ff; }

/* Alternating subtle bg tint for rhythm */
.topic-section:nth-child(even) {
  background: linear-gradient(180deg, transparent 0%, rgba(30, 34, 45, 0.4) 50%, transparent 100%);
}

.topic-label { position: relative; }

.sticky-label {
  position: sticky;
  top: calc(var(--nav-h) + 36px + 2rem);
}

.section-number {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  padding: 0.2rem 0.6rem;
  background: var(--accent-dim);
  border-radius: 4px;
}

.sticky-label h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-strong);
}

.sticky-label .section-desc {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Per-section accent colors on labels */
#stocks .section-number  { color: #5b8def; background: rgba(41, 98, 255, 0.1); }
#etfs .section-number    { color: #26a69a; background: rgba(38, 166, 154, 0.1); }
#risks .section-number   { color: #ef5350; background: rgba(239, 83, 80, 0.1); }
#simulation .section-number { color: #b388ff; background: rgba(124, 77, 255, 0.1); }
#quiz .section-number    { color: #5b8def; background: rgba(41, 98, 255, 0.1); }

/* ══════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════ */
.topic-detail {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 0;
  background: var(--gradient-btn);
  border-radius: 0 2px 2px 0;
  transition: height 0.3s;
}

.card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.card:hover::before {
  height: 100%;
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-icon {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: 6px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.card-highlight {
  border-color: rgba(41, 98, 255, 0.3);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(41, 98, 255, 0.06) 100%);
}
.card-highlight::before { height: 100%; }

/* ── Term lists ── */
.term-list {
  list-style: none;
  margin-top: 0.75rem;
}
.term-list li {
  padding: 0.6rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}
.term-list li:last-child { border-bottom: none; }

/* ── Comparison Grid ── */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.comp-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.comp-col h4 {
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.comp-col h4::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
}
.comp-col:first-child h4::before { background: var(--green); }
.comp-col:last-child h4::before  { background: var(--accent); }

.comp-col ul { list-style: none; }
.comp-col ul li {
  padding: 0.35rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  position: relative;
  padding-left: 1rem;
}
.comp-col ul li::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  transform: translateY(-50%);
}

/* ══════════════════════════════════════════════
   SIMULATION BUTTON
   ══════════════════════════════════════════════ */
.btn-sim {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.85rem 2rem;
  background: var(--gradient-btn);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-sim:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
  color: #fff;
}

/* ══════════════════════════════════════════════
   QUIZ
   ══════════════════════════════════════════════ */
.quiz-intro {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.quiz-question {
  margin-bottom: 2rem;
}
.quiz-question p {
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quiz-options label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg);
  transition: all 0.2s;
}
.quiz-options label:hover {
  background: var(--surface-hover);
  border-color: var(--border-light);
  color: var(--text);
}

.quiz-options input[type="radio"] {
  accent-color: var(--accent);
  width: 16px; height: 16px;
}

.quiz-options label.correct {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}
.quiz-options label.wrong {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}

#quiz-submit {
  margin-top: 1rem;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 8px;
  background: var(--gradient-btn);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px var(--accent-glow);
}
#quiz-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
}
#quiz-submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#quiz-result {
  margin-top: 1.75rem;
  padding: 1.5rem;
  background: var(--accent-dim);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(41, 98, 255, 0.2);
}
#quiz-result h3 {
  margin-bottom: 0.5rem;
  color: var(--text-strong);
}
#quiz-result p { color: var(--text-muted); }

.hidden { display: none; }

/* ══════════════════════════════════════════════
   SCROLL REVEAL ANIMATION
   ══════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════ */
footer {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  background: var(--bg-deep);
}

footer a { color: var(--text-muted); }
footer a:hover { color: var(--accent-light); }

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .topic-section-inner {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 3rem 1rem;
    gap: 1.5rem;
  }
  .sticky-label {
    position: relative;
    top: 0;
  }
  .comparison {
    grid-template-columns: 1fr;
  }
  #topnav ul { display: none; }
  #topnav ul.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem;
    gap: 0.25rem;
  }
  .nav-toggle { display: block; }
  .hero-stats { gap: 1.5rem; flex-wrap: wrap; }
  .hero-content h1 { font-size: 2rem; }
  .ticker-tape { display: none; }
  body { padding-top: var(--nav-h); }
  html { scroll-padding-top: calc(var(--nav-h) + 16px); }
}

@media (max-width: 480px) {
  .hero-stats { flex-direction: column; gap: 1rem; }
  .hero-actions { flex-direction: column; align-items: center; }
}
