/* SectorFox screen player. Built for TVs (1920x1080 and up) and still usable on laptops, portrait displays and phones. */

:root {
    --bg: #0a0e13;
    --bg-2: #0f151d;
    --panel: #121a24;
    --line: rgba(255, 255, 255, 0.09);
    --ink: #f4f6f8;
    --ink-2: #c8d1da;
    --muted: #8d99a6;
    --accent: #f5b301;
    --accent-ink: #14110a;
    --glow: rgba(245, 179, 1, 0.13);
    --fox: #ff6b2c;
    --live: #2bd576;
    --warn: #ffb020;
    --breaking: #e8202f;
    --gold-1: #ffe07d;
    --gold-2: #f5b301;
    --gold-3: #d48f00;
    --pad: clamp(16px, 2.2vw, 48px);
    --ticker-h: clamp(40px, 5.4vh, 66px);
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--ink);
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow: hidden;
}

.sfx {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: var(--bg);
    background:
        radial-gradient(90vw 70vh at 0% -10%, var(--glow), transparent 60%),
        linear-gradient(180deg, var(--bg-2), var(--bg) 70%);
}

.sfx.is-tv { cursor: none; }

/* Top bar */

.sfx-top {
    display: flex;
    align-items: center;
    gap: clamp(12px, 1.6vw, 32px);
    padding: clamp(10px, 1.6vh, 26px) var(--pad);
    border-bottom: 1px solid var(--line);
}

.sfx-brand {
    display: flex;
    align-items: center;
    gap: 0.55em;
    min-width: 0;
    font-size: clamp(16px, 1.45vw, 32px);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.sfx-mark { width: 1.5em; height: 1.5em; flex: none; color: var(--fox); }
.sfx-word b { color: var(--fox); font-weight: 800; }

.sfx-sector {
    margin-left: 0.35em;
    padding: 0.2em 0.75em;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.62em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sfx-status {
    display: flex;
    align-items: center;
    gap: 0.55em;
    margin-left: auto;
    color: var(--muted);
    font-size: clamp(12px, 0.95vw, 21px);
    white-space: nowrap;
}

.sfx-dot { width: 0.62em; height: 0.62em; border-radius: 50%; background: #56616d; flex: none; }
.sfx-dot.is-live { background: var(--live); animation: sfx-pulse 2.4s ease-out infinite; }
.sfx-dot.is-offline { background: var(--warn); }

.sfx-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.05;
}

.sfx-time {
    font-size: clamp(20px, 2.15vw, 48px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.sfx-date {
    color: var(--muted);
    font-size: clamp(10px, 0.78vw, 17px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* World clocks in the top bar: the sector's cities (Sectors in the admin area), grouped by region
   and up to 5 at a time. With more than one group the groups take turns (screen.js). All groups
   sit in the same grid cell, so the bar keeps its size and nothing else moves. */

.sfx-world {
    display: grid;
    align-items: center;
    justify-items: center;
    min-width: 0;
    margin-left: auto;
}

.sfx-wc-group {
    grid-area: 1 / 1;
    display: flex;
    align-items: center;
    gap: clamp(14px, 1.6vw, 40px);
}

.sfx-world.is-rotating .sfx-wc-group {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

.sfx-world.is-rotating .sfx-wc-group.is-on {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease 0.35s, visibility 0s linear 0s;
}

.sfx-wc-region {
    align-self: stretch;
    display: flex;
    align-items: center;
    padding-right: clamp(12px, 1.3vw, 32px);
    border-right: 1px solid var(--line);
    color: var(--accent);
    font-size: clamp(9px, 0.6vw, 14px);
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sfx-wc {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
}

.sfx-wc-city {
    color: var(--muted);
    font-size: clamp(9px, 0.6vw, 14px);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sfx-wc-time {
    color: var(--ink-2);
    font-size: clamp(13px, 1.05vw, 25px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 980px) { .sfx-world { display: none; } }

/* Main area */

.sfx-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(250px, 26vw, 560px);
    gap: var(--pad);
    padding: var(--pad);
    min-height: 0;
}

.sfx-story {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    padding-bottom: clamp(16px, 2.6vh, 36px);
}

.sfx-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em 1em;
    margin-bottom: clamp(12px, 2.4vh, 34px);
    color: var(--muted);
    font-size: clamp(13px, 1.1vw, 25px);
}

.sfx-cat {
    padding: 0.28em 0.8em;
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.82em;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sfx-cat.is-featured { background: var(--fox); color: #fff; }
.sfx-cat.is-breaking { background: var(--breaking); color: #fff; animation: sfx-flash 1.8s ease-in-out infinite; }
.sfx-cat.is-events { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* "You're in the news": a story that names the screen's client. */
.sfx-mention {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    padding: 0.28em 0.8em;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 50%, var(--gold-3) 100%);
    color: #1d1400;
    font-size: 0.82em;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 0 0 1px rgba(255, 224, 125, 0.6), 0 0 26px rgba(245, 179, 1, 0.45);
}

.sfx-mention::before { content: "\2605"; }

/* A bar beside breaking stories (red) and stories about the client (gold). */
.sfx-story.is-breaking::before,
.sfx-story.is-mention::before {
    content: "";
    position: absolute;
    left: calc(var(--pad) * -0.55);
    top: 14%;
    bottom: 14%;
    width: clamp(4px, 0.32vw, 8px);
    border-radius: 99px;
    background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 50%, var(--gold-3));
    box-shadow: 0 0 22px rgba(245, 179, 1, 0.5);
}

.sfx-story.is-breaking::before { background: var(--breaking); box-shadow: 0 0 24px rgba(232, 32, 47, 0.65); }
.sfx-story.is-breaking .sfx-progress span { background: var(--breaking); }
.sfx.is-empty .sfx-story::before { display: none; }
.sfx-cat.is-ad { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.sfx-cat:empty, .sfx-source:empty, .sfx-age:empty { display: none; }
.sfx-source { color: var(--ink); font-weight: 600; }
.sfx-age::before { content: "\00B7"; margin-right: 1em; color: var(--muted); }

.sfx-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    margin: 0;
    font-size: clamp(28px, 3.45vw + 0.8vh, 94px);
    font-weight: 800;
    line-height: 1.16;
    letter-spacing: -0.015em;
    padding-bottom: 0.08em;
    text-wrap: balance;
}

.sfx-title:empty { display: none; }
.sfx-title.is-long { font-size: clamp(26px, 2.9vw + 0.7vh, 80px); }
.sfx-title.is-xlong { font-size: clamp(24px, 2.4vw + 0.6vh, 66px); -webkit-line-clamp: 5; }

.sfx-media {
    max-width: 100%;
    max-height: 34vh;
    margin-top: 2.4vh;
    align-self: flex-start;
    object-fit: contain;
    border-radius: 12px;
}

.sfx-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-width: 62ch;
    margin: clamp(12px, 2.6vh, 38px) 0 0;
    color: var(--ink-2);
    font-size: clamp(16px, 1.4vw + 0.3vh, 39px);
    line-height: 1.42;
}

.sfx-excerpt:empty { display: none; }

/* "Coming up": the next events in the sector, counted down by the screen's own date. */

.sfx-events {
    display: grid;
    gap: clamp(10px, 2vh, 28px);
    margin-top: clamp(4px, 1vh, 14px);
}

.sfx-event {
    display: grid;
    grid-template-columns: clamp(110px, 10vw, 250px) minmax(0, 1fr);
    align-items: center;
    gap: clamp(14px, 1.8vw, 44px);
    padding: clamp(10px, 1.6vh, 22px) clamp(14px, 1.4vw, 30px);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.sfx-event:first-child { border-color: rgba(245, 179, 1, 0.45); background: var(--glow); }

.sfx-event-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.sfx-event-num {
    color: var(--accent);
    font-size: clamp(34px, 3.6vw, 96px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.sfx-event-num.is-word { font-size: clamp(24px, 2.3vw, 62px); letter-spacing: 0; }
.sfx-event.is-live .sfx-event-num { color: var(--live); }

.sfx-event-unit {
    margin-top: 0.4em;
    color: var(--muted);
    font-size: clamp(10px, 0.8vw, 18px);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sfx-event-text { min-width: 0; }

.sfx-event-name {
    overflow: hidden;
    font-size: clamp(20px, 2vw, 54px);
    font-weight: 800;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sfx-event-when {
    margin-top: 0.3em;
    color: var(--ink-2);
    font-size: clamp(14px, 1.2vw, 30px);
}

.sfx.is-empty .sfx-events { display: none; }

/* Stories with a picture: text on the left, picture on the right. */
.sfx-story.has-media {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto auto auto auto 1fr;
    column-gap: clamp(20px, 2.4vw, 64px);
}

.sfx-story.has-media .sfx-meta { grid-column: 1; grid-row: 2; }
.sfx-story.has-media .sfx-title { grid-column: 1; grid-row: 3; font-size: clamp(24px, 2.5vw + 0.6vh, 72px); }
.sfx-story.has-media .sfx-excerpt { grid-column: 1; grid-row: 4; }
.sfx-story.has-media .sfx-qr-box { grid-column: 1; grid-row: 5; }

.sfx-story.has-media .sfx-media {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: center;
    justify-self: center;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
}

.sfx-qr-box {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-top: clamp(16px, 3.4vh, 52px);
    color: var(--muted);
    font-size: clamp(13px, 1vw, 22px);
}

.sfx-qr {
    width: clamp(84px, 8.2vw, 180px);
    height: auto;
    aspect-ratio: 1;
    padding: clamp(4px, 0.35vw, 8px);
    border-radius: 10px;
    background: #fff;
}

.sfx-qr-text { line-height: 1.3; white-space: nowrap; }

/* "Open it here" under a QR code: public pages only, where people read on their own devices. */
.sfx-qr-side { display: flex; flex-direction: column; gap: 0.4em; min-width: 0; }

.sfx-link {
    color: var(--accent);
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.sfx-link::after { content: " \2197"; }
.sfx-link:hover, .sfx-link:focus-visible { text-decoration: underline; outline: none; }

.sfx-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: var(--line);
}

.sfx-progress span {
    display: block;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
}

.sfx.is-paused .sfx-progress span { background: var(--muted); }
.sfx.is-browse .sfx-progress { visibility: hidden; }

/* Browse mode on larger screens: the story moves up to leave room for the controls
   (the player sets this when they fit), with headlines of at most 3 lines. */
.sfx.has-controls-space .sfx-main { padding-bottom: calc(var(--controls-space, 0px) + var(--pad)); }
.sfx.has-controls-space .sfx-title { -webkit-line-clamp: 3; }
.sfx.has-controls-space .sfx-story > * { flex-shrink: 0; }

.sfx-empty {
    display: none;
    color: var(--muted);
    font-size: clamp(20px, 2.3vw, 56px);
    font-weight: 600;
    line-height: 1.3;
}

.sfx.is-empty .sfx-empty { display: block; }
.sfx.is-empty .sfx-meta,
.sfx.is-empty .sfx-title,
.sfx.is-empty .sfx-excerpt,
.sfx.is-empty .sfx-media,
.sfx.is-empty .sfx-qr-box,
.sfx.is-empty .sfx-progress { display: none; }

.sfx-story.is-in .sfx-meta,
.sfx-story.is-in .sfx-title,
.sfx-story.is-in .sfx-media,
.sfx-story.is-in .sfx-excerpt,
.sfx-story.is-in .sfx-qr-box,
.sfx-story.is-in .sfx-events { animation: sfx-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

.sfx-story.is-in .sfx-events { animation-delay: 0.08s; }

.sfx-story.is-in .sfx-title { animation-delay: 0.05s; }
.sfx-story.is-in .sfx-excerpt { animation-delay: 0.12s; }
.sfx-story.is-in .sfx-qr-box { animation-delay: 0.2s; }

/* Ad panel */

.sfx-ad {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
}

.sfx-ad-label {
    padding: 0.85em 1.15em;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: clamp(10px, 0.72vw, 15px);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.sfx-ad-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 1.4vh, 20px);
    min-height: 0;
    padding: clamp(14px, 1.6vw, 34px);
    text-align: center;
    animation: sfx-fade 0.8s ease both;
}

.sfx-ad-img { max-width: 100%; max-height: 62%; object-fit: contain; border-radius: 10px; }
.sfx-ad-title { font-size: clamp(18px, 1.7vw, 42px); font-weight: 800; line-height: 1.15; }
.sfx-ad-text { color: var(--muted); font-size: clamp(13px, 1.05vw, 24px); line-height: 1.4; }

.sfx-ad-qr {
    display: flex;
    align-items: center;
    gap: 0.7em;
    color: var(--muted);
    font-size: clamp(11px, 0.85vw, 18px);
}

.sfx-ad-qr img {
    width: clamp(64px, 5.4vw, 124px);
    height: auto;
    aspect-ratio: 1;
    padding: 4px;
    border-radius: 8px;
    background: #fff;
}

.sfx-ad-body.is-placeholder {
    background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.022) 0 14px, transparent 14px 28px);
}

.sfx-ad-ph-mark {
    width: clamp(46px, 4.4vw, 92px);
    height: clamp(46px, 4.4vw, 92px);
    border: 2px dashed var(--accent);
    border-radius: 16px;
    opacity: 0.75;
}

.sfx-ad-ph-title { font-size: clamp(20px, 2vw, 48px); font-weight: 800; line-height: 1.1; }
.sfx-ad-ph-text { max-width: 17em; color: var(--muted); font-size: clamp(13px, 1.05vw, 24px); line-height: 1.4; }
.sfx-ad-ph-url { margin-top: 0.4vh; color: var(--accent); font-size: clamp(14px, 1.2vw, 27px); font-weight: 700; }

/* Screens that show ads only: the ads fill the main area. Without news there is no ticker. */
.sfx.is-ads-only .sfx-main { grid-template-columns: minmax(0, 1fr); }
.sfx.is-ads-only .sfx-ad { display: none; }
.sfx.no-news { --ticker-h: 0px; }
.sfx.no-news .sfx-ticker { display: none; }

/* Ticker */

.sfx-ticker {
    display: flex;
    align-items: stretch;
    min-width: 0;
    height: var(--ticker-h);
    border-top: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.35);
    font-size: clamp(14px, 1.12vw, 26px);
}

.sfx-ticker-label {
    display: flex;
    align-items: center;
    padding: 0 1.2em;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.78em;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sfx-ticker-track {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}

.sfx-ticker-inner {
    display: inline-flex;
    white-space: nowrap;
    will-change: transform;
    animation: sfx-ticker 90s linear infinite;
}

.sfx-ticker-copy { display: inline-flex; }
.sfx-tick { color: var(--ink-2); }
.sfx-tick::after { content: "\2022"; margin: 0 1.3em; color: var(--accent); }
.sfx-tick.is-mention::before { content: "\2605\00A0"; color: var(--gold-2); }

/* Breaking news: the ticker turns red and shows only the breaking headlines. */
.sfx.has-breaking .sfx-ticker { background: rgba(232, 32, 47, 0.18); border-top-color: rgba(232, 32, 47, 0.55); }
.sfx.has-breaking .sfx-ticker-label { background: var(--breaking); color: #fff; }
.sfx.has-breaking .sfx-ticker-label::before {
    content: "";
    width: 0.62em;
    height: 0.62em;
    margin-right: 0.75em;
    border-radius: 50%;
    background: #fff;
    animation: sfx-blink 1.2s ease-in-out infinite;
}
.sfx.has-breaking .sfx-tick { color: #fff; font-weight: 700; }
.sfx.has-breaking .sfx-tick::after { color: var(--breaking); }

/* Browse controls */

.sfx-controls {
    position: absolute;
    left: var(--pad);
    right: var(--pad);
    bottom: calc(var(--ticker-h) + 14px);
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9em;
    padding: 0.65em;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(12, 17, 24, 0.985);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    font-size: clamp(14px, 1vw, 22px);
    animation: sfx-up 0.28s ease both;
}

.sfx-nav, .sfx-actions { display: flex; align-items: center; gap: 0.5em; flex: none; }

.sfx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.8em;
    min-width: 2.8em;
    padding: 0 1em;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sfx-btn:hover, .sfx-btn:focus-visible { background: rgba(255, 255, 255, 0.12); border-color: var(--accent); outline: none; }
.sfx-btn svg { width: 1.3em; height: 1.3em; }
.sfx-arrow, .sfx-icon { padding: 0; }
.sfx-close { white-space: nowrap; font-variant-numeric: tabular-nums; }

.sfx-counter {
    min-width: 4.6em;
    color: var(--muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.sfx-actions { margin-left: auto; }

/* All filters stay visible: they wrap onto extra rows above the buttons (scrolling only if there are very many). */
.sfx-filters {
    order: -1;
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    min-width: 0;
    max-height: 60vh;
    padding: 0.15em 0.15em 0.6em;
    overflow-y: auto;
    border-bottom: 1px solid var(--line);
}

.sfx-chip {
    flex: none;
    padding: 0.6em 1.05em;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.sfx-chip:hover, .sfx-chip:focus-visible { border-color: var(--accent); outline: none; }
.sfx-chip.is-active { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }

/* Full-screen ad break */

.sfx-break {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    background: #05080b;
    animation: sfx-fade 0.5s ease both;
}

.sfx-break-top {
    display: flex;
    justify-content: space-between;
    padding: 1.2em var(--pad);
    color: var(--muted);
    font-size: clamp(11px, 0.85vw, 18px);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.sfx-break-count { font-variant-numeric: tabular-nums; }

.sfx-break-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: var(--pad);
}

.sfx-break-body .sfx-ad-label { display: none; }
.sfx-break-body .sfx-ad-body { width: 100%; max-width: 1500px; height: 100%; }
.sfx-break-body .sfx-ad-img { max-height: 78%; }
.sfx-break-body .sfx-ad-title { font-size: clamp(28px, 3.6vw, 98px); }
.sfx-break-body .sfx-ad-text { font-size: clamp(16px, 1.6vw, 40px); }
.sfx-break-body .sfx-ad-qr img { width: clamp(90px, 8vw, 190px); }

/* Portrait displays and phones */

@media (max-aspect-ratio: 4/5), (max-width: 760px) {
    .sfx-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }

    /* Narrow screens stack the picture under the headline; only the picture shrinks to fit. */
    .sfx-story.has-media { display: flex; }
    .sfx-story.has-media .sfx-meta,
    .sfx-story.has-media .sfx-title,
    .sfx-story.has-media .sfx-excerpt,
    .sfx-story.has-media .sfx-qr-box { flex-shrink: 0; }
    .sfx-story.has-media .sfx-title { -webkit-line-clamp: 3; }
    .sfx-story.has-media .sfx-media { flex: 0 1 auto; min-height: 0; max-height: 36vh; margin-top: 2vh; justify-self: auto; align-self: flex-start; }
    .sfx-ad { max-height: 30vh; }
    .sfx-ad-body { flex-direction: row; flex-wrap: wrap; }
    .sfx-ad-img { max-height: 20vh; }
}

/* Portrait TVs: size type by the screen width, which is the short side. */
@media (max-aspect-ratio: 4/5) and (min-width: 761px) {
    .sfx-brand { font-size: clamp(16px, 2.6vw, 44px); }
    .sfx-status { font-size: clamp(12px, 1.8vw, 30px); }
    .sfx-time { font-size: clamp(20px, 3.9vw, 66px); }
    .sfx-date { font-size: clamp(10px, 1.45vw, 24px); }
    .sfx-meta { font-size: clamp(13px, 2.1vw, 36px); }
    .sfx-title { font-size: clamp(28px, 6vw, 118px); -webkit-line-clamp: 6; }
    .sfx-title.is-long { font-size: clamp(26px, 5.2vw, 100px); }
    .sfx-title.is-xlong { font-size: clamp(24px, 4.5vw, 88px); -webkit-line-clamp: 7; }
    .sfx-story.has-media .sfx-title { font-size: clamp(26px, 5.2vw, 100px); }
    .sfx-excerpt { font-size: clamp(16px, 2.9vw, 52px); -webkit-line-clamp: 3; }
    .sfx-qr-box { font-size: clamp(13px, 1.9vw, 32px); }
    .sfx-qr { width: clamp(84px, 15vw, 260px); }
    .sfx-ticker { font-size: clamp(14px, 2vw, 34px); }
    .sfx-ad-title { font-size: clamp(18px, 3vw, 52px); }
    .sfx-ad-text, .sfx-ad-ph-text { font-size: clamp(13px, 1.9vw, 32px); }
    .sfx-controls { font-size: clamp(14px, 1.9vw, 30px); }
    /* The clocks get a row of their own under the logo and the time. */
    .sfx-top { flex-wrap: wrap; }
    .sfx-world { order: 1; flex: 1 0 100%; margin-left: 0; padding-top: clamp(8px, 1vh, 20px); border-top: 1px solid var(--line); }
    .sfx-wc-group { gap: clamp(14px, 3vw, 56px); }
    .sfx-wc-region, .sfx-wc-city { font-size: clamp(9px, 1.2vw, 20px); }
    .sfx-wc-time { font-size: clamp(13px, 2.2vw, 38px); }
    .sfx-event { grid-template-columns: clamp(110px, 18vw, 300px) minmax(0, 1fr); }
    .sfx-event-num { font-size: clamp(34px, 7vw, 130px); }
    .sfx-event-num.is-word { font-size: clamp(24px, 4.6vw, 86px); }
    .sfx-event-unit { font-size: clamp(10px, 1.5vw, 26px); }
    .sfx-event-name { font-size: clamp(20px, 3.6vw, 70px); white-space: normal; }
    .sfx-event-when { font-size: clamp(14px, 2.2vw, 40px); }
}

@media (max-width: 760px) {
    .sfx-event { grid-template-columns: 84px minmax(0, 1fr); gap: 12px; }
    .sfx-event-name { white-space: normal; }
    .sfx-event:nth-child(n+4) { display: none; }
    .sfx-status-text { display: none; }
    .sfx-title { -webkit-line-clamp: 5; }
    .sfx-controls { flex-wrap: wrap; }
    .sfx-close { padding: 0 0.8em; }
}

@media (prefers-reduced-motion: reduce) {
    .sfx-story.is-in .sfx-meta,
    .sfx-story.is-in .sfx-title,
    .sfx-story.is-in .sfx-media,
    .sfx-story.is-in .sfx-excerpt,
    .sfx-story.is-in .sfx-qr-box,
    .sfx-ad-body,
    .sfx-controls,
    .sfx-break { animation: none; }
    .sfx-dot.is-live { animation: none; }
    .sfx-story.is-in .sfx-events,
    .sfx-cat.is-breaking,
    .sfx.has-breaking .sfx-ticker-label::before { animation: none; }
    .sfx-world.is-rotating .sfx-wc-group,
    .sfx-world.is-rotating .sfx-wc-group.is-on { transition: none; }
}

@keyframes sfx-in {
    from { opacity: 0; transform: translateY(1.4vh); }
    to { opacity: 1; transform: none; }
}

@keyframes sfx-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes sfx-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

@keyframes sfx-ticker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes sfx-flash {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232, 32, 47, 0.6); }
    50% { box-shadow: 0 0 0 0.45em rgba(232, 32, 47, 0); }
}

@keyframes sfx-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

@keyframes sfx-pulse {
    0% { box-shadow: 0 0 0 0 rgba(43, 213, 118, 0.55); }
    70% { box-shadow: 0 0 0 0.6em rgba(43, 213, 118, 0); }
    100% { box-shadow: 0 0 0 0 rgba(43, 213, 118, 0); }
}
