/* Global theme */
:root {
  --bg: #0f172a;
  --bg-elevated: rgba(15, 23, 42, 0.72);
  --bg-solid: #111827;
  --card: rgba(15, 23, 42, 0.6);
  --card-border: rgba(148, 163, 184, 0.16);
  --card-border-strong: rgba(79, 70, 229, 0.28);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --accent: #38bdf8;
  --accent-2: #a855f7;
  --success: #22c55e;
  --shadow: 0 24px 80px rgba(2, 6, 23, 0.42);
  --shadow-soft: 0 16px 48px rgba(2, 6, 23, 0.22);
  --max-width: 1200px;
  --section-space: 80px;
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.35), transparent 28%),
    radial-gradient(circle at 80% 12%, rgba(56, 189, 248, 0.18), transparent 24%),
    linear-gradient(180deg, #020617 0%, var(--bg) 44%, #0b1220 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

.container {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
}

.section {
  padding: var(--section-space) 0;
  position: relative;
}

.section-alt {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.5));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color 180ms ease, border-color 180ms ease, backdrop-filter 180ms ease, box-shadow 180ms ease;
}

.site-header.is-scrolled {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.22);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.32);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: rgba(226, 232, 240, 0.88);
  font-weight: 500;
}

.nav-links a:hover {
  color: white;
}

.nav-toggle {
  display: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-direction: column;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
  display: block;
}

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

.hero {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding-top: 2rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: 2rem;
  position: relative;
}

.hero-copy,
.hero-panel,
.preview-card,
.cta-card,
.about-portrait,
.topic-card,
.glass-card {
  position: relative;
  z-index: 1;
}

.hero-copy h1 {
  margin: 0.35rem 0 1rem;
  font-size: clamp(3rem, 7vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
  max-width: 10ch;
}

.hero-copy .lead {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--muted);
  max-width: 44rem;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.12);
  border: 1px solid rgba(79, 70, 229, 0.2);
  color: #c7d2fe;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 999px;
  padding: 1rem 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 18px 40px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 22px 54px rgba(79, 70, 229, 0.38);
}

.btn-secondary {
  color: var(--text);
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.btn-secondary:hover {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.62);
}

.btn-small {
  padding: 0.8rem 1.1rem;
  font-size: 0.95rem;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.hero-pills span,
.lesson-links a {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.34);
  padding: 0.6rem 0.9rem;
  color: rgba(226, 232, 240, 0.9);
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-bg::before,
.hero-bg::after {
  content: "";
  position: absolute;
  inset: auto;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.24;
}

.hero-bg::before {
  background: rgba(79, 70, 229, 0.8);
  left: -8rem;
  top: 4rem;
}

.hero-bg::after {
  background: rgba(56, 189, 248, 0.7);
  right: -8rem;
  bottom: -10rem;
}

.hero-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(56, 189, 248, 0.6));
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
  opacity: 0.4;
  animation: float 12s linear infinite;
}

.hero-panel {
  padding: 1.5rem;
  overflow: hidden;
}

.glass-card {
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.58));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin: 1.4rem 0;
}

.panel-grid div {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.panel-grid strong {
  display: block;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.panel-grid span,
.panel-caption {
  color: var(--muted);
}

.mini-chart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.65rem;
  align-items: end;
  min-height: 170px;
  padding: 0.3rem 0 0.5rem;
}

.mini-chart span {
  display: block;
  border-radius: 18px 18px 8px 8px;
  background: linear-gradient(180deg, rgba(79, 70, 229, 1), rgba(56, 189, 248, 0.8));
  box-shadow: 0 12px 26px rgba(56, 189, 248, 0.14);
  transform-origin: bottom;
  animation: pulseBars 3.5s ease-in-out infinite;
}

.mini-chart span:nth-child(1) { height: 28%; animation-delay: 0s; }
.mini-chart span:nth-child(2) { height: 52%; animation-delay: 0.2s; }
.mini-chart span:nth-child(3) { height: 72%; animation-delay: 0.4s; }
.mini-chart span:nth-child(4) { height: 44%; animation-delay: 0.6s; }
.mini-chart span:nth-child(5) { height: 86%; animation-delay: 0.8s; }
.mini-chart span:nth-child(6) { height: 66%; animation-delay: 1s; }

.section-heading {
  max-width: 46rem;
  margin-bottom: 2rem;
}

.section-heading h2,
.about-copy h2,
.cta-card h2 {
  margin: 0.75rem 0 0.8rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.section-heading p,
.about-copy p,
.cta-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  max-width: 66ch;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
}

.topic-card {
  padding: 1.5rem;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.topic-card:hover {
  transform: translateY(-6px);
  border-color: var(--card-border-strong);
  box-shadow: 0 28px 70px rgba(2, 6, 23, 0.38);
}

.topic-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.92), rgba(56, 189, 248, 0.78));
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.24);
}

.topic-icon svg {
  width: 1.6rem;
  height: 1.6rem;
}

.topic-card h3 {
  margin: 1rem 0 0.5rem;
  font-size: 1.45rem;
}

.topic-card p {
  margin: 0 0 1.4rem;
  color: var(--muted);
  line-height: 1.75;
}

.lesson-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.lesson-links a {
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.lesson-links a:hover {
  transform: translateY(-2px);
  border-color: rgba(79, 70, 229, 0.34);
  background: rgba(15, 23, 42, 0.56);
}

.preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.preview-card {
  padding: 1.4rem;
}

.preview-tabs {
  display: inline-flex;
  gap: 0.45rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.26);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.preview-tab {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.preview-tab.is-active {
  color: white;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.9), rgba(56, 189, 248, 0.9));
}

.preview-window {
  margin-top: 1rem;
  min-height: 320px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.44), rgba(15, 23, 42, 0.76));
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
}

.preview-content {
  display: none;
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 280px;
  color: #dbeafe;
  font-size: 1rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.preview-content.is-visible {
  display: block;
}

.graph-canvas {
  position: relative;
}

.node {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 0 0 8px rgba(56, 189, 248, 0.08);
}

.edge {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.8), rgba(56, 189, 248, 0.8));
  transform-origin: left center;
}

.n1 { left: 18%; top: 66%; }
.n2 { left: 44%; top: 28%; }
.n3 { left: 70%; top: 62%; }
.n4 { left: 56%; top: 82%; }
.e1 { left: 20%; top: 64%; width: 30%; transform: rotate(-25deg); }
.e2 { left: 46%; top: 30%; width: 29%; transform: rotate(33deg); }
.e3 { left: 58%; top: 80%; width: 17%; transform: rotate(-76deg); }

.preview-action {
  margin-top: 1rem;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
  gap: 1.5rem;
  align-items: center;
}

.about-portrait {
  padding: 1rem;
  max-width: 420px;
  justify-self: end;
}

.about-portrait img {
  width: 100%;
  border-radius: 22px;
}

.cta-section {
  padding-top: 20px;
}

.cta-card {
  text-align: center;
  padding: 2.2rem;
}

.cta-card p {
  margin-left: auto;
  margin-right: auto;
}

.cta-card .btn {
  margin-top: 1.5rem;
}

.site-footer {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(2, 6, 23, 0.28);
}

.footer-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 1rem;
  align-items: start;
}

.footer-brand {
  margin-bottom: 0.75rem;
}

.footer-layout p,
.footer-bottom {
  color: var(--muted);
}

.footer-links,
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.social-links a {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.38);
  font-weight: 800;
}

.footer-bottom {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 640ms ease, transform 640ms ease;
}

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

@keyframes float {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0;
  }
  10% { opacity: 0.55; }
  50% {
    transform: translate3d(24px, -120px, 0) scale(1.08);
    opacity: 0.3;
  }
  100% {
    transform: translate3d(48px, -240px, 0) scale(0.92);
    opacity: 0;
  }
}

@keyframes pulseBars {
  0%, 100% { transform: scaleY(0.96); opacity: 0.76; }
  50% { transform: scaleY(1.06); opacity: 1; }
}

@media (max-width: 980px) {
  .hero-layout,
  .preview-layout,
  .about-layout,
  .footer-layout,
  .topic-grid {
    grid-template-columns: 1fr;
  }

  .about-portrait {
    max-width: 100%;
    justify-self: stretch;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    position: relative;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    right: 0;
    width: min(320px, calc(100vw - 2rem));
    padding: 1rem;
    margin-top: 0.75rem;
    display: grid;
    gap: 0.9rem;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-soft);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 180ms ease, transform 180ms ease;
  }

  .nav-links.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-links .btn {
    width: 100%;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --section-space: 60px;
  }

  .container {
    width: min(var(--max-width), calc(100% - 1.2rem));
  }

  .hero {
    min-height: auto;
    padding-top: 2.5rem;
  }

  .hero-copy h1 {
    font-size: clamp(2.6rem, 12vw, 4.2rem);
  }

  .actions,
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  :root {
    --section-space: 48px;
    --radius: 24px;
  }

  .container {
    width: min(var(--max-width), calc(100% - 1rem));
  }

  .nav {
    min-height: 68px;
  }

  .brand {
    gap: 0.65rem;
  }

  .brand-mark {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 14px;
  }

  .hero {
    min-height: auto;
    padding-top: 1.5rem;
  }

  .hero-layout {
    gap: 1.25rem;
  }

  .hero-copy h1 {
    font-size: clamp(2.2rem, 14vw, 3.2rem);
    max-width: 100%;
  }

  .hero-copy .lead {
    font-size: 1rem;
    line-height: 1.7;
    max-width: 36rem;
  }

  .btn {
    width: 100%;
    min-height: 48px;
    padding: 0.95rem 1.1rem;
  }

  .topic-grid,
  .preview-layout,
  .panel-grid,
  .footer-layout {
    gap: 1rem;
  }

  .card,
  .glass-card,
  .preview-card,
  .cta-card,
  .about-portrait {
    border-radius: 22px;
  }

  .section {
    padding: 48px 0;
  }

  .footer-bottom {
    gap: 0.75rem;
  }
}

@media (max-width: 360px) {
  :root {
    --section-space: 40px;
  }

  .container {
    width: min(var(--max-width), calc(100% - 0.75rem));
  }

  .nav-links {
    width: min(100vw - 1rem, 100%);
  }

  .hero-copy h1 {
    font-size: clamp(2rem, 15vw, 3rem);
  }

  .hero-copy .lead {
    font-size: 0.98rem;
  }

  .eyebrow,
  .section-kicker {
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
  }

  .btn {
    font-size: 0.96rem;
  }
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 0 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.78);
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.back-to-top:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.9);
  outline-offset: 3px;
}
