/* ============================================
   THE TREE HOUSE PLAY SCHOOL — CORE STYLES
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700;800&display=swap');

:root {
  /* Palette */
  --cream: #FBF6EE;
  --cream-deep: #F3EBDA;
  --blush: #F7C9CE;
  --blush-deep: #EFA8B3;
  --butter: #FAE0A0;
  --butter-deep: #F3C969;
  --sky: #BFE3E8;
  --sky-deep: #95CCD4;
  --mint: #C9E4D4;
  --mint-deep: #9FCFB4;
  --lavender: #D9CFEA;
  --bark: #6B5847;
  --ink: #1A1613;
  --ink-soft: #3D3830;
  --white: #FFFFFF;

  /* Type */
  --font-display: 'Poppins', system-ui, sans-serif;
  --font-body: 'Poppins', system-ui, sans-serif;

  /* Spacing/scale */
  --container: 1240px;
  --radius-lg: 32px;
  --radius-md: 20px;
  --radius-sm: 12px;

  /* Shadows */
  --shadow-soft: 0 20px 60px -20px rgba(107, 88, 71, 0.25);
  --shadow-card: 0 12px 30px -10px rgba(107, 88, 71, 0.18);
}

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

html {
  scroll-behavior: auto;
}

body {
  font-family: var(--font-body);
  font-weight: 500; /* KLAY uses 500 for body/paragraph text */
  color: var(--ink);
  background: var(--cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.1;
}

h1 {
  font-weight: 800; /* Very bold for main hero titles */
}

h2 {
  font-weight: 700; /* Bold for section titles to match Klay */
}

h3 {
  font-weight: 700; /* Bold for cards & subtitles */
}

h4 {
  font-weight: 600; /* Semi-bold for smaller headings */
}

a { text-decoration: none; color: inherit; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

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

/* Visible keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--sky-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================
   NAVIGATION (shared across all pages)
   ============================================ */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 56px);
  background: rgba(251, 246, 238, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(107, 88, 71, 0.08);
  transition: padding 0.4s ease, background 0.4s ease;
}

.site-nav.is-compact {
  padding: 14px clamp(20px, 4vw, 56px);
  background: rgba(251, 246, 238, 0.92);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
}

.nav-brand svg { width: 30px; height: 30px; }

.nav-links {
  display: flex;
  gap: clamp(16px, 2.4vw, 34px);
  font-weight: 600;
  font-size: 0.98rem;
}

.nav-links a {
  position: relative;
  padding: 6px 2px;
  color: var(--ink-soft);
  transition: color 0.25s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 0%;
  height: 3px;
  border-radius: 3px;
  background: var(--blush-deep);
  transition: width 0.3s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
}

.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after {
  width: 100%;
}

.nav-cta {
  background: var(--blush-deep);
  color: var(--ink);
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.nav-cta:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 16px 34px -10px rgba(239, 168, 179, 0.55);
}

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
}
.nav-toggle span, .nav-toggle::before, .nav-toggle::after {
  content: '';
  display: block;
  width: 22px; height: 2.5px;
  background: var(--ink);
  border-radius: 2px;
  position: relative;
}
.nav-toggle::before { transform: translateY(-7px); position: absolute; }
.nav-toggle::after { transform: translateY(7px); position: absolute; }

/* ============================================
   SCROLL PROGRESS INDICATOR
   ============================================ */
.scroll-progress {
  position: fixed;
  right: clamp(14px, 2vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 200px;
  background: rgba(107, 88, 71, 0.12);
  border-radius: 4px;
  z-index: 150;
}

.scroll-progress-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 0%;
  background: linear-gradient(180deg, var(--butter-deep), var(--blush-deep));
  border-radius: 4px;
}

.scroll-progress-dot {
  position: absolute;
  left: 50%;
  bottom: 0%;
  width: 16px; height: 16px;
  background: var(--cream);
  border: 3px solid var(--blush-deep);
  border-radius: 50%;
  transform: translate(-50%, 50%);
  box-shadow: var(--shadow-card);
}

@media (max-width: 880px) {
  .scroll-progress { display: none; }
}

/* ============================================
   CANVAS & BACKGROUND GALLERY
   ============================================ */
#scene-canvas {
  display: none !important; /* Hide 3D stage in favor of natural image gallery scroll */
}

.gallery-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 1;
  overflow: hidden;
  background: var(--cream);
}

.gallery-image-wrapper {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 1.2s cubic-bezier(0.25, 1, 0.5, 1), transform 1.4s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: opacity, transform;
}

.gallery-image-wrapper.active {
  opacity: 1;
  transform: scale(1.02);
}

.gallery-image-wrapper img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(1.04) brightness(0.95);
  will-change: transform;
}

/* ── Precise child face centering & positioning based on layout alignment ── */
.gallery-image-wrapper[data-bg="bg_hero"] img {
  object-position: 60% 45%;
}
.gallery-image-wrapper[data-bg="bg_question"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="bg_artist"] img {
  object-position: center 50%;
}
.gallery-image-wrapper[data-bg="bg_scientist"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="bg_explorer"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="bg_musician"] img {
  object-position: center 50%;
}
.gallery-image-wrapper[data-bg="bg_doctor"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="bg_astronomer"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="unique_builder"] img {
  object-position: center 50%;
}
.gallery-image-wrapper[data-bg="school_entrance"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="clean_classroom"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="kids_reading"] img {
  object-position: center 50%;
}
.gallery-image-wrapper[data-bg="teacher_reading"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="home_future"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="about_seed"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="about_roots"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="about_reading"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="home_intro"] img {
  object-position: center 50%;
}
.gallery-image-wrapper[data-bg="home_play"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="prog_painting"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="prog_builder"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="daycare_rest"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="prog_future"] img {
  object-position: center 50%;
}
.gallery-image-wrapper[data-bg="safety_intro"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="safety_reading"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="safety_classroom"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="safety_blocks"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="safety_seed"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="contact_intro"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="contact_roots"] img {
  object-position: center 50%;
}
.gallery-image-wrapper[data-bg="prog_hero"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="outdoor_play"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="programs_reading"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="building_blocks"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="programs_future"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="about_values"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="about_bloom"] img {
  object-position: 15% 50%;
}
.gallery-image-wrapper[data-bg="contact_touch"] img {
  object-position: 85% 50%;
}
.gallery-image-wrapper[data-bg="contact_find"] img {
  object-position: 85% 50%;
}


/* Much lighter overlay — let the photos show beautifully */
.gallery-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  /* Airy soft fade at edges, completely bright and seamless */
  background:
    linear-gradient(to bottom,
      rgba(251,246,238,0.25) 0%,
      rgba(251,246,238,0) 15%,
      rgba(251,246,238,0) 85%,
      rgba(251,246,238,0.3) 100%
    );
  pointer-events: none;
  z-index: 2;
}

.story-content {
  position: relative;
  z-index: 10;
  overflow-x: hidden;
}

/* ── Chapter‑level accent colours (CSS custom properties) ── */
[data-chapter="0"]  { --ch-color: #9FCFB4; --ch-color2: #C9E4D4; --ch-num: '00'; }
[data-chapter="1"]  { --ch-color: #FAE0A0; --ch-color2: #FDE9B8; --ch-num: '01'; }
[data-chapter="2"]  { --ch-color: #F7C9CE; --ch-color2: #FBDDE0; --ch-num: '02'; }
[data-chapter="3"]  { --ch-color: #BFE3E8; --ch-color2: #D4EEF2; --ch-num: '03'; }
[data-chapter="4"]  { --ch-color: #D9CFEA; --ch-color2: #E8E2F3; --ch-num: '04'; }
[data-chapter="5"]  { --ch-color: #F7C9CE; --ch-color2: #FBDDE0; --ch-num: '05'; }
[data-chapter="6"]  { --ch-color: #9FCFB4; --ch-color2: #C9E4D4; --ch-num: '06'; }
[data-chapter="7"]  { --ch-color: #FAE0A0; --ch-color2: #FDE9B8; --ch-num: '07'; }
[data-chapter="8"]  { --ch-color: #BFE3E8; --ch-color2: #D4EEF2; --ch-num: '08'; }
[data-chapter="9"]  { --ch-color: #D9CFEA; --ch-color2: #E8E2F3; --ch-num: '09'; }
[data-chapter="10"] { --ch-color: #9FCFB4; --ch-color2: #C9E4D4; --ch-num: '10'; }
[data-chapter="11"] { --ch-color: #FAE0A0; --ch-color2: #FDE9B8; --ch-num: '11'; }
[data-chapter="12"] { --ch-color: #F7C9CE; --ch-color2: #FBDDE0; --ch-num: '12'; }
[data-chapter="13"] { --ch-color: #BFE3E8; --ch-color2: #D4EEF2; --ch-num: '13'; }

.chapter {
  position: relative;
  min-height: 120vh;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.chapter-inner {
  pointer-events: auto;
  position: relative;
  max-width: 620px;
  padding: 68px 80px 64px; /* extensive padding to ensure text stays completely inside the bubble */

  /* Premium frosted-glass organic bubble shape (highly readable, soft white glow) */
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-radius: 46% 54% 50% 50% / 50% 52% 48% 50%;
  border: 2px solid rgba(255, 255, 255, 0.65);

  /* Water bubble layered glow and depth */
  box-shadow:
    inset 0 4px 15px rgba(255, 255, 255, 0.65),
    0 12px 36px rgba(107, 88, 71, 0.06),
    0 2px 25px rgba(255, 255, 255, 0.30);

  margin: 0 clamp(20px, 4vw, 56px);
  overflow: visible; /* let attached bubbles extend outward */
  z-index: 10;
  transition: box-shadow 0.4s ease, border-color 0.6s ease, border-radius 0.6s ease, transform 0.4s ease;
}

/* Sub-bubbles attached to the main card to form a bubble cluster */
.chapter-inner .attached-bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16); /* matching side bubbles */
  border: 1.2px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    inset 0 3px 8px rgba(255, 255, 255, 0.50),
    0 6px 18px rgba(107, 88, 71, 0.04);
  pointer-events: none;
  z-index: -1;
  transform-origin: center;
}

/* Floating/pulsating animation for the attached bubbles */
@keyframes bubble-float-sub {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(3px, -5px) scale(1.025);
  }
}

.chapter-inner .attached-bubble.ab1 {
  width: 120px;
  height: 120px;
  top: -45px;
  right: -30px;
  animation: bubble-float-sub 7s infinite ease-in-out;
}

.chapter-inner .attached-bubble.ab2 {
  width: 80px;
  height: 80px;
  bottom: -30px;
  left: -20px;
  animation: bubble-float-sub 8s infinite ease-in-out -2s;
}

.chapter-inner .attached-bubble.ab3 {
  width: 60px;
  height: 60px;
  top: 40%;
  left: -35px;
  animation: bubble-float-sub 6s infinite ease-in-out -4s;
}

.chapter-inner .attached-bubble.ab4 {
  width: 95px;
  height: 95px;
  bottom: -35px;
  right: -25px;
  animation: bubble-float-sub 9s infinite ease-in-out -1s;
}

/* Assign unique morphing animations to give each section a random, unique bubble shape */
[data-chapter="0"] .chapter-inner,
[data-chapter="4"] .chapter-inner,
[data-chapter="8"] .chapter-inner,
[data-chapter="12"] .chapter-inner {
  animation: bubble-morph-1 12s infinite ease-in-out alternate;
}
[data-chapter="1"] .chapter-inner,
[data-chapter="5"] .chapter-inner,
[data-chapter="9"] .chapter-inner,
[data-chapter="13"] .chapter-inner {
  animation: bubble-morph-2 15s infinite ease-in-out alternate -3s;
}
[data-chapter="2"] .chapter-inner,
[data-chapter="6"] .chapter-inner,
[data-chapter="10"] .chapter-inner {
  animation: bubble-morph-3 13s infinite ease-in-out alternate -6s;
}
[data-chapter="3"] .chapter-inner,
[data-chapter="7"] .chapter-inner,
[data-chapter="11"] .chapter-inner {
  animation: bubble-morph-4 16s infinite ease-in-out alternate -9s;
}

/* Morphing animations for random, liquid water bubble shapes (not regular ovals or circles) */
@keyframes bubble-morph-1 {
  0% { border-radius: 43% 57% 41% 59% / 57% 45% 55% 43%; }
  50% { border-radius: 54% 46% 56% 44% / 46% 54% 46% 54%; }
  100% { border-radius: 41% 59% 43% 57% / 59% 41% 57% 43%; }
}

@keyframes bubble-morph-2 {
  0% { border-radius: 53% 47% 35% 65% / 45% 58% 42% 55%; }
  50% { border-radius: 42% 58% 54% 46% / 55% 42% 58% 45%; }
  100% { border-radius: 53% 47% 35% 65% / 45% 58% 42% 55%; }
}

@keyframes bubble-morph-3 {
  0% { border-radius: 35% 65% 58% 42% / 60% 38% 62% 40%; }
  50% { border-radius: 48% 52% 42% 58% / 45% 55% 45% 55%; }
  100% { border-radius: 35% 65% 58% 42% / 60% 38% 62% 40%; }
}

@keyframes bubble-morph-4 {
  0% { border-radius: 48% 52% 43% 57% / 55% 42% 58% 45%; }
  50% { border-radius: 58% 42% 50% 50% / 40% 60% 40% 60%; }
  100% { border-radius: 48% 52% 43% 57% / 55% 42% 58% 45%; }
}

/* Hover: card lifts slightly */
.chapter-inner:hover {
  box-shadow:
    inset 0 4px 20px rgba(255, 255, 255, 0.65),
    0 12px 32px rgba(107, 88, 71, 0.12),
    0 0 25px var(--ch-color, rgba(159, 207, 180, 0.25));
  transform: translateY(-4px) scale(1.005);
}

/* Decorative big chapter number — watermark behind content */
.chapter-inner::before {
  content: var(--ch-num, '');
  position: absolute;
  top: -18px;
  right: 16px;
  font-family: var(--font-display);
  font-size: 9rem;
  font-weight: 900;
  line-height: 1;
  color: var(--ch-color, #9FCFB4);
  opacity: 0.18;
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.04em;
}

/* Glass bubble shine highlight */
.chapter-inner::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 20px;
  width: clamp(40px, 12vw, 85px);
  height: clamp(12px, 4vw, 25px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 50%;
  transform: rotate(-12deg);
  pointer-events: none;
  z-index: 12;
  filter: blur(0.5px);
}

/* Mobile optimization: retain morphing bubbles and attached bubble decorations */
@media (max-width: 640px) {
  .chapter-inner {
    padding: 44px 32px 40px !important;
    /* Retain liquid organic shapes and animation keyframes */
  }
  .chapter-inner .attached-bubble {
    display: block !important;
    transform: scale(0.6);
  }
  /* Offset bubbles slightly inward to prevent horizontal viewport clipping */
  .chapter-inner .attached-bubble.ab1 { right: -15px !important; top: -25px !important; }
  .chapter-inner .attached-bubble.ab2 { left: -10px !important; bottom: -15px !important; }
  .chapter-inner .attached-bubble.ab3 { left: -15px !important; }
  .chapter-inner .attached-bubble.ab4 { right: -10px !important; bottom: -15px !important; }
}

.chapter.align-right { justify-content: flex-end; }
.chapter.align-left  { justify-content: flex-start; }
.chapter.align-center { justify-content: center; text-align: center; }
.chapter.align-center .chapter-inner { max-width: 820px; }

/* ── Eyebrow: now a coloured pill badge ── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ch-color, #9FCFB4);
  color: var(--ink);
  padding: 5px 14px 5px 10px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.73rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.eyebrow::before {
  content: '✦';
  font-size: 0.65rem;
  opacity: 0.7;
}

/* ── Big heading ── */
.chapter h2 {
  font-size: clamp(2.2rem, 4.8vw, 3.8rem);
  margin-bottom: 18px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* ── Body text ── */
.chapter p {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 46ch;
}

.chapter-inner:not(.story-card) > p:not(.hero-subtitle) {
  display: inline;
  background: var(--ch-color2, rgba(255, 255, 255, 0.45));
  color: var(--ink);
  padding: 4px 10px;
  border-radius: 6px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  line-height: 2.1;
}

/* Ensure any elements following the inline paragraph start on a new line with proper spacing */
.chapter-inner:not(.story-card) > p:not(.hero-subtitle) + * {
  display: block;
  margin-top: 24px !important;
}

/* Ensure buttons remain button-width rather than full container width */
.chapter-inner:not(.story-card) > p:not(.hero-subtitle) + .btn {
  display: inline-flex;
  width: fit-content;
}

.chapter.align-center p { margin-left: auto; margin-right: auto; }

/* Word split animation helper */
.split-word {
  display: inline-block;
  overflow: hidden;
}
.split-word span { display: inline-block; }

/* ============================================
   HERO CHAPTER (Chapter 0 full-featured hero)
   ============================================ */
/* Special layout for the hero section to clear navigation bar */
.chapter[data-chapter="0"] {
  padding-top: 200px;
  align-items: flex-start;
}

.hero-chapter {
  max-width: 620px !important;
  text-align: left;
  padding: 68px 72px 96px;
}

/* Admissions open blinking badge */
.hero-admission-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(159, 207, 180, 0.18);
  border: 1.5px solid rgba(159, 207, 180, 0.5);
  color: #4A8A6B;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.admission-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #4CAF80;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(76, 175, 128, 0.6);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%  { box-shadow: 0 0 0 0 rgba(76, 175, 128, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(76, 175, 128, 0); }
  100%{ box-shadow: 0 0 0 0 rgba(76, 175, 128, 0); }
}

/* Hero Chapter container: just constrain width + match base chapter-inner padding.
   Border-radius and animation are inherited from [data-chapter="0"] .chapter-inner
   via the standard bubble-morph-1 keyframes — same organic shape as all other chapters. */
.chapter-inner.hero-chapter {
  max-width: 620px;
  padding: 68px 72px 96px;
}


/* Hero heading: scaled for smaller container */
.hero-chapter h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.2rem) !important;
  line-height: 1.12 !important;
  margin-bottom: 8px !important;
}

/* Subtitle: left-aligned */
.hero-subtitle {
  font-size: clamp(0.84rem, 1.1vw, 0.96rem) !important;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 52ch;
  margin: 0 0 10px !important;
}

/* Trust pills: left-aligned */
.hero-trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 12px;
}

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(107, 88, 71, 0.12);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

/* CTA buttons side-by-side: left-aligned */
.hero-cta-row {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

/* Override .btn margin-top so it sits inside the flex row */
.hero-cta-row .btn {
  margin-top: 0;
}

/* Stats ribbon at bottom of hero: left-aligned */
.hero-stats-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 10px 0 0;
  border-top: 1px solid rgba(107, 88, 71, 0.10);
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 20px 0 0;
}

.hero-stat-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.02em;
}

.hero-stat-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-top: 4px;
}

.hero-stat-divider {
  width: 1px;
  height: 30px;
  background: rgba(107, 88, 71, 0.15);
  flex-shrink: 0;
  margin-right: 20px;
}

@media (max-width: 640px) {
  .hero-chapter { padding: 36px 24px 32px; }
  .hero-stat-divider { display: none; }
  .hero-stats-row { gap: 18px; }
  .hero-admission-badge { font-size: 0.72rem; }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  padding: 15px 32px;
  border-radius: 999px;
  margin-top: 28px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
  box-shadow: var(--shadow-card);
}

.btn-primary {
  background: linear-gradient(135deg, var(--ch-color, #EFA8B3), var(--blush-deep));
  color: var(--ink);
  border: none;
}
.btn-primary:hover {
  transform: translateY(-4px) scale(1.045);
  box-shadow: 0 22px 44px -10px rgba(239, 168, 179, 0.65);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
  box-shadow: none;
}
.btn-outline:hover {
  background: var(--ink);
  color: var(--cream);
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(60,53,48,0.25);
}

/* ============================================
   CARDS (programs, teachers, testimonials)
   ============================================ */
.card-grid {
  display: grid;
  gap: 18px;
  pointer-events: auto;
}

.story-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 30px 24px 35px 28px / 28px 30px 24px 32px;
  padding: 26px 24px;
  box-shadow: 
    inset 0 3px 8px rgba(255,255,255,0.45),
    0 8px 24px rgba(107,88,71,0.08);
  border: 1.8px solid rgba(255, 255, 255, 0.45);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-radius 0.4s ease;
}

.story-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(107,88,71,0.14);
  border-radius: 24px 35px 28px 30px / 30px 24px 32px 28px;
}

/* ── Stats row — big bold number blocks ── */
.stat-row {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 24px 18px 28px 20px / 20px 24px 18px 28px;
  padding: 18px 24px;
  flex: 1;
  min-width: 90px;
  box-shadow: 0 6px 16px rgba(107, 88, 71, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  text-align: center;
  transition: transform 0.3s ease, border-radius 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(107, 88, 71, 0.12);
  border-radius: 18px 28px 20px 24px / 24px 18px 28px 20px;
}

.stat-number {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  color: var(--ink);
  line-height: 1;
  background: linear-gradient(135deg, var(--ink) 40%, var(--bark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 600px) {
  .review-grid { grid-template-columns: 1fr !important; }
}

.story-card h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.story-card p {
  font-size: 0.96rem;
  color: var(--ink-soft);
  max-width: none;
  line-height: 1.65;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* ============================================
   PRELOADER
   ============================================ */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-tree {
  width: 90px; height: 90px;
}

.preloader-bar-track {
  width: 220px;
  height: 8px;
  background: rgba(107, 88, 71, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

.preloader-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--mint-deep), var(--butter-deep));
  border-radius: 8px;
  transition: width 0.2s ease;
}

.preloader-text {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* ============================================
   CUSTOM CURSOR
   ============================================ */
.cursor-leaf {
  position: fixed;
  top: 0; left: 0;
  width: 28px; height: 28px;
  pointer-events: none;
  z-index: 500;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.12s ease;
  mix-blend-mode: multiply;
}
.cursor-leaf.is-active { opacity: 0.85; }
.cursor-leaf.is-hover { transform: translate(-50%, -50%) scale(1.6); }

@media (hover: none) {
  .cursor-leaf { display: none; }
}

/* ============================================
   GRAIN OVERLAY
   ============================================ */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  position: relative;
  z-index: 10;
  background: var(--ink);
  color: var(--cream);
  padding: 70px clamp(24px, 8vw, 110px) 32px;
}

.footer-grid {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(251, 246, 238, 0.14);
}

.footer-grid h4 {
  color: var(--cream);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-family: var(--font-body);
  font-weight: 700;
}

.footer-grid p, .footer-grid a, .footer-grid li {
  color: rgba(251, 246, 238, 0.72);
  font-size: 0.94rem;
  line-height: 1.8;
}

.footer-grid a:hover { color: var(--butter); }

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--cream);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-bottom {
  max-width: var(--container);
  margin: 0 auto;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: rgba(251, 246, 238, 0.5);
}

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

/* ============================================
   CONTACT FORM
   ============================================ */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: auto;
}

.contact-form input,
.contact-form textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(107, 88, 71, 0.12);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--blush-deep);
  outline: none;
}

.contact-form textarea { resize: vertical; min-height: 110px; }

.form-status {
  font-size: 0.9rem;
  font-weight: 600;
}
.form-status.success { color: #5C8A6B; }
.form-status.error { color: #C76B6B; }

/* ============================================
   RESPONSIVE / MOBILE
   ============================================ */
@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .chapter-inner { max-width: 100%; }
  .footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 32px 20px !important;
  }
  .footer-grid > div:first-child,
  .footer-grid > div:last-child {
    grid-column: span 2 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Reduced-3D fallback class toggled by JS on low-end/mobile */
.reduced-3d #scene-canvas { opacity: 0.7; }

/* ============================================
   WINDING ROAD PATH JOURNEY
   ============================================ */
.story-content {
  position: relative;
}

/* SVG winding road container — sits behind content */
.road-journey {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

/* The faint road track (full path, always visible) */
.road-track {
  fill: none;
  stroke: rgba(107, 88, 71, 0.22);
  stroke-width: 50;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Road edge dashes (the white lane markings) */
.road-edge {
  fill: none;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 5;
  stroke-dasharray: 30 20;
  stroke-linecap: round;
}

/* The coloured progress road that grows with scroll */
.road-progress {
  fill: none;
  stroke: url(#roadGrad);
  stroke-width: 20;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dashoffset: 9999;
  transition: stroke-dashoffset 0s;
  filter: drop-shadow(0 4px 14px rgba(159, 207, 180, 0.8));
}

/* Tree / landmark decorations on the road */
.road-landmark {
  font-size: 1.6rem;
  position: absolute;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.5s, transform 0.5s;
  z-index: 3;
}

.road-landmark.revealed {
  opacity: 0.9;
  transform: scale(1.15);
}

/* The walking caterpillar character */
.road-walker {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  will-change: left, top, transform;
  margin-left: -2.5rem;    /* half of width (80px / 2 = 40px = 2.5rem) */
  margin-top:  -3rem;      /* sit above the road */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 50px;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.22));
  --caterpillar-color-1: #9FCFB4;
  --caterpillar-color-2: #C9E4D4;
}

.road-walker .caterpillar-svg {
  width: 100%;
  height: auto;
  overflow: visible;
  transition: transform 0.3s ease;
}

.road-walker .segment,
.road-walker .head {
  stroke: #6B5847;
  stroke-width: 1.8px;
  transition: fill 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.road-walker .segment.s1,
.road-walker .segment.s3,
.road-walker .head {
  fill: var(--caterpillar-color-1);
}

.road-walker .segment.s2,
.road-walker .segment.s4 {
  fill: var(--caterpillar-color-2);
}

/* Crawling ripple / wave animation */
@keyframes caterpillar-crawl {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.road-walker .segment.s4 {
  animation: caterpillar-crawl 1.2s infinite ease-in-out;
  animation-delay: 0s;
}
.road-walker .segment.s3 {
  animation: caterpillar-crawl 1.2s infinite ease-in-out;
  animation-delay: 0.15s;
}
.road-walker .segment.s2 {
  animation: caterpillar-crawl 1.2s infinite ease-in-out;
  animation-delay: 0.3s;
}
.road-walker .segment.s1 {
  animation: caterpillar-crawl 1.2s infinite ease-in-out;
  animation-delay: 0.45s;
}
.road-walker .head-group {
  animation: caterpillar-crawl 1.2s infinite ease-in-out;
  animation-delay: 0.6s;
}

/* Confetti pop when walker reaches last stop */
.road-walker.celebrate {
  animation: celebrate 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes celebrate {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-24px) scale(1.25); }
  100% { transform: translateY(0) scale(1.1) rotate(8deg); }
}

/* Story section entrance reveals */
.chapter-inner[data-reveal-pending] {
  opacity: 0;
  transform: translateY(32px) scale(0.94);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1),
              transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.chapter-inner.is-revealed {
  opacity: 1 !important;
  transform: none !important;
}

/* ============================================
   RESPONSIVE DESIGN & MOBILE SCROLL ROAD
   ============================================ */
@media (max-width: 768px) {
  .chapter {
    min-height: 110vh !important;
    padding: 10vh 4% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
  }

  .chapter[data-chapter="0"] {
    padding-top: 110px !important;
  }
  
  .chapter-inner {
    width: 92% !important;
    max-width: 420px !important;
    margin: 0 auto !important;
    padding: 60px 48px 56px !important; /* custom mobile bubble padding to keep text inside shapes */
    pointer-events: auto !important;
  }

  .chapter-inner.hero-chapter {
    padding: 38px 22px 30px !important;
    text-align: center !important;
  }

  .chapter-inner.hero-chapter h2 {
    font-size: 1.45rem !important;
    line-height: 1.15 !important;
  }

  .hero-subtitle {
    font-size: 0.82rem !important;
    text-align: center !important;
  }

  .hero-trust-row {
    justify-content: center !important;
    gap: 4px !important;
  }

  .trust-pill {
    padding: 3px 8px !important;
    font-size: 0.65rem !important;
  }

  .hero-cta-row {
    justify-content: center !important;
    gap: 8px !important;
  }

  .hero-cta-row .btn {
    padding: 10px 20px !important;
    font-size: 0.88rem !important;
  }

  .hero-stats-row {
    justify-content: space-between !important;
    gap: 6px !important;
    margin-top: 12px !important;
  }

  .chapter-inner.hero-chapter .hero-stat-divider {
    display: none !important;
  }

  .hero-stat {
    padding: 0 !important;
    align-items: center !important;
    text-align: center !important;
    flex: 1 !important;
  }

  .hero-stat-num {
    font-size: 1.15rem !important;
  }

  .hero-stat-label {
    font-size: 0.55rem !important;
    text-align: center !important;
  }

  .hero-admission-badge {
    font-size: 0.65rem !important;
    padding: 3px 10px !important;
    margin-bottom: 6px !important;
  }
  
  /* Scale down the sub-bubbles slightly to fit nicely within viewport margins */
  .chapter-inner .attached-bubble {
    transform: scale(0.65) !important;
  }
  
  .chapter-inner::before {
    font-size: 5rem !important;
    top: -8px !important;
    right: 10px !important;
  }

  .road-walker {
    transform: scale(0.7) !important;
  }

  .road-landmark {
    font-size: 1.4rem !important;
  }

  /* Mobile-specific child image centering overrides to guarantee faces are visible */
  .gallery-image-wrapper[data-bg="bg_hero"] img {
    object-position: center 45% !important;
  }

  .gallery-image-wrapper[data-bg="bg_artist"] img,
  .gallery-image-wrapper[data-bg="bg_scientist"] img,
  .gallery-image-wrapper[data-bg="bg_doctor"] img,
  .gallery-image-wrapper[data-bg="unique_builder"] img,
  .gallery-image-wrapper[data-bg="school_entrance"] img,
  .gallery-image-wrapper[data-bg="teacher_reading"] img,
  .gallery-image-wrapper[data-bg="about_seed"] img,
  .gallery-image-wrapper[data-bg="home_play"] img,
  .gallery-image-wrapper[data-bg="prog_builder"] img,
  .gallery-image-wrapper[data-bg="prog_future"] img,
  .gallery-image-wrapper[data-bg="safety_intro"] img,
  .gallery-image-wrapper[data-bg="safety_blocks"] img,
  .gallery-image-wrapper[data-bg="contact_intro"] img,
  .gallery-image-wrapper[data-bg="contact_roots"] img {
    object-position: 85% 50% !important;
  }

  .gallery-image-wrapper[data-bg="bg_question"] img,
  .gallery-image-wrapper[data-bg="bg_explorer"] img,
  .gallery-image-wrapper[data-bg="bg_musician"] img,
  .gallery-image-wrapper[data-bg="bg_astronomer"] img,
  .gallery-image-wrapper[data-bg="clean_classroom"] img,
  .gallery-image-wrapper[data-bg="kids_reading"] img,
  .gallery-image-wrapper[data-bg="home_future"] img,
  .gallery-image-wrapper[data-bg="about_roots"] img,
  .gallery-image-wrapper[data-bg="about_reading"] img,
  .gallery-image-wrapper[data-bg="home_intro"] img,
  .gallery-image-wrapper[data-bg="prog_painting"] img,
  .gallery-image-wrapper[data-bg="daycare_rest"] img,
  .gallery-image-wrapper[data-bg="safety_reading"] img,
  .gallery-image-wrapper[data-bg="safety_classroom"] img,
  .gallery-image-wrapper[data-bg="safety_seed"] img {
    object-position: 15% 50% !important;
  }
}

/* ── Floating WhatsApp Button ── */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background-color: #25D366;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  cursor: pointer;
}

.whatsapp-float:hover {
  transform: scale(1.12) rotate(8deg);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.whatsapp-float svg {
  width: 26px;
  height: auto;
  fill: currentColor;
}

/* ── Footer Social Icons ── */
.footer-social-container {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.footer-social-link {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(107, 88, 71, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6B5847;
  transition: all 0.3s ease;
  border: 1px solid rgba(107, 88, 71, 0.15);
}

.footer-social-link:hover {
  background: var(--ch-color, #9FCFB4);
  color: #fff;
  border-color: transparent;
  transform: translateY(-3px);
}

.footer-social-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}




