/* ==========================================================================
   DSA Learning Module — Base Stylesheet
   Design tokens + layout for Hero, Roadmap, Cards, Badges and Modal.
   Mirrors /python_animation/css/style.css exactly so this module reads as a
   native extension of the same site, not a separate project.
   ========================================================================== */

:root {
  /* Colors — same "Night Interpreter" palette used across the whole site */
  --ink-950: #05070d;
  --ink-900: #0a0e17;
  --ink-800: #0e1420;
  --ink-700: #131b2b;
  --ink-600: #1b2536;
  --ink-500: #2a3650;

  --signal: #49e5c8;
  --signal-dim: #2fa88f;
  --ember: #ffb454;
  --ember-dim: #d9922f;
  --violet: #7c6cff;

  --text-hi: #eef2fb;
  --text-mid: #aab3c9;
  --text-low: #6d7690;

  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-bg-strong: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-strong: rgba(255, 255, 255, 0.16);

  --shadow-signal: 0 0 40px rgba(73, 229, 200, 0.25);
  --shadow-ember: 0 0 40px rgba(255, 180, 84, 0.2);

  /* Type */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Layout */
  --container: 1240px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--ink-900);
  color: var(--text-hi);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--signal); color: var(--ink-950); }

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

/* ==========================================================================
   HERO SECTION — identical structure/animation language to Python Animation
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(73, 229, 200, 0.14), transparent 60%),
    linear-gradient(180deg, var(--ink-950) 0%, var(--ink-900) 55%, var(--ink-800) 100%);
}

.hero__layer { position: absolute; inset: 0; pointer-events: none; }

.hero__grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 40%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 65% at 50% 40%, #000 10%, transparent 75%);
}

.hero__blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; will-change: transform; }

.blob--signal { width: 480px; height: 480px; left: -120px; top: 8%; background: radial-gradient(circle at 30% 30%, var(--signal), transparent 70%); animation: floatBlobA 16s ease-in-out infinite; }
.blob--ember { width: 420px; height: 420px; right: -100px; top: 30%; background: radial-gradient(circle at 60% 40%, var(--ember), transparent 70%); animation: floatBlobB 20s ease-in-out infinite; }
.blob--violet { width: 360px; height: 360px; left: 38%; bottom: -140px; background: radial-gradient(circle at 50% 50%, var(--violet), transparent 70%); animation: floatBlobC 18s ease-in-out infinite; }

#particle-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.hero__shape { position: absolute; border: 1px solid var(--glass-border-strong); opacity: 0.5; }

.shape--tri { top: 18%; right: 12%; width: 60px; height: 60px; border: none; clip-path: polygon(50% 0, 0 100%, 100% 100%); background: linear-gradient(160deg, rgba(73, 229, 200, 0.14), transparent); animation: floatY 9s ease-in-out infinite; }
.shape--ring { bottom: 16%; left: 8%; width: 90px; height: 90px; border-radius: 50%; animation: floatY 11s ease-in-out infinite reverse, spin 30s linear infinite; }
.shape--square { top: 62%; right: 22%; width: 40px; height: 40px; border-radius: 8px; transform: rotate(20deg); animation: floatY 8s ease-in-out infinite; }

/* Floating DSA glyphs — swapped for Python's, kept same visual weight */
.py-glyph {
  position: absolute;
  font-family: var(--font-mono);
  color: var(--signal);
  opacity: 0.35;
  font-size: 28px;
  filter: drop-shadow(0 0 10px rgba(73, 229, 200, 0.5));
  animation: floatY 10s ease-in-out infinite;
}
.py-glyph--1 { top: 14%; left: 10%; animation-duration: 12s; }
.py-glyph--2 { top: 66%; left: 16%; animation-duration: 9s; color: var(--ember); filter: drop-shadow(0 0 10px rgba(255,180,84,.5)); }
.py-glyph--3 { top: 24%; right: 8%; animation-duration: 13s; }
.py-glyph--4 { bottom: 12%; right: 16%; animation-duration: 10s; color: var(--violet); filter: drop-shadow(0 0 10px rgba(124,108,255,.5)); }

.code-float {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-mid);
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  line-height: 1.5;
  animation: floatY 14s ease-in-out infinite;
}
.code-float span { color: var(--signal); }
.code-float b { color: var(--ember); font-weight: 500; }
.code-float--a { top: 12%; left: 5%; animation-duration: 15s; }
.code-float--b { bottom: 10%; right: 6%; animation-duration: 17s; animation-delay: -4s; }

.hero__content { position: relative; z-index: 2; text-align: center; max-width: 880px; padding: 0 24px; }

.hero__badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 999px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  font-size: 13px; color: var(--text-mid); letter-spacing: 0.03em;
  opacity: 0; animation: fadeUp 0.8s ease forwards;
}
.hero__badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 10px var(--signal); animation: pulse 2s ease-in-out infinite; }

.hero__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.08; margin-top: 24px; letter-spacing: -0.02em;
  opacity: 0; animation: fadeUp 0.9s ease 0.15s forwards;
}
.hero__title .grad {
  background: linear-gradient(96deg, var(--signal) 0%, var(--ember) 55%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  background-size: 200% auto; animation: shimmer 6s linear infinite;
}

.hero__subtitle {
  margin-top: 22px; font-size: clamp(1rem, 1.6vw, 1.2rem); color: var(--text-mid);
  max-width: 620px; margin-left: auto; margin-right: auto;
  opacity: 0; animation: fadeUp 0.9s ease 0.3s forwards;
}

.hero__actions {
  margin-top: 40px; display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  opacity: 0; animation: fadeUp 0.9s ease 0.45s forwards;
}

.btn-cta {
  position: relative; overflow: hidden;
  padding: 16px 34px; border-radius: 999px; font-weight: 600; font-size: 15.5px; letter-spacing: 0.01em;
  color: var(--ink-950); background: linear-gradient(100deg, var(--signal), #7de8d3);
  box-shadow: var(--shadow-signal);
  transition: transform 0.35s cubic-bezier(.22,1,.36,1), box-shadow 0.35s ease;
}
.btn-cta:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 0 60px rgba(73, 229, 200, 0.45); }
.btn-cta:active { transform: translateY(-1px) scale(0.98); }
.btn-cta .ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.55); transform: scale(0); animation: rippleAnim 0.65s ease-out forwards; pointer-events: none; }

.btn-ghost {
  padding: 16px 30px; border-radius: 999px; font-weight: 500; font-size: 15px; color: var(--text-hi);
  border: 1px solid var(--glass-border-strong); background: var(--glass-bg); backdrop-filter: blur(10px);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}
.btn-ghost:hover { border-color: var(--signal); background: var(--glass-bg-strong); transform: translateY(-3px); }

.scroll-indicator {
  position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-low); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  opacity: 0; animation: fadeUp 0.9s ease 0.7s forwards, bounceDown 2.2s ease-in-out 1.6s infinite;
}
.scroll-indicator__mouse { width: 24px; height: 38px; border: 1.5px solid var(--glass-border-strong); border-radius: 14px; position: relative; }
.scroll-indicator__mouse::before {
  content: ''; position: absolute; top: 6px; left: 50%; width: 4px; height: 8px; border-radius: 2px;
  background: var(--signal); transform: translateX(-50%); animation: scrollDot 1.8s ease-in-out infinite;
}

/* ==========================================================================
   ROADMAP SECTION
   ========================================================================== */

.roadmap { position: relative; padding: 140px 0 160px; background: var(--ink-800); overflow: hidden; }
.roadmap::before {
  content: ''; position: absolute; top: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border-strong), transparent);
}
.roadmap__glow {
  position: absolute; top: -200px; left: 50%; transform: translateX(-50%); width: 700px; height: 500px;
  background: radial-gradient(ellipse, rgba(73,229,200,0.10), transparent 70%); pointer-events: none;
}

.section-head { text-align: center; max-width: 640px; margin: 0 auto 68px; position: relative; z-index: 1; }
.section-head__eyebrow { display: inline-block; font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--signal); margin-bottom: 14px; }
.section-head__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -0.01em; }
.section-head__subtitle { margin-top: 14px; color: var(--text-mid); font-size: 1.05rem; }

/* Category filter pills — additive, uses same pill language as hero__badge */
.filter-bar {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin: 0 auto 44px;
}
.filter-chip {
  padding: 8px 18px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-mid);
  backdrop-filter: blur(10px);
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}
.filter-chip:hover { transform: translateY(-2px); color: var(--text-hi); border-color: var(--glass-border-strong); }
.filter-chip.active { color: var(--ink-950); background: var(--signal); border-color: var(--signal); box-shadow: 0 0 20px rgba(73,229,200,0.35); }

/* Cards grid — identical to Python Animation's .topic-grid / .topic-card */
.topic-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }

.topic-card {
  position: relative; border-radius: var(--radius-md); padding: 26px 24px 24px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  overflow: hidden; cursor: pointer; transform-style: preserve-3d; perspective: 800px;
  transition: transform 0.45s cubic-bezier(.22,1,.36,1), border-color 0.4s ease, box-shadow 0.4s ease;
  opacity: 0; animation: cardIn 0.7s cubic-bezier(.22,1,.36,1) forwards; animation-play-state: paused;
}
.topic-card.in-view { animation-play-state: running; opacity: 1; }
.topic-card.filtered-out { display: none; }

.topic-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(73,229,200,0.5), rgba(255,255,255,0) 40%, rgba(255,180,84,0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.4s ease; pointer-events: none;
}
.topic-card::after {
  content: ''; position: absolute; top: -60%; left: -60%; width: 60%; height: 220%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.14), transparent);
  transform: rotate(20deg); transition: left 0.9s ease; pointer-events: none;
}
.topic-card:hover { transform: translateY(-8px); border-color: var(--glass-border-strong); box-shadow: 0 26px 50px rgba(0,0,0,0.4), 0 0 34px rgba(73,229,200,0.12); }
.topic-card:hover::before { opacity: 1; }
.topic-card:hover::after { left: 130%; }

.topic-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.topic-card__icon {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, rgba(73,229,200,0.16), rgba(124,108,255,0.10));
  border: 1px solid var(--glass-border); margin-bottom: 20px; color: var(--signal);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.topic-card:hover .topic-card__icon { transform: scale(1.08) rotate(-4deg); box-shadow: 0 0 22px rgba(73,229,200,0.28); }
.topic-card__icon svg { width: 26px; height: 26px; transform-origin: center; transform-box: fill-box; }

.topic-card__index { position: absolute; top: 22px; right: 22px; font-family: var(--font-mono); font-size: 12px; color: var(--text-low); letter-spacing: 0.05em; }

.topic-card__title { font-family: var(--font-display); font-weight: 600; font-size: 1.14rem; margin-bottom: 8px; color: var(--text-hi); }
.topic-card__desc { font-size: 0.9rem; color: var(--text-mid); line-height: 1.55; min-height: 42px; }

/* Tag / badge system — reuses the pill language already established by
   .hero__badge and .section-head__eyebrow so nothing new is invented. */
.topic-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-mid);
}
.tag-badge.tag--category { color: var(--signal); border-color: rgba(73,229,200,0.28); background: rgba(73,229,200,0.08); }
.tag-badge.tag--soon { color: var(--ember); border-color: rgba(255,180,84,0.28); background: rgba(255,180,84,0.08); }
.tag-badge.tag--live { color: var(--violet); border-color: rgba(124,108,255,0.3); background: rgba(124,108,255,0.1); }

.topic-card__arrow { margin-top: 18px; display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 500; color: var(--signal); }
.topic-card__arrow svg { width: 15px; height: 15px; transition: transform 0.35s cubic-bezier(.22,1,.36,1); }
.topic-card:hover .topic-card__arrow svg { transform: translateX(6px); }

.card-ripple { position: absolute; border-radius: 50%; background: rgba(73,229,200,0.35); transform: scale(0); animation: rippleAnim 0.6s ease-out forwards; pointer-events: none; }

/* ==========================================================================
   MODAL / LESSON POPUP — identical markup/behaviour to Python Animation
   ========================================================================== */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 28px; background: rgba(5, 7, 13, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; overscroll-behavior: contain;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  width: 100%; max-width: 960px; height: min(680px, 86vh);
  background: linear-gradient(180deg, var(--ink-700), var(--ink-800));
  border: 1px solid var(--glass-border-strong); border-radius: 22px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.55), 0 0 60px rgba(73,229,200,0.08);
  display: flex; flex-direction: column; overflow: hidden;
  transform: scale(0.9) translateY(24px); opacity: 0;
  transition: transform 0.4s cubic-bezier(.22,1,.36,1), opacity 0.4s ease;
}
.modal.fullscreen { max-width: 100%; height: 100vh; border-radius: 0; }
.modal-overlay.active .modal { transform: scale(1) translateY(0); opacity: 1; }

.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--glass-border); background: var(--glass-bg); }
.modal__title-wrap { display: flex; align-items: center; gap: 12px; }
.modal__icon { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(140deg, rgba(73,229,200,0.2), rgba(124,108,255,0.14)); display: flex; align-items: center; justify-content: center; color: var(--signal); }
.modal__icon svg { width: 18px; height: 18px; }
.modal__title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.modal__eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--text-low); letter-spacing: 0.08em; }
.modal__actions { display: flex; align-items: center; gap: 6px; }
.modal__btn { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--text-mid); transition: background 0.25s ease, color 0.25s ease; }
.modal__btn:hover { background: var(--glass-bg-strong); color: var(--text-hi); }
.modal__btn svg { width: 17px; height: 17px; }
.modal__body { position: relative; flex: 1; min-height: 0; background: var(--ink-900); overflow: hidden; overscroll-behavior: contain; }
.modal__iframe { width: 100%; height: 100%; border: 0; opacity: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; transition: opacity 0.4s ease; }
.modal__iframe.loaded { opacity: 1; }
.modal__loader { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--text-mid); font-size: 13px; font-family: var(--font-mono); transition: opacity 0.3s ease; }
.modal__loader.hide { opacity: 0; pointer-events: none; }
.loader-ring { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--glass-border); border-top-color: var(--signal); animation: spin 0.9s linear infinite; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ==========================================================================
   RESPONSIVE — mirrors /python_animation/css/responsive.css
   ========================================================================== */

@media (max-width: 1024px) {
  .container { padding: 0 24px; }
  .topic-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
  .code-float--b { display: none; }
  .roadmap { padding: 110px 0 120px; }
}

@media (max-width: 768px) {
  .hero { min-height: 100svh; }
  .hero__title { font-size: clamp(2rem, 8vw, 2.8rem); }
  .hero__actions { flex-direction: column; width: 100%; max-width: 320px; margin-left: auto; margin-right: auto; }
  .btn-cta, .btn-ghost { width: 100%; text-align: center; }
  .code-float { display: none; }
  .shape--tri, .shape--square { display: none; }
  .topic-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
  .section-head { margin-bottom: 46px; }
  .modal { height: 90vh; border-radius: 16px; }
  .modal__title { font-size: 0.95rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 18px; }
  .topic-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .topic-card { padding: 20px 16px 18px; }
  .topic-card__icon { width: 42px; height: 42px; border-radius: 12px; margin-bottom: 14px; }
  .topic-card__icon svg { width: 20px; height: 20px; }
  .topic-card__title { font-size: 0.98rem; }
  .topic-card__desc { font-size: 0.82rem; min-height: 0; }
  .topic-card__index { top: 16px; right: 16px; }
  .hero__badge { font-size: 11.5px; padding: 6px 12px; }
  .section-head__title { font-size: 1.7rem; }
  .modal-overlay { padding: 0; }
  .modal { height: 100vh; border-radius: 0; max-width: 100%; }
  .modal__header { padding: 12px 14px; }
  .filter-bar { gap: 8px; }
  .filter-chip { padding: 7px 14px; font-size: 12px; }
}

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

@media (max-height: 620px) {
  .py-glyph, .code-float { display: none; }
  .scroll-indicator { display: none; }
}
