/*
 * Narrowcasting-scherm, ontworpen voor 1920×1080 liggend.
 * De .stage is minimaal 1920×1080 en wordt in JS geschaald zodat hij het hele venster vult;
 * bij een breder of hoger venster groeit vooral de kalender mee.
 * Kleuren en fonts: zie theme.css.
 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-body);
    cursor: none;
    -webkit-font-smoothing: antialiased;
}

.stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    padding: 24px 28px 26px;
    display: grid;
    grid-template-rows: 112px 1fr;
    gap: 24px;
    transform-origin: 0 0;
}

h1, h2, h3 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.05;
}

/* ---------- Header ---------- */
.header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 32px;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 32px;
    min-width: 0;
}

/* Logo: public/images/logo-dcterra.svg */
.logo-slot {
    flex: none;
    width: 330px;
    height: 100px;
    display: flex;
    align-items: center;
}

.logo-slot img {
    max-width: 100%;
    max-height: 100%;
}

.logo-slot.is-missing {
    border: 3px dashed var(--color-border);
    border-radius: var(--radius-sm);
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 22px;
}

.clock {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 12px 36px 12px 40px;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: var(--color-primary-contrast);
}

.clock__time {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 96px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}

.clock__seconds {
    font-size: 44px;
    font-weight: 600;
    opacity: .7;
    margin-left: 6px;
}

.clock__date {
    font-size: 36px;
    font-weight: 500;
    line-height: 1.15;
    max-width: 360px;
}

.simulated-badge {
    position: absolute;
    left: 48px;
    bottom: 8px;
    font-size: 18px;
    padding: 2px 14px;
    border-radius: var(--radius-pill);
    background: var(--color-magenta);
    color: #fff;
}

.offline-badge {
    position: absolute;
    right: 48px;
    bottom: 8px;
    font-size: 18px;
    color: var(--color-text-muted);
}

/* ---------- Layout ---------- */
.main {
    display: grid;
    grid-template-columns: 590px 1fr;
    gap: 22px;
    min-height: 0;
}

.panel {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 22px 24px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .04);
}

.panel__title {
    font-size: 44px;
    color: var(--color-primary);
}

.panel__subtitle {
    margin-top: 4px;
    font-size: 26px;
    color: var(--color-text-muted);
}

/* ---------- Rooster ---------- */
.schedule {
    --row-scale: 1;
    margin-top: 20px;
    flex: 1;
    display: grid;
    /* Rows share the height, but never grow taller than 96px when only a few lessons are planned. */
    grid-auto-rows: minmax(0, 96px);
    align-content: start;
    gap: 8px;
    min-height: 0;
}

.schedule__empty {
    grid-row: span 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 44px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.lesson {
    display: grid;
    grid-template-columns: 40px 146px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    min-height: 0;
    overflow: hidden;
    transition: background-color .4s, color .4s, opacity .4s;
}

.lesson__period {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: calc(40px * var(--row-scale));
    color: var(--color-primary);
}

.lesson__time {
    white-space: nowrap;
    font-size: calc(25px * var(--row-scale));
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
}

.lesson__body {
    min-width: 0;
}

.lesson__title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: calc(36px * var(--row-scale));
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson__title.is-empty {
    color: var(--color-border);
    font-weight: 500;
}

.lesson__note {
    font-size: calc(23px * var(--row-scale));
    line-height: 1.2;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson--break {
    background: var(--color-break);
}

.lesson--break .lesson__period {
    font-size: calc(28px * var(--row-scale));
    color: var(--color-green);
}

.lesson--break .lesson__title {
    font-size: calc(30px * var(--row-scale));
    color: var(--color-green);
}

.lesson.is-past {
    opacity: .5;
}

.lesson.is-current {
    background: var(--color-current);
    color: var(--color-current-contrast);
    box-shadow: inset 10px 0 0 var(--color-accent);
    transform: scale(1.015);
}

.lesson.is-current .lesson__period,
.lesson.is-current .lesson__time,
.lesson.is-current .lesson__note,
.lesson.is-current .lesson__title {
    color: inherit;
}

.lesson.is-current .lesson__note {
    opacity: .85;
}

/* ---------- Kalender ---------- */
.calendar-panel__head {
    display: flex;
    align-items: baseline;
    gap: 24px;
    min-width: 0;
}

.calendar-panel__head .panel__title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.calendar-panel__dates {
    flex: none;
    font-size: 26px;
    color: var(--color-text-muted);
}

.legend {
    margin-top: 10px;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px 28px;
    font-size: 21px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
}

.legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend__swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.legend__swatch--today {
    background: var(--color-today);
    border: 3px solid var(--color-today-border);
}

.legend__swatch--holiday {
    background: var(--color-holiday);
    border-color: var(--color-holiday-text);
}

.legend__swatch--weekend {
    background: var(--color-weekend);
}

.legend__swatch--special {
    background: linear-gradient(90deg, var(--color-magenta) 0 30%, var(--color-surface) 30%);
}

.calendar {
    --rows: 6;
    margin-top: 14px;
    flex: 1;
    min-height: 0;
    display: grid;
    /* Week number, 5 school days, 2 narrower weekend days. */
    grid-template-columns: 40px repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .72fr));
    grid-template-rows: 32px repeat(var(--rows), minmax(0, 1fr));
    gap: 5px;
    /* --cell-font is set by JS: smaller when the unit has many weeks. */
    font-size: var(--cell-font, 26px);
}

.calendar__dow {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 24px;
    text-align: center;
    color: var(--color-primary);
    align-self: end;
}

.calendar__dow.is-weekend {
    color: var(--color-text-muted);
}

.calendar__week {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95em;
    font-weight: 600;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.day {
    position: relative;
    min-height: 0;
    overflow: hidden;
    padding: 3px 7px;
    border-radius: 10px;
    background: var(--color-surface-muted);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.day__labels {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.day__number {
    font-weight: 700;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.day__month {
    font-weight: 500;
    font-size: .7em;
    margin-left: 6px;
    color: var(--color-text-muted);
}

.day--weekend {
    background: var(--color-weekend);
    color: var(--color-text-muted);
}

.day--outside {
    background: transparent;
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--color-border) 45%, transparent);
    color: var(--color-border);
}

.day--holiday {
    background: var(--color-holiday);
    color: var(--color-holiday-text);
}

.day--past {
    opacity: .55;
}

.day--today {
    background: var(--color-today);
    box-shadow: inset 0 0 0 5px var(--color-today-border), 0 6px 16px rgba(0, 79, 132, .3);
    padding: 4px 10px;
    color: var(--color-accent-contrast);
    opacity: 1;
}

.day__label,
.special {
    display: block;
    font-size: .78em;
    line-height: 1.22;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.day__label {
    font-weight: 700;
}

.special {
    padding: 0 5px;
    border-radius: 5px;
    font-weight: 600;
    /* Wrap onto --chip-lines lines (set by JS from the row height), then ellipsis. */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--chip-lines, 1);
    line-clamp: var(--chip-lines, 1);
    white-space: normal;
    overflow-wrap: break-word;
    hyphens: auto; /* Dutch hyphenation (html lang="nl"): "Sinterklaas-viering" */
}

/* ---------- Teller (in de header) ---------- */
.counter {
    grid-column: 2;
    justify-self: center;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 40px;
    border-radius: var(--radius);
    background: var(--color-green);
    color: #fff;
    font-size: 30px;
    font-weight: 500;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
}

.counter__line {
    overflow: hidden;
    text-overflow: ellipsis;
}

.counter__number {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 48px;
    line-height: 1;
    color: var(--color-accent);
}

.counter__unit {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 34px;
}

.counter--last {
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 56px;
    padding: 14px 56px;
}

.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 56px;
    font-weight: 600;
    color: var(--color-text-muted);
}

[hidden] {
    display: none !important;
}
