:root {
    --metrobus-purple: #4c466f;
    --metrobus-purple-dark: #373250;
    --metrobus-purple-light: #f1f0f6;
    --metrobus-green: #81b34f;
    --metrobus-green-dark: #5d8d31;
    --page-background: #f4f5f7;
    --surface: #ffffff;
    --text: #23242a;
    --muted: #656872;
    --border: #dfe1e6;
    --row-alt: #f8f8fa;
    --row-hover: #eef5e9;
    --shadow: 0 12px 32px rgba(41, 38, 59, 0.10);
}

html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    min-height: 100%;
    margin-bottom: 60px;
    background: var(--page-background);
    color: var(--text);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.schedule-page {
    width: min(1440px, calc(100% - 2rem));
    margin: 2rem auto 4rem;
}

.schedule-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border-radius: 1.25rem;
    background: radial-gradient(circle at top right, rgba(129, 179, 79, 0.30), transparent 34%), linear-gradient(135deg, var(--metrobus-purple-dark), var(--metrobus-purple));
    box-shadow: var(--shadow);
    color: #fff;
}

    .schedule-hero::after {
        content: "";
        position: absolute;
        right: -4rem;
        bottom: -6rem;
        width: 16rem;
        height: 16rem;
        border: 2rem solid rgba(255, 255, 255, 0.05);
        border-radius: 50%;
        pointer-events: none;
    }

.schedule-hero__main {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: clamp(1.25rem, 3vw, 2.25rem);
}

.route-number {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    min-width: 5rem;
    height: 5rem;
    padding: 0 0.85rem;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    color: #fff;
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 850;
    line-height: 1;
}

.route-heading {
    min-width: 0;
}

.route-kicker {
    margin: 0 0 0.2rem;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.route-heading h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.7rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.08;
}

.schedule-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.55rem;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.96rem;
}

.schedule-controls {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    padding: 1rem clamp(1.25rem, 3vw, 2.25rem) 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(20, 18, 33, 0.16);
    backdrop-filter: blur(4px);
}

.control-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.control-label {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.segmented-control {
    display: inline-flex;
    overflow: hidden;
    padding: 0.2rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.11);
}

.schedule-option {
    padding: 0.48rem 0.8rem;
    border-radius: 0.55rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

    .schedule-option:hover {
        background: rgba(255, 255, 255, 0.16);
        color: #fff;
    }

    .schedule-option:focus-visible {
        outline: 3px solid rgba(255, 255, 255, 0.9);
        outline-offset: 2px;
    }

    .schedule-option.active {
        background: #fff;
        color: var(--metrobus-purple-dark);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
    }

.schedule-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 1.1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.schedule-card__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.schedule-card__eyebrow {
    margin: 0 0 0.15rem;
    color: var(--metrobus-green-dark);
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.schedule-card__header h2 {
    margin: 0;
    color: var(--metrobus-purple-dark);
    font-size: clamp(1.15rem, 2.5vw, 1.55rem);
    font-weight: 800;
}

.schedule-table tbody tr.current-trip > th,
.schedule-table tbody tr.current-trip > td {
    background: #eef7e7;
    box-shadow: inset 0 1px 0 #c9dfb7, inset 0 -1px 0 #c9dfb7;
}

    .schedule-table tbody tr.current-trip > th:first-child {
        position: relative;
        box-shadow: inset 5px 0 0 #81b34f, inset 0 1px 0 #c9dfb7, inset 0 -1px 0 #c9dfb7;
    }

.schedule-table tbody tr.current-trip .departure-time {
    color: #304c1d;
    font-weight: 800;
}

.current-trip-label {
    display: block;
    margin-top: .2rem;
    color: #426621;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1;
    text-transform: uppercase;
}

.scroll-hint {
    display: none;
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.table-scroll {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-color: var(--metrobus-purple) #ececf0;
    scrollbar-width: thin;
}

    .table-scroll:focus-visible {
        outline: 3px solid rgba(76, 70, 111, 0.28);
        outline-offset: -3px;
    }

.schedule-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
}

    .schedule-table th,
    .schedule-table td {
        min-width: 8rem;
        padding: 0.88rem 1rem;
        border-right: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        text-align: center;
        vertical-align: middle;
    }

        .schedule-table th:last-child,
        .schedule-table td:last-child {
            border-right: 0;
        }

    .schedule-table thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--metrobus-purple);
        color: #fff;
        font-size: 0.88rem;
        font-weight: 800;
        line-height: 1.2;
    }

.timepoint-name {
    display: block;
    max-width: 12rem;
    margin: 0 auto;
    white-space: normal;
}

.schedule-table tbody tr:nth-child(even) {
    background: var(--row-alt);
}

.schedule-table tbody tr:hover {
    background: var(--row-hover);
}

.schedule-table tbody tr:last-child th,
.schedule-table tbody tr:last-child td {
    border-bottom: 0;
}

.schedule-table tbody th {
    font-weight: 800;
}

.departure-time {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
}

.no-service {
    color: #9a9ca4;
    font-size: 1.15rem;
}

.next-day-marker {
    margin-left: 0.1rem;
    color: var(--metrobus-green-dark);
    font-size: 0.75em;
    font-weight: 900;
}

.partial-trip {
    background-image: linear-gradient(90deg, rgba(129, 179, 79, 0.06), transparent 35%);
}

.schedule-table .block-column {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 6rem;
    min-width: 6rem;
    max-width: 6rem;
    border-right: 2px solid #cbc8d9;
    box-shadow: 5px 0 10px -8px rgba(31, 28, 48, 0.75);
}

.schedule-table thead .block-column {
    z-index: 5;
    background: var(--metrobus-purple-dark);
    color: #fff;
}

.schedule-table tbody .block-column {
    background: var(--metrobus-purple-light);
    color: var(--metrobus-purple-dark);
}

.schedule-table tbody tr:nth-child(even) .block-column {
    background: #e9e7f0;
}

.schedule-table tbody tr:hover .block-column {
    background: #e1ecd8;
}

.schedule-table tbody tr.current-trip,
.schedule-table tbody tr.current-trip .block-column {
    background: #e7f3dc;
}

.schedule-table tbody tr.current-trip {
    box-shadow: inset 0.3rem 0 0 var(--metrobus-green);
}

.schedule-message {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.schedule-message__icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--metrobus-purple-light);
    color: var(--metrobus-purple);
    font-size: 1.25rem;
    font-weight: 900;
}

.schedule-message h2,
.schedule-message p {
    margin: 0;
}

.schedule-message h2 {
    color: var(--metrobus-purple-dark);
    font-size: 1.15rem;
}

.schedule-message p {
    margin-top: 0.2rem;
    color: var(--muted);
}

.schedule-notes {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    margin-top: 1rem;
    padding: 0 0.25rem;
    color: var(--muted);
    font-size: 0.86rem;
}

    .schedule-notes p {
        margin: 0.2rem 0;
    }

.schedule-note-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
}

@media (max-width: 767.98px) {
    .schedule-page {
        width: min(100% - 1rem, 1440px);
        margin-top: 0.5rem;
    }

    .schedule-hero {
        border-radius: 0.9rem;
    }

    .schedule-hero__main {
        align-items: flex-start;
        gap: 0.85rem;
        padding: 1rem;
    }

    .route-number {
        min-width: 4rem;
        height: 4rem;
        border-radius: 0.8rem;
    }

    .schedule-controls {
        display: grid;
        gap: 0.85rem;
        padding: 0.9rem 1rem 1rem;
    }

    .control-group {
        display: grid;
        gap: 0.35rem;
    }

    .segmented-control {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        width: 100%;
    }

    .schedule-option {
        text-align: center;
    }

    .schedule-card__header {
        align-items: center;
        padding: 0.95rem 1rem;
    }

    .scroll-hint {
        display: block;
    }

    .schedule-table th,
    .schedule-table td {
        min-width: 7.2rem;
        padding: 0.78rem 0.8rem;
    }

    .schedule-table .block-column {
        width: 5.5rem;
        min-width: 5.5rem;
        max-width: 5.5rem;
    }

    .schedule-notes {
        display: block;
        padding: 0 0.15rem;
    }
}

@media print {
    @page {
        size: landscape;
        margin: 0.45in;
    }

    html,
    body {
        background: #fff;
    }

    body {
        margin: 0;
    }

    .schedule-page {
        width: 100%;
        margin: 0;
    }

    .schedule-hero {
        margin-bottom: 0.3in;
        border: 1px solid #888;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
        color: #000;
    }

        .schedule-hero::after,
        .schedule-controls,
        .scroll-hint {
            display: none;
        }

    .schedule-hero__main {
        padding: 0.18in;
    }

    .route-number {
        min-width: 0.6in;
        height: 0.6in;
        border: 0;
        border-radius: 0.08in;
        box-shadow: none;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .route-kicker,
    .schedule-summary {
        color: #444;
    }

    .route-heading h1 {
        color: #000;
    }

    .schedule-card {
        overflow: visible;
        border-radius: 0;
        box-shadow: none;
    }

    .schedule-card__header {
        padding: 0.08in 0.1in;
    }

    .table-scroll {
        overflow: visible;
    }

    .schedule-table {
        min-width: 0;
        font-size: 8.5pt;
    }

        .schedule-table th,
        .schedule-table td {
            min-width: 0;
            padding: 0.07in 0.08in;
        }

        .schedule-table thead th,
        .schedule-table thead .block-column {
            position: static;
            background: var(--metrobus-purple);
            color: #fff;
            print-color-adjust: exact;
            -webkit-print-color-adjust: exact;
        }

        .schedule-table .block-column {
            position: static;
            width: auto;
            min-width: 0;
            max-width: none;
            box-shadow: none;
        }

        .schedule-table tbody .block-column {
            background: var(--metrobus-purple-light);
            print-color-adjust: exact;
            -webkit-print-color-adjust: exact;
        }

    .schedule-notes {
        font-size: 7.5pt;
    }
}
