:root {
    /* Color Palette - Light & Pastel */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #121212;
    --text-secondary: #666666;
    
    /* Vibrant Mesh Gradient System */
    --gradient-1: #ffffff;
    --gradient-2: #f8f9fa;
    --glow-1: rgba(240, 98, 146, 0.2);
    --glow-2: rgba(186, 104, 200, 0.2);
    --glow-3: rgba(33, 150, 243, 0.2);
    
    /* Level Specific Themes - Elevated */
    --preescolar-color: #fce4ec;
    --preescolar-glow: rgba(240, 98, 146, 0.3);
    --primaria-color: #f3e5f5;
    --primaria-glow: rgba(186, 104, 200, 0.3);
    --secundaria-color: #e3f2fd;
    --secundaria-glow: rgba(33, 150, 243, 0.3);
    --bachillerato-color: #fff5f5;
    --bachillerato-glow: rgba(229, 115, 115, 0.3);
    
    /* App Colors */
    --accent-purple-dark: #6b21a8;
    
    /* System Colors */
    --white: #ffffff;
    --black: #000000;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Spacing */
    --section-padding: 100px 5%;
    --container-max-width: 1400px;
    
    /* Transitions */
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

* {
    max-width: 100vw;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.1;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-smooth);
}

ul {
    list-style: none;
}

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

/* Layout Utilities */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: var(--section-padding);
}

/* Header & Navigation */
/* Mobile Menu Toggle (Hidden on Desktop) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    header {
        top: 1rem;
        padding: 0 1rem;
        gap: 1rem;
    }
    .logo-btn {
        width: 50px;
        height: 50px;
    }
    .nav-pill {
        padding: 0.4rem 1.2rem;
    }
    .nav-links {
        display: none;
        opacity: 0;
        visibility: hidden;
        position: absolute;
        top: calc(100% + 1rem);
        right: 0;
        width: 280px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(25px) saturate(180%);
        -webkit-backdrop-filter: blur(25px) saturate(180%);
        flex-direction: column;
        padding: 1.5rem;
        border-radius: 30px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.4);
        text-align: left;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        transform: translateY(10px) scale(0.95);
        transform-origin: top right;
        pointer-events: none;
        z-index: 999;
    }
    .nav-links.active {
        display: flex;
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
    .nav-links a {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
        padding: 0.8rem 1.2rem;
        border-radius: 15px;
        transition: var(--transition-smooth);
        width: 100%;
        display: block;
        opacity: 0.8;
    }
    .nav-links a:hover {
        background: rgba(0, 0, 0, 0.05);
        opacity: 1;
    }
    /* Mobile Dropdown fix */
    .nav-links .dropdown-content {
        position: static;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.02);
        padding: 0.5rem 0 0.5rem 1rem;
        width: 100%;
        display: block; /* Always visible in mobile pill or on click? Let's make it visible for simplicity */
    }
    .nav-links .dropdown:hover .dropdown-content {
        animation: none;
    }
    .nav-links .dropdown > a {
        pointer-events: none; /* Disable parent link in mobile to show sub-links */
        font-weight: 600;
        opacity: 1;
    }
    .menu-toggle {
        display: block !important;
        pointer-events: auto !important;
        position: relative;
        z-index: 1001;
    }
    .hero {
        background-attachment: scroll !important;
        min-height: 70vh !important;
        overflow: hidden; /* Prevent hero content from leaking */
    }
    .container {
        width: 100% !important;
        max-width: 100vw !important;
        overflow: hidden;
        padding: 0 1.5rem !important;
    }
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center !important;
    }
    .footer-col {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .timeline-line {
        display: none !important;
    }
    h1 {
        font-size: 2.5rem !important;
        line-height: 1.1 !important;
        margin-bottom: 1rem;
    }
    h2 {
        font-size: 1.8rem !important;
        line-height: 1.2 !important;
    }
    p {
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }
    .section {
        padding: 3rem 0;
    }
    .container {
        padding: 0 1.2rem;
    }
    .hero p {
        font-size: 1.1rem !important;
        margin-top: 1rem !important;
    }
}

header {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    pointer-events: none;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

header > * {
    pointer-events: auto;
    pointer-events: auto;
}

.logo-btn {
    width: 65px;
    height: 65px;
    flex-shrink: 0; /* Prevent distortion */
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
    pointer-events: auto;
    position: relative;
    aspect-ratio: 1 / 1;
}

/* Premium Gradient Border (Aura) */
.logo-btn::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(135deg, #4f46e5, #9333ea, #f06292);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.6;
    transition: var(--transition-smooth);
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.2);
}

.logo-btn img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.logo-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 15px 35px rgba(147, 51, 234, 0.25);
}

.logo-btn:hover::before {
    opacity: 1;
    inset: -6px;
    filter: blur(6px);
    box-shadow: 0 0 25px rgba(147, 51, 234, 0.4);
}

.logo-btn span {
    color: white;
    -webkit-text-fill-color: white;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.logo-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(33, 150, 243, 0.3);
}

.nav-pill {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.03);
    padding: 0.7rem 2.5rem;
    display: flex;
    align-items: center;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.nav-pill:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.apps-pill {
    padding: 0.7rem 1.5rem !important;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
    .apps-pill {
        padding: 0.7rem 1rem !important;
    }
}

/* Premium Buttons */
.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    color: white !important;
    padding: 1.2rem 3rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-block;
    transition: var(--transition-smooth);
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(79, 70, 229, 0.5);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white !important;
    padding: 1.2rem 3rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-block;
    transition: var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.7;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:hover {
    opacity: 1;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border-radius: 12px;
    padding: 1rem 0;
    z-index: 1001;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.05);
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.3s ease;
}

.dropdown-content a {
    display: block;
    padding: 0.8rem 1.5rem;
    opacity: 0.7;
    transition: var(--transition-smooth);
}

.dropdown-content a:hover {
    opacity: 1;
    background-color: var(--bg-secondary);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Curaduría Grid */
.curaduria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 3rem;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    background-color: var(--gradient-1);
    background-image: 
        radial-gradient(at 0% 0%, var(--glow-color-1, #e3f2fd) 0px, transparent 50%),
        radial-gradient(at 100% 0%, var(--glow-color-2, #fce4ec) 0px, transparent 50%),
        radial-gradient(at 50% 100%, var(--glow-color-3, #f3e5f5) 0px, transparent 50%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3BaseFilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/feTurbulence%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 5.5rem);
    margin-bottom: 1.5rem;
    letter-spacing: -2px;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
}

/* Carousel Styles */
.carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 2rem 0;
}

.carousel-track {
    display: flex;
    gap: 2rem;
    transition: var(--transition-smooth);
}

.carousel-slide {
    min-width: 100%;
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Book Carousel Specifics */
.book-card {
    min-width: 300px;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: var(--transition-smooth);
}

.book-card:hover {
    transform: translateY(-10px);
}

.book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    background: var(--accent-mint);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.book-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.book-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 5rem 0 2rem;
    border-top: 1px solid var(--gray-200);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-col h4 {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.footer-col ul li {
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    opacity: 0.7;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    opacity: 0.5;
}
.themed-img-container.no-filter::after {
    display: none;
}

.footer-col i {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
    display: inline-block;
    vertical-align: middle;
}

.footer-col a:hover i {
    transform: translateY(-3px) scale(1.2);
    color: #9333ea !important;
}

/* Level Themes Classes */
body.theme-preescolar { --glow-color-1: #fce4ec; --glow-color-2: #f06292; }
body.theme-primaria { --glow-color-1: #f3e5f5; --glow-color-2: #ba68c8; }
body.theme-secundaria { --glow-color-1: #e3f2fd; --glow-color-2: #2196f3; }
.book-card.pastel-blue { background: #e3f2fd; }
.book-card.pastel-pink { background: #fce4ec; }
.book-card.pastel-mint { background: #e8f5e9; }
.book-card.pastel-lavender { background: #f3e5f5; }
.book-card.pastel-wine { background: #fff5f5; }
.book-card.pastel-yellow { background: #fffde7; }

.themed-img-container {
    position: relative;
    border-radius: 30px;
    overflow: hidden;
    line-height: 0;
    border: 8px solid white;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08);
    background: white;
}

.themed-img-container img {
    border-radius: 22px;
    transition: transform 0.8s ease;
}

.themed-img-container:hover img {
    transform: scale(1.05);
}

.themed-img-container::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--level-overlay, rgba(147, 51, 234, 0.1));
    mix-blend-mode: multiply;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.themed-img-container:hover::after {
    opacity: 0.5;
}

.theme-preescolar { --level-overlay: rgba(240, 98, 146, 0.15); }
.theme-primaria { --level-overlay: rgba(186, 104, 200, 0.15); }
.theme-secundaria { --level-overlay: rgba(33, 150, 243, 0.15); }
.theme-bachillerato { --level-overlay: rgba(229, 115, 115, 0.15); }

.rotate-left {
    transform: rotate(-90deg) scale(1.5);
}

/* Dynamic Animations */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.floating-element {
    animation: float 6s ease-in-out infinite;
}

/* Better Responsive Grids */
@media (max-width: 768px) {
    .curaduria-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .hero-grid {
        grid-template-columns: 1fr !important;
        text-align: center;
    }
    .section {
        padding: 3rem 0;
    }
    .book-card {
        padding: 1.5rem;
    }
    h1 {
        font-size: clamp(2.5rem, 12vw, 4rem) !important;
    }
    h2 {
        font-size: 2.2rem !important;
    }
    .timeline-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        text-align: left !important;
    }
    .timeline-grid > div {
        text-align: left !important;
    }
    .timeline::before {
        display: none; /* Hide the visual line on mobile */
    }
}

/* Timeline Components */
.timeline-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
    align-items: center;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--primaria-glow), transparent);
    transform: translateX(-50%);
    opacity: 0.5;
}

/* WhatsApp Widget */
.wa-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: inherit;
}

.wa-bubble {
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.3);
    cursor: pointer;
    border: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pulse-wa 2s infinite;
}

@keyframes pulse-wa {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.wa-bubble:hover {
    transform: scale(1.1);
}

.wa-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    overflow: hidden;
    display: none;
    flex-direction: column;
    transform-origin: bottom right;
    animation: slide-up 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wa-header {
    background: #075E54;
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
}

.wa-header strong {
    display: block;
    font-size: 0.95rem;
}

.wa-header p {
    font-size: 0.75rem;
    opacity: 0.8;
    margin: 0 !important;
}

.wa-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    background: #E5DDD5;
}

.wa-body p {
    background: white;
    padding: 12px;
    border-radius: 0 15px 15px 15px;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 20px !important;
}

.wa-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wa-options button {
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
    padding: 12px 15px;
    border-radius: 12px;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.wa-options button:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.wa-footer {
    padding: 15px;
    background: white;
    text-align: center;
}

.wa-direct {
    color: #075E54;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
}

.wa-content-detail {
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-line;
}

.back-wa {
    display: block;
    margin-bottom: 15px;
    color: #075E54;
    cursor: pointer;
    font-weight: 600;
}

/* Reveal Animations */
[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

[data-reveal].active {
    opacity: 1;
    transform: translateY(0);
}

/* Instagram Feed Styles */
.instagram-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.instagram-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 2rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(15px);
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 50px rgba(0,0,0,0.03);
}

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

/* Instagram Enhanced Styles */
.instagram-grid-wrapper {
    width: 100%;
    margin-top: 3rem;
    transition: var(--transition-smooth);
}

.instagram-grid-wrapper:hover {
    transform: translateY(-5px);
}

/* Ensure the Behold widget takes up enough space */
behold-widget {
    display: block;
    min-height: 500px;
}

/* Wide Feed Layout */
.instagram-grid-wrapper {
    max-width: 1600px !important;
    width: 95% !important;
}

behold-widget {
    min-height: 700px !important;
}
