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

:root {
    --blue: #0079e1;
    --cream: #fdffe3;
    --dark: #312A2A;
    --red: #e0534a;
    --card: #FDF9F4;
    --radius: 14px;
    --bg: #FDF9F4;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}


html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 0.5rem 0;
    overflow-x: hidden;
}

/* ── Theater legend ────────────────────────────────────────────────────── */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
    margin-bottom: 1.2rem;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--card);
    border: 2px solid;
    transition: transform 0.2s, box-shadow 0.2s, color 0.3s;
    user-select: none;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.legend-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--tc);
    border-radius: 999px;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}
.legend-item:hover::before,
.legend-item.active::before {
    transform: scaleX(1);
}
.legend-item:hover,
.legend-item.active {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    color: #fff;
}
.legend-item .dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s;
}
.legend-item:hover .dot,
.legend-item.active .dot { background: #fff !important; }

/* ── Calendar ──────────────────────────────────────────────────────────── */
.cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    background: var(--dark);
    overflow: hidden;
    border: var(--dark) 3px solid;
}
.cal-head {
    background: var(--dark);
    color: #fff;
    text-align: center;
    padding: 0.55rem 0.2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}
.month-row {
    grid-column: 1 / -1;
    background: var(--dark);
    color: #fff;
    padding: 0.7rem 1rem;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    position: sticky;
    top: 0;
    z-index: 9;
}
.cal-day {
    background-color: var(--card);
    min-height: 96px;
    padding: 0.35rem;
    cursor: default;
    min-width: 0;
    overflow: hidden;
    position: relative;
}
.cal-day::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
    pointer-events: none;
}
.cal-day:hover::before { opacity: 1; }
.cal-day > * { position: relative; z-index: 1; }

/* Hover animation variants */
.hover-shimmer::before {
    background: linear-gradient(135deg, #fce4ec 0%, #e8f5e9 25%, #e3f2fd 50%, #fff9c4 75%, #f3e5f5 100%);
    background-size: 200% 200%;
    animation: anim-shimmer 3s ease infinite;
}
.hover-warm::before {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 33%, #ffeaa7 66%, #fdcb6e 100%);
    background-size: 200% 200%;
    animation: anim-warm 4s ease infinite;
}
.hover-cool::before {
    background: linear-gradient(90deg, #e0f7fa 0%, #b2ebf2 25%, #80deea 50%, #b2ebf2 75%, #e0f7fa 100%);
    background-size: 300% 100%;
    animation: anim-cool 3s linear infinite;
}
.hover-aurora::before {
    background: linear-gradient(135deg, #c8e6c9 0%, #b39ddb 33%, #81d4fa 66%, #a5d6a7 100%);
    background-size: 200% 200%;
    animation: anim-aurora 5s ease infinite;
}
.hover-confetti::before {
    background: radial-gradient(circle at 50% 50%, #fff9c4 0%, #f8bbd0 35%, #e1bee7 60%, #fff9c4 100%);
    background-size: 200% 200%;
    animation: anim-confetti 3s ease infinite;
}
.hover-glow::before {
    background: radial-gradient(circle at 50% 50%, #e8d5f5 0%, #f3e5f5 50%, #ede7f6 100%);
    background-size: 150% 150%;
    animation: anim-glow 2.5s ease infinite;
}

@keyframes anim-shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes anim-warm {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes anim-cool {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}
@keyframes anim-aurora {
    0% { background-position: 0% 0%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 0%; }
}
@keyframes anim-confetti {
    0% { background-position: 50% 50%; }
    33% { background-position: 0% 0%; }
    66% { background-position: 100% 100%; }
    100% { background-position: 50% 50%; }
}
@keyframes anim-glow {
    0% { background-position: 50% 50%; }
    50% { background-position: 30% 30%; }
    100% { background-position: 50% 50%; }
}

/* Pride flag hover variants (June) */
.hover-pride-rainbow::before {
    background: linear-gradient(180deg, #FF6B6B 0%, #FF6B6B 16.6%, #FFA94D 16.6%, #FFA94D 33.2%, #FFE066 33.2%, #FFE066 49.8%, #69DB7C 49.8%, #69DB7C 66.4%, #74C0FC 66.4%, #74C0FC 83%, #B197FC 83%, #B197FC 100%);
    background-size: 100% 300%;
    animation: anim-pride 3s ease infinite;
}
.hover-pride-trans::before {
    background: linear-gradient(180deg, #7EC8E3 0%, #7EC8E3 20%, #F5A9B8 20%, #F5A9B8 40%, #FFFFFF 40%, #FFFFFF 60%, #F5A9B8 60%, #F5A9B8 80%, #7EC8E3 80%, #7EC8E3 100%);
    background-size: 100% 300%;
    animation: anim-pride 3.5s ease infinite;
}
.hover-pride-bi::before {
    background: linear-gradient(180deg, #D962A0 0%, #D962A0 40%, #9B59B6 40%, #9B59B6 60%, #4A6FA5 60%, #4A6FA5 100%);
    background-size: 100% 300%;
    animation: anim-pride 3s ease infinite;
}
.hover-pride-pan::before {
    background: linear-gradient(180deg, #FF69B4 0%, #FF69B4 33.3%, #FFD700 33.3%, #FFD700 66.6%, #69CFFF 66.6%, #69CFFF 100%);
    background-size: 100% 300%;
    animation: anim-pride 3s ease infinite;
}
.hover-pride-nb::before {
    background: linear-gradient(180deg, #FFF430 0%, #FFF430 25%, #FFFFFF 25%, #FFFFFF 50%, #9C59D1 50%, #9C59D1 75%, #2C2C2C 75%, #2C2C2C 100%);
    background-size: 100% 300%;
    animation: anim-pride 4s ease infinite;
}
.hover-pride-lesbian::before {
    background: linear-gradient(180deg, #D62900 0%, #D62900 20%, #FF9B55 20%, #FF9B55 40%, #FFFFFF 40%, #FFFFFF 60%, #D461A6 60%, #D461A6 80%, #A50062 80%, #A50062 100%);
    background-size: 100% 300%;
    animation: anim-pride 3.5s ease infinite;
}
@keyframes anim-pride {
    0% { background-position: 50% 0%; }
    50% { background-position: 50% 100%; }
    100% { background-position: 50% 0%; }
}

.cal-day.today { background-color: #fff9e6; }
.cal-day.past { opacity: 0.45; }
.cal-day .day-num {
    font-size: 0.78rem;
    font-weight: 600;
    color: #999;
    margin-bottom: 0.15rem;
}
.cal-day.first-of-month .day-num {
    font-weight: 800;
    color: var(--dark);
}
.cal-day.today .day-num {
    background: var(--red);
    color: #fff;
    width: 22px; height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
}

.day-num .mob-dow { display: none; }
.evt-list { display: contents; }

/* ── Event pills ───────────────────────────────────────────────────────── */
.evt {
    padding: 2px 4px;
    margin-bottom: 2px;
    border-radius: 4px;
    font-size: 0.65rem;
    line-height: 1.35;
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
    color: var(--dark);
    position: relative;
    z-index: 1;
    max-height: 50px;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease,
                margin-bottom 0.3s ease, padding 0.3s ease, filter 0.15s;
}
.evt:hover {
    filter: brightness(0.93);
}
.evt.evt-hidden {
    opacity: 0;
    transform: scale(0.8);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}
.evt .evt-time {
    font-weight: 700;
}
.evt .evt-name {
    font-weight: 500;
}
.evt-more {
    font-size: 0.65rem;
    color: var(--blue);
    font-weight: 700;
    cursor: pointer;
    padding: 1px 4px;
    position: relative;
    z-index: 1;
}
.evt-more:hover { text-decoration: underline; }

/* ── Overlays ──────────────────────────────────────────────────────────── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26,26,46,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.overlay.open { display: flex; }
.panel {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: panelIn 0.25s ease;
}
@keyframes panelIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.panel-header h3 { font-size: 1.1rem; font-weight: 700; }
.panel-header .theater-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    color: #fff;
    white-space: nowrap;
    margin-top: 0.25rem;
    display: inline-block;
}
.panel-close {
    background: none; border: none;
    font-size: 1.5rem; cursor: pointer;
    color: #999; padding: 0; line-height: 1;
    flex-shrink: 0;
}
.panel-close:hover { color: var(--dark); }
.panel-body { padding: 1rem 1.25rem; }
.panel-body p { font-size: 0.9rem; color: #555; margin-bottom: 0.8rem; line-height: 1.6; }
.panel-body .meta { font-size: 0.82rem; color: #888; margin-bottom: 0.2rem; }
.panel-body .btn {
    display: inline-block;
    padding: 0.55rem 1.3rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    margin-top: 0.4rem;
    margin-right: 0.4rem;
    transition: transform 0.15s, box-shadow 0.15s;
}
.panel-body .btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.panel-body .btn-ticket { background: var(--blue); }
.panel-body .btn-info { background: var(--dark); }

/* ── Day detail list ───────────────────────────────────────────────────── */
.day-detail-header {
    background: var(--dark);
    color: #fff;
    padding: 0.9rem 1.25rem;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius) var(--radius) 0 0;
}
.day-detail-header button { background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; }
.day-detail-list { padding: 0.4rem; }
.day-event-card {
    padding: 0.7rem;
    border-radius: 8px;
}
.day-event-card + .day-event-card { border-top: 1px solid #eee; }
.day-event-card .card-top {
    display: flex;
    gap: 0.7rem;
    align-items: center;
}
.day-event-card .color-bar { width: 4px; border-radius: 2px; flex-shrink: 0; align-self: stretch; min-height: 2.2rem; }
.day-event-card .info { flex: 1; min-width: 0; }
.day-event-card .info h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.1rem; }
.day-event-card .info .sub { font-size: 0.78rem; color: #888; }
.day-event-card .time-badge { font-size: 0.8rem; font-weight: 700; color: var(--dark); white-space: nowrap; margin-right: 0.3rem; }
.day-event-card .card-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}
.day-event-card .card-actions a,
.day-event-card .card-actions button {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.72rem;
    color: #fff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.day-event-card .card-actions a:hover,
.day-event-card .card-actions button:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.day-event-card .card-actions .link-ticket { background: var(--blue); }
.day-event-card .card-actions .btn-more-info { background: var(--dark); }
.day-event-card .card-desc {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.3s ease, padding 0.3s ease;
    font-size: 0.82rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
    padding-left: calc(4px + 0.7rem);
}
.day-event-card .card-desc.open {
    max-height: 500px;
    opacity: 1;
    margin-top: 0.5rem;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer { text-align: center; padding: 1.5rem 1rem; font-size: 0.82rem; color: #999; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container { padding: 0.5rem 0.25rem 0; }
    .cal-day { min-height: 54px; padding: 0.15rem; }
    .evt { font-size: 0.55rem; padding: 1px 2px; border-left-width: 2px; }
    .cal-head { font-size: 0.6rem; padding: 0.35rem 0; }
    .month-row { font-size: 0.9rem; padding: 0.45rem 0.6rem; }
    .cal-day .day-num { font-size: 0.65rem; }
    .legend-item { font-size: 0.6rem; padding: 0.15rem 0.4rem; }
}

@media (max-width: 600px) {
    .cal {
        grid-template-columns: 1fr;
        gap: 0;
        border: none;
        background: var(--bg);
    }
    .cal-head { display: none; }
    .month-row {
        position: sticky;
        top: 0;
        z-index: 10;
        border-radius: 0;
        padding: 0.6rem 0.8rem;
        font-size: 1.05rem;
        margin-top: 0.5rem;
    }
    .cal-day {
        min-height: unset;
        padding: 0.5rem 0.6rem;
        background: var(--card);
        border-bottom: 1px solid #eee;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.3rem;
    }
    .cal-day.mob-empty { display: none; }
    .cal-day .day-num {
        font-size: 0.85rem;
        font-weight: 700;
        min-width: 6.5rem;
        margin-bottom: 0;
    }
    .cal-day .day-num .mob-dow {
        display: inline;
        font-weight: 600;
        color: #888;
        margin-right: 0.3rem;
    }
    .cal-day.today .day-num {
        width: auto;
        height: auto;
        display: inline;
        background: none;
        color: var(--red);
        font-weight: 800;
    }
    .cal-day.today .day-num .mob-dow { color: var(--red); }
    .cal-day .evt-list {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .evt {
        font-size: 0.72rem;
        padding: 0.3rem 0.5rem;
        border-radius: 6px;
        line-height: 1.4;
    }
    .evt-more {
        font-size: 0.72rem;
        padding: 0.2rem 0.5rem;
    }
    .cal-day::before { display: none; }
    .legend { margin-bottom: 0.6rem; gap: 0.3rem; }
    .legend-item { font-size: 0.65rem; padding: 0.2rem 0.5rem; }

    /* Day detail panel on mobile */
    .overlay { padding: 0; align-items: flex-end; }
    .panel {
        max-width: 100%;
        max-height: 90vh;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    .day-event-card .card-top { flex-wrap: wrap; }
    .day-event-card .card-actions {
        width: 100%;
        padding-left: calc(4px + 0.7rem);
        margin-top: 0.3rem;
    }
}
