/* Display screen (TV). Own design, independent of the light/dark theme of the site.
   Sizes use vw/vh so the screen looks the same on any TV resolution. */

:root {
    --wine: #51101c;
    --wine-deep: #2a0910;
    --burgundy: #9e2a40;
    --cream: #f7f2e6;
    --blue: #a9cdec;
    --text: #fbf5ee;
    --muted: rgb(251 245 238 / 0.7);
    --card: rgb(255 255 255 / 0.07);
    --card-border: rgb(255 255 255 / 0.14);
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.screen {
    background:
        radial-gradient(circle at 88% 8%, rgb(169 205 236 / 0.16), transparent 38%),
        linear-gradient(135deg, var(--wine-deep) 0%, var(--wine) 45%, var(--burgundy) 100%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: clamp(14px, 1.15vw, 34px);
    line-height: 1.35;
    overflow: hidden;
}
.no-js body.screen { overflow: auto; }
.screen.hide-cursor { cursor: none; }
.icon { width: 1.1em; height: 1.1em; vertical-align: -0.15em; flex-shrink: 0; }
h1, h2, p { margin: 0; }

.screen-app { display: flex; flex-direction: column; height: 100vh; padding: 2.2vh 2.6vw 1.6vh; gap: 2vh; }
.no-js .screen-app { height: auto; }

/* Top bar: logo, name, clock */
.screen-top { display: flex; align-items: center; justify-content: space-between; gap: 2vw; }
.screen-brand { display: flex; align-items: center; gap: 1.2vw; }
.screen-brand img { width: 4.2vw; height: 4.2vw; min-width: 48px; min-height: 48px; border-radius: 12%; box-shadow: 0 0.4vw 1.6vw rgb(0 0 0 / 0.35); }
.screen-site { font-family: var(--font-serif); font-weight: 700; font-size: 1.7em; line-height: 1.1; }
.screen-school { color: var(--blue); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75em; font-weight: 700; }
.screen-clock { text-align: right; display: flex; flex-direction: column; }
.screen-time { font-size: 2.6em; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.screen-date { color: var(--muted); }
.screen-date::first-letter { text-transform: uppercase; }

/* Slides */
.screen-slides { position: relative; flex: 1; min-height: 0; }
.js .screen-slide {
    position: absolute; inset: 0; opacity: 0; visibility: hidden;
    transform: translateX(3vw); transition: opacity 700ms ease, transform 700ms ease, visibility 0s 700ms;
}
.js .screen-slide.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity 700ms ease, transform 700ms ease; }
.no-js .screen-slide { margin-bottom: 4vh; }
.screen-heading { display: flex; align-items: center; gap: 0.6vw; font-size: 1.8em; margin-bottom: 1.6vh; }
.screen-heading::first-letter { text-transform: uppercase; }
.screen-muted { color: var(--muted); }

/* Week + next event */
.screen-week-layout { display: grid; grid-template-columns: minmax(0, 2.35fr) minmax(0, 1fr); gap: 1.8vw; height: 100%; }
.screen-week { display: flex; flex-direction: column; min-height: 0; }
.screen-days { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.8vw; }
.screen-day { background: var(--card); border: 1px solid var(--card-border); border-radius: 1vw; padding: 1vh 0.6vw; display: flex; flex-direction: column; gap: 0.8vh; overflow: hidden; }
.screen-day.is-today { background: rgb(255 255 255 / 0.16); border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
.screen-day.is-past { opacity: 0.5; }
.screen-day-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--card-border); padding-bottom: 0.6vh; margin-bottom: 0.2vh; }
.screen-day-name { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; font-size: 0.85em; color: var(--muted); }
.screen-day.is-today .screen-day-name { color: var(--blue); }
.screen-day-num { font-size: 1.7em; font-weight: 800; }
.screen-day-empty { color: var(--muted); text-align: center; margin-top: 1vh; }
.screen-event { border-left: 0.35vw solid var(--ev); background: rgb(0 0 0 / 0.18); border-radius: 0.5vw; padding: 0.6vh 0.5vw; display: flex; flex-direction: column; }
.screen-event-time { font-size: 0.8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.screen-event-title { font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.screen-event-loc { font-size: 0.78em; color: var(--muted); }
.screen-day-more { font-size: 0.8em; color: var(--muted); }

.screen-next {
    background: var(--cream); color: #2a1a1e; border-radius: 1.4vw; padding: 3vh 2vw;
    display: flex; flex-direction: column; gap: 1.4vh; border-top: 1.2vh solid var(--ev, var(--burgundy));
    box-shadow: 0 1.5vh 4vh rgb(0 0 0 / 0.35); min-height: 0; overflow: hidden;
}
.screen-next-label { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; font-size: 0.85em; color: var(--burgundy); }
.screen-next-when { font-size: 1.6em; font-weight: 800; color: #2f6fa3; }
.screen-next-title { font-family: var(--font-serif); font-size: 2.5em; line-height: 1.1; overflow-wrap: anywhere; }
.screen-next-title.screen-muted { color: #6b5a5e; font-size: 1.5em; }
.screen-next-date { color: #6b5a5e; }
.screen-next-date::first-letter { text-transform: uppercase; }
.screen-next-meta { display: flex; align-items: center; gap: 0.5vw; font-weight: 600; }
.screen-next-text { color: #4a3a3e; border-top: 1px solid #e6ddd0; padding-top: 1.4vh; }

/* News */
.screen-news { height: 100%; display: grid; gap: 3vw; align-items: center; grid-template-columns: minmax(0, 1fr); }
.screen-news.has-image { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.screen-news-label { display: flex; align-items: center; gap: 0.6vw; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; color: var(--blue); margin-bottom: 2vh; }
.screen-pin { background: var(--cream); color: var(--burgundy); border-radius: 99px; padding: 0.2em 0.8em; letter-spacing: 0.04em; font-size: 0.85em; }
.screen-news-title { font-family: var(--font-serif); font-size: 3.6em; line-height: 1.05; margin-bottom: 3vh; overflow-wrap: anywhere; }
.screen-news-body { font-size: 1.45em; line-height: 1.45; max-width: 60ch; }
.screen-news-body p, .screen-news-body ul, .screen-news-body ol { margin: 0 0 1.4vh; }
.screen-news-body a { color: var(--blue); }
.screen-news-meta { margin-top: 3vh; color: var(--muted); }
.screen-news-image { width: 100%; max-height: 66vh; object-fit: cover; border-radius: 1.6vw; box-shadow: 0 2vh 5vh rgb(0 0 0 / 0.45); }

/* More news (#113): the posts after the first two, as a list of headlines */
.screen-news-more { height: 100%; display: flex; flex-direction: column; }
.screen-news-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; display: grid; gap: 2.4vh 3vw; grid-template-columns: minmax(0, 1fr); align-content: center; }
.screen-news-list.is-many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.screen-news-list li { display: flex; gap: 1.6vw; align-items: center; background: var(--card); border: 1px solid var(--card-border); border-radius: 1.2vw; padding: 2vh 1.6vw; min-height: 0; overflow: hidden; }
.screen-news-list img { flex: none; width: 9vw; height: 9vw; object-fit: cover; border-radius: 0.8vw; }
.screen-news-list h2 { font-family: var(--font-serif); font-size: 1.9em; line-height: 1.1; margin: 0 0 1vh; overflow-wrap: anywhere; }
.screen-news-list-body { font-size: 1.15em; line-height: 1.4; }
.screen-news-list-body p { margin: 0; }
.screen-news-list .screen-news-meta { margin-top: 1vh; }

/* Nothing to show */
.screen-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; text-align: center; }
.screen-empty img { width: 16vw; height: 16vw; border-radius: 12%; }
.screen-empty h1 { font-family: var(--font-serif); font-size: 3em; }

/* Bottom: progress, dots, controls */
.screen-bottom { display: flex; flex-direction: column; gap: 1vh; }
.screen-progress { height: 4px; background: rgb(255 255 255 / 0.15); border-radius: 99px; overflow: hidden; }
.screen-progress span { display: block; height: 100%; width: 0; background: var(--blue); }
.screen-controls { display: flex; align-items: center; justify-content: space-between; }
.screen-dots { display: flex; gap: 0.6vw; }
.screen-dot { width: 0.8vw; height: 0.8vw; min-width: 10px; min-height: 10px; border-radius: 50%; border: 0; padding: 0; background: rgb(255 255 255 / 0.3); cursor: pointer; }
.screen-dot.is-active { background: var(--cream); }
.screen-buttons { display: flex; gap: 0.4vw; opacity: 0; transition: opacity 300ms; }
.screen-bottom:hover .screen-buttons, .screen-bottom:focus-within .screen-buttons, .screen.show-controls .screen-buttons { opacity: 1; }
.screen-buttons button {
    display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 0.6vw;
    border: 1px solid var(--card-border); border-radius: 10px; background: rgb(0 0 0 / 0.25); color: var(--text); cursor: pointer; font: inherit;
}
.screen-buttons button:hover { background: rgb(255 255 255 / 0.15); }
.screen-bottom.is-single .screen-dots, .screen-bottom.is-single .screen-progress,
.screen-bottom.is-single [data-action="prev"], .screen-bottom.is-single [data-action="next"], .screen-bottom.is-single [data-action="pause"] { display: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.no-js .js-only { display: none !important; }

/* Smaller screens (e.g. testing on a laptop or phone): stack the columns */
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
    body.screen { overflow: auto; font-size: 15px; }
    .screen-app { height: auto; min-height: 100vh; }
    .js .screen-slide { position: relative; inset: auto; display: none; }
    .js .screen-slide.is-active { display: block; }
    .screen-week-layout, .screen-news.has-image { grid-template-columns: 1fr; height: auto; }
    .screen-days { grid-template-columns: 1fr; }
    .screen-day.is-past { display: none; }
    .screen-brand img { width: 48px; height: 48px; }
    .screen-news-title { font-size: 2.2em; }
    .screen-news-body { font-size: 1.1em; }
    .screen-news-list.is-many { grid-template-columns: 1fr; }
    .screen-news-list img { width: 72px; height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
    .js .screen-slide, .js .screen-slide.is-active { transition: none; transform: none; }
}

/* Cancelled events (#34) */
.cal-cancelled-badge {
    display: inline-block; align-self: flex-start; margin-top: 0.2vh; padding: 0.1vh 0.4vw; border-radius: 0.3vw;
    background: #c0392b; color: #fff; font-size: 0.75em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.screen-event.is-cancelled { opacity: 0.7; }
.screen-event.is-cancelled .screen-event-title { text-decoration: line-through; text-decoration-thickness: 0.2vh; }

/* Standby (#110): nothing chosen and approved – the school logo drifts slowly over a dark screen and bounces off
   the edges like a TV on standby (carousel.js moves it). Without motion: centred, gently fading. */
.screen-slide.screen-standby {
    position: fixed; inset: 0; z-index: 20; display: block; overflow: hidden;
    background: radial-gradient(circle at 50% 40%, #1b0a0f 0%, #070304 100%);
}
.screen-standby-logo {
    position: absolute; left: 0; top: 0; width: clamp(120px, 14vw, 360px); height: auto; border-radius: 14%;
    box-shadow: 0 1vw 4vw rgb(0 0 0 / 0.6); will-change: transform; transform: translate(40vw, 35vh);
}
.screen-standby-clock {
    position: absolute; right: 3vw; bottom: 3vh; margin: 0; font-size: 1.4em; color: rgb(255 255 255 / 0.45);
    font-variant-numeric: tabular-nums;
}
.screen-standby ~ * { display: none; }
@media (prefers-reduced-motion: reduce) {
    .screen-standby-logo { left: 50%; top: 50%; transform: translate(-50%, -50%) !important; animation: screen-standby-fade 6s ease-in-out infinite alternate; }
}
@keyframes screen-standby-fade { from { opacity: 0.35; } to { opacity: 1; } }
