/* Cards — a quiet channel-style grid of videos; sources as light-bordered cards. */
:root {
  --accent: #2257d6;
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --text: #16181d;
  --muted: #596069;
  --line: #e3e5e9;
  --line-strong: #cdd1d7;
  --link: var(--accent);
  --tint: color-mix(in srgb, var(--accent) 9%, var(--bg));
  --mark: color-mix(in srgb, #f5c400 38%, var(--bg));
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --bg-soft: #1a1d21;
    --text: #e6e8eb;
    --muted: #9ca3ad;
    --line: #2a2e34;
    --line-strong: #3b4048;
    --link: color-mix(in srgb, var(--accent) 62%, #ffffff);
    --tint: color-mix(in srgb, var(--accent) 22%, var(--bg));
    --mark: color-mix(in srgb, #f5c400 30%, var(--bg));
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  caret-color: var(--accent);
  overflow-wrap: break-word;
}
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html:not(.js) .js-only { display: none !important; }
[hidden] { display: none !important; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 760px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* Top bar */
.topbar { border-bottom: 1px solid var(--line); font-size: 14px; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; }
.channel { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.channel a { color: var(--text); }
.avatar { width: 24px; height: 24px; border-radius: 50%; }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }

/* Page head */
.pagehead { padding: 36px 0 24px; }
.pagehead h1 { font-size: 28px; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
.pagehead .lede { margin-top: 8px; max-width: 60ch; color: var(--muted); font-size: 17px; }
.pagehead .muted { margin-top: 10px; font-size: 14px; }
.lede { color: var(--muted); }

/* Search + chips */
.tools { display: grid; gap: 14px; padding-bottom: 20px; }
.search { position: relative; max-width: 560px; }
.search input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 40px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:hover { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--text)); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-ic { position: absolute; left: 12px; top: 13px; color: var(--muted); pointer-events: none; }
.search kbd {
  position: absolute; right: 10px; top: 11px;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center;
  font: 500 12px/1 var(--font); color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 5px;
}
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }
@media (hover: none) { .search kbd { display: none; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px;
  font: 500 14px/1 var(--font); color: var(--text);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 999px;
  cursor: pointer;
}
.chip:hover { background: var(--bg-soft); }
.chip .n { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--tint); border-color: var(--accent); color: var(--link); }
.chip[aria-pressed="true"] .n { color: inherit; }

.status { display: flex; align-items: baseline; gap: 14px; font-size: 14px; color: var(--muted); min-height: 22px; }
.linkbtn { padding: 0; font: inherit; color: var(--link); background: none; border: 0; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 0.18em; }

/* Index: video cards */
.cards { display: grid; gap: 32px 24px; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); padding-bottom: 48px; }
.card { min-width: 0; }
.thumb, .vthumb {
  display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: var(--bg-soft);
  border: 1px solid var(--line);
}
.thumb img, .vthumb img { width: 100%; height: 100%; object-fit: cover; }
.nothumb { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.card-title { margin-top: 12px; font-size: 16px; line-height: 1.4; font-weight: 600; }
.card-title a { color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-title a:hover { color: var(--link); text-decoration: none; }
.card .meta { margin-top: 4px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.hits { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.hits-label { color: var(--muted); margin-bottom: 6px; }
.hits li { display: grid; grid-template-columns: 2.2em 1fr; padding: 4px 0; line-height: 1.4; }
.hits .hn { color: var(--muted); font-variant-numeric: tabular-nums; }
.hits .hd { display: block; color: var(--muted); font-size: 13px; }
.hits .more { margin-top: 4px; display: inline-block; }

/* Empty states */
.empty { padding: 48px 0 64px; max-width: 60ch; }
.empty-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }

/* Video page head */
.vhead { padding: 32px 0 24px; }
.vhead h1 { font-size: 23px; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
.vrow { display: flex; gap: 16px; align-items: flex-start; margin-top: 18px; }
.vthumb { flex: 0 0 136px; }
.vmeta { font-size: 14px; color: var(--muted); display: grid; gap: 2px; padding-top: 2px; }
.vhead .lede { margin-top: 18px; max-width: 65ch; }
@media (min-width: 720px) {
  .vhead { padding-top: 44px; }
  .vhead h1 { font-size: 30px; }
  .vthumb { flex-basis: 240px; }
  .vmeta { font-size: 15px; gap: 4px; }
}

/* Sticky search bar on the video page */
.tools.sticky {
  position: sticky; top: 0; z-index: 2;
  margin: 0 -20px; padding: 12px 20px; gap: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.tools.sticky .search { max-width: none; }
@media (min-width: 720px) { .tools.sticky { margin: 0; padding: 12px 0; } }

.filters { display: grid; gap: 12px; padding: 16px 0 8px; }
.filter { display: grid; gap: 6px; }
.filter-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.filter .chip { min-height: 32px; font-size: 13px; padding: 0 11px; }
.chip.more { color: var(--link); border-style: dashed; }

/* Sections and source cards */
.sec { padding-top: 20px; }
.sec-title { font-size: 18px; font-weight: 600; margin: 12px 0 12px; }
.sec-title .muted { font-weight: 400; font-size: 15px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.sources { display: grid; gap: 12px; }
.src {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  scroll-margin-top: var(--bar-h, 140px);
}
.src:target { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.src-head { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; }
.src-n {
  min-width: 26px; height: 22px; padding: 0 6px;
  display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--bg-soft); border-radius: 6px;
}
.src-n:hover { color: var(--link); text-decoration: none; }
.src-title { font-size: 16px; line-height: 1.4; font-weight: 600; }
.src-by, .src-note, .src-foot { margin-left: 36px; }
.src-by { margin-top: 4px; font-size: 14px; color: var(--muted); }
.src-by > span + span::before { content: " · "; }
.src-note { margin-top: 8px; font-size: 15px; line-height: 1.55; max-width: 65ch; }
.src-foot { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; }
.tag { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px;
  font-weight: 500; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text);
}
.btn svg { color: var(--link); }
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.small { font-size: 13px; }
.copy { margin-left: auto; color: var(--muted); }
.copy:hover { color: var(--link); }
.copy.done { color: var(--link); }
@media (max-width: 480px) {
  .src { padding: 14px; }
  .src-by, .src-note, .src-foot { margin-left: 0; }
}

/* Prev / next */
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 40px 0 48px; }
.pn-link { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; min-width: 0; }
.pn-link:hover { border-color: var(--line-strong); background: var(--bg-soft); text-decoration: none; }
.pn-link .muted { font-size: 13px; }
.pn-t { color: var(--text); font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pn .nx { text-align: right; }
@media (max-width: 480px) { .pn { grid-template-columns: 1fr; } .pn .nx { text-align: left; } }

/* Footer */
.footer { border-top: 1px solid var(--line); font-size: 14px; }
.footer-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-top: 20px; padding-bottom: 32px; }
.links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
