/* ==========================================
   PURPLE HEARTS CHILDCARE — Premium Motion Layer
   Dark/light theme, glassmorphism, and all
   GSAP-driven interaction styling.
   ========================================== */

/* ---------- Premium display typography ---------- */
.hero-title,
.page-header h1,
.section-header h2,
.mission-content h2,
.cta-section h2 {
    font-family: 'Fraunces', 'Poppins', serif;
    font-optical-sizing: auto;
    letter-spacing: -0.01em;
}

.hero-title {
    font-size: clamp(1.9rem, 7vw, 4.6rem);
    font-weight: 600;
    line-height: 1.15;
    overflow-wrap: break-word;
    word-break: break-word;
}

.page-header h1 {
    font-size: clamp(1.7rem, 6vw, 3.4rem);
    font-weight: 600;
    overflow-wrap: break-word;
}

.section-header h2 {
    font-size: clamp(1.5rem, 5vw, 2.6rem);
    font-weight: 600;
    overflow-wrap: break-word;
}

/* ==========================================
   DARK THEME
   Overrides the same CSS variables styles.css
   already uses everywhere, so the whole site
   inherits dark mode automatically.
   ========================================== */
:root[data-theme="dark"] {
    --primary-color: #A78BFA;
    --secondary-color: #C4B5FD;
    --accent-color: #4C3575;
    --danger-color: #F87171;
    --text-dark: #F3EEFA;
    --text-light: #B7AAC9;
    --bg-light: #0F0A18;
    --bg-white: #191026;
    --border-color: #322446;
    --shine: rgba(255, 255, 255, 0.35);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 8px 26px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.55);
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(1200px 600px at 15% -10%, #241A38 0%, transparent 55%),
        radial-gradient(1000px 500px at 100% 10%, #1E1530 0%, transparent 50%),
        var(--bg-light);
}

:root[data-theme="dark"] .navbar {
    background: rgba(15, 10, 24, 0.75);
    border-bottom: 1px solid var(--border-color);
}

:root[data-theme="dark"] .hero-slide::after {
    background: linear-gradient(135deg, rgba(15, 10, 24, 0.78), rgba(15, 10, 24, 0.5));
}

:root[data-theme="dark"] .logo-script {
    filter: brightness(1.3);
}

:root[data-theme="dark"] img {
    filter: brightness(0.94);
}

:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn-secondary {
    color: #150F22;
}

:root[data-theme="dark"] .marquee-strip {
    background: var(--bg-white);
    border-color: var(--border-color);
}

:root[data-theme="dark"] .announcement-banner {
    background: var(--bg-white);
}

:root[data-theme="dark"] .announcement-item {
    background: var(--bg-light);
}

:root[data-theme="dark"] .announcement-item h3 {
    color: var(--text-dark);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.theme-toggle:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ==========================================
   GLASSMORPHISM
   ========================================== */
.navbar {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

:root[data-theme="dark"] .glass-panel {
    background: rgba(25, 16, 38, 0.55);
    border: 1px solid rgba(167, 139, 250, 0.18);
}

/* ==========================================
   PAGE LOADER
   ========================================== */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    opacity: 1;
    transition: opacity 0.5s ease;
}

.page-loader--hide {
    opacity: 0;
    pointer-events: none;
}

.page-loader-mark {
    width: 64px;
    height: 64px;
    opacity: 0;
}

.page-loader-mark img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 6px 18px rgba(139, 92, 246, 0.4));
}

/* ---------- Page transition overlay (between-page fade) ---------- */
.page-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: var(--bg-light);
    pointer-events: none;
    opacity: 0;
    transform: translateY(100%);
}

/* ==========================================
   SCROLL REVEAL / STAGGER helpers
   (JS sets initial state via GSAP; these are
   graceful no-JS / reduced-motion fallbacks)
   ========================================== */
.reveal-up,
.reveal-fade,
.reveal-stagger > * {
    will-change: transform, opacity;
}

[data-split-text] {
    opacity: 0;
}

.split-word {
    display: inline-block;
    overflow: hidden;
    padding-bottom: 0.08em;
    vertical-align: top;
}

.split-word-inner {
    display: inline-block;
}

.navbar--scrolled {
    box-shadow: var(--shadow-md);
}

/* ==========================================
   MAGNETIC BUTTONS
   ========================================== */
.btn {
    will-change: transform;
}

/* ==========================================
   TILT CARDS
   ========================================== */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 900px;
    will-change: transform;
}

/* ==========================================
   INFINITE MARQUEE
   ========================================== */
.marquee-strip {
    overflow: hidden;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1.1rem 0;
}

.marquee-track {
    display: flex;
    width: max-content;
    gap: 3rem;
    animation: marquee-scroll 28s linear infinite;
}

.marquee-strip:hover .marquee-track {
    animation-play-state: paused;
}

.marquee-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--secondary-color);
    white-space: nowrap;
}

.marquee-item .dot {
    color: var(--primary-color);
    opacity: 0.6;
}

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

/* ==========================================
   ANIMATED COUNTERS
   ========================================== */
.stats-section {
    background: var(--bg-white);
    padding: 4rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
    text-align: center;
}

.stat-tile {
    padding: 1.5rem 1rem;
}

.stat-number {
    font-family: 'Fraunces', serif;
    font-size: clamp(2.4rem, 5vw, 3.4rem);
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
}

.stat-label {
    margin-top: 0.6rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
}

/* ==========================================
   HORIZONTAL SCROLL SHOWCASE
   ========================================== */
.h-scroll-section {
    position: relative;
    overflow: hidden;
}

.h-scroll-heading {
    text-align: center;
    margin-bottom: 2.5rem;
}

.h-scroll-track {
    display: flex;
    gap: 2rem;
    width: max-content;
    padding: 0 2rem;
}

.h-scroll-card {
    position: relative;
    width: min(340px, 80vw);
    flex-shrink: 0;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    aspect-ratio: 3 / 4;
}

.h-scroll-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.h-scroll-card:hover img {
    transform: scale(1.08);
}

.h-scroll-card-caption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 1.5rem;
    background: linear-gradient(0deg, rgba(15, 10, 24, 0.88), transparent);
    color: #fff;
}

.h-scroll-card-caption h3 {
    color: #fff;
    margin-bottom: 0.25rem;
    font-family: 'Fraunces', serif;
}

.h-scroll-card-caption p {
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    font-size: 0.9rem;
}

/* ==========================================
   IMAGE HOVER DISTORTION (gallery)
   ========================================== */
.gallery-item {
    position: relative;
}

.gallery-item img {
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), filter 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.12) rotate(-1deg);
    filter: saturate(1.15);
}

.gallery-item::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(76, 29, 149, 0.15));
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.gallery-item:hover::before {
    opacity: 1;
}

/* ==========================================
   FLOATING PARTICLES (hero)
   ========================================== */
.hero-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.hero-particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(196, 181, 253, 0.2));
    opacity: 0;
}

/* ==========================================
   REDUCED MOTION
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    .marquee-track {
        animation: none;
    }
    .page-loader,
    .page-transition-overlay {
        display: none !important;
    }
    * {
        scroll-behavior: auto !important;
    }
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .h-scroll-card {
        width: min(260px, 78vw);
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Below 900px the JS pin/scroll-jack is skipped (see animations.js) —
   let the track scroll natively with touch/swipe instead. */
@media (max-width: 899px) {
    .h-scroll-track {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1rem;
    }
    .h-scroll-card {
        scroll-snap-align: start;
    }
}
