body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 7s ease;
}

/* Cache-busted to force refresh */
body.bg1 { background-image: url('rotating background photos/bg1.jpg?v=2025-10-31-2005'); }
body.bg2 { background-image: url('rotating background photos/bg2.jpg?v=2025-10-31-2005'); }
body.bg3 { background-image: url('rotating background photos/bg3.jpg?v=2025-10-31-2005'); }

header {
    background-color: #ce1126;
    color: white;
    padding: 20px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hamburger {
    font-size: 24px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: none;
}

.nav-menu {
    display: flex;
}

.nav-menu ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    margin-left: 20px;
}

.nav-menu a {
    color: white;
    text-decoration: none;
}

.nav-menu a:hover {
    text-decoration: underline;
}

main {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

section {
    text-align: center;
}

.content-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    background-color: #f4f4f4;
    padding: 20px;
    border-radius: 8px;
}

.hero, .countdown, .donation, .form-wrapper {
    margin-bottom: 20px;
    width: 100%;
}

h1 {
    color: #ce1126;
}

form {
    display: flex;
    flex-direction: column;
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}

.form-wrapper {
    display: flex;
    justify-content: center;
}

.button-container {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
}

button {
    background-color: #ce1126;
    color: white;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    flex: 1;
}

.event-button {
    padding: 10px 20px;
    font-size: 18px;
    text-decoration: none;
    display: inline-block;
}

button:hover {
    background-color: #a00a1a;
}

label {
    margin-top: 10px;
}

input, button {
    margin-top: 5px;
    padding: 5px;
}

.hide {
    display: none;
}

/* Fixed Donation Box - Bottom Right */
/* Fixed Header Box - Top Left */
.header-fixed {
    position: fixed;
    top: 80px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ce1126;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 280px;
    z-index: 900;
    text-align: center;
}

.header-fixed h1 {
    color: #ce1126;
    margin: 0 0 10px 0;
    font-size: 20px;
}

.header-fixed p {
    margin: 0;
    font-size: 14px;
    color: #333;
}

/* Fixed Countdown Box - Top Right */
.countdown-fixed {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ce1126;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 220px;
    z-index: 900;
    text-align: center;
}

.countdown-fixed h3 {
    color: #ce1126;
    margin: 0 0 12px 0;
    font-size: 16px;
}

.countdown-fixed p {
    margin: 0;
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

.countdown-fixed .upcoming {
    margin-top: 10px;
    text-align: left;
}

.countdown-fixed .upcoming h4 {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: #555;
    text-align: center;
    font-weight: 600;
}

.countdown-fixed .upcoming ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.countdown-fixed .upcoming li {
    font-size: 12px;
    margin: 4px 0;
    color: #222;
}

/* Fixed Donation Box - Bottom Right */
.donation-fixed {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ce1126;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 220px;
    z-index: 900;
}

.donation-fixed h3 {
    color: #ce1126;
    margin: 0 0 12px 0;
    font-size: 16px;
    text-align: center;
}

.donation-fixed form {
    display: flex;
    flex-direction: column;
    margin: 0;
    max-width: none;
}

.donation-fixed label {
    font-size: 13px;
    margin: 0 0 4px 0;
    color: #333;
}

.donation-fixed input {
    padding: 6px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 0 0 8px 0;
}

.donation-fixed button {
    padding: 8px;
    font-size: 14px;
    background-color: #ce1126;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin: 0;
}

.donation-fixed button:hover {
    background-color: #a00a1a;
}

.donation-fixed p {
    margin: 8px 0 0 0;
    font-size: 12px;
    text-align: center;
    color: #28a745;
}

footer {
    background-color: #ce1126;
    color: white;
    text-align: center;
    padding: 10px;
    position: relative;
    margin-top: 20px;
    width: 100%;
}

/* Simple social button styling for footer links */
.footer-links { margin-top: 6px; }
.social-button {
    display: inline-block;
    background: #1877F2;
    color: #fff !important;
    padding: 6px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
}
.social-button:hover { filter: brightness(0.95); }

/* PDF Viewer and Form Styles */
#pdf-viewer {
    position: relative;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.pdf-page {
    position: relative;
    margin: 0 auto;
    background-color: #fff;
}

/* Slightly lighten PNG fallback so paper appears white */
.pdf-page.png-fallback {
    filter: brightness(1.15) contrast(1.05);
}

/* Lighten only the PDF canvas background image, not overlays */
.pdf-page canvas.pdf-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    filter: brightness(1.25) contrast(1.1);
    background: #ffffff;
}

.interactive-layer {
    z-index: 2;
}

/* PNG fallback background image element */
.fallback-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
    filter: brightness(1.25) contrast(1.1);
    background: #ffffff;
}

.interactive-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.interactive-element {
    position: absolute;
    background: transparent;
    border: none;
    transition: all 0.3s ease;
}

.interactive-element:hover {
    background: transparent;
    border-color: transparent;
}

.interactive-element.text-input {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 2px;
}

.interactive-element.text-input input {
    width: 100%;
    height: 100%;
    padding: 4px 8px;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.2;
}

.interactive-element.checkbox-input {
    width: 24px !important;
    height: 24px !important;
    background: #fff;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.interactive-element.checkbox-input.checked {
    background: #ce1126;
    border-color: #ce1126;
}

.interactive-element.checkbox-input.checked .checkbox-inner:after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

/* Calculation Popup */
.calculation-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-width: 300px;
    z-index: 1000;
}

.calculation-popup h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-title {
    flex: 1;
}

.expand-indicator {
    color: #666;
    font-weight: normal;
    font-size: 18px;
    margin-left: 10px;
    min-width: 20px;
    text-align: center;
    display: none; /* Hide on desktop by default */
}

/* Show indicator only on mobile */
@media (max-width: 768px) {
    .expand-indicator {
        display: inline;
    }
}

/* Collapsed state - hide items and total when collapsed */
.calculation-popup.collapsed #calculation-items {
    display: none !important;
}

.calculation-popup.collapsed .total-row {
    display: none !important;
}

.calculation-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-weight: bold;
}

#clown-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

.clown {
    cursor: pointer;
    transition: transform 0.2s;
    width: 100px;
    height: 100px;
    border: none;
    box-shadow: none;
    background: transparent;
}

.clown:hover {
    transform: scale(1.1);
}

/* Click Me bubble next to fez (injected via JS) */
#click-fez-bubble, .click-me-bubble {
    position: absolute;
    top: 0;
    left: 108px; /* default fallback; JS will resize/reposition */
    background: #ffeb3b;
    color: #000;
    font-weight: 700;
    font-size: 14px;
    padding: 6px 10px;
    border: 2px solid #000;
    border-radius: 14px;
    cursor: default;
    box-shadow: 2px 2px 0 #000;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fezPulse 2.4s ease-in-out infinite;
    background-image: radial-gradient(circle at 30% 30%, #fff59d, #ffeb3b);
    pointer-events: none; /* make non-actionable */
}

.click-me-bubble::after {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-right: 10px solid #ffeb3b; /* arrow pointing toward fez */
    filter: drop-shadow(1px 1px 0 #000);
}

@keyframes fezPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.modal {
display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

.game-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#game-board {
width: 100%;
    margin-top: 10px;
}

#tic-board {
    width: 100% !important; /* Override any inline styles */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.tic-cell {
    border: 1px solid #ccc;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background-color: #fff;
    font-size: 24px;
}

#checkers-board {
    width: 100% !important; /* Override any inline styles */
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}

.checkers-cell {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkers-cell.light {
    background-color: #f0d9b5;
}

.checkers-cell.dark {
    background-color: #8b4513;
}

.checkers-piece {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    margin: auto;
}

.red {
    background-color: red;
}

.black {
    background-color: black;
}

.king {
    border: 2px solid gold;
}

#game-status {
    margin-top: 10px;
}

#reset-game {
    margin-top: 10px;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-bottom: 20px;
}

.event-item {
    background-color: #ce1126;
    color: white;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border-radius: 5px;
}

.event-item:hover {
    background-color: #a00a1a;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
    width: 100%;
}

.gallery img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
}

#gallery-modal .gallery {
    margin-top: 20px;
}

/* Gallery-only layout overrides (scoped to #gallery-modal so other modals like #game-modal are unaffected) */
#gallery-modal .modal-content {
    /* make the gallery modal wider so multiple columns can display */
    max-width: 900px;
}

#gallery-modal .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    width: 100%;
}

#gallery-modal .gallery img {
    width: 100%;
    height: 140px; /* consistent thumbnail height */
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* Video gallery styles */
.video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 10px;
    width: 100%;
}

.video-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.video-card video {
    width: 100%;
    height: auto;
    border-radius: 6px;
    background: #000;
}

.video-card h5 {
    margin: 6px 0 0 0;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: #333;
}

/* ========== MOBILE RESPONSIVE STYLES ========== */

/* Small phones - 480px and below */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    header {
        padding: 12px 10px;
    }

    main {
        padding: 10px;
        min-height: auto;
    }

    /* Fixed boxes become static and stack */
    .header-fixed,
    .countdown-fixed,
    .donation-fixed {
        position: static;
        width: auto;
        max-width: 100%;
        margin: 10px auto;
        display: block;
    }

    /* SCSA Registration button - full width on mobile */
    .scsa-registration-section {
        padding: 20px 10px !important;
    }

    .scsa-btn {
        display: block !important;
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        box-sizing: border-box;
    }

    /* Form improvements */
    form input,
    form select,
    form textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }

    form button {
        padding: 14px;
        font-size: 16px;
        min-height: 48px; /* Touch-friendly */
    }

    /* Video gallery smaller on tiny screens */
    .video-gallery {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Modal adjustments */
    .modal-content {
        width: 96%;
        margin: 5% auto;
        padding: 15px;
    }

    /* Calculation popup */
    .calculation-popup {
        width: 95%;
        bottom: 10px;
        right: 2.5%;
        left: 2.5%;
        font-size: 13px;
    }

    /* Footer adjustments */
    footer {
        padding: 15px 10px;
        font-size: 13px;
    }
}

/* Tablets and small screens - 481px to 768px */
@media (min-width: 481px) and (max-width: 768px) {
    /* Fixed boxes stack but with some spacing */
    .header-fixed {
        position: static;
        width: auto;
        max-width: 90%;
        margin: 15px auto;
    }

    .countdown-fixed {
        position: static;
        width: auto;
        max-width: 90%;
        margin: 15px auto;
    }

    .donation-fixed {
        position: static;
        width: auto;
        max-width: 90%;
        margin: 15px auto;
    }

    .video-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .scsa-btn {
        font-size: 17px !important;
        padding: 15px 28px !important;
    }
}

/* General mobile - 768px and below */
@media (max-width: 768px) {
    .hamburger {
        display: block;
        font-size: 28px;
        padding: 8px;
        min-width: 44px; /* Touch target */
        min-height: 44px;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background-color: #ce1126;
        box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    }

    .nav-menu.active {
        display: flex;
        flex-direction: column;
    }

    .nav-menu li {
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .nav-menu a {
        display: block;
        padding: 15px 20px;
        min-height: 48px; /* Touch-friendly */
    }

    .button-container {
        flex-direction: column;
        gap: 12px;
    }

    .content-container {
        max-width: 100%;
        padding: 15px;
    }

    /* Make all buttons touch-friendly */
    button,
    .btn,
    a.button {
        min-height: 44px;
        padding: 12px 20px;
    }

    /* Interactive checkboxes smaller on mobile for tighter layout */
    .interactive-element.checkbox-input {
        transform: none;
        width: 14px !important;
        height: 14px !important;
        margin: 4px;
        min-width: 0;
        min-height: 0;
    }

    /* Reduce checkmark size to fit the smaller box */
    .interactive-element.checkbox-input.checked .checkbox-inner:after {
        font-size: 12px;
    }

    /* Hide legacy red total on mobile - use floating summary box instead */
    .total-section {
        display: none;
    }

    /* Ensure indicator is always visible on mobile */
    .calculation-popup h3 {
        cursor: pointer;
        margin-bottom: 15px;
    }

    /* Clown/fez container adjustments */
    #clown-container {
        bottom: 80px;
        right: 10px;
    }

    #clown-face {
        max-width: 60px;
    }
}

/* Larger tablets and small desktops - 769px to 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-fixed,
    .countdown-fixed,
    .donation-fixed {
        width: 240px;
    }

    main {
        padding: 20px 40px;
    }
}

/* Video gallery responsive */
@media (max-width: 600px) {
    .video-gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
}

/* Lightbox (gallery enlarge) styles - scoped to #lightbox */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

#lightbox img {
    max-width: 90%;
    max-height: 80%;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

#lightbox .close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
    color: #fff;
    background: transparent;
    border: none;
    cursor: pointer;
}

#lightbox button[aria-label="Previous"],
#lightbox button[aria-label="Next"] {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 28px;
    padding: 8px 12px;
    cursor: pointer;
}

#lightbox button[aria-label="Previous"] { left: 20px; }
#lightbox button[aria-label="Next"] { right: 20px; }

#lightbox button:focus { outline: 2px solid #fff; }