:root {
    --forest: #256f4a;
    --moss: #e6ede6;
    --bark: #3b3b28;
    --cream: #f9fbf9;
    --stone: #d9e2d9;
    --text: #0f172a;
    --highlight: #cde5ce;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    height: auto;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    font-family: system-ui, sans-serif;
    line-height: 1.6;
    background: var(--cream);
    color: var(--text);
    overflow-x: hidden;
    overflow-y: auto;
}

header {
    background: var(--forest) url('./assets/banner.jpg') center 55%/cover no-repeat;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    height: 250px;
    display: flex;
    align-items: flex-end;
    background-attachment: scroll;
    flex-shrink: 0;
    position: sticky;
    top: -180px;
    /* Equal to the height difference between header and portal-container */

}

/* Header bar */
.portal-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.75);
    height: 70px;
    position: sticky;
    top: 0;
    height: 70px;
}

/* New inner row that matches <main>'s responsive padding */
.portal-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-left: 10rem;
    padding-right: 10rem;
    max-width: 100%;
}

nav.menu a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    margin-right: 1rem;
    padding: 0.25rem 0.5rem;
    border-bottom: 2px solid transparent;
}

nav.menu a.active {
    border-bottom-color: #fff;
}

.portal-btn {
    display: inline-block;
    background: transparent;
    border: 2px solid #fff;
    border-radius: 6px;
    padding: .5rem 1rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.portal-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

main {
    flex: 1 1 auto;
    padding: 2rem 10rem;
}

h1,
h2 {
    color: var(--forest);
}

section {
    margin-bottom: 3rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    border: 1px solid var(--stone);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

th,
td {
    border: 1px solid var(--stone);
    padding: 0.75rem;
    text-align: left;
}

th {
    background: var(--moss);
    color: var(--bark);
    font-weight: 700;
}

tr:nth-child(even) {
    background: #fff;
}

tr:nth-child(odd) {
    background: var(--cream);
}

.committee-block {
    background: var(--highlight);
    border: 1px solid var(--stone);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.committee-block h3 {
    margin-top: 0;
    color: var(--forest);
}

footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    border-top: 1px solid var(--stone);
    padding: 0rem 1rem;
    color: #475569;
    font-size: 0.9rem;
    background: #f1f5f1;
    flex-shrink: 0;
}

/* ===== Calendar iframe sizing: responsive and capped on wide screens ===== */
.calendar-embed {
    width: 100%;
    max-width: 100%;
    border: 1px solid #777;
}

.calendar-embed iframe {
    width: 100%;
    height: min(75vh, 900px);
    border: 0;
    display: block;
}

@media (max-width: 600px) {
    .calendar-embed iframe {
        height: 85vh;
    }
}

/* ===== iCal link styling ===== */
.ical-card {
    margin-top: 1rem;
    background: #f8faf8;
    border: 1px solid var(--stone);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.ical-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.ical-label {
    font-weight: 600;
    color: var(--forest);
    margin: 0;
}

.link-box {
    flex: 1 1 420px;
    background: #eef3ee;
    border: 1px dashed var(--stone);
    border-radius: 8px;
    padding: .5rem .75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: .9rem;
    word-break: break-all;
    overflow: auto;
    max-height: 5.5rem;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--forest);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: .55rem .9rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-copy:hover {
    filter: brightness(.95);
}

.copy-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
}

.copied {
    color: var(--forest);
    font-weight: 600;
    margin-left: .5rem;
    display: none;
}

/* Match <main>'s responsive paddings */
@media (max-width: 1400px) {
    main {
        padding: 2rem 7rem;
    }

    .portal-inner {
        padding-left: 7rem;
        padding-right: 7rem;
    }
}

@media (max-width: 1100px) {
    main {
        padding: 2rem 4rem;
    }

    .portal-inner {
        padding-left: 4rem;
        padding-right: 4rem;
    }
}

@media (max-width: 780px) {
    main {
        padding: 1.25rem 1rem;
    }

    .portal-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #month-calendar {
        display: none;
    }

    #schedule-calendar {
        display: block;
    }
}

@media (min-width: 780px) {
    #month-calendar {
        display: block;
    }

    #schedule-calendar {
        display: none;
    }
}

@media (max-width: 520px) {

    /* Stack only tables that do NOT opt out */
    table:not(.no-mobile-stack),
    table:not(.no-mobile-stack) thead,
    table:not(.no-mobile-stack) tbody,
    table:not(.no-mobile-stack) th,
    table:not(.no-mobile-stack) td,
    table:not(.no-mobile-stack) tr {
        display: block;
    }

    /* Hide headers accessibly only for stacked tables */
    table:not(.no-mobile-stack) thead {
        position: absolute !important;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        border: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    table:not(.no-mobile-stack) tr {
        margin-bottom: .75rem;
        background: #fff;
    }

    table:not(.no-mobile-stack) td {
        border: none;
        border-bottom: 1px solid var(--stone);
        padding: .5rem .75rem;
    }

    table:not(.no-mobile-stack) td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--bark);
        display: block;
        margin-bottom: .25rem;
    }

    /* Make sure opt-out tables show normally and have no label chips */
    table.no-mobile-stack {
        display: table !important;
    }

    table.no-mobile-stack thead {
        display: table-header-group !important;
        position: static !important;
        width: auto;
        height: auto;
        clip: auto;
        clip-path: none;
        white-space: normal;
    }

    table.no-mobile-stack tbody {
        display: table-row-group !important;
    }

    table.no-mobile-stack tr {
        display: table-row !important;
        margin: 0 !important;
    }

    table.no-mobile-stack th,
    table.no-mobile-stack td {
        display: table-cell !important;
        padding: .75rem !important;
    }

    table.no-mobile-stack td::before {
        content: none !important;
    }
}

/* Contests two-column layout */
.contests-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1rem 0;
}

/* Left menu */
.contests-menu {
    min-width: 200px;
    /* menu column width on wide screens */
    max-width: 260px;
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #ffffff;
    /* adjust to suit your theme */
    border: 1px solid #e6e9ee;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

/* Menu buttons */
.contests-menu .menu-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.98rem;
    color: inherit;
}

.contests-menu .menu-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.contests-menu .menu-item.active {
    background: #256f4a;
    /* your brand color */
    color: #fff;
    font-weight: 600;
}

/* Right content */
.contests-content {
    flex: 1 1 auto;
    min-width: 0;
    background: #fff;
    border: 1px solid #e6e9ee;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

/* Small screen: stack menu above content */
@media (max-width: 760px) {
    .contests-layout {
        flex-direction: column;
    }

    .contests-menu {
        flex: none;
        width: 100%;
        max-width: none;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .contests-menu .menu-item {
        white-space: nowrap;
        flex: 0 0 auto;
    }
}