/* News page. Uses the tokens from app.css. Every block of content sits on a solid panel, so the
   painting behind the top of the page never runs behind text. */

/* the page is mostly pictures and short lists: let it use a wide screen */
body.has-side > main.nw { max-width: 1520px; }
/* other pages sit centred in 1180px, so on a laptop their text starts 16px further in: start this one there too */
@media (min-width: 761px) { body.has-side > main.nw { padding-left: calc(var(--gutter) * 2); padding-right: calc(var(--gutter) * 2); } }

.nw-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.nw-top h1 { margin: 0 0 4px; font-size: 28px; line-height: 1.15; letter-spacing: -0.015em; text-shadow: 0 2px 14px rgba(0, 0, 0, .55); }
.nw-lede { margin: 0; color: var(--text); opacity: .85; max-width: 62ch; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.nw-feed {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap;
}
.nw-feed::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--num); }
.nw-feed:hover { border-color: var(--gold); }

.nw-status { display: inline-block; padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.nw-status.nw-err { color: var(--err); }
.nw-status[hidden] { display: none; }

.nw a { color: var(--text); text-decoration: none; }
.nw a:hover { color: var(--gold); }
.nw-meta { color: var(--muted); font-size: 13px; }
.nw-note { color: var(--muted); margin: 0; list-style: none; }

/* ---------- panels ---------- */
.nw-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px 16px; margin: 0 0 16px; min-width: 0;
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .7);
}
.nw-ptop { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; margin: 0 0 12px; }
.nw-ptop h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.005em; }
.nw-pmeta { color: var(--muted); font-size: 13px; }

/* ---------- first screen: videos left, reading right ---------- */
.nw-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 16px; align-items: stretch; }
@media (max-width: 860px) { .nw-split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- watch: live streams and videos ---------- */
/* sized by the panel's own width, so the same rules serve a half-screen panel and a phone */
.nw-watch { container-type: inline-size; }
.nw-tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nw-tiles.nw-first > li:first-child { grid-column: 1 / -1; }
.nw-tile { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nw-pic {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden;
  background: var(--raise); margin-bottom: 5px;
}
.nw-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nw-tile:hover .nw-pic img { filter: brightness(1.08); }
.nw-tile:hover .nw-tname { color: var(--gold); }
.nw-tname { font-weight: 600; font-size: 13.5px; line-height: 1.3; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-ttitle { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.nw-tile .nw-meta { font-size: 12.5px; }
.nw-first > li:first-child .nw-tname { font-size: 16px; }
.nw-first > li:first-child .nw-ttitle { font-size: 13.5px; color: var(--text); opacity: .8; }
.nw-lang { font-size: 10.5px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; }

/* a half-screen panel: the busiest stream on top, the next four in a row under it */
@container (min-width: 400px) {
  .nw-tiles.nw-first { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .nw-first > li:not(:first-child) .nw-ttitle { display: none; }
}
/* a wide panel: the busiest stream beside a 2 x 2 block of the next four */
@container (min-width: 660px) {
  .nw-tiles.nw-first > li:first-child { grid-column: span 2; grid-row: span 2; }
  .nw-first > li:not(:first-child) .nw-ttitle { display: -webkit-box; }
}

/* labels on a picture: solid dark plates, readable on any frame */
.nw-chip {
  position: absolute; display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 6px; border-radius: 4px; background: rgba(8, 11, 20, .86); color: #fff;
  font: 600 11.5px/1.45 var(--ui);
}
.nw-chip-tl { left: 6px; top: 6px; }
.nw-chip-br { right: 5px; bottom: 5px; padding: 1px 5px; font-size: 11px; }
.nw-onair::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 0 0 rgba(255, 77, 77, .6); animation: nw-pulse 2s ease-out infinite; }
@keyframes nw-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 77, .55); } 70%, 100% { box-shadow: 0 0 0 6px rgba(255, 77, 77, 0); } }
@media (prefers-reduced-motion: reduce) { .nw-onair::before { animation: none; } }

/* videos: the server sends five per list. A row of five in a wide panel, otherwise a sideways strip */
.nw-vids .nw-tname { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nw-vids {
  grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 31%;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  margin: 0 -16px; padding: 0 16px 6px; scroll-padding: 0 16px;
}
.nw-vids > li { scroll-snap-align: start; }
@container (max-width: 399px) { .nw-vids { grid-auto-columns: 72%; margin: 0 -12px; padding: 0 12px 6px; scroll-padding: 0 12px; } }
/* a medium panel: rows of three (no strip cut off at the panel's edge); a wide one: one row of five */
@container (min-width: 400px) { .nw-vids { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; margin: 0; padding: 0; } }
@container (min-width: 660px) { .nw-vids { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.nw-yttop { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.nw-seg { display: inline-flex; padding: 2px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); }
.nw-seg button {
  height: 26px; padding: 0 10px; border: 0; border-radius: 5px; background: none; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.nw-seg button:hover { color: var(--text); }
.nw-seg button[aria-pressed="true"] { background: var(--raise); color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }

.nw-pitch { margin-top: 14px; font-size: 13px; }
.nw .nw-pitch a { color: var(--field); }

/* ---------- reading: Blizzard posts, patch notes, forum threads in tabs ---------- */
.nw-text { display: flex; flex-direction: column; padding-top: 8px; }
.nw-tabs { display: flex; gap: 2px; margin: 0 -4px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.nw-tabs button {
  flex: none; position: relative; height: 40px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 15px; font-weight: 600; white-space: nowrap;
}
.nw-tabs button:hover { color: var(--text); }
.nw-tabs button[aria-selected="true"] { color: var(--text); }
.nw-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--gold); }
.nw-tabs .nw-count { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
/* beside the videos the tab body takes the videos' height and scrolls inside it, so the first
   screen ends at the same line on both sides */
@media (min-width: 861px) {
  .nw-text { min-height: 520px; }
  .nw-tabbody { flex: 1 1 0; min-height: 0; contain: size; overflow-y: auto; overscroll-behavior: contain; margin-right: -10px; padding-right: 10px; scrollbar-width: thin; }
}

/* ---------- headlines, below ---------- */
.nw-news .nw-links { columns: 3 300px; column-gap: 28px; }
/* in columns every entry gets the same rule below it, so the column tops line up */
.nw-news .nw-links > li, .nw-news .nw-links > li:first-child { break-inside: avoid; border-top: 0; border-bottom: 1px solid var(--line); padding: 8px 0 9px; }

@media (max-width: 640px) {
  .nw-panel { padding: 12px 12px 14px; border-radius: 8px; }
  .nw-text { padding-top: 6px; }
  .nw-tabs button { font-size: 14px; padding: 0 9px; }
}

.nw-patch, .nw-posts, .nw-links { list-style: none; margin: 0; padding: 0; }
.nw-patch > li, .nw-posts > li, .nw-links > li { padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.nw-patch > li:first-child, .nw-posts > li:first-child, .nw-links > li:first-child { border-top: 0; padding-top: 2px; }

/* patch notes: a dated list, newest first */
.nw-patch > li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: start; }
.nw-patch > li.nw-note { display: block; }
.nw-day { display: flex; flex-direction: column; align-items: center; padding: 3px 0 4px; border-radius: 6px; background: var(--raise); line-height: 1.1; }
.nw-day b { font-size: 17px; font-weight: 650; color: var(--text); }
.nw-day span { font-size: 11.5px; color: var(--muted); }
.nw-official .nw-day { background: color-mix(in srgb, var(--gold) 16%, var(--raise)); }
.nw-official .nw-day b { color: var(--gold); }
.nw-patch a { font-weight: 600; line-height: 1.35; }
.nw-patch .nw-meta { display: block; margin-top: 2px; }
.nw-otag { color: var(--gold); font-weight: 600; }

/* posts with an excerpt */
.nw-posts h3 { margin: 0 0 3px; font-size: 15px; font-weight: 600; line-height: 1.35; }
.nw-posts .nw-meta { margin: 0 0 5px; }
.nw-excerpt { margin: 0; font-size: 14px; color: var(--text); opacity: .82; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-blue > li:not(.nw-note) { padding-left: 12px; border-left: 3px solid var(--q-rare); margin-top: 0; }
.nw-blue > li + li { margin-top: 8px; }
.nw-author { color: var(--q-rare); font-weight: 600; }

/* headlines: title and source */
.nw-links a { line-height: 1.35; }
.nw-links .nw-meta { display: block; margin-top: 2px; }

.nw-region { font: 600 11px/1 var(--ui); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 1px 4px; margin-right: 2px; vertical-align: 1px; }
.nw-foot { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* promoted streams: paid, so always labelled */
.nw-featured { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.nw-fcard {
  display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 10px 12px;
  background: var(--raise); border: 1px solid var(--line); border-left: 3px solid var(--num); border-radius: 8px;
}
.nw-fcard:hover .nw-tname { color: var(--gold); }
.nw-ftag { color: var(--num); font-weight: 600; font-size: 12px; border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; }

/* light theme: the painting is faint, so the heading needs no shadow */
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .nw-top h1, :root[data-theme="system"] .nw-lede { text-shadow: none; }
  :root[data-theme="system"] .nw-panel { box-shadow: 0 6px 20px -14px rgba(20, 27, 43, .35); }
}

/* small stream tiles keep their viewer line on one line */
.nw-first > li:not(:first-child) .nw-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
