/* Timetable page (timetable.js). The search box and the "not drawn yet" cards
   come from slots.css; the hero, header and footer from styles.css. */

.tt-eyebrow {
    font-family: var(--font-accent);
    color: var(--iro-sand-light);
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.tt-hero .competition-info h2 {
    margin-bottom: 0.75rem;
}

.tt-lead {
    color: rgb(255 255 255 / 0.8);
    font-size: 1.05rem;
    max-width: 44rem;
}

/* --- controls ----------------------------------------------------------- */
.tt-controls {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.tt-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    gap: 0.75rem;
}

.tt-tab {
    --slot-color: var(--accent-color);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.6rem;
    align-items: center;
    text-align: left;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-bottom: 4px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tt-tab i {
    grid-row: 1 / span 2;
    font-size: 1.5rem;
    color: var(--slot-color);
}

.tt-tab-name {
    font-weight: 700;
    line-height: 1.2;
}

.tt-tab-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tt-tab:hover {
    box-shadow: var(--shadow-md);
}

.tt-tab.is-active {
    border-color: var(--slot-color);
    border-bottom-color: var(--slot-color);
    box-shadow: var(--shadow-md);
}

.tt-tab:focus-visible,
.tt-day:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.tt-days {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tt-day {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tt-day:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tt-day.is-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

[data-theme="dark"] .tt-day.is-active {
    color: var(--bg-primary);
}

.tt-today {
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--error-color);
    margin-left: 0.2rem;
}

.tt-day.is-active .tt-today {
    color: inherit;
    opacity: 0.85;
}

.tt-controls .finder-status {
    margin: 0;
}

.tt-controls .finder-status:empty {
    display: none;
}

/* --- the board ---------------------------------------------------------- */
.tt-board {
    margin-bottom: 1.5rem;
}

.tt-loading {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
}

.tt-predraw {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tt-predraw i {
    color: var(--accent-color);
    margin-top: 0.15rem;
}

/* By slot: one grid row per slot. Columns are set from the number of phases
   (2 for most disciplines, 4 for water) so the same rule draws every tab. */
.tt-table {
    --slot-color: var(--accent-color);
    --tt-columns: 6rem repeat(var(--tt-phases), minmax(7.5rem, 1fr)) minmax(13rem, 1.7fr);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.tt-table.no-holders {
    --tt-columns: 6rem repeat(var(--tt-phases), minmax(7.5rem, 1fr));
}

.tt-row {
    display: grid;
    grid-template-columns: var(--tt-columns);
    gap: 0.75rem;
    align-items: center;
    padding: 0.6rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.tt-row:nth-child(even) {
    background: var(--bg-secondary);
}

.tt-head {
    border-top: none;
    background: var(--table-head) !important;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.tt-head abbr,
.tt-agenda-phase abbr {
    text-decoration: none;
    font-size: 0.7rem;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 0 0.3rem;
    margin-left: 0.2rem;
    opacity: 0.75;
}

.tt-slot {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    border-left: 4px solid var(--slot-color);
    padding-left: 0.6rem;
}

.tt-when {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.tt-when strong {
    color: var(--text-primary);
}

.tt-holder {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.tt-holder strong {
    color: var(--text-primary);
}

.tt-holder span,
.tt-holder small {
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.tt-free {
    color: var(--text-muted);
}

.tt-board mark {
    background: rgb(181 162 114 / 0.35);
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}

/* By day: the agenda of one discipline on one day, in time order. */
.tt-agenda {
    --slot-color: var(--accent-color);
    list-style: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.tt-agenda-item {
    display: grid;
    grid-template-columns: 4.5rem minmax(9rem, 1fr) 6rem minmax(12rem, 2fr);
    gap: 0.75rem;
    align-items: center;
    padding: 0.6rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.tt-agenda-item:first-child {
    border-top: none;
}

.tt-agenda-item:nth-child(even) {
    background: var(--bg-secondary);
}

.tt-agenda-time {
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.tt-agenda-phase {
    color: var(--text-secondary);
    font-weight: 600;
}

.tt-undrawn {
    margin-top: 1.25rem;
}

.tt-undrawn h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tt-notes {
    margin-bottom: 2rem;
    padding: 0.9rem 1.1rem;
    border-left: 4px solid var(--accent-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.tt-notes i {
    color: var(--accent-color);
}

/* --- programme ---------------------------------------------------------- */
.tt-programme {
    margin: 2.5rem 0 3rem;
}

.tt-programme h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.tt-programme h3 i {
    color: var(--accent-color);
}

.tt-programme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.tt-day-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.25rem;
}

.tt-day-card h4 {
    font-family: var(--font-accent);
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.tt-day-card ul {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.tt-day-card li {
    display: grid;
    grid-template-columns: 6.75rem 1fr;
    gap: 0.75rem;
    color: var(--text-primary);
}

.tt-day-card time {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-top: 0.05rem;
}

.tt-day-card li.is-key span {
    font-weight: 700;
}

.tt-day-card small {
    display: block;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.8rem;
}

.tt-programme-more {
    margin-top: 1rem;
    color: var(--text-secondary);
}

.tt-programme-more a {
    color: var(--primary-color);
    font-weight: 600;
}

/* --- phones ------------------------------------------------------------- */
/* The grid stops being a table: each slot becomes a small card, the slot and
   its handler on top, the phases underneath with their label in front, since
   there is no header row to read it from. */
@media (max-width: 720px) {
    .tt-head {
        display: none;
    }

    .tt-row {
        grid-template-columns: auto 1fr;
        gap: 0.35rem 0.75rem;
        padding: 0.75rem 1rem;
    }

    .tt-row .tt-slot {
        grid-column: 1;
    }

    .tt-row .tt-holder,
    .tt-row .tt-free {
        grid-column: 2;
        grid-row: 1;
    }

    .tt-row .tt-when {
        grid-column: 1 / -1;
        display: flex;
        gap: 0.4rem;
        font-size: 0.9rem;
    }

    .tt-row .tt-when::before {
        content: attr(data-label);
        flex: 1;
        color: var(--text-muted);
    }

    .tt-agenda-item {
        grid-template-columns: 3.75rem auto 1fr;
        gap: 0.25rem 0.6rem;
        padding: 0.7rem 1rem;
    }

    .tt-agenda-item .tt-agenda-time {
        grid-row: 1 / span 2;
    }

    .tt-agenda-item .tt-holder,
    .tt-agenda-item .tt-free {
        grid-column: 2 / -1;
    }

    .tt-tabs {
        grid-template-columns: 1fr 1fr;
    }

    .tt-tab {
        padding: 0.6rem 0.75rem;
    }

    .tt-day-card li {
        grid-template-columns: 5.75rem 1fr;
    }

    .tt-programme-grid {
        grid-template-columns: 1fr;
    }
}
