:root {
    /* Color Palette from Design System */
    --primary: #bd0050;
    --primary-container: #ffa9b9;
    --on-primary: #fff7f7;
    --on-primary-container: #7d0032;
    
    --secondary: #6d5c4e;
    --secondary-container: #ffe7d5;
    --on-secondary-container: #645446;
    
    --tertiary: #566348;
    --tertiary-container: #efffdb;
    --on-tertiary-container: #566348;
    
    --background: #fcf9f7;
    --surface: #fcf9f7;
    --surface-container-low: #f6f3f1;
    --surface-container-lowest: #ffffff;
    --on-surface: #323331;
    --on-surface-variant: #5f5f5d;
    
    --outline: #7b7b78;
    --outline-variant: #b3b2af;
    
    /* Typography */
    --font-headline: 'Epilogue', sans-serif;
    --font-body: 'Manrope', sans-serif;
    
    /* Shadows */
    --ambient-shadow: 0 32px 64px -16px rgba(189, 0, 80, 0.08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--background);
    color: var(--on-surface);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headline);
    color: var(--on-surface);
}

/* Custom UI Helpers */
.text-display-lg {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.ambient-shadow {
    box-shadow: var(--ambient-shadow);
}

/* Transition & Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Custom Overrides for standard elements */
.btn-primary {
    background: linear-gradient(to right, var(--primary), var(--primary-container));
    color: var(--on-primary);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    box-shadow: 0 10px 25px -5px rgba(189, 0, 80, 0.3);
    opacity: 0.9;
}

/* Navigation Blur Effect */
.nav-glass {
    background-color: rgba(252, 249, 247, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Gallery Styles */
.gallery-item {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(189, 0, 80, 0.15);
}

#lightbox {
    transition: opacity 0.3s ease;
    display: none;
}

#lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#lightbox-img {
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#lightbox.active #lightbox-img {
    transform: scale(1);
}

/* Prevent scroll when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}

/* --- Accessibility Tools --- */

/* Font Size Modifiers */
html.font-xl {
    font-size: 115%;
}

html.font-2xl {
    font-size: 130%;
}

/* High Contrast Mode */
html.high-contrast {
    /* High contrast color palette */
    --primary: #ffff00; /* Bright yellow */
    --primary-container: #333300;
    --on-primary: #000000;
    --on-primary-container: #ffff00;
    
    --secondary: #00ffff; /* Bright cyan */
    --secondary-container: #003333;
    --on-secondary-container: #00ffff;
    
    --tertiary: #ff00ff;
    --tertiary-container: #330033;
    --on-tertiary-container: #ff00ff;
    
    --background: #000000;
    --surface: #000000;
    --surface-container-lowest: #000000;
    --surface-container-low: #111111;
    --surface-container-high: #333333;
    
    --on-surface: #ffffff;
    --on-surface-variant: #eeeeee;
    
    --outline: #ffffff;
    --outline-variant: #cccccc;
    
    --ambient-shadow: none;
}

/* Force some high contrast borders where necessary */
html.high-contrast * {
    border-color: var(--outline-variant);
}

/* Remove decorative shadows in high contrast */
html.high-contrast .shadow-lg,
html.high-contrast .shadow-sm,
html.high-contrast .shadow-xl,
html.high-contrast .shadow-2xl,
html.high-contrast .nav-glass {
    box-shadow: none;
    border: 1px solid var(--outline);
}

/* Remove background blurs to ensure clarity */
html.high-contrast .nav-glass,
html.high-contrast .backdrop-blur-md {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-color: var(--surface);
}

/* Widget Panel Visibility transition styles */
#a11y-panel.active,
#mobile-menu.active {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

#mobile-menu {
    background-color: var(--background, #fcf9f7);
    z-index: 999;
}

#mobile-menu.active {
    display: flex;
}

#mobile-menu .mobile-nav-link:hover {
    color: var(--primary);
}

/* --- OVERRIDES DE BARRIDO PARA ALTO CONTRASTE --- */

/* 1. Eliminar fondos hardcodeados o pasteles */
html.high-contrast .bg-white,
html.high-contrast .bg-pink-100,
html.high-contrast [class*="bg-[#"] {
    background-color: var(--surface-container-low) !important;
    color: var(--on-surface) !important;
    border: 1px solid var(--outline) !important;
}

/* 2. Forzar legibilidad en componentes clave que antes eran blancos (iconos, pasos) */
html.high-contrast .bg-white.text-primary,
html.high-contrast .bg-white.text-on-surface-variant {
    background-color: var(--surface-container-lowest) !important;
    color: var(--primary) !important;
    border: 2px solid var(--primary) !important;
}

/* 3. Arreglar bg-primary puro para que use el texto invertido correspondiente (negro sobre amarillo) */
html.high-contrast .bg-primary {
    background-color: var(--primary) !important;
    color: var(--on-primary) !important;
}
/* Forzar color de texto negro si el elemento tiene bg-primary, incluso si tiene la clase text-white */
html.high-contrast .bg-primary,
html.high-contrast .bg-primary.text-white {
    color: var(--on-primary) !important;
}
html.high-contrast .bg-primary * {
    color: var(--on-primary) !important;
}

/* 4. Forzar que todos los gradientes de tailwind (excepto los de imagen) sean sólidos */
html.high-contrast .from-primary,
html.high-contrast .from-amber-400,
html.high-contrast .from-emerald-400,
html.high-contrast .from-blue-400 {
    background: var(--surface-container-high) !important;
    color: var(--primary) !important;
    border: 2px solid var(--primary) !important;
}

/* 5. Asegurar botón primario con máximo impacto visual */
html.high-contrast .btn-primary {
    background: var(--primary) !important;
    color: var(--on-primary) !important;
    border: none !important;
}

/* 6. Evitar que clases de texto blanco causen invisibilidad */
html.high-contrast .text-white {
    color: var(--on-surface) !important;
}
