/* Kiosk layout */
* {
    margin: 0;
    padding: 0;
    cursor: none;
}

html {
    overflow: hidden;
    background: #000;
}

body {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
    background: #000;
}

/* Weather ticker */
.weather-ticker {
    --gap: 40px;
    display: flex;
    gap: var(--gap);
    overflow: hidden;
    padding-block: 8px;
    background-color: #c62144;
    color: white;
    font-size: 2em;
    user-select: none;
}

.weather-ticker ul {
    display: flex;
    flex-shrink: 0;
    min-width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: var(--gap);
    list-style: none;
    animation: ticker-scroll 30s linear infinite;
}

.weather-ticker .weather {
    display: inline-grid;
    padding-inline: 2rem;
    row-gap: 0.15em;
    text-align: center;
    white-space: nowrap;
    line-height: 1.15;
}

.weather-ticker .weather-precip {
    font-size: 0.8em;
    min-height: 1.15em;
}

.weather-ticker ul>li:first-child {
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: colorChange 2s infinite;
}

.weather-ticker-icon {
    display: block;
    width: 80px;
    height: 80px;
    flex: none;
    object-fit: contain;
}

@keyframes ticker-scroll {
    to {
        transform: translateX(calc(-100% - var(--gap)));
    }
}

@keyframes colorChange {

    0%,
    100% {
        color: white;
    }

    50% {
        color: darkgray;
    }
}

/* NWS alert ticker */
#nws-alert-banner {
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
    padding-block: 0.5rem;
    background: #ffce55;
    color: #171717;
    font-size: clamp(1rem, 2.2vw, 1.5rem);
    line-height: 1.3;
}

.nws-alert-track {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: max-content;
    padding-inline-start: 100%;
    white-space: nowrap;
    animation: nws-alert-scroll 30s linear infinite;
}

#nws-alert-list {
    display: flex;
    gap: 1rem;
    list-style: none;
}

#nws-alert-list li+li::before {
    content: "•";
    margin-inline-end: 1rem;
}

@keyframes nws-alert-scroll {
    to {
        transform: translateX(-100%);
    }
}

/* Webcam */
#mrmsp-webcam {
    grid-row: 3;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    container-type: size;
}

.webcam-frame {
    position: relative;
    width: 100%;
    width: min(100cqw, calc(100cqh * 16 / 9));
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.webcam-player {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Bottom ticker */
#bottom-ticker {
    grid-row: 4;
    position: relative;
    z-index: 2;
    min-width: 0;
    height: calc(1.3em + 1rem);
    overflow: visible;
    background: #000;
    font-size: 2em;
}

#bottom-ticker>aside {
    box-sizing: border-box;
    height: 100%;
    overflow: hidden;
    padding-block: 0.5rem;
    line-height: 1.3;
}

#bottom-ticker>[hidden] {
    display: none;
}

#announcement-ticker {
    color: #171717;
}

#joke-ticker {
    color: white;
}

#announcement-track,
.joke-ticker-track {
    display: flex;
    align-items: center;
    gap: 5rem;
    width: max-content;
    white-space: nowrap;
}

#announcement-text,
#joke-ticker-text {
    white-space: pre;
}

#bottom-ticker:has(> #announcement-ticker:not([hidden])) {
    background-color: #ffce55;
}

#bottom-ticker:has(> #joke-ticker:not([hidden])) {
    background-color: #c62144;
}

/* Pushers extend above the bar without changing its height. */
#announcement-pusher,
#joke-pusher {
    position: absolute;
    left: calc(100% - 18px);
    bottom: 0;
    height: 2.75em;
    width: auto;
    z-index: 1;
    pointer-events: none;
}

/* Reveal red as the yellow announcement panel slides away. */
#bottom-ticker.is-pushing-announcement:has(> #announcement-ticker:not([hidden])) {
    background-color: #c62144;
}

#bottom-ticker.is-pushing-announcement>#announcement-ticker {
    background-color: #ffce55;
}

/* Reveal yellow as the green quiz panel slides away. */
#bottom-ticker.is-pushing-quiz:has(> #quiz-ticker:not([hidden])) {
    background-color: #ffce55;
}

#bottom-ticker.is-pushing-quiz>#quiz-ticker {
    background-color: #133c1c;
}

#mrmsp-webcam {
    position: relative;
}

.weather-ticker,
#kiosk-clock {
    font-family: system-ui, sans-serif;
}

#kiosk-clock {
    position: absolute;
    top: clamp(10px, 1.85vh, 24px);
    left: clamp(10px, 1.85vh, 24px);
    z-index: 1;
    display: inline-flex;
    align-items: baseline;
    gap: 0.3em;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgb(0 0 0 / 78%);
    color: white;
    font-size: clamp(24px, 3.7vh, 48px);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    pointer-events: none;
}

#quiz-ticker {
    color: white;
}

#quiz-track {
    display: flex;
    align-items: center;
    gap: 2rem;
    width: max-content;
    white-space: pre;
}

#bottom-ticker:has(> #quiz-ticker:not([hidden])) {
    background-color: #133c1c;
}

#quiz-puller {
    position: absolute;
    right: 0;
    bottom: 0;
    height: 3.5em;
    width: auto;
    z-index: 1;
    pointer-events: none;
}

/* #bottom-ticker.has-quiz.is-pulling-joke:has(> #joke-ticker:not([hidden])) {
    background-color: #133c1c;
} */

*/ #bottom-ticker.is-pushing-joke:has(> #joke-ticker:not([hidden])) {
    background-color: #133c1c;
}

#bottom-ticker.is-pushing-joke>#joke-ticker {
    background-color: #c62144;
}

/* Green behind the joke panel while the snowboarder moves it left. */
#bottom-ticker.is-pushing-joke:has(> #joke-ticker:not([hidden])) {
    background-color: #133c1c;
}

/* Red travels with the outgoing joke panel. */
#bottom-ticker.is-pushing-joke>#joke-ticker {
    background-color: #c62144;
}

#bottom-ticker>aside {
    position: absolute;
    inset: 0;
}

#bottom-ticker.is-pushing-announcement>#announcement-ticker,
#bottom-ticker.is-pushing-joke>#joke-ticker,
#bottom-ticker.is-pushing-quiz>#quiz-ticker {
    z-index: 1;
}

#announcement-pusher,
#joke-pusher,
#quiz-puller {
    z-index: 2;
}