/* Section program tables - built by script/program.js */

:root {
    --program-text: rgb(26, 65, 111);
    --program-title: rgb(170, 20, 20);
    --program-grid: #555;
    --program-yellow: #fff2cc;
    --program-purple: #d9d9ff;
    --program-green: #d5e8c8;
    --program-blue: #ddebf7;
    --program-next: var(--NSWBlue);
}

#program-print {
    display: none;
}

.program {
    color: var(--program-text);
    margin-bottom: 1.5em;
}

/* Next meeting / next event - a slim strip so the table stays the focus */
.program__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 8px;
    margin: 0.6em 0;
}

.program__cards:empty {
    display: none;
}

.program__card {
    background: #f4f9fc;
    border-left: 5px solid var(--program-next);
    border-radius: 8px;
    padding: 0.4em 0.8em;
}

.program__card--yellow { background: var(--program-yellow); border-left-color: #e0b400; }
.program__card--purple { background: var(--program-purple); border-left-color: var(--scoutsinternation); }
.program__card--green { background: var(--program-green); border-left-color: var(--scoutsdarkgreen); }
.program__card--blue { background: var(--program-blue); border-left-color: var(--NSWMediumBlue); }

.program__card p {
    margin: 0;
}

.program .program__card-heading {
    font-size: 0.7em;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.75;
}

.program .program__card-line {
    line-height: 1.3;
}

.program .program__card-when {
    font-weight: 800;
    margin-right: 0.3em;
}

.program .program__card-activity {
    font-weight: 600;
}

.program .program__card-activity .program__invite {
    display: inline;
    margin-left: 0.3em;
}

.program__tbc {
    font-weight: 400;
    font-style: italic;
    opacity: 0.75;
}

/* Term picker and print button - one compact row */
.program__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 0.6em;
}

.program__nav {
    display: flex;
    align-items: stretch;
    gap: 4px;
    flex: 0 1 auto;
    min-width: 0;
}

.program__picker {
    display: flex;
    min-width: 0;
}

.program__select,
.program__step,
.program__pdf {
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 700;
    min-height: 36px;
    border: 2px solid var(--program-text);
    border-radius: 8px;
    background: #fff;
    color: var(--program-text);
    cursor: pointer;
}

.program__select {
    padding: 0 0.6em;
    min-width: 0;
    max-width: 100%;
}

.program__step {
    width: 36px;
    padding: 0;
}

.program__step:hover:not(:disabled),
.program__select:hover {
    background: #eef4fa;
}

.program__step:disabled {
    opacity: 0.35;
    cursor: default;
}

.program__pdf {
    padding: 0 0.9em;
    border-color: var(--program-title);
    background: var(--program-title);
    color: #fff;
    transition: background-color 0.2s, color 0.2s;
}

.program__pdf:hover {
    background: #fff;
    color: var(--program-title);
}

.program__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Title and progress share one line */
.program__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    column-gap: 1em;
    margin: 0.5em 0 0.4em;
}

.program__title {
    color: var(--program-title);
    text-align: center;
    font-size: 1.35em;
    margin: 0;
}

.program .program__progress {
    font-size: 0.85em;
    margin: 0;
}

.program .program__progress:empty {
    display: none;
}

.program__bar {
    display: inline-block;
    width: 90px;
    height: 7px;
    border-radius: 4px;
    background: #dde5ee;
    vertical-align: middle;
    overflow: hidden;
    margin-right: 6px;
}

.program__bar span {
    display: block;
    height: 100%;
    background: var(--program-next);
}

.program .program__key,
.program .program__empty {
    font-size: 0.85em;
    text-align: center;
    opacity: 0.8;
}

/* The table - laid out like the original program sheets */
.program__table {
    width: 100%;
    border-collapse: collapse;
    border: 3px solid var(--program-grid);
    font-weight: 600;
}

.program__table th,
.program__table td {
    border: 1.5px solid var(--program-grid);
    padding: 0.6em 0.5em;
    text-align: center;
    vertical-align: middle;
}

.program__table thead th {
    border-bottom-width: 3px;
    font-weight: 600;
}

.program__table .program__week {
    width: 3.5em;
}

.program__table .program__date {
    white-space: nowrap;
}

.program__table td.program__activity {
    font-weight: 700;
}

.program__badges img {
    display: inline-block;
    width: 2.6em;
    height: 2.6em;
    object-fit: contain;
    margin: 0 0.15em;
    vertical-align: middle;
}

.program__row--yellow { background: var(--program-yellow); }
.program__row--purple { background: var(--program-purple); }
.program__row--green { background: var(--program-green); }
.program__row--blue { background: var(--program-blue); }

.program__term th {
    background: var(--program-text);
    color: #fff;
    text-align: left;
    padding: 0.4em 0.8em;
}

/* Where we are up to */
.program__row.is-past {
    opacity: 0.45;
}

.program__row.is-next td,
.program__row.is-today td {
    border-top: 3px solid var(--program-next);
    border-bottom: 3px solid var(--program-next);
}

.program__row:not([class*="program__row--"]).is-next,
.program__row:not([class*="program__row--"]).is-today {
    background-color: #e3f4fb;
}

.program__pill {
    display: inline-block;
    background: var(--program-next);
    color: #fff;
    font-size: 0.7em;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 0.2em 0.7em;
    margin-right: 0.5em;
    vertical-align: middle;
}

.program__row.is-today .program__pill {
    background: var(--program-title);
}

/* Phones - each row becomes a card */
@media screen and (max-width: 700px) {
    .program__table,
    .program__table tbody,
    .program__table tr,
    .program__table td {
        display: block;
        border: none;
    }

    .program__table {
        border: none;
    }

    .program__table thead {
        display: none;
    }

    .program__table tr.program__row {
        border: 1.5px solid var(--program-grid);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 0.5em 0.8em;
    }

    .program__table tr.program__term th {
        display: block;
        border-radius: 10px;
        margin: 1em 0 10px;
    }

    .program__table td {
        padding: 0.15em 0;
        text-align: left;
    }

    .program__table td:empty,
    .program__table td.program__week {
        display: none;
    }

    .program__table td.program__date {
        font-size: 0.85em;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .program__table td.program__activity {
        font-size: 1.15em;
    }

    .program__table td[data-label="Duty"]::before,
    .program__table td[data-label="Lead / Assist"]::before,
    .program__table td[data-label="Leader"]::before {
        content: attr(data-label) ": ";
        font-weight: 400;
        opacity: 0.7;
    }

    .program__table tr.program__row.is-next,
    .program__table tr.program__row.is-today {
        border: 3px solid var(--program-next);
    }

    .program__row.is-next td,
    .program__row.is-today td {
        border: none;
    }
}

/* Save as PDF - print only the program sheet */
@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body > *:not(#program-print) {
        display: none !important;
    }

    #program-print {
        display: block;
        font-family: 'Nunito Sans', sans-serif;
        color: var(--program-text);
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #program-print h1 {
        color: var(--program-title);
        text-align: center;
        font-size: 18pt;
        margin: 0 0 4mm;
    }

    /* Group logo top-left, title centred */
    #program-print .program-print__header {
        display: flex;
        align-items: center;
        margin: 0 0 4mm;
    }

    #program-print .program-print__logo,
    #program-print .program-print__spacer {
        flex: 0 0 auto;
        width: 17mm;
    }

    #program-print .program-print__logo {
        height: 24mm;
        object-fit: contain;
    }

    #program-print .program-print__header h1 {
        flex: 1 1 auto;
        margin: 0;
    }

    /* QR code back to the program page */
    #program-print .program-print__footer {
        display: flex;
        align-items: center;
        gap: 4mm;
        margin-top: 4mm;
        break-inside: avoid;
    }

    #program-print .program-print__qr {
        flex: 0 0 24mm;
        width: 24mm;
        height: 24mm;
    }

    #program-print .program-print__qr svg {
        display: block;
        width: 100%;
        height: 100%;
    }

    #program-print .program-print__link {
        display: flex;
        flex-direction: column;
        gap: 1mm;
        font-size: 9pt;
    }

    #program-print .program-print__link strong {
        font-size: 10pt;
    }

    #program-print .program-print__link span:last-child {
        font-size: 8pt;
        opacity: 0.7;
    }

    #program-print .program__table {
        font-size: 10pt;
    }

    #program-print .program__table th,
    #program-print .program__table td {
        padding: 1.6mm 1.5mm;
    }

    #program-print .program__badges img {
        width: 7.5mm;
        height: 7.5mm;
    }

    #program-print .program__ext {
        display: none;
    }

    #program-print .program__invite {
        font-size: 8.5pt;
    }

    #program-print tr {
        break-inside: avoid;
    }

    #program-print .program__row.is-past {
        opacity: 1;
    }

    #program-print .program__row.is-next td,
    #program-print .program__row.is-today td {
        border-top-width: 1.5px;
        border-bottom-width: 1.5px;
        border-color: var(--program-grid);
    }

    #program-print .program__row:not([class*="program__row--"]).is-next,
    #program-print .program__row:not([class*="program__row--"]).is-today {
        background: none;
    }

    #program-print .program__pill,
    #program-print .program__empty {
        display: none;
    }
}

/* Activities another section has invited us to */
.program__invite {
    display: block;
    margin-top: 2px;
    font-size: 0.85em;
    font-weight: 600;
    font-style: italic;
}

/* Activity names that link to more information */
.program a.program__link {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--program-next);
    text-underline-offset: 3px;
}

.program a.program__link:hover,
.program a.program__link:focus-visible {
    color: var(--NSWMediumBlue);
}

.program__ext {
    font-size: 0.7em;
    margin-left: 0.2em;
}

#program-print a {
    color: inherit;
    text-decoration: none;
}
