/* * CALENDARIO PERÚ 2026 - HOJA DE ESTILOS PRINCIPAL
 * Tema: Laguna Humantay (Azul Profundo, Turquesa, Hielo)
 */

/* =========================================
   1. VARIABLES & THEMING
   ========================================= */
:root {
    /* Paleta de Colores Humantay */
    --humantay-deep: #0f2c3e;
    --humantay-teal: #1a7a8a;
    --humantay-ice: #dceef2;
    --humantay-rock: #546e7a;
    --humantay-green: #4db6ac;

    /* Glassmorphism Base */
    --glass-card-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-blur: 15px;

    /* Texto & Acentos */
    --text-primary: #0f2c3e;
    --text-secondary: #37474f;
    --accent-glow: var(--humantay-teal);

    /* Feriados */
    --holiday-bg: var(--humantay-teal);
    --holiday-text: #ffffff;

    /* Tooltip Sólido */
    --tooltip-bg: #eef2f3;
    --tooltip-text: #0f2c3e;
    --tooltip-btn-bg: linear-gradient(135deg, var(--humantay-deep), var(--humantay-teal));
    --tooltip-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);

    /* Header */
    --header-bg: rgba(255, 255, 255, 0.60);
    --header-border: rgba(255, 255, 255, 0.3);

    /* Z-INDEX STACK (Documentación)
       - Background: -2
       - Month Card (Default): 1
       - Month Card (Hover): 20
       - Calendar Day Holiday (Hover): 50
       - Header: 100
       - Tooltip: 200 (Contexto local del día)
    */
}

[data-theme="dark"] {
    --glass-card-bg: rgba(15, 30, 40, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);

    --text-primary: #eceff1;
    --text-secondary: #b0bec5;
    --accent-glow: var(--humantay-green);

    --holiday-bg: var(--humantay-green);
    --holiday-text: #000;

    --tooltip-bg: #1c2e36;
    --tooltip-text: #eceff1;
    --tooltip-btn-bg: linear-gradient(135deg, var(--humantay-green), var(--humantay-teal));
    --tooltip-shadow: 0 15px 50px rgba(0, 0, 0, 0.8);

    --header-bg: rgba(15, 30, 40, 0.61);
    --header-border: rgba(255, 255, 255, 0.05);
}

/* =========================================
   2. GLOBAL & RESET
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background Image Optimization */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('background.webp') no-repeat center center;
    background-size: cover;
    z-index: -2;
    filter: brightness(0.9);
    will-change: transform;
    /* Hint for performance */
}

/* Overlay for Readability */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--humantay-deep);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

[data-theme="dark"] body::after {
    opacity: 0.5;
}

/* Utility Class */
.glass-effect {
    background: var(--glass-card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

/* =========================================
   3. HEADER
   ========================================= */
header {
    padding: 0.6rem 5%;
    position: sticky;
    top: 0;
    z-index: 100;
    /* Priority Level: High */
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--header-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

h1 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Theme Toggle Switch */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.2);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background: #fff;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--humantay-teal);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* =========================================
   4. CALENDAR LAYOUT & CARDS
   ========================================= */
.calendar-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    padding: 2rem 5%;
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    /* Z-Index removed to allow children to compete with header */
}

.month-card {
    border-radius: 20px;
    padding: 1.5rem;
    transition: box-shadow 0.3s ease;
    position: relative;
    z-index: 1;
    /* Base Level */
    overflow: visible;
}

/* Elevate Month Card on Hover */
.month-card:hover {
    z-index: 20;
    /* Priority Level: Mid (Below Header) */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.month-title {
    text-align: center;
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 10px;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}

.day-name {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 8px;
}

/* Day Cells */
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: default;
    position: relative;
}

.calendar-day.weekend {
    opacity: 0.7;
}

/* =========================================
   5. FERIADOS & TOOLTIPS
   ========================================= */
.calendar-day.holiday {
    opacity: 1 !important;
    background: var(--holiday-bg) !important;
    color: var(--holiday-text) !important;
    font-weight: 700;
    cursor: help;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
    z-index: 2;
    /* Local Level */
}

/* Fix overlapping neighbor cells */
.calendar-day.holiday:hover {
    transform: scale(1.1);
    z-index: 50;
    /* Priority Level: High Local */
}

/* Tooltip Container */
.holiday-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 200;
    /* Priority Level: Very High Local */
    width: 280px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 20px;
    border-radius: 12px;
    font-size: 0.85rem;
    text-align: center;
    box-shadow: var(--tooltip-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: opacity 0.2s ease, visibility 0.2s;
    pointer-events: none;

    /* Default Position: TOP */
    bottom: 130%;
    top: auto;
}

/* Tooltip Variant: BOTTOM (Triggered by JS) */
.holiday-tooltip.show-bottom {
    bottom: auto;
    top: 130%;
}

/* Tooltip Arrows */
.holiday-tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    top: 100%;
    bottom: auto;
    border-color: var(--tooltip-bg) transparent transparent transparent;
}

.holiday-tooltip.show-bottom::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent var(--tooltip-bg) transparent;
}

/* Invisible Bridge (Prevents hover loss) */
.holiday-tooltip::before {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 30px;
    top: 100%;
    bottom: auto;
    background: transparent;
}

.holiday-tooltip.show-bottom::before {
    top: auto;
    bottom: 100%;
}

/* Visibility Trigger */
.calendar-day.holiday:hover .holiday-tooltip,
.holiday-tooltip:hover {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Tooltip Content */
.tooltip-title {
    display: block;
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.1rem;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 8px;
    color: var(--text-primary);
}

[data-theme="dark"] .tooltip-title {
    border-color: rgba(255, 255, 255, 0.2);
}

.tooltip-desc {
    display: block;
    margin-bottom: 15px;
    line-height: 1.5;
    font-weight: 400;
}

.tooltip-btn {
    display: block;
    text-align: center;
    background: var(--tooltip-btn-bg);
    color: #fff !important;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    transition: filter 0.2s, transform 0.2s;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tooltip-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* =========================================
   6. FOOTER & MEDIA QUERIES
   ========================================= */
.photo-credit {
    position: fixed;
    bottom: 15px;
    left: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: 300;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 50;
    pointer-events: none;
}

footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    opacity: 0.7;
    position: relative;
    z-index: 1;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.4rem;
    }

    .header-logo {
        height: 35px;
    }

    .calendar-container {
        padding: 1rem 3%;
    }

    .holiday-tooltip {
        width: 250px;
        bottom: 140%;
    }
}