@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..900;1,9..144,400..900&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    /* Core palette (as specified) */
    --bg: #5E130F;
    --bubble: #FFFFFF;
    --text: #4E0300;

    /* Supporting accents, drawn from lion dance costuming: gold trim, red sash, drum-night blue */
    --gold: #F7B633;
    --gold-deep: #C98A16;
    --gold-text: #704A00;
    --red: #8C2F2A;
    --muted: #4E0300;
    --hairline: rgba(18, 19, 69, 0.12);

    --nav-height: 5.2rem;

    --display: 'Fraunces', Georgia, serif;
    --body: 'Manrope', 'Segoe UI', Tahoma, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body);
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    padding-top: var(--nav-height, 5.2rem);
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: var(--display);
    color: var(--text);
    letter-spacing: -0.01em;
}

a {
    color: inherit;
}

/* ---------- Top nav ---------- */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.9rem 1.75rem;
    background: #000;
    box-shadow: 0 12px 28px rgba(18, 19, 69, 0.22);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 0;
    background: none;
    cursor: pointer;
    font: inherit;
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.25rem;
    color: #fff;
    letter-spacing: -0.01em;
}

.nav-brand .mark {
    width: 2.1rem;
    height: 2.1rem;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.nav-link {
    border: 2px solid transparent;
    background: none;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    color: #fff;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

/* ---------- Layout shell ---------- */

.tab-container {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: rise 0.35s ease both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bubble {
    background: var(--bubble);
    color: var(--text);
    border-radius: 1.5rem;
    padding: 2.25rem;
    box-shadow: 0 18px 40px rgba(18, 19, 69, 0.28);
}

.page-head {
    text-align: center;
    color: #fff;
    margin-bottom: 1.75rem;
}

.page-head .eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0.6rem;
}

.page-head h1,
.page-head h2 {
    color: #fff;
    font-size: 2.4rem;
}

.page-head p {
    max-width: 40rem;
    margin: 0.65rem auto 0;
    color: rgba(255, 255, 255, 0.85);
}

.divider {
    display: flex;
    justify-content: center;
    margin: 0;
    color: var(--gold);
}

.divider img {
    width: auto;
    height: auto;
    max-width: min(90%, 640px);
    max-height: 100px;
    display: block;
}

/* ---------- Home ---------- */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2.5rem;
    overflow: hidden;
}

.hero-mask {
    position: absolute;
    right: -3rem;
    top: -3rem;
    width: 16rem;
    height: 16rem;
    opacity: 0.06;
    pointer-events: none;
}

.hero-text {
    flex: 0 1 34rem;
    max-width: 34rem;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.hero-text .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold-deep);
    margin-bottom: 0.6rem;
    display: block;
}

.hero-text h1 {
    font-size: 2.6rem;
    line-height: 1.1;
    margin-bottom: 0.9rem;
}

.hero-text p {
    color: var(--muted);
    font-size: 1.05rem;
    margin-bottom: 0.9rem;
    max-width: 34rem;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.cta-button {
    display: inline-block;
    border: 0;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 0.8rem 1.3rem;
    border-radius: 0.8rem;
    background: var(--bg);
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(59, 64, 143, 0.35);
}

.cta-button.gold {
    background: var(--gold);
    color: var(--gold-text);
}

.cta-button.red {
    background: var(--red);
    color: #fff;
}

.cta-button.outline {
    background: transparent;
    color: var(--text);
    border: 2px solid var(--hairline);
}

.hero-figure {
    flex: 0 1 420px;
    width: 420px;
    max-width: 420px;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.hero-slideshow {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 1.1rem;
    overflow: hidden;
    box-shadow: 0 14px 30px rgba(18, 19, 69, 0.22);
}

.hero-slideshow .admin-upload {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    margin: 0;
    border-radius: 0;
    opacity: 0;
    transition: opacity 1.1s ease;
    z-index: 1;
}

.hero-slideshow .admin-upload.active {
    opacity: 1;
    z-index: 2;
}

.admin-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 1.1rem;
    border: 2px dashed var(--hairline);
    background: repeating-linear-gradient(135deg, rgba(59,64,143,0.03) 0 10px, rgba(59,64,143,0.06) 10px 20px);
    color: var(--muted);
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 1rem;
}

.admin-upload .icon {
    width: 1.6rem;
    height: 1.6rem;
    opacity: 0.6;
}

.admin-upload.has-photo {
    display: block;
    padding: 0;
    border: none;
    background: none;
    overflow: hidden;
}

.admin-upload.has-photo img,
.admin-upload.has-photo video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.section-block {
    margin-top: 2.5rem;
}

.section-block > h2 {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
}

.section-block > .lede {
    color: var(--muted);
    margin-bottom: 1.25rem;
    max-width: 42rem;
}

.gallery-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.75rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.gallery-grid .admin-upload {
    flex: 0 0 auto;
    width: 400px;
    height: 300px;
    aspect-ratio: 4 / 3;
    scroll-snap-align: start;
}

.gallery-grid .admin-upload.has-photo img {
    object-fit: cover;
}

/* ---------- Photo Gallery page ---------- */

.photo-gallery {
    /* This is the target row height the justified-layout script aims
       for. It's read from JS via getComputedStyle, and overridden at
       the mobile breakpoint below — so the two stay in sync from one
       place instead of duplicating a pixel value in the script. */
    --gallery-row-height: 220px;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.gallery-item {
    /* Fallback size before JS measures the container and lays out
       real justified rows (also the size used if JS ever fails). */
    height: var(--gallery-row-height);
    width: calc(var(--gallery-row-height) * 4 / 3);
    border: 0;
    padding: 0;
    background: repeating-linear-gradient(135deg, rgba(59,64,143,0.03) 0 10px, rgba(59,64,143,0.06) 10px 20px);
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    display: block;
    box-shadow: 0 6px 16px rgba(18, 19, 69, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(18, 19, 69, 0.2);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-empty {
    color: var(--muted);
    font-style: italic;
}

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(20, 6, 5, 0.86);
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.lightbox-overlay.open {
    display: flex;
}

.lightbox-box {
    background: var(--bubble);
    border-radius: 1.25rem;
    max-width: min(760px, 100%);
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    position: relative;
}

.lightbox-box img {
    width: 100%;
    max-height: 65vh;
    object-fit: contain;
    background: #111;
    display: block;
}

.lightbox-caption {
    padding: 1.25rem 1.5rem;
}

.lightbox-caption p {
    color: var(--muted);
}

.lightbox-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: 0;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover { background: rgba(0,0,0,0.75); }

/* ---------- Sign-up form ---------- */

.join-panel {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

.join-copy h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.join-copy p {
    color: var(--muted);
    margin-bottom: 0.9rem;
}

.join-copy ul {
    padding-left: 1.15rem;
    color: var(--muted);
}

.join-copy li {
    margin-bottom: 0.4rem;
}

.signup-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    background: rgba(59, 64, 143, 0.04);
    border: 1px solid var(--hairline);
    border-radius: 1.1rem;
    padding: 1.5rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-row label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.form-row input,
.form-row select,
.form-row textarea {
    font: inherit;
    padding: 0.7rem 0.85rem;
    border-radius: 0.6rem;
    border: 1.5px solid var(--hairline);
    background: #fff;
    color: var(--text);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: 2px solid var(--bg);
    outline-offset: 1px;
    border-color: var(--bg);
}

.form-row textarea {
    resize: vertical;
    min-height: 5rem;
}

.signup-form .cta-button {
    align-self: flex-start;
}

.form-embed {
    background: rgba(59, 64, 143, 0.04);
    border: 1px solid var(--hairline);
    border-radius: 1.1rem;
    padding: 0.75rem;
    margin-top: 1rem;
}

.form-embed iframe {
    width: 100%;
    height: 600px;
    border: 0;
    border-radius: 0.7rem;
    background: #fff;
    display: block;
}

.form-fallback {
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.6rem;
}

.form-fallback a {
    color: var(--bg);
    font-weight: 700;
    text-decoration: underline;
}

/* ---------- What We Do ---------- */

.offer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.offer-card {
    border: 1px solid var(--hairline);
    border-radius: 1.1rem;
    padding: 1.5rem;
    background: rgba(59, 64, 143, 0.03);
}

.offer-card .num {
    font-family: var(--display);
    font-size: 1.6rem;
    color: var(--gold-deep);
    margin-bottom: 0.4rem;
    display: block;
}

.offer-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.offer-card p {
    color: var(--muted);
    font-size: 0.95rem;
}

.performance-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2rem;
    margin-top: 1rem;
}

.performance-text {
    flex: 1 1 0;
    min-width: 200px;
}

.performance-text h2 {
    margin-bottom: 0.4rem;
}

.performance-media {
    flex: 0 0 640px;
    max-width: 100%;
}

.performance-media .admin-upload {
    width: 640px;
    max-width: 100%;
    aspect-ratio: 16 / 9;
}

/* ---------- Timelines (Upcoming & Past Events) ---------- */

.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    padding-left: 0.25rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 1.85rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: var(--hairline);
}

.timeline-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.timeline-marker {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 3.7rem;
    height: 3.7rem;
    border-radius: 50%;
    background: var(--bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 6px 14px rgba(18, 19, 69, 0.18);
}

.timeline-item.upcoming .timeline-marker {
    background: var(--gold);
    color: var(--gold-text);
}

/* Past events checkmarks use the gold accent instead of the red bg color */
[data-panel="past"] .timeline-marker {
    background: var(--gold);
    color: var(--gold-text);
}

.timeline-content {
    flex: 1;
    padding-bottom: 0.2rem;
}

.timeline-content h3 {
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}

.timeline-meta {
    font-weight: 700;
    color: var(--gold-deep);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.timeline-content p {
    color: var(--muted);
    font-size: 0.95rem;
}

.events-loading,
.events-empty {
    color: var(--muted);
    font-style: italic;
}

.year-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.year-tab {
    border: 2px solid var(--hairline);
    background: none;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text);
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.year-tab:hover {
    background: rgba(59, 64, 143, 0.06);
}

.year-tab.active {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.past-event-card {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.past-event-card .admin-upload {
    flex: 0 0 200px;
    aspect-ratio: 4 / 3;
    border-radius: 0.9rem;
}

/* ---------- Leaders & Members ---------- */

.roster-group {
    margin-top: 2rem;
}

.roster-group h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.roster-group h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--hairline);
}

.roster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}

.member-card {
    text-align: center;
}

.member-card .admin-upload {
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.member-card h3 {
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.member-card p {
    color: var(--gold-deep);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.name-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.name-chip {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    background: rgba(59, 64, 143, 0.06);
    border: 1px solid var(--hairline);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.alumni-note {
    margin-top: -0.4rem;
    margin-bottom: 1.25rem;
    font-style: italic;
}

.alumni-card {
    padding: 1.1rem 0.5rem;
    border-radius: 1rem;
    background: rgba(59, 64, 143, 0.04);
    border: 1px dashed var(--hairline);
}

.alumni-card h3 {
    color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem 1.75rem;
    padding: 1rem 1rem 3rem;
    color: rgba(255, 255, 255, 0.85);
}

.site-footer a {
    text-decoration: none;
    font-weight: 700;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .join-panel {
        grid-template-columns: 1fr;
    }

    .offer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero {
        flex-direction: column;
        text-align: center;
    }

    .hero-text {
        max-width: 100%;
        width: 100%;
    }

    .hero-figure {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }

    .hero-text p {
        margin-left: auto;
        margin-right: auto;
    }

    .button-row {
        justify-content: center;
    }
}

@media (max-width: 700px) {
    .top-nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .offer-grid {
        grid-template-columns: 1fr;
    }

    .nav-links {
        width: 100%;
    }

    .nav-link {
        flex: 1 1 calc(33.33% - 0.35rem);
        text-align: center;
        padding: 0.55rem 0.4rem;
    }

    .bubble {
        padding: 1.5rem;
    }

    .page-head h1,
    .page-head h2 {
        font-size: 1.9rem;
    }

    .past-event-card {
        flex-direction: column;
        text-align: center;
    }

    .past-event-card .admin-upload {
        flex: none;
        width: 9rem;
    }

    .photo-gallery {
        --gallery-row-height: 150px;
    }
}