/* Schibsted Grotesk, SIL Open Font License 1.1 (fonts/OFL.txt), self-hosted. */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/schibsted-grotesk-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/schibsted-grotesk-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #eef0f3;
  --panel: #f7f8fa;
  --ink: #1b1e27;
  --muted: #5d6371;
  --line: #d6dae1;
  --accent: #2b3fd6;
  --accent-soft: #dfe3fb;
  --bar: #dde1ea;
  --mark: #ffe45c;
  --mark-ink: #1b1e27;
  --thumb: #d3d7df;
  --danger: #a3261b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c;
    --panel: #171b23;
    --ink: #e6e8ee;
    --muted: #949bab;
    --line: #2a303c;
    --accent: #9aa6ff;
    --accent-soft: #252c4d;
    --bar: #232936;
    --mark: #f5d544;
    --mark-ink: #15171c;
    --thumb: #222733;
    --danger: #ff8a7a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151c; --panel: #171b23; --ink: #e6e8ee; --muted: #949bab; --line: #2a303c;
  --accent: #9aa6ff; --accent-soft: #252c4d; --bar: #232936; --mark: #f5d544;
  --mark-ink: #15171c; --thumb: #222733; --danger: #ff8a7a; color-scheme: dark;
}

* { box-sizing: border-box; }
/* Author display rules (e.g. .menu button) must never override the hidden attribute. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Schibsted Grotesk", system-ui, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 18px 24px 12px;
}
/* Liked / Watched / All: which collection the page searches */
.scope { display: flex; gap: 20px; margin-bottom: 4px; }
.scope button {
  border: 0; background: none; cursor: pointer; padding: 2px 0 5px;
  font-size: 15px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.scope button:hover { color: var(--ink); }
.scope button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.scope .cnt { font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 2px; }
.searchrow { display: flex; gap: 12px; align-items: center; }
#q {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  font-size: clamp(24px, 3.4vw, 38px);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.15;
  padding: 4px 0;
  caret-color: var(--accent);
}
#q::placeholder { color: var(--muted); opacity: .55; font-weight: 500; }
#q:focus-visible { outline: none; }
#q::-webkit-search-cancel-button { filter: grayscale(1); cursor: pointer; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  border: 1px solid var(--line); background: transparent;
  padding: 3px 10px; border-radius: 999px; cursor: pointer; font-size: 13.5px;
}
.seg button:hover { border-color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.sel { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); }
.sel select {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 6px; padding: 3px 6px; font-size: 13.5px;
}
.syncbox { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.ghost {
  border: 1px solid var(--line); background: transparent; border-radius: 6px;
  padding: 4px 12px; cursor: pointer; font-size: 13.5px; white-space: nowrap;
}
.ghost:hover { border-color: var(--muted); }
.ghost:disabled { opacity: .6; cursor: progress; }
.linkish { border: 0; background: none; padding: 6px 0; color: var(--accent); cursor: pointer; font-size: 13.5px; }
.linkish:hover { text-decoration: underline; }
.only-narrow { display: none; }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); align-items: start; }
.side {
  position: sticky; top: var(--top-h, 120px);
  max-height: calc(100vh - var(--top-h, 120px)); overflow-y: auto;
  padding: 18px 16px 40px 24px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.side section + section { margin-top: 22px; }
.side h2 { font-size: 13.5px; font-weight: 600; margin: 0 0 8px; color: var(--muted); }
#chfilter {
  width: 100%; border: 1px solid var(--line); background: var(--panel);
  border-radius: 6px; padding: 5px 9px; font-size: 13.5px; margin-bottom: 6px;
}

.facet { list-style: none; margin: 0; padding: 0; }
.facet button {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer;
  padding: 4px 6px; border-radius: 5px; font-size: 13.5px; isolation: isolate;
}
.facet button::before { /* proportional count bar */
  content: ""; position: absolute; inset: 2px auto 2px 0; z-index: -1;
  width: var(--w, 0%); background: var(--bar); border-radius: 4px;
}
.facet button:hover { color: var(--accent); }
.facet button[aria-pressed="true"] { color: var(--accent); font-weight: 600; }
.facet button[aria-pressed="true"]::before { background: var(--accent-soft); }
.facet .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet .n { color: var(--muted); font-size: 12.5px; }
.facet img, .facet .noav {
  width: 20px; height: 20px; border-radius: 50%; flex: none; background: var(--thumb); object-fit: cover;
}

main { padding: 16px 24px 60px; min-width: 0; }
.summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 14px; }
#count { margin: 0; font-weight: 600; }
.active { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 4px 1px 10px;
  font-size: 13px; background: var(--panel);
}
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 15px; line-height: 1; }
.chip button:hover { color: var(--ink); }
.msg { margin: 30px 0; max-width: 60ch; color: var(--muted); }
.msg.error { color: var(--danger); white-space: pre-wrap; }
.msg code { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--ink); }

/* ---------------------------------------------------------------- results */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 26px 18px; }
.v { min-width: 0; }
.thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 7px; background: var(--thumb);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb img.broken { visibility: hidden; }
.dur, .flag {
  position: absolute; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 3px 5px; border-radius: 4px; background: rgb(15 17 22 / .82); color: #fff;
}
.dur { right: 6px; bottom: 6px; }
.flag { left: 6px; top: 6px; background: var(--danger); }
.flag.liked { background: var(--accent); color: var(--bg); }
.v.gone .thumb img { filter: grayscale(1); opacity: .7; }
.trow { display: flex; gap: 4px; margin-top: 8px; align-items: flex-start; }
.t {
  flex: 1; min-width: 0; color: inherit; text-decoration: none;
  font-weight: 600; font-size: 15px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.t:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.more {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  padding: 0 2px; font-size: 18px; line-height: 1; border-radius: 4px; flex: none;
}
.more:hover { color: var(--ink); background: var(--bar); }
.meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.ch {
  border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: inherit;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
}
.ch:hover { color: var(--accent); text-decoration: underline; }
.meta .when { flex: none; display: flex; gap: 6px; align-items: baseline; }
.meta .wc { font-weight: 600; color: var(--ink); }
.snip { margin: 6px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* the one loud thing: matches look like a highlighter stroke */
mark {
  background: linear-gradient(100deg, transparent 0 2%, var(--mark) 3% 97%, transparent 98%);
  color: var(--mark-ink); padding: 0 .12em; margin: 0 -.06em; border-radius: .2em .35em .25em .3em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

#sentinel { height: 1px; }

/* ---------------------------------------------------------------- dialog */
dialog {
  width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  border: 1px solid var(--line); border-radius: 10px; padding: 0;
  background: var(--panel); color: var(--ink);
}
dialog::backdrop { background: rgb(10 12 18 / .55); }
dialog form { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 10px 10px 0; }
#d-body { padding: 0 24px 24px; }
#d-body .thumb { border-radius: 8px; margin-top: 4px; }
#d-body h3 { font-size: 21px; line-height: 1.25; letter-spacing: -.01em; margin: 16px 0 6px; }
#d-body .facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 12px 0; font-size: 14px; }
#d-body .facts dt { color: var(--muted); }
#d-body .facts dd { margin: 0; }
#d-body .tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 14px; }
#d-body .tags span { font-size: 12.5px; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; color: var(--muted); }
#d-body .views { margin: 0 0 14px; font-size: 14px; }
#d-body .views summary { cursor: pointer; color: var(--accent); }
#d-body .views ol { margin: 8px 0 0; padding-left: 22px; max-height: 220px; overflow-y: auto; columns: 2 220px; }
#d-body .views li { break-inside: avoid; }
#d-body .desc { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; max-width: 72ch; }
#d-body a { color: var(--accent); }
#d-body .actions { display: flex; gap: 10px; margin-top: 4px; }
#d-body .actions a.ghost { color: var(--ink); text-decoration: none; }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 820px) {
  .top { padding: 12px 16px 10px; }
  .only-narrow { display: inline-block; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side {
    display: none; position: static; max-height: none; border-right: 0;
    border-bottom: 1px solid var(--line); padding: 14px 16px;
  }
  .side.open { display: block; }
  main { padding: 14px 16px 50px; }
  .syncbox { margin-left: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------------------------------------------------------------- account */
.account { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgb(10 12 18 / .18);
}
.menu[hidden] { display: none; }
.menu a, .menu button {
  display: block; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 7px 10px; border-radius: 5px; font-size: 14px; color: var(--ink); text-decoration: none;
}
.menu a:hover, .menu button:hover { background: var(--bar); }
.menu-who { margin: 2px 10px 6px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.danger-text { color: var(--danger) !important; }
button.danger {
  border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; font-weight: 600;
  background: var(--danger); color: var(--bg);
}
button.danger:disabled { opacity: .45; cursor: not-allowed; }
.syncbox a.inline { color: var(--accent); }

/* ---------------------------------------------------------------- dialogs */
.dlg-body { padding: 0 24px 24px; }
.dlg-body h3 { font-size: 21px; letter-spacing: -.01em; margin: 6px 0 8px; }
.dlg-body p { max-width: 62ch; }
.steps { padding-left: 22px; margin: 12px 0 18px; max-width: 64ch; }
.steps li { margin: 6px 0; }
.steps em { font-style: normal; font-weight: 600; }
.drop {
  display: flex; align-items: center; justify-content: center; min-height: 92px;
  border: 1.5px dashed var(--line); border-radius: 8px; cursor: pointer; color: var(--muted);
  padding: 12px; text-align: center;
}
.drop:hover, .drop:focus-within, .drop.over { border-color: var(--accent); color: var(--ink); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 14px; }
.field input {
  border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 7px 10px; max-width: 260px;
}

/* ---------------------------------------------------------------- landing & text pages */
body.page { background: var(--bg); }
.landing { max-width: 720px; margin: 0 auto; padding: 56px 24px 64px; }
.wordmark { font-weight: 700; font-size: 17px; letter-spacing: -.01em; margin: 0 0 56px; }
.wordmark a { color: inherit; text-decoration: none; }
.landing h1 {
  font-size: clamp(34px, 6vw, 56px); line-height: 1.05; letter-spacing: -.03em; font-weight: 700;
  margin: 0 0 20px; max-width: 16ch;
}
.landing h2 { font-size: 19px; margin: 44px 0 10px; letter-spacing: -.01em; }
.lead { font-size: 18.5px; line-height: 1.5; color: var(--muted); max-width: 58ch; margin: 0 0 28px; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 8px; }
.cta {
  display: inline-block; padding: 11px 20px; border-radius: 8px; font-weight: 600; font-size: 16px;
  background: var(--ink); color: var(--bg); text-decoration: none;
}
.cta:hover { background: var(--accent); }
.notice {
  margin: 0 0 22px; padding: 10px 14px; border-radius: 8px; max-width: 58ch;
  background: var(--accent-soft); color: var(--ink);
}
.landing .steps li { margin: 10px 0; line-height: 1.5; }
.landing p { line-height: 1.55; max-width: 64ch; }
.prose h1 { font-size: clamp(30px, 5vw, 44px); }
.prose ul { padding-left: 20px; max-width: 64ch; }
.prose li { margin: 7px 0; line-height: 1.5; }
.landing a { color: var(--accent); }
.landing .cta { color: var(--bg); }
.foot { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; }
