/* Epilogue font loaded via <link> in HTML for non-blocking rendering */

:root {
    /* Brand Colors */
    --brand-orange: #f26828;
    --brand-orange-hover: #ff8c42;
    --brand-black: #0d0d0d;
    --brand-white: #ffffff;

    /* Theme Tokens (Light Mode - Default) */
    --bg-gradient: radial-gradient(circle at top left, #ffffff, #f4f4f4);
    --text-primary: #0d0d0d;
    --text-secondary: #555555;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-blur: blur(12px);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
    --accent-color: var(--brand-orange);
}

body.dark-mode {
    --bg-gradient: radial-gradient(circle at top left, #0d0d0d, #1a1a1a);
    --text-primary: #ffffff;
    --text-secondary: #bbbbbb;
    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.3);
    --accent-color: var(--brand-orange-hover);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: 'Epilogue', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.5s ease, color 0.5s ease;
}

/* Layout Containers */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    /* Prevent page-wide horizontal scroll from children */
}

/* Header & Logo */
header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    z-index: 100;
}

.logo {
    width: 120px;
    height: auto;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* Timeline/Weekend Section */
.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px;
}

.timeline {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 450px;
    margin-bottom: 2rem;
    perspective: 1000px;
    touch-action: pan-y pinch-zoom;
    /* Allow vertical scroll but handle horizontal swipe via JS */
}

/* Card Styling - Refactored for Carousel */
.timeline .card {
    position: absolute;
    width: 300px;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: grab;
}

.timeline .card:active {
    cursor: grabbing;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Carousel States */
.card.state-prev {
    transform: translateX(-100%) scale(0.8) rotateY(20deg);
    opacity: 0.4;
    z-index: 1;
    filter: blur(2px) grayscale(100%);
    pointer-events: auto;
}

.card.state-active {
    transform: translateX(0) scale(1) rotateY(0);
    opacity: 1;
    z-index: 10;
    pointer-events: auto;
    filter: none;
}

.card.state-next {
    transform: translateX(100%) scale(0.8) rotateY(-20deg);
    opacity: 0.4;
    z-index: 1;
    filter: blur(2px) grayscale(100%);
    pointer-events: auto;
}

.card.state-hidden {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
    z-index: 0;
}

/* Avatar Styling */
.avatar-container {
    position: relative;
    pointer-events: none;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    padding: 4px;
    background: var(--glass-bg);
    transition: transform 0.3s ease;
}

.card.state-active .avatar {
    width: 140px;
    height: 140px;
}

/* Typography */
.name {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.date {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.card-side .name {
    font-size: 1.1rem;
}

.card-side .date {
    font-size: 0.8rem;
}

/* Buttons */
.btn-whatsapp {
    background: var(--brand-orange);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-whatsapp:hover {
    background: var(--brand-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(242, 104, 40, 0.3);
}

/* Holiday Section */
#holiday-section {
    width: 100%;
    display: none;
    /* Shown via JS */
    flex-direction: column;
    align-items: center;
    padding-top: 3rem;
    margin-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.holiday-branches {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.branch-group {
    width: 100%;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    /* Hard cut for anything that leaks from the carousel */
}

.holiday-cards {
    display: flex;
    padding: 40px 1rem 2rem 1rem;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
}

.holiday-cards::-webkit-scrollbar {
    display: none;
}

/* Pseudo-elements to help centering the first/last card */
.holiday-cards::before,
.holiday-cards::after {
    content: '';
    flex: 0 0 auto;
    width: calc(50% - 140px);
    /* 140px is half of holiday-card width */
}

/* On desktop, if cards don't overflow, center them */
@media (min-width: 901px) {
    .holiday-cards:not(:has(> :nth-child(4))) {
        justify-content: center;
    }

    .holiday-cards:not(:has(> :nth-child(4)))::before,
    .holiday-cards:not(:has(> :nth-child(4)))::after {
        display: none;
    }
}

.holiday-card {
    position: relative !important;
    width: 280px !important;
    flex: 0 0 auto;
    scroll-snap-align: center;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.holiday-card .avatar-container {
    margin-top: 1.5rem;
}

.holiday-card-sequential {
    opacity: 1;
    filter: none;
}

.branch-label {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 800;
    background: var(--accent-color);
    color: white;
    padding: 2px 12px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Theme Toggle */
#theme-toggle {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

#theme-toggle:hover {
    transform: rotate(15deg);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

/* Responsive */
@media (max-width: 900px) {
    .timeline {
        height: 400px;
    }

    .card {
        width: 260px;
        padding: 1.5rem;
    }

    .card.state-prev {
        transform: translateX(-75%) scale(0.75) rotateY(15deg);
        opacity: 0.3;
    }

    .card.state-next {
        transform: translateX(75%) scale(0.75) rotateY(-15deg);
        opacity: 0.3;
    }

    .card.state-active {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    .avatar {
        width: 100px;
        height: 100px;
    }

    .card.state-active .avatar {
        width: 120px;
        height: 120px;
    }

    .name {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    header {
        margin-bottom: 2rem;
    }

    .card {
        width: 220px;
    }

    .card.state-prev {
        transform: translateX(-82%) scale(0.65);
    }

    .card.state-next {
        transform: translateX(82%) scale(0.65);
    }
}