@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Outfit:wght@300;400;700;800&display=swap');

/* 
   🎨 NIÑOS DEL SOL - PREMIUM DESIGN SYSTEM 2.0
   Senior Architectural Refactoring - Zero Debt Edition
*/

:root {
    /* Color Tokens - Dynamic HSL */
    --p-h: 145; /* Primary Hue */
    --p-s: 65%;
    --p-l: 35%;
    
    --primary: hsl(var(--p-h), var(--p-s), var(--p-l));
    --primary-hover: hsl(var(--p-h), var(--p-s), 25%);
    --primary-soft: hsl(var(--p-h), var(--p-s), 96%);
    --primary-glass: hsla(var(--p-h), var(--p-s), 35%, 0.1);
    
    --accent-h: 44; /* Burnt Yellow Hue */
    --accent: hsl(var(--accent-h), 95%, 50%);
    --accent-hover: hsl(var(--accent-h), 100%, 40%);
    --accent-soft: hsl(var(--accent-h), 95%, 96%);

    --dark: #0a1f14;
    --light: #f9fbf9;
    --white: #ffffff;
    --text: #1b2620;
    --text-muted: #5c6b62;

    /* Layout Tokens */
    --header-h: 90px;
    --header-h-small: 70px;
    --container-w: 1300px;
    --section-sp: clamp(60px, 8vw, 120px);
    --radius-lg: 40px;
    --radius-md: 24px;
    --radius-sm: 12px;

    /* Effects */
    --shadow-soft: 0 10px 30px rgba(10, 31, 20, 0.05);
    --shadow-premium: 0 20px 50px rgba(10, 31, 20, 0.12);
    --transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    --glass: rgba(255, 255, 255, 0.92);
    --glass-blur: blur(20px);

    /* Typography */
    --f-heading: 'Outfit', sans-serif;
    --f-body: 'Inter', sans-serif;
}

/* 1. RESET & BASE */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
body { 
    font-family: var(--f-body); 
    color: var(--text); 
    background: var(--light); 
    line-height: 1.7; 
    overflow-x: hidden; 
}
h1, h2, h3, h4 { font-family: var(--f-heading); color: var(--dark); line-height: 1.2; font-weight: 800; }
a { text-decoration: none; color: inherit; transition: var(--transition); }
img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }
ul { list-style: none; }

.container { max-width: var(--container-w); margin: 0 auto; padding: 0 5%; }

/* 2. REVEAL ANIMATIONS ENGINE */
.reveal, .reveal-left, .reveal-right, .zoom-in {
    opacity: 0;
    will-change: transform, opacity;
    transition: var(--transition);
}
.reveal { transform: translateY(40px); }
.reveal-left { transform: translateX(-50px); }
.reveal-right { transform: translateX(50px); }
.zoom-in { transform: scale(0.92); }

.active { opacity: 1 !important; transform: translate(0) scale(1) !important; }

/* 3. CORE COMPONENTS */

/* Header & Nav */
header {
    position: fixed;
    top: 0; width: 100%;
    z-index: 2000;
    padding: 25px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

header.scrolled {
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    padding: 15px 5%;
    box-shadow: 0 5px 30px rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

/* Subpage Header Base (Ensures white bg on subpages) */
body:not(.index-page) header {
    background: var(--white);
    padding: 15px 5%;
    box-shadow: 0 5px 30px rgba(0,0,0,0.05);
}

.logo { height: 50px; transition: var(--transition); }
header.scrolled .logo { height: 40px; }

nav ul { display: flex; gap: 35px; align-items: center; }
nav ul li a { 
    font-weight: 600; 
    font-size: 0.95rem; 
    color: var(--dark); 
    position: relative;
    padding: 10px 0;
}
/* Index Override for transparent hero header */
.index-page header:not(.scrolled) nav ul li a { color: var(--dark); }

header.scrolled nav ul li a { color: var(--dark); }

nav ul li a::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0; height: 3px; background: var(--accent);
    transition: var(--transition);
    border-radius: 10px;
}
nav ul li a:hover::after, nav ul li a.active::after { width: 100%; }
nav ul li a:hover { color: var(--accent) !important; }

/* Buttons */
.btn {
    padding: 14px 35px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border: none;
}

.btn-primary { background: var(--primary); color: var(--white); box-shadow: 0 10px 20px hsla(var(--p-h), var(--p-s), 20%, 0.2); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-3px); box-shadow: var(--shadow-premium); }

.btn-accent { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-3px); }

.btn-outline { background: transparent; border: 2px solid var(--white); color: var(--white); }
header.scrolled .btn-outline { border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--white); color: var(--primary); }

/* 4. SECTION PATTERNS */
section { padding: var(--section-sp) 0; position: relative; }

.section-tag {
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 15px;
}

.section-title { 
    font-size: 3rem; 
    margin-bottom: 20px; 
    font-weight: 800; 
    letter-spacing: -1px; 
    transition: var(--transition);
    cursor: default;
}
.section-title:hover { color: var(--accent); transform: translateX(10px); }
.section-subtitle { font-size: 1.2rem; color: var(--text-muted); max-width: 700px; margin-bottom: 50px; line-height: 1.6; }

/* 5. HERO SECTION */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.3)), url('../imagenes/Fondo.webp') center/cover no-repeat fixed;
    color: var(--white);
    text-align: left;
}

.hero.hero-light {
    background: linear-gradient(rgba(255,255,255,0.4), rgba(255,255,255,0.2)), url('../imagenes/Fondo.webp') center/cover no-repeat !important;
    color: var(--dark);
}

.hero h1 { color: var(--white); font-size: 4.5rem; max-width: 900px; margin-bottom: 30px; }
.hero p { font-size: 1.4rem; max-width: 600px; margin-bottom: 40px; opacity: 0.9; }

/* 6. CARD GRIDS (Mission, Programs, etc) */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
}

.card {
    background: var(--white);
    padding: 50px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.02);
}

.card:hover { transform: translateY(-10px); box-shadow: var(--shadow-premium); border-color: var(--primary-glass); }

.card-icon {
    font-size: 3rem;
    margin-bottom: 25px;
    color: var(--primary);
    display: inline-block;
}

.card h3 { font-size: 1.8rem; margin-bottom: 20px; }
.card p { color: var(--text-muted); line-height: 1.7; }

/* 7. GALLERY REBORN */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.gallery-item {
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: var(--radius-md);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.gallery-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-item:hover img { transform: scale(1.15); }

/* 8. CONTACT SECTION */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 80px;
    align-items: center;
}

.contact-form-box {
    background: var(--white);
    padding: 60px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
}

.form-group { margin-bottom: 25px; }
.form-group label { display: block; margin-bottom: 10px; font-weight: 600; color: var(--dark); font-size: 0.9rem; }

.form-group input, .form-group textarea {
    width: 100%;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid #e0e6e2;
    background: #fdfdfd;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glass);
    background: var(--white);
}

/* 9. FOOTER */
footer {
    background: var(--dark);
    color: #a0b0a6;
    padding: 100px 0 50px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 60px;
    margin-bottom: 80px;
}

.footer-logo { height: 60px; margin-bottom: 25px; filter: brightness(0) invert(1); }
.footer-title { color: var(--white); font-size: 1.3rem; margin-bottom: 25px; }

.footer-links li { margin-bottom: 15px; }
.footer-links a:hover { color: var(--accent); padding-left: 5px; }

.social-links { display: flex; gap: 15px; }
.social-icon {
    width: 45px; height: 45px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    transition: var(--transition);
}
.social-icon:hover { background: var(--primary); transform: translateY(-5px); }
.social-icon img { height: 20px; width: auto; filter: brightness(0) invert(1); }

/* 10. RESPONSIVE MAGIC */
@media (max-width: 1024px) {
    .container { padding: 0 7%; }
    .hero h1 { font-size: 3.5rem; }
    .contact-wrapper { grid-template-columns: 1fr; gap: 50px; }
}

@media (max-width: 768px) {
    :root { --section-sp: 80px; }
    .hero h1 { font-size: 2.8rem; }
    nav ul { display: none; } /* Mobile menu implementation in next step */
    .section-title { font-size: 2.2rem; }
    .contact-form-box { padding: 40px; }
}

/* Mobile Menu Overlay */
.mobile-nav {
    position: fixed;
    inset: 0;
    background: var(--dark);
    z-index: 2500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    transform: translateX(100%);
    transition: var(--transition);
}

.mobile-nav.active { transform: translateX(0); }
.mobile-nav a { color: var(--white); font-size: 2rem; font-weight: 700; padding: 12px 24px; min-height: 48px; border-radius: 12px; }
.mobile-nav a:active { background: rgba(255,255,255,0.1); }

.menu-toggle {
    display: none;
    cursor: pointer;
    z-index: 3000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    gap: 6px;
}

@media (max-width: 768px) {
    header nav { display: none; }
    .menu-toggle { display: flex; }
    .hero h1 { font-size: 3rem; }
    .hero { text-align: center; }
    .cta-buttons { justify-content: center; }
}

.menu-toggle span {
    width: 30px; height: 3px;
    background: var(--dark);
    border-radius: 3px;
    transition: var(--transition);
}
.index-page header:not(.scrolled) .menu-toggle span { background: var(--dark); }
header.scrolled .menu-toggle span { background: var(--primary); }

.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); background: var(--white) !important; }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); background: var(--white) !important; }

/* 11. BANNER SYSTEM (Donation CTA) */
.donation-banner {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-premium);
    max-width: 380px;
    z-index: 4000;
    display: none;
    border: 1px solid hsla(var(--p-h), var(--p-s), 35%, 0.1);
    animation: bannerSlideUp 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes bannerSlideUp {
    from { opacity: 0; transform: translateY(50px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.donation-banner.active { display: block; }

.donation-banner-close {
    position: absolute;
    top: 15px; right: 15px;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
}

.donation-banner h3 { font-family: var(--f-heading); font-size: 1.4rem; margin-bottom: 15px; color: var(--primary); }
.donation-banner p { font-size: 0.95rem; margin-bottom: 25px; line-height: 1.5; color: var(--text-muted); }
.donation-banner .btn { width: 100%; justify-content: center; padding: 12px; margin-bottom: 5px; }

/* 12. INFINITE PRISM DISCOVERY (3D IMMERSIVE GALLERY) */
body.gallery-page {
    background: #000;
    overflow-x: hidden;
    margin: 0; padding: 0;
}
body.gallery-page header {
    background: transparent !important;
    border-bottom: none;
    box-shadow: none;
}
body.gallery-page footer {
    display: block !important;
}

body.gallery-page header nav ul li a {
    color: var(--white);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
body.gallery-page header .logo {
    filter: brightness(0) invert(1);
}
body.gallery-page header .menu-toggle span {
    background: var(--white);
}

.prism-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    perspective: 1500px;
    -webkit-perspective: 1500px;
    background: #000;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.prism-container:active {
    cursor: grabbing;
}

.prism-overlay-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    mix-blend-mode: exclusion;
    color: #fff;
    width: 100%;
}
#prism-title {
    font-size: clamp(4rem, 15vw, 12rem);
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 0.85;
    margin: 0;
    text-transform: uppercase;
    will-change: transform, filter, color;
    transform-origin: center;
    transition: color 0.3s;
}
.prism-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 300;
    letter-spacing: 12px;
    color: var(--primary);
    margin-top: 15px;
    text-transform: uppercase;
}

.prism-slider {
    position: absolute;
    width: 50vw;
    height: 50vh;
    left: 25vw;
    top: 25vh;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    will-change: transform;
}
.prism-panel {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.prism-panel img {
    width: 100%; height: 100%;
    object-fit: cover;
    box-shadow: 0 0 50px rgba(0,0,0,0.9);
    filter: grayscale(10%);
    opacity: 0.9;
}
.prism-instructions {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
    letter-spacing: 3px;
    pointer-events: none;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .prism-slider { width: 80vw; height: 45vh; left: 10vw; top: 27.5vh;}
    .prism-subtitle { letter-spacing: 6px; }
}

/* =========================================
   13. PREMIUM GLASSMORPHISM FOOTER
   ========================================= */
.footer-premium {
    background: #0e0e0e; 
    position: relative;
    width: 100%;
    padding: 80px 5% 0;
    border-top: 1px solid rgba(255,255,255,0.05); 
    color: rgba(255,255,255,0.7);
    font-family: var(--f-body);
}

.footer-glass {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-lg);
    padding: 50px;
    margin-bottom: 40px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 2fr 1fr;
    gap: 50px;
}

.footer-brand .footer-logo-wrap {
    display: inline-block;
    margin-bottom: 20px;
}

.footer-brand .footer-logo {
    width: 200px;
    display: block;
}

.footer-slogan {
    font-family: var(--f-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.footer-mission {
    font-size: 0.95rem;
    line-height: 1.8;
}

.footer-links-contact {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 40px;
}

.footer-premium h4 {
    color: #fff;
    font-family: var(--f-heading);
    font-size: 1.1rem;
    margin-bottom: 25px;
    position: relative;
    display: inline-block;
}

.footer-premium h4::after {
    content: '';
    position: absolute;
    bottom: -8px; left: 0;
    width: 40%; height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}
.footer-premium h4:hover::after {
    width: 100%;
    background: var(--accent);
}

.footer-nav ul {
    list-style: none; padding: 0; margin: 0;
}
.footer-nav li { margin-bottom: 12px; }
.footer-nav a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    display: inline-block;
}
.footer-nav a:hover {
    color: var(--accent);
    transform: translateX(8px);
}

.footer-contact p {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    transition: var(--transition);
}
.footer-contact p i {
    color: var(--primary);
    font-size: 1.1rem;
    margin-top: 3px;
    transition: color 0.3s;
}
.footer-contact p:hover { color: #fff; }
.footer-contact p:hover i { color: var(--accent); text-shadow: 0 0 10px var(--accent); }

.social-glass-icons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.social-glass-icons a {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: transparent;
    display: flex; justify-content: center; align-items: center;
    transition: var(--transition);
    border: none;
}
.social-glass-icons a img {
    width: 100%; height: 100%;
    object-fit: contain;
    transition: var(--transition);
    opacity: 0.8;
}
.social-glass-icons a:hover {
    transform: translateY(-5px);
}
.social-glass-icons a:hover img {
    opacity: 1;
    filter: drop-shadow(0 10px 15px var(--accent));
}

.footer-bottom-bar {
    display: flex;
    justify-content: space-between;
    padding: 25px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 10px;
}
.footer-bottom-bar a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}
.footer-bottom-bar a:hover {
    text-shadow: 0 0 8px var(--accent);
}

@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-social-section { grid-column: span 2; }
}
@media (max-width: 768px) {
    .footer-glass { padding: 30px 20px; }
    .footer-grid { grid-template-columns: 1fr; gap: 40px; }
    .footer-links-contact { grid-template-columns: 1fr; }
    .footer-social-section { grid-column: span 1; }
    .footer-bottom-bar { flex-direction: column; text-align: center; justify-content: center; }
}

/* Scroll Reveal System */
html { scroll-behavior: smooth; }
.reveal, .reveal-up { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.5, 0, 0, 1); }
.reveal-left { opacity: 0; transform: translateX(-40px); transition: all 0.8s cubic-bezier(0.5, 0, 0, 1); }
.reveal-right { opacity: 0; transform: translateX(40px); transition: all 0.8s cubic-bezier(0.5, 0, 0, 1); }
.reveal.active, .reveal-up.active, .reveal-left.active, .reveal-right.active { opacity: 1; transform: translate(0, 0); }
.navbar-scrolled, header.scrolled { background: var(--surface-container-base) !important; backdrop-filter: blur(16px); box-shadow: 0 4px 30px rgba(0,0,0,0.1); transition: all 0.3s ease; }
