/* ------------------------------
   Theme Variables
   ------------------------------
   All colors, shadows, and borders are defined as CSS custom
   properties here. Switching to dark mode is just a matter of
   overriding these on [data-theme="dark"] — no other rules need
   to change. JavaScript sets that attribute on <html>.
*/
:root {
  --bg: #f6fbff;
  --bg-2: #e9f4ff;
  --surface: #ffffff;
  --text: #17324d;
  --muted: #41627f;
  --primary: #0b84f3;
  --secondary: #14b8a6;
  --accent: #ff9e1b;
  --danger: #e55353;
  --success: #1f9d5f;
  --focus: #111827;
  --border: #b9d5eb;
  --shadow: 0 10px 30px rgba(16, 45, 77, 0.12);
}

:root[data-theme="dark"] {
  --bg: #0d1b2a;
  --bg-2: #16283d;
  --surface: #122235;
  --text: #e8f2ff;
  --muted: #b5d0ea;
  --primary: #57b6ff;
  --secondary: #3ad8c9;
  --accent: #ffc45b;
  --danger: #ff7c7c;
  --success: #56d18b;
  --focus: #f8fafc;
  --border: #2b4964;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

/* ------------------------------
   Global Styles
   ------------------------------
   box-sizing: border-box makes padding/border count inside the
   element's declared width, which avoids a lot of layout math.
   scroll-behavior: smooth enables anchor-link scrolling.
*/
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Nunito", sans-serif;
  color: var(--text);
  /* Three-layer background: two radial blobs for the colorful corner glows,
     plus a linear gradient that fades from --bg at the top to --bg-2 below.
     They're listed comma-separated so the browser stacks them. */
  background:
    radial-gradient(circle at 10% 15%, rgba(11, 132, 243, 0.15), transparent 35%),
    radial-gradient(circle at 90% 5%, rgba(20, 184, 166, 0.2), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  line-height: 1.6;
}

h1,
h2,
h3 {
  font-family: "Baloo 2", cursive;
  line-height: 1.2;
  margin-top: 0;
}

p,
li,
label,
button,
a,
legend,
input {
  /* clamp(min, preferred, max) scales the font smoothly between
     viewport sizes without needing explicit breakpoints. */
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.08rem);
}

a {
  color: var(--primary);
}

a:hover {
  color: var(--secondary);
}

.section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 4.5rem 1rem 2.5rem;
}

.section-heading {
  margin-bottom: 1.5rem;
}

.section-heading p {
  color: var(--muted);
  max-width: 65ch;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--accent);
  color: #111;
  padding: 0.7rem 1rem;
  border-radius: 0.6rem;
  z-index: 9999;
  font-weight: 700;
}

.skip-link:focus {
  left: 8px;
}

/* ------------------------------
   Header / Navigation
   ------------------------------
   The header is sticky so it stays visible while scrolling.
   backdrop-filter: blur() gives the frosted-glass effect behind it.
   color-mix() blends --bg with transparent so the page content
   shows through slightly (requires a modern browser).
*/
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--border);
}

.navbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand {
  font-family: "Baloo 2", cursive;
  font-size: 1.45rem;
  text-decoration: none;
  color: var(--text);
  margin-right: auto;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  /* color-mix() blends two colors by percentage without needing
     a separate variable. Here it creates a subtle tinted hover pill. */
  background: color-mix(in srgb, var(--primary) 17%, transparent);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0.8rem;
  padding: 0.55rem;
  min-width: 48px;
  min-height: 48px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--text);
  margin: 4px 0;
  border-radius: 3px;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  min-height: 48px;
  padding: 0.45rem 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
}

/* ------------------------------
   Hero
------------------------------ */
.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: min(74vh, 760px);
  border-radius: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0;
  background: linear-gradient(125deg, #123a58, #0e2c44);
}

.hero-media {
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, #123a58, #0e2c44);
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(6, 20, 35, 0.78), rgba(8, 33, 48, 0.36)),
    radial-gradient(circle at 80% 20%, rgba(20, 184, 166, 0.16), transparent 38%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: clamp(1.2rem, 2vw, 2rem);
  max-width: min(72ch, 100%);
}

.tag {
  display: inline-block;
  background: color-mix(in srgb, var(--secondary) 36%, transparent);
  color: #f6fdff;
  border: 1px solid color-mix(in srgb, #9df8ef 65%, transparent);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-weight: 700;
}

.hero h1 {
  /* clamp() keeps the heading large on desktop, but scales it
     down smoothly on smaller screens without a media query. */
  font-size: clamp(2rem, 1.6rem + 2vw, 3.2rem);
  margin-bottom: 0.8rem;
  color: #f4faff;
}

.hero-intro {
  max-width: 55ch;
  color: #d9eefb;
}

.hero-actions {
  margin-top: 1.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

/* ------------------------------
   Components
------------------------------ */
.card-grid {
  display: grid;
  gap: 1rem;
}

.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.2rem;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.lesson-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.btn {
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 0.65rem 1rem;
  border-radius: 0.85rem;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary,
.btn-small {
  background: linear-gradient(135deg, var(--primary), #249efc);
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), #16c7b3);
  color: #062b27;
}

.btn-ghost {
  background: color-mix(in srgb, var(--surface) 82%, var(--primary) 18%);
  color: var(--text);
  border: 1px solid var(--border);
}

.learn-list {
  padding-left: 1.2rem;
}

.quiz fieldset {
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.7rem;
  margin-bottom: 0.8rem;
}

.quiz label {
  display: block;
  margin-top: 0.35rem;
}

.quiz-result {
  min-height: 1.5rem;
  margin-top: 0.7rem;
  font-weight: 700;
}

.activity-feedback {
  min-height: 1.6rem;
  margin-top: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 75%, var(--secondary) 25%);
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  min-height: 44px;
  cursor: pointer;
}

.chip.active {
  background: color-mix(in srgb, var(--secondary) 36%, var(--surface));
  border-color: var(--secondary);
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.selection-grid label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.45rem;
  background: color-mix(in srgb, var(--surface) 82%, var(--bg-2) 18%);
}

.bulb-display {
  margin-top: 0.7rem;
  min-height: 120px;
  display: grid;
  place-items: center;
}

.bulb {
  width: 70px;
  height: 90px;
  border-radius: 48% 48% 42% 42%;
  border: 3px solid var(--border);
  background: linear-gradient(180deg, #f6f7f9, #dde5eb);
  position: relative;
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

.bulb::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 18px;
  left: 50%;
  transform: translateX(-50%);
  bottom: -16px;
  border-radius: 0 0 8px 8px;
  background: #9caab7;
}

.bulb.on {
  /* Radial gradient fades from white at the center out to warm yellow,
     mimicking the glow of a real incandescent bulb. The box-shadow
     adds the diffuse light spreading outward. */
  background: radial-gradient(circle at 50% 30%, #fff8b4, #ffd251 80%);
  box-shadow: 0 0 26px #ffd251;
}

.button-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.heart-zone {
  min-height: 90px;
  display: grid;
  place-items: center;
  margin-top: 0.8rem;
}

.beat-visual {
  margin-top: 0.8rem;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--surface) 84%, var(--bg-2) 16%);
}

.beat-lights {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.beat-light {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, var(--bg-2) 20%);
}

.beat-light.active {
  background: linear-gradient(140deg, var(--accent), #ffd77d);
  color: #1b2734;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.heart {
  width: 56px;
  aspect-ratio: 1;
  background: #f0476d;
  transform: rotate(-45deg);
  position: relative;
  border-radius: 8px;
  transition: filter 0.2s ease;
}

.heart::before,
.heart::after {
  content: "";
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f0476d;
}

.heart::before {
  top: -28px;
  left: 0;
}

.heart::after {
  top: 0;
  left: 28px;
}

.heart.pulse {
  animation: heartbeat 0.5s ease;
  filter: drop-shadow(0 0 10px rgba(240, 71, 109, 0.55));
}

@keyframes heartbeat {
  0% { transform: rotate(-45deg) scale(1); }
  40% { transform: rotate(-45deg) scale(1.12); }
  100% { transform: rotate(-45deg) scale(1); }
}

.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem 1rem 2.5rem;
}

.site-footer nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ------------------------------
   Reveal Animations
   ------------------------------
   Sections start hidden and slightly shifted downward.
   When JavaScript adds .visible (via IntersectionObserver),
   the transition runs and slides them into place.
*/
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

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

/* ------------------------------
   Accessibility / Focus
   ------------------------------
   We remove the default browser outline and replace it with a
   custom box-shadow ring that matches the design. This keeps
   keyboard navigation visible without the ugly default rectangle.
   The prefers-reduced-motion block collapses all animations and
   transitions for users who have that system preference turned on.
*/
button,
input,
a {
  outline: none;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent);
  border-radius: 0.6rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------
   Responsive
   ------------------------------
   At 980px the multi-column grids collapse to a single column so
   everything stacks nicely on tablets. The hamburger button also
   appears here — on desktop it's hidden (display: none).
   At 560px we fine-tune a few spacings for smaller phones.
*/
@media (max-width: 980px) {
  .hero,
  .lesson-layout,
  .three-up,
  .two-up {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 58vh;
  }

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

  .nav-links {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem 1rem;
    display: none;
    flex-direction: column;
  }

  .nav-links.open {
    display: flex;
  }
}

@media (max-width: 560px) {
  .section {
    padding-top: 3.8rem;
  }

  .hero {
    min-height: 62vh;
  }

  .hero-video {
    opacity: 0.74;
  }

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