/* Watch News: Timetable feed with a daily digest. Tokens first; light by default, dark by device or by choice. */
:root { --bg:#EDF0F2; --fg:#14181C; --muted:#4A5560; --line:#C9D0D6; --red:#C8261C; --wash:#DCE2E7; --warn-bg:#fef3c7; --warn-fg:#78350f; --warn-text:#b45309; color-scheme: light dark; }
/* Auto: follow the device unless the person chose a theme (data-theme set on <html>). */
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --bg:#14181C; --fg:#E8ECEF; --muted:#9AA6B1; --line:#2A323A; --red:#F0574D; --wash:#1E252B; --warn-bg:#3b2f0b; --warn-fg:#fde68a; --warn-text:#fbbf24; } }
:root[data-theme="dark"] { --bg:#14181C; --fg:#E8ECEF; --muted:#9AA6B1; --line:#2A323A; --red:#F0574D; --wash:#1E252B; --warn-bg:#3b2f0b; --warn-fg:#fde68a; --warn-text:#fbbf24; color-scheme: dark; }
:root[data-theme="light"] { --bg:#EDF0F2; --fg:#14181C; --muted:#4A5560; --line:#C9D0D6; --red:#C8261C; --wash:#DCE2E7; --warn-bg:#fef3c7; --warn-fg:#78350f; --warn-text:#b45309; color-scheme: light; }
:root { --col:720px; --pic:216px; --tcol:72px; --text:Barlow,"Helvetica Neue",Arial,system-ui,sans-serif; --cond:"Barlow Condensed","Arial Narrow","Helvetica Neue",Arial,sans-serif; }

* { box-sizing: border-box; }
[hidden] { display:none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin:0; background:var(--bg); color:var(--fg); font:400 16px/1.45 var(--text); }
a { color:inherit; }
button { font:inherit; color:inherit; background:none; border:0; padding:0; cursor:pointer; }
:focus-visible { outline:2px solid var(--fg); outline-offset:2px; border-radius:2px; }
/* Large screens get a wider column, a bigger photo and larger type so the page does not float in empty space. */
.wrap { max-width:var(--col); margin:0 auto; padding:0 1rem; }
.muted { color:var(--muted); font-size:.9rem; margin:.25rem 0 .6rem; }
.label { margin:.7rem 0 .3rem; font:600 15px var(--cond); }

/* Fonts: Barlow and Barlow Condensed (SIL Open Font License, see /fonts/OFL.txt), self-hosted, Latin subset. */
@font-face { font-family:"Barlow"; font-weight:400; font-style:normal; font-display:swap; src:url(/fonts/barlow-400.woff2) format("woff2"); }
@font-face { font-family:"Barlow"; font-weight:500; font-style:normal; font-display:swap; src:url(/fonts/barlow-500.woff2) format("woff2"); }
@font-face { font-family:"Barlow"; font-weight:600; font-style:normal; font-display:swap; src:url(/fonts/barlow-600.woff2) format("woff2"); }
@font-face { font-family:"Barlow Condensed"; font-weight:500; font-style:normal; font-display:swap; src:url(/fonts/barlow-condensed-500.woff2) format("woff2"); }
@font-face { font-family:"Barlow Condensed"; font-weight:600; font-style:normal; font-display:swap; src:url(/fonts/barlow-condensed-600.woff2) format("woff2"); }
@font-face { font-family:"Barlow Condensed"; font-weight:700; font-style:normal; font-display:swap; src:url(/fonts/barlow-condensed-700.woff2) format("woff2"); }

/* Header */
.top { position:sticky; top:0; z-index:10; background:var(--bg); border-bottom:1px solid var(--line); }
.bar { display:flex; align-items:center; gap:1.25rem; height:72px; }
.mark { margin:0; font:700 30px/1 var(--cond); letter-spacing:.005em; white-space:nowrap; }
.search { position:relative; flex:1; min-width:0; max-width:560px; }
.search svg { position:absolute; left:.85rem; top:50%; translate:0 -50%; width:17px; height:17px; stroke:var(--muted); fill:none; stroke-width:2; stroke-linecap:round; }
.search input { width:100%; font:inherit; font-size:16px; color:var(--fg); background:var(--wash); border:1px solid transparent; border-radius:8px; padding:.7rem 2.4rem .7rem 2.6rem; }
.search input::placeholder { color:var(--muted); }
.clear { position:absolute; right:.5rem; top:50%; translate:0 -50%; width:28px; height:28px; border-radius:50%; color:var(--muted); }
.clear:hover { background:var(--line); }
#open-settings { margin-left:auto; }
.icon { width:44px; height:44px; display:grid; place-items:center; border-radius:6px; }
.icon:hover, .icon[aria-expanded="true"] { background:var(--wash); }
.icon svg { width:22px; height:22px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.tabs { display:flex; gap:2rem; }
.kind-tabs { display:contents; }
.tab { font:500 21px/1 var(--cond); padding:.5rem 0 .8rem; color:var(--muted); border-bottom:2px solid transparent; }
.tab.active { color:var(--fg); border-bottom-color:var(--fg); }
.count { font-weight:500; color:var(--muted); }

/* Feed rows: time | text | photo | save flag. The flag always sits in the last column, so it never moves. */
.day { position:sticky; top:var(--head,97px); z-index:5; background:var(--bg); margin-top:.4rem; padding:1.1rem 0 .45rem; border-bottom:1px solid var(--fg); font:600 15px/1 var(--cond); letter-spacing:.02em; color:var(--muted); }
.entry { display:grid; grid-template-columns:var(--tcol) minmax(0,1fr) var(--pic) 44px; gap:0 1rem; align-items:start; padding:1.4rem 0; border-bottom:1px solid var(--line); }
.entry.nopic { grid-template-columns:var(--tcol) minmax(0,1fr) 44px; }
.entry .flag { grid-column:-2 / -1; }
.t { font:500 23px/1.05 var(--cond); font-variant-numeric:tabular-nums; padding-top:.1rem; }
.new .t, .t.new { color:var(--red); }
.main { min-width:0; }
.hl { display:block; font-size:17px; font-weight:500; line-height:1.3; text-decoration:none; overflow-wrap:anywhere; }
.hl:hover { text-decoration:underline; text-underline-offset:3px; }
.src { margin-top:.3rem; font-size:13px; color:var(--muted); }
.src .o:hover { color:var(--fg); text-decoration:underline; text-underline-offset:3px; }
.sum { margin:.35rem 0 0; font-size:14px; color:var(--muted); max-width:62ch; overflow-wrap:anywhere; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.thumb { grid-column:3; width:var(--pic); aspect-ratio:3/2; background:var(--wash); border-radius:2px; overflow:hidden; display:block; }
.thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.flag { width:40px; height:40px; display:grid; place-items:center; border-radius:6px; color:var(--muted); justify-self:end; margin-top:-.25rem; }
.flag:hover { background:var(--wash); color:var(--fg); }
.flag svg { width:20px; height:20px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linejoin:round; }
.flag[aria-pressed="true"] { color:var(--fg); }
.flag[aria-pressed="true"] svg { fill:currentColor; }
mark { background:transparent; color:inherit; font-weight:600; box-shadow:inset 0 -.45em 0 color-mix(in srgb, var(--red) 28%, transparent); }

/* First-load stand-ins: grey shapes with the same grid as a real row, no animation. */
.entry.ghost .t, .entry.ghost .bar1, .entry.ghost .bar2, .entry.ghost .bar3 { background:var(--wash); border-radius:3px; }
.entry.ghost .t { width:60%; height:1em; margin-top:.25rem; }
.entry.ghost .bar1 { height:1.15em; width:92%; }
.entry.ghost .bar2 { height:1.15em; width:64%; margin-top:.5rem; }
.entry.ghost .bar3 { height:.9em; width:40%; margin-top:.8rem; }

/* Last visit: a red line that draws in once */
.seen { position:relative; display:flex; align-items:center; height:26px; margin:.2rem 0; }
.seen::before { content:""; position:absolute; left:0; right:0; top:50%; height:2px; background:var(--red); transform-origin:left; }
.seen.draw::before { animation:sweep .9s cubic-bezier(.2,.7,.2,1) both; }
.seen::after { content:""; position:absolute; left:0; top:50%; width:9px; height:9px; margin:-4.5px 0 0 -2px; border-radius:50%; background:var(--red); }
.seen span { position:relative; background:var(--bg); color:var(--red); font:600 15px/1 var(--cond); letter-spacing:.02em; padding:0 .6rem 0 1.1rem; }
@keyframes sweep { from { transform:scaleX(0); } }

/* Digest card (top of the feed) */
.dcard { margin:1.1rem 0 .6rem; border:1px solid var(--fg); border-radius:2px; overflow:hidden; }
/* 16:9 as a minimum: the ::before sets the height from the width, and the caption can make it taller. */
.lead { position:relative; display:flex; align-items:flex-end; background:#14181C; color:#fff; text-decoration:none; }
.lead::before { content:""; flex:none; width:0; padding-top:56.25%; }
.lead img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.lead .shade { position:absolute; inset:0; background:linear-gradient(transparent 30%, rgba(0,0,0,.85)); }
.cap { position:relative; width:100%; padding:1rem 1.2rem; display:flex; flex-direction:column; gap:.3rem; }
.cap .why { font:600 16px/1 var(--cond); color:#ffb1aa; text-shadow:0 1px 6px rgba(0,0,0,.9); }
.cap .h { font:600 clamp(20px,3.6vw,30px)/1.15 var(--text); max-width:28ch; }
.cap .o { font-size:13px; opacity:.85; }
.dl { padding:.9rem 1.2rem 1rem; }
.dl h2 { margin:0 0 .4rem; font:700 24px/1 var(--cond); }
.dl .bs { margin:.1rem 0 .7rem; font-size:15px; color:var(--muted); }
.dl ol { list-style:none; margin:0; padding:0; }
.dl li { display:grid; grid-template-columns:22px 1fr; gap:.4rem; padding:.4rem 0; border-top:1px solid var(--line); font-size:15px; line-height:1.3; }
.dl li .n { font:600 18px/1.1 var(--cond); color:var(--muted); }
.dl li a { text-decoration:none; font-weight:500; }
.dl li a:hover { text-decoration:underline; text-underline-offset:3px; }
.dfoot { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-top:.6rem; font-size:14px; color:var(--muted); }
.dcard.done .ok { margin:.2rem 0 .3rem; font:700 28px var(--cond); color:var(--red); }
.rdfold { margin:.7rem 0 0; border-top:1px solid var(--line); padding-top:.5rem; font-size:14px; color:var(--muted); }
.rdfold summary { cursor:pointer; font:600 16px var(--cond); list-style:none; }
.rdfold summary::before { content:"+"; display:inline-block; width:1.1rem; }
.rdfold[open] summary::before { content:"\2013"; }
.rdfold ul { margin:.4rem 0 0; padding-left:1.1rem; }
.rdfold li { padding:.15rem 0; }
.rdfold a { text-decoration:none; }
.rdfold a:hover { text-decoration:underline; }

/* Digest page */
.dh { margin:1.4rem 0 .2rem; }
.dh h1 { margin:0; font:700 clamp(40px,8vw,60px)/.95 var(--cond); }
.dh p { margin:.4rem 0 0; color:var(--muted); }
.brief { margin:1.2rem 0 .8rem; padding:1.1rem 0 1rem; border-top:2px solid var(--fg); border-bottom:1px solid var(--line); }
.brief h2, .top5 { margin:0 0 .6rem; font:700 26px/1 var(--cond); }
.top5 { margin:1.4rem 0 0; }
.brief .bt { margin:0; font-size:19px; line-height:1.5; max-width:60ch; }
.dg { display:grid; grid-template-columns:52px minmax(0,1fr) 40px; gap:0 .9rem; padding:1.3rem 0; border-bottom:1px solid var(--line); align-items:start; }
.dg .rk { font:700 44px/.9 var(--cond); color:var(--muted); }
.dg .hl { font-size:22px; font-weight:600; line-height:1.2; }
.dg .why { margin:.45rem 0 0; font:500 16px/1.2 var(--cond); color:var(--red); }
.bigpic { grid-column:1/-1; margin-top:.9rem; aspect-ratio:3/2; background:var(--wash); overflow:hidden; border-radius:2px; display:block; }
.bigpic img { width:100%; height:100%; object-fit:cover; display:block; }
.dend { margin:1.6rem 0 4rem; text-align:center; }
.dend .line { position:relative; height:2px; background:var(--red); margin-bottom:1.2rem; transform-origin:left; animation:sweep 1s cubic-bezier(.2,.7,.2,1) both; }
.dend .line::before { content:""; position:absolute; left:0; top:-4px; width:10px; height:10px; border-radius:50%; background:var(--red); }
.dend b { display:block; font:700 30px var(--cond); }
.dend p { margin:.2rem 0 1rem; color:var(--muted); }

/* Buttons, chips, panels, banners */
.btn { border:1px solid var(--fg); border-radius:6px; padding:.45rem 1.1rem; font-weight:500; background:none; }
.btn:hover { background:var(--fg); color:var(--bg); }
.fchip { display:inline-flex; align-items:center; gap:.5rem; margin:.9rem 0 0; padding:.25rem .3rem .25rem .8rem; border:1px solid var(--line); border-radius:99px; font-size:14px; }
.fchip button { width:22px; height:22px; border-radius:50%; color:var(--muted); }
.fchip button:hover { background:var(--wash); }
.more { text-align:center; margin:1.6rem 0 3rem; }
.empty { padding:2.5rem 0; color:var(--muted); max-width:42ch; }
/* Quiet status line: an amber dot and muted text, no box. Errors use the amber text colour. */
.banner { display:flex; align-items:center; gap:.5rem; margin:.9rem 0 0; font-size:13px; color:var(--muted); }
.banner::before { content:""; flex:none; width:7px; height:7px; border-radius:50%; background:var(--warn-text); }
.banner.err { color:var(--warn-text); font-size:14px; }
.panel { max-width:720px; margin:0 auto; padding:0 1rem 3rem; }
.panel h2 { margin:1.2rem 0 .2rem; font:700 32px/1 var(--cond); }
.panel h3 { margin:1.4rem 0 .3rem; padding-top:1rem; border-top:1px solid var(--line); font:700 22px/1 var(--cond); }
.chips { display:flex; flex-wrap:wrap; gap:.35rem; margin:.2rem 0 .7rem; }
.chip { border:1px solid var(--line); border-radius:99px; padding:.2rem .7rem; font-size:13.5px; color:var(--muted); }
.chip:hover { border-color:var(--fg); color:var(--fg); }
.chip[aria-pressed="true"] { background:var(--fg); color:var(--bg); border-color:var(--fg); }
.row-form { display:flex; gap:.5rem; flex-wrap:wrap; margin:.2rem 0 .5rem; }
.row-form input, .panel input[type="text"], .panel input[type="password"] { flex:1 1 220px; min-width:0; font:inherit; padding:.45rem .6rem; border:1px solid var(--line); border-radius:6px; background:var(--wash); color:var(--fg); }
.source-list { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:.25rem .75rem; }
.source-list label { display:flex; gap:.5rem; align-items:baseline; padding:.25rem 0; }
.source-list small { color:var(--warn-text); }
.panel .row { display:flex; gap:.5rem; flex-wrap:wrap; align-items:center; }
.qr { margin:.75rem 0; }
.qr img { width:160px; height:160px; image-rendering:pixelated; background:#fff; padding:6px; border-radius:6px; }

/* Theme switch: a small segmented control with an icon per choice. */
.theme-switch { display:inline-flex; gap:2px; padding:3px; border:1px solid var(--line); border-radius:999px; background:var(--wash); }
.theme-switch button { display:grid; place-items:center; width:2rem; height:2rem; padding:0; border:0; border-radius:999px; background:transparent; color:var(--muted); cursor:pointer; transition:background .15s, color .15s; }
.theme-switch button:hover { color:var(--fg); }
.theme-switch button[aria-checked="true"] { background:var(--fg); color:var(--bg); }
.theme-switch svg { width:1.1rem; height:1.1rem; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }

/* Desktop: wide column, bigger photo and type. */
@media (min-width: 900px) {
  :root { --col:1080px; --pic:300px; --tcol:92px; }
  .entry { gap:0 1.5rem; }
  /* Header: wordmark left, search centred, gear right. */
  .bar { display:grid; grid-template-columns:1fr minmax(0,560px) 1fr; }
  .search { max-width:none; }
  #open-settings { margin-left:0; justify-self:end; }
  .t { font-size:27px; }
  .hl { font-size:21px; line-height:1.28; }
  .src { font-size:14px; margin-top:.4rem; }
  .sum { font-size:15.5px; margin-top:.5rem; -webkit-line-clamp:4; }
  .day { font-size:17px; padding-top:1.4rem; }
}

/* Very wide screens: wider again, so the margins stay modest. */
@media (min-width: 1500px) {
  :root { --col:1280px; --pic:372px; --tcol:104px; }
  .t { font-size:30px; }
  .hl { font-size:23px; }
  .sum { font-size:16.5px; max-width:68ch; }
}

/* Phones: the photo moves above the text and fills the width; the header scrolls away. */
@media (max-width: 640px) {
  .top { position:static; }
  .bar { height:64px; gap:.6rem; }
  .mark { font-size:25px; }
  .search input { font-size:16px; padding:.65rem 2rem .65rem 2.2rem; } /* 16px stops iPhones zooming in when the box is focused */
  .search input:placeholder-shown { padding-right:.6rem; }
  .search svg { left:.7rem; }
  .icon { width:40px; height:40px; }
  .tabs { gap:1.6rem; }
  .day { top:0; }
  .entry, .entry.nopic { grid-template-columns:54px minmax(0,1fr) 40px; gap:0 .6rem; padding-top:0; }
  .entry .thumb { order:-1; grid-column:1/-1; width:calc(100% + 2rem); margin:0 -1rem .75rem; aspect-ratio:16/10; border-radius:0; }
  .t { font-size:20px; padding-top:.9rem; }
  .entry .main { padding-top:.9rem; }
  .entry .flag { margin-top:.65rem; }
  .dg { grid-template-columns:40px minmax(0,1fr) 40px; }
  .dg .rk { font-size:34px; }
  .bigpic { margin-left:-1rem; margin-right:-1rem; border-radius:0; }
  .brief .bt { font-size:17.5px; }
}
@media (min-width: 480px) and (max-width: 640px) { .entry .thumb { aspect-ratio:16/9; } } /* keep the full-width photo from getting too tall */
@media (prefers-reduced-motion: reduce) { .seen.draw::before, .dend .line { animation:none; } .theme-switch button { transition:none; } }
