/* /tv — Portalis Vision, a Portalis Ltd set, so its window is Portalis OS
   (portalis/os.css). the picture inside isn't: each channel keeps its own
   look. Civic Weather is the company's civic arm on air: ink teal panels,
   gold heads, the logo's cyan, numbers in vtFont. everything on the tube is
   sized in cqw so it scales with the screen like a picture would. */

.tv {
  width: min(820px, calc(100% - 24px), calc((100vh - 190px) * 4 / 3 + 34px));
  min-width: min(320px, calc(100% - 24px));
  margin: 3.4em auto 1em;
}
.tv .os-build { margin: 10px 0 0; }
.tv .os-build a { color: rgba(255, 255, 255, 0.8); }

.tv__well { padding: 10px; background: #1a1d1c; box-shadow: inset 1px 1px 0 var(--os-dk), inset -1px -1px 0 #fff; }
.tv__screen {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  container-type: inline-size;
  background: #02080b;
  border-radius: 3% / 4%;
  font: 2.4cqw/1.15 var(--os-ui);
  color: #e8f3f2;
  user-select: none;
}
.tv__cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* the tube: scanlines, a soft vignette, a little bloom off the glass */
.tv__glass {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0, 6, 10, 0.55) 100%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.07), transparent 35%);
  box-shadow: inset 0 0 3cqw rgba(0, 0, 0, 0.8);
}

/* between cities: snow, and who we're linking to */
/* teletext (tvtext.js): its own canvas over the channel's picture and the forecast */
.tv__tt { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tv__tt[hidden] { display: none; }
/* the picture's layers; on the guide they shrink into its window (WIN in tv.js), the snow with them */
.tv__pic { position: absolute; inset: 0; }
.tv__gd { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tv__gd[hidden] { display: none; }
.is-guide .tv__pic, .is-guide .tv__link { transform: translate(5%, 6.5%) scale(0.44); transform-origin: 0 0; }
.tv__link { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity 0.25s; pointer-events: none; }
.tv__link.is-on { opacity: 1; transition: none; }
.tv__link canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.tv__link p[hidden] { display: none; }
.tv__link p { position: relative; margin: 0; padding: 0.4em 0.9em; font: 4.2cqw/1 vtFont, monospace; letter-spacing: 0.08em; background: #02080b; color: #45f0ff; }

/* the front panel under the tube: the channel on a little ink display, the set's buttons */
.tv__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 2px 6px; font: 12px var(--os-ui); color: var(--os-ink); }
.tv__ch { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.tv__ch b { display: inline-block; min-width: 2.2em; padding: 1px 4px; text-align: center; font: 18px/1 vtFont, monospace; color: #8df7ff; background: var(--os-ink); }
.tv__keys { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-left: auto; }
.tv__keys .os-btn { min-width: 0; padding: 3px 9px; }
.tv__pair { display: inline-flex; }
.tv__pair .os-btn + .os-btn { margin-left: -1px; }
.tv__keys [aria-pressed="true"] { background: linear-gradient(#dcdfd7, #eceee8); box-shadow: inset 1px 1px 0 var(--os-sh); font-weight: bold; }
.tv__fm:empty { display: none; }
.tv__fm.is-ask { color: var(--os-gold2); }
@media (max-width: 560px) {
  .tv__keys { display: grid; grid-template-columns: repeat(3, 1fr); margin-left: 0; width: 100%; }
  .tv__pair .os-btn { flex: 1; }
  #tv-k-flap { grid-column: span 2; }
}
/* the flap: a sunken tray under the panel, the keypad and teletext's keys side by side */
.tv__fl::after { content: " \25BE"; }
.tv__fl[aria-expanded="true"]::after { content: " \25B4"; }
.tv__flap { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; margin: 0 2px 8px; padding: 10px; background: #d5d9d2; box-shadow: inset 1px 1px 0 var(--os-dk), inset -1px -1px 0 #fff; }
.tv__flap[hidden] { display: none; }
.tv__pad, .tv__fx { display: grid; gap: 4px; }
.tv__pad { grid-template-columns: repeat(3, 3.4em); }
.tv__fx { grid-template-columns: repeat(2, 5.6em); align-content: start; }
.tv__flap .os-btn { min-width: 0; padding: 5px 4px; font-size: 12px; }
.tv__pad [data-p] { font: 16px/1 vtFont, monospace; }
.tv__pad .tv__w { font-size: 11px; }
.tv__flap [aria-pressed="true"] { background: linear-gradient(#dcdfd7, #eceee8); box-shadow: inset 1px 1px 0 var(--os-sh); font-weight: bold; }
/* teletext's own four colours on the keys, as on any remote */
.tv__fx i { display: inline-block; width: 0.8em; height: 0.8em; margin-right: 5px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); }
.fx-r { background: #ff3030; } .fx-g { background: #30ff50; } .fx-y { background: #ffee30; } .fx-b { background: #2a40ff; }

/* the channel list */
.tv__list { margin: 10px 0 0; padding: 0; list-style: none; border: 1px solid var(--os-line); background: #fff; max-height: 50vh; overflow: auto; }
.tv__list li::before { content: none; }
.tv__list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; font: 12px var(--os-ui); color: var(--os-ink); text-align: left; background: none; border: 0; cursor: pointer; }
.tv__list button:hover, .tv__list button:focus-visible { outline: none; background: var(--os-sel); color: #fff; }
.tv__list button[aria-current] { font-weight: bold; }
.tv__list b { min-width: 2.2em; padding: 1px 4px; text-align: center; font: 16px/1 vtFont, monospace; color: #8df7ff; background: var(--os-ink); }
.tv__list small { display: block; font-weight: normal; opacity: 0.75; }

/* ---------- the on-screen display ---------- */
/* the set's, over any channel: Portalis OS's colours on the tube, sized with it */
.osd { position: absolute; inset: 0; pointer-events: none; font: 2.2cqw/1.2 var(--os-ui); color: var(--os-ink); }
.osd > * { opacity: 0; transition: opacity 0.3s; }
.osd > .is-on { opacity: 1; transition: none; }
.osd__ch { position: absolute; right: 5%; top: 16%; display: flex; flex-direction: column; align-items: flex-end; }
.osd__ch b { font: 9cqw/0.9 vtFont, monospace; color: #8df7ff; text-shadow: 0.4cqw 0.4cqw 0 #02080b, 0 0 2cqw rgba(69, 240, 255, 0.5); }
.osd__ch span { margin-top: 0.6cqw; padding: 0.3cqw 1cqw; font: bold 2cqw/1.2 var(--os-ui); letter-spacing: 0.08em; text-transform: uppercase; color: #fff; background: rgba(2, 8, 11, 0.7); }
.osd__ch span:empty { display: none; }
.osd__msg { position: absolute; left: 5%; top: 16%; padding: 0.6cqw 1.4cqw; font: 3.6cqw/1 vtFont, monospace; letter-spacing: 0.06em; color: #f2c14e; background: rgba(2, 8, 11, 0.75); }
.osd__msg:empty { display: none; }
.osd__vol {
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1.4cqw; padding: 1cqw 1.6cqw;
  font: bold 1.8cqw/1 var(--os-ui); letter-spacing: 0.12em; color: #fff;
  background: linear-gradient(90deg, #072f3d, #157a90); box-shadow: inset 0 0 0 0.25cqw rgba(255, 255, 255, 0.25), 0.6cqw 0.6cqw 0 rgba(0, 8, 12, 0.5);
}
.osd__seg { display: flex; gap: 0.35cqw; }
.osd__seg i { width: 1.2cqw; height: 2.6cqw; background: rgba(2, 8, 11, 0.6); }
.osd__seg i.on { background: #f2c14e; box-shadow: inset 0 0.5cqw 0 rgba(255, 255, 255, 0.45); }
.osd__vol b { min-width: 3.4em; font: 3.4cqw/1 vtFont, monospace; letter-spacing: 0.04em; text-align: right; color: #8df7ff; }

/* INFO: now and next, a little Portalis OS window on the tube */
.osd__info {
  position: absolute; left: 5%; right: 5%; bottom: 12%;
  background: #e6e8e2; box-shadow: 0 0 0 0.35cqw #157a90, 0.8cqw 0.8cqw 0 rgba(0, 8, 12, 0.5);
}
.osd__info header { display: flex; align-items: center; gap: 1.6cqw; padding: 0.7cqw 1.4cqw; color: #fff; font-weight: bold; background: linear-gradient(90deg, #072f3d, #157a90 70%, #2a96ab); }
.osd__info header b { font: 4cqw/1 vtFont, monospace; color: #8df7ff; font-weight: normal; }
.osd__info header span { flex: 1; font-size: 2.6cqw; letter-spacing: 0.04em; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osd__info header time { font: 3.4cqw/1 vtFont, monospace; color: #f2c14e; font-weight: normal; }
.osd__info dl { margin: 0; padding: 1cqw 1.6cqw 0.4cqw; display: grid; gap: 0.6cqw; }
.osd__info dl div { display: grid; grid-template-columns: 7cqw 7.5cqw 1fr; align-items: baseline; }
.osd__info dt { font: bold 1.8cqw/1 var(--os-ui); letter-spacing: 0.1em; text-transform: uppercase; color: #157a90; }
.osd__info dd { display: contents; }
.osd__info dd time { font: 3cqw/1 vtFont, monospace; color: #0b2530; }
.osd__info dd { font-size: 2.4cqw; }
.osd__info p { margin: 0; padding: 0.4cqw 1.6cqw 1.2cqw; font-size: 2.2cqw; }
.osd__bar { height: 0.8cqw; margin: 0.4cqw 1.6cqw 1.2cqw !important; padding: 0 !important; background: #a3aaa4; box-shadow: inset 0.15cqw 0.15cqw 0 #4d5652; }
.osd__bar i { display: block; height: 100%; background: linear-gradient(90deg, #157a90, #45f0ff); }

/* ---------- Civic Weather ---------- */
.wx { position: absolute; inset: 0; }
.wx b, .wx strong { font-weight: normal; }
/* the club's own headings, paragraphs and bullets (style.css) stay off the tube */
.wx h3 { text-decoration: none; }
.wx p { margin: 0; }
.wx li::before { content: none; }
.wx__h { display: block; }
.wx__top {
  position: absolute; left: 0; right: 0; top: 0; height: 13%;
  display: flex; align-items: center; gap: 2.4cqw; padding: 0 3.6cqw;
  background: linear-gradient(to bottom, rgba(6, 30, 40, 0.92), rgba(6, 30, 40, 0.72));
  border-bottom: 0.35cqw solid #f2c14e;
}
.wx__brand { display: flex; align-items: center; gap: 1.2cqw; font: bold 2.1cqw/1 var(--os-ui); letter-spacing: 0.12em; color: #f2c14e; }
.wx__brand img { width: 6cqw; height: 6cqw; }
.wx__where { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wx__where b { font: 5.2cqw/1 vtFont, monospace; font-size: var(--nm, 5.2cqw); letter-spacing: 0.04em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.wx__where span { font-size: 1.8cqw; color: #8df7ff; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx__clock { display: flex; flex-direction: column; align-items: flex-end; }
.wx__clock b { font: 5cqw/1 vtFont, monospace; color: #fff; }
.wx__clock span { font-size: 1.8cqw; letter-spacing: 0.1em; color: #f2c14e; }

/* a page of the forecast: wipes in from the left, out to the right */
.wx__panel {
  position: absolute; left: 5%; right: 5%; top: 18%; bottom: 17%;
  display: flex; flex-direction: column;
  background: linear-gradient(to bottom, rgba(9, 52, 66, 0.9), rgba(4, 26, 36, 0.9));
  box-shadow: inset 0.3cqw 0.3cqw 0 rgba(141, 247, 255, 0.35), inset -0.3cqw -0.3cqw 0 rgba(0, 0, 0, 0.5), 0.8cqw 0.8cqw 0 rgba(0, 8, 12, 0.45);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.55s steps(14);
}
.wx__panel.is-in { clip-path: inset(0 0 0 0); }
.wx__panel.is-out { clip-path: inset(0 0 0 100%); }
.wx__h {
  margin: 0; padding: 0.9cqw 2.4cqw; font: bold 2.4cqw/1 var(--os-ui); letter-spacing: 0.16em; color: #0b2530;
  background: linear-gradient(to right, #f2c14e, #e9a93a 60%, rgba(242, 193, 78, 0));
}
.wx__body { flex: 1; min-height: 0; padding: 2.2cqw 3cqw; }

.wx-ic { display: block; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }

/* now: the icon and the temperature, the readings beside them */
.wx-now { display: grid; grid-template-columns: 38% 1fr; gap: 3cqw; height: 100%; align-items: center; }
.wx-now__big { display: flex; flex-direction: column; align-items: center; text-align: center; }
.wx-now__big .wx-ic { width: 17cqw; height: 17cqw; }
.wx-now__t { font: 11cqw/1 vtFont, monospace; color: #fff; }
.wx-now__w { font-size: 2.4cqw; letter-spacing: 0.12em; color: #f2c14e; }
.wx-rows { display: grid; gap: 0.9cqw; margin: 0; }
.wx-rows div { display: flex; align-items: baseline; gap: 1cqw; border-bottom: 0.15cqw dotted rgba(141, 247, 255, 0.35); padding-bottom: 0.5cqw; }
.wx-rows dt { flex: 1; font-size: 2cqw; letter-spacing: 0.12em; color: #8df7ff; }
.wx-rows dd { margin: 0; font: 3.4cqw/1 vtFont, monospace; color: #fff; }
.wx-meter { display: inline-block; width: 9cqw; height: 1.3cqw; margin-left: 1cqw; background: rgba(0, 0, 0, 0.5); box-shadow: inset 0 0 0 0.15cqw rgba(141, 247, 255, 0.4); vertical-align: middle; }
.wx-meter i { display: block; height: 100%; background: linear-gradient(to right, #45f0ff, #f2c14e 50%, #ff5a4e); }

/* the five days */
.wx-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.4cqw; height: 100%; }
.wx-day { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 1.2cqw 0.4cqw; text-align: center; background: rgba(0, 0, 0, 0.22); box-shadow: inset 0.15cqw 0.15cqw 0 rgba(141, 247, 255, 0.25); }
.wx-day h3 { margin: 0; font: bold 2.2cqw/1 var(--os-ui); letter-spacing: 0.14em; color: #f2c14e; }
.wx-day .wx-ic { width: 9.5cqw; height: 9.5cqw; }
.wx-day p { margin: 0; font-size: 1.6cqw; letter-spacing: 0.06em; color: #8df7ff; min-height: 2.2em; }
.wx-day b { font: 4.4cqw/1 vtFont, monospace; color: #fff; }
.wx-day small { font: 3cqw/1 vtFont, monospace; color: #9ab; }

/* advisories */
.wx-adv { display: flex; flex-direction: column; gap: 1.5cqw; height: 100%; }
.wx-adv article { display: grid; grid-template-columns: 11cqw 1fr; gap: 0.4cqw 1.6cqw; }
.wx-adv em { grid-row: span 2; align-self: start; padding: 0.6cqw 0; text-align: center; font: bold 1.6cqw/1 var(--os-ui); font-style: normal; letter-spacing: 0.1em; color: #0b2530; background: #8df7ff; }
.wx-adv em.lv-2 { background: #f2c14e; }
.wx-adv em.lv-3 { background: #ff5a4e; color: #fff; animation: wx-blink 1s steps(1) infinite; }
.wx-adv h3 { margin: 0; font: 3.2cqw/1 vtFont, monospace; letter-spacing: 0.06em; color: #fff; }
.wx-adv p { margin: 0; font-size: 2cqw; color: #cfe; }
.wx-adv .wx-fine { margin-top: auto; font-size: 1.5cqw; color: #8aa; font-style: italic; }
@keyframes wx-blink { 50% { opacity: 0.35; } }

/* across the network: other cities' weather */
.wx-net { display: grid; grid-template-columns: 1fr 1fr; gap: 1cqw 3cqw; margin: 0; padding: 0; list-style: none; }
.wx-net li { display: grid; grid-template-columns: 6.5cqw 1fr auto; align-items: center; gap: 1.4cqw; padding: 0.4cqw 0; border-bottom: 0.15cqw dotted rgba(141, 247, 255, 0.35); }
.wx-net .wx-ic { width: 6cqw; height: 6cqw; }
.wx-net span { font-size: 2cqw; line-height: 1.15; color: #fff; text-transform: uppercase; }
.wx-net span small { display: block; font-size: 1.5cqw; letter-spacing: 0.08em; color: #8df7ff; }
.wx-net b { font: 4cqw/1 vtFont, monospace; color: #fff; }

/* between pages, only the city: a chip with the current reading in the corner */
.wx__chip {
  position: absolute; left: 5%; bottom: 17%; display: flex; align-items: center; gap: 1.4cqw; padding: 1cqw 2cqw 1cqw 1.2cqw;
  background: rgba(4, 26, 36, 0.85); border-left: 0.6cqw solid #f2c14e;
  opacity: 0; transform: translateX(-2cqw); transition: opacity 0.4s, transform 0.4s;
}
.wx__chip.is-in { opacity: 1; transform: none; }
.wx__chip .wx-ic { width: 7cqw; height: 7cqw; }
.wx__chip b { font: 6cqw/1 vtFont, monospace; color: #fff; }
.wx__chip span { font-size: 1.8cqw; letter-spacing: 0.12em; color: #f2c14e; }
.wx__chip span small { display: block; color: #8df7ff; font-size: 1.5cqw; }

/* the crawl along the bottom */
.wx__tick {
  position: absolute; left: 0; right: 0; bottom: 0; height: 9%;
  display: flex; align-items: stretch;
  background: rgba(4, 22, 30, 0.92); border-top: 0.35cqw solid #157a90;
}
.wx__tick > b { display: flex; align-items: center; padding: 0 2.4cqw; font: bold 2.2cqw/1 var(--os-ui); letter-spacing: 0.16em; color: #0b2530; background: #f2c14e; }
.wx__crawl { position: relative; flex: 1; overflow: hidden; }
.wx__crawl span { position: absolute; top: 50%; left: 0; transform: translate(100cqw, -50%); white-space: nowrap; font: 3.6cqw/1 vtFont, monospace; letter-spacing: 0.04em; color: #fff; }

/* the icons' own weather */
.ic-drop { animation: ic-fall 0.9s linear infinite; }
.ic-drop:nth-child(2) { animation-delay: -0.3s; }
.ic-drop:nth-child(3) { animation-delay: -0.6s; }
.ic-ash { animation: ic-fall 2.4s linear infinite; }
.ic-ash:nth-child(2) { animation-delay: -0.8s; }
.ic-ash:nth-child(3) { animation-delay: -1.6s; }
@keyframes ic-fall { from { transform: translateY(-3px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(7px); opacity: 0; } }
.ic-bolt { color: #f2c14e; animation: ic-flash 2.2s steps(1) infinite; }
@keyframes ic-flash { 0%, 8%, 16% { opacity: 1; } 4%, 12%, 30%, 100% { opacity: 0; } }
.ic-fog { animation: ic-drift 4s ease-in-out infinite alternate; }
.ic-fog:nth-child(2) { animation-delay: -2s; }
@keyframes ic-drift { to { transform: translateX(4px); } }
.ic-sun { color: #f2c14e; }
.ic-ray { color: #f2c14e; transform-origin: 24px 24px; animation: ic-spin 24s linear infinite; }
@keyframes ic-spin { to { transform: rotate(360deg); } }
.ic-heat { color: #ff7a4e; animation: ic-pulse 1.8s ease-in-out infinite; transform-origin: 24px 24px; }
@keyframes ic-pulse { 50% { transform: scale(1.12); opacity: 0.6; } }
.ic-ring { color: #ff4ed8; animation: ic-pulse 2.6s ease-in-out infinite; transform-origin: 24px 24px; }
.ic-ring:nth-child(2) { color: #45f0ff; animation-delay: -1.3s; }
.ic-ice { color: #bdf3ff; transform-origin: 24px 24px; animation: ic-spin 30s linear infinite; }
.ic-gold { color: #f2c14e; }
.ic-dim { color: #7f9aa0; }
.ic-wave { color: #45f0ff; animation: ic-drift 1.6s ease-in-out infinite alternate; }
.ic-wave:nth-child(2) { animation-delay: -0.8s; }

@media (prefers-reduced-motion: reduce) {
  .wx-ic *, .wx-adv em { animation: none !important; }
  .wx__panel { transition: none; }
}
/* a break (tv.js, portalis/ads.js) has the whole tube: the forecast steps aside */
.wx.is-away { display: none; }

/* 05 Rotation: its own look, a music channel's. a bug in the corner over the videos (none
   on the idents, which carry the name themselves) and MTV's caption, bottom left, white
   type on the picture with a hard shadow, at a video's start and end */
.mv { position: absolute; inset: 0; pointer-events: none; font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; }
.mv__bug { position: absolute; right: 5.5%; bottom: 6.5%; font: 600 3.4cqw/1 'Barlow Condensed', 'Arial Narrow', sans-serif; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.55); text-shadow: 0.25cqw 0.25cqw 0 rgba(255, 61, 139, 0.5); }
.mv.is-ident .mv__bug { display: none; }
.mv__l3 { position: absolute; left: 6%; bottom: 9%; max-width: 64%; display: flex; flex-direction: column; gap: 0.3cqw; color: #fff; text-shadow: 0.25cqw 0.25cqw 0 rgba(0, 0, 0, 0.85); opacity: 0; transform: translateX(-1.5cqw); transition: opacity 0.4s, transform 0.4s; }
.mv__l3.is-in { opacity: 1; transform: none; }
.mv__l3 > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv__l3 b { font: 600 4.2cqw/1.05 'Barlow Condensed', 'Arial Narrow', sans-serif; text-transform: uppercase; letter-spacing: 0.02em; }
.mv__l3 span { font: 500 3.3cqw/1.1 'Barlow Condensed', 'Arial Narrow', sans-serif; }
.mv__l3 small { font: 500 2.6cqw/1.1 'Barlow Condensed', 'Arial Narrow', sans-serif; text-transform: uppercase; letter-spacing: 0.1em; color: #ffd23d; }
@media (prefers-reduced-motion: reduce) { .mv__l3 { transition: none; transform: none; } }
