/* Palette from app/Shared/Theme.swift (light / dark); look from the approved WEB-2 mockup. */
:root {
  --accent: #23479A; --paper: #EEF1F4; --surface: #FFFFFF; --sunk: #E3E8EE; --ink: #131A26;
  --muted: #58637A; --faint: #A3ACBC; --line: #D3DAE3; --rule: #E3E8EE; --accent-soft: #DDE5F6; --selection: #EEF2FA;
  --highlight: #F6E27A; --highlight-ink: #131A26;
  --true: #2C7350; --true-bg: #DDEFE4; --false: #9C3A3A; --false-bg: #F6DEDB;
  --misleading: #8A5A12; --misleading-bg: #F5E8D0;
  --shadow: 0 1px 2px rgba(19,26,38,.05), 0 2px 8px rgba(19,26,38,.04);
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --bar-h: 59px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #8FAEF5; --paper: #0E1219; --surface: #171D28; --sunk: #1F2633; --ink: #E6EAF0;
    --muted: #98A3B6; --faint: #5C6678; --line: #2B3444; --rule: #252D3B; --accent-soft: #223153; --selection: #1E2A44;
    --highlight: #E6CD55; --shadow: none;
    --true: #7FCB9F; --true-bg: #18302A; --false: #EE9A92; --false-bg: #3A1F1F;
    --misleading: #E4B66A; --misleading-bg: #352A17;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }

/* header */
header#bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 28px; padding: 10px 24px; background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line); }
.wordmark { display: flex; flex-direction: column; line-height: 1; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.wordmark .he { font: 700 26px/1 "Times New Roman", serif; }
.wordmark .cap { font: 700 9px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); font-size: 15px; padding: 6px 12px; border-radius: 8px; }
.nav a:hover { background: var(--sunk); text-decoration: none; color: var(--ink); }
.nav a[aria-current] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.spacer { flex: 1; }
.hsearch { position: relative; width: 240px; margin: 0; }
.hsearch input { width: 100%; font: 14px var(--sans); padding: 7px 30px 7px 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--sunk); color: var(--ink); -webkit-appearance: none; appearance: none; }
.hsearch input::placeholder { color: var(--muted); }
.hsearch svg { position: absolute; left: 10px; top: 9px; width: 15px; height: 15px; stroke: var(--muted); fill: none; stroke-width: 2; pointer-events: none; }
.hsearch kbd { position: absolute; right: 8px; top: 6px; font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: var(--surface); pointer-events: none; }
.signout { font: 14px var(--sans); color: var(--muted); background: none; border: 0; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.signout:hover { color: var(--ink); background: var(--sunk); }
.tabbar { display: none; }

/* layout and type */
main { max-width: 760px; margin: 0 auto; padding: 36px 24px 96px; }
h1 { font: 600 34px/1.18 var(--serif); letter-spacing: -.01em; margin: 0 0 18px; }
.title-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.title-row h1 { margin: 0; }
.count { font: 13px var(--mono); color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; margin-bottom: 18px; }
h2.group { display: flex; align-items: center; gap: 12px; margin: 40px 0 12px; font: 700 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
h2.group::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.date { font: 12.5px var(--mono); text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.meta, .row-meta, .locator, .status { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }
.screen.notice { padding-top: 48px; }

/* filter */
.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filter input { flex: 1 1 260px; font: 15px var(--sans); padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); -webkit-appearance: none; appearance: none; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { font: 13px var(--sans); padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.seg .n { font-family: var(--mono); font-size: 11px; opacity: .7; margin-left: 4px; }

/* rows */
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.rows li + li { border-top: 1px solid var(--rule); }
.row { display: flex; gap: 14px; align-items: center; padding: 14px 18px; color: var(--ink); }
.row:hover, .row:focus-visible { background: var(--selection); text-decoration: none; }
.row .body { flex: 1; min-width: 0; }
.row-title { display: block; font: 17px/1.4 var(--serif); }
.row-meta { display: block; margin-top: 3px; font-size: 13px; }
.row .chev { color: var(--faint); font-size: 20px; }
.snippet { display: block; color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
mark { background: var(--highlight); color: var(--highlight-ink); border-radius: 2px; padding: 0 1px; }
.answer-text { font: 19px/1.6 var(--serif); margin: 14px 0 26px; }
.pill-line { margin: 0 0 14px; }
.verdict { flex: none; display: inline-flex; align-items: center; gap: 5px; font: 700 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.verdict::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.verdict-true { background: var(--true-bg); color: var(--true); }
.verdict-false { background: var(--false-bg); color: var(--false); }
.verdict-misleading { background: var(--misleading-bg); color: var(--misleading); }
.button { display: inline-flex; align-items: center; gap: 8px; font: 600 15px var(--sans); padding: 10px 18px; border-radius: 10px; border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
.button:hover { background: var(--accent-soft); text-decoration: none; }
.button.primary { background: var(--accent); color: var(--surface); }
.button.primary:hover { filter: brightness(1.08); }
.badge { font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); vertical-align: middle; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 36px 0 0; }
.chips a { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); font-size: 14px; }

/* answer: evidence cards */
.evidence { display: grid; gap: 10px; }
.ev { display: grid; grid-template-columns: 34px 1fr; gap: 4px 12px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); color: var(--ink); }
.ev:hover { border-color: var(--accent); text-decoration: none; }
.ev .ord { font: 22px/1 var(--serif); color: var(--faint); padding-top: 2px; }
.ev .ev-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ev .st { font: 600 16px/1.35 var(--sans); }
.ev .ex { grid-column: 2; font: italic 15px/1.5 var(--serif); color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; quotes: "\201C" "\201D"; }

/* quote cards */
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 24px 28px; margin-bottom: 16px; }
.caps { display: block; font: 700 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.qcard .src { display: block; font: 600 20px/1.3 var(--serif); color: var(--ink); margin: 8px 0 4px; }
.qcard .src:hover { color: var(--accent); text-decoration: none; }
.excerpt { margin: 22px 0 0; padding: 0 0 0 18px; border-left: 3px solid var(--highlight); }
.excerpt .loc { display: block; margin-bottom: 6px; }
.excerpt .ctx { font: italic 16px/1.65 var(--serif); color: var(--muted); }
.excerpt mark { font: normal 21px/1.5 var(--serif); background: linear-gradient(transparent 12%, var(--highlight) 12%, var(--highlight) 92%, transparent 92%); color: var(--highlight-ink); padding: 0 2px; border-radius: 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--rule); }
.actions.plain { margin: 0 0 8px; padding-top: 0; border-top: 0; }
span.notice { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); background: var(--sunk); padding: 6px 10px; border-radius: 8px; }
span.notice:empty { display: none; }

/* timeline */
.yr { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0 18px; }
.yr .y { font: 600 22px/1 var(--serif); color: var(--ink); margin: 0; padding-top: 18px; text-align: right; position: sticky; top: calc(var(--bar-h) + 12px); align-self: start; }
.yr .items { list-style: none; margin: 0; border-left: 2px solid var(--line); padding: 8px 0 16px 22px; }
.yr .it { position: relative; display: block; padding: 10px 14px; border-radius: 10px; color: var(--ink); }
.yr .it:hover { background: var(--surface); text-decoration: none; }
.yr .it::before { content: ""; position: absolute; left: -29px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.yr .it-title { display: block; font: 17px/1.4 var(--serif); }

/* sign-in card */
#signin { position: fixed; inset: 0; overflow: auto; display: grid; place-items: center; padding: 24px; }
.scard { width: 100%; max-width: 400px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 44px 32px 32px; }
.scard .he { font: 700 56px/1 "Times New Roman", serif; }
.scard .cap { font: 700 11px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin: 8px 0 26px; }
.scard p { color: var(--muted); font-size: 16px; margin: 0 0 24px; }
.scard small { display: block; margin-top: 22px; color: var(--faint); font-size: 12.5px; }
/* CloudKit draws a fixed 218x40 block with an SVG label around its own origin: centre the block, never touch its display. */
#apple-sign-in-button { display: flex; justify-content: center; min-height: 40px; line-height: 0; }
#apple-sign-in-button .apple-auth-button { margin: 0 auto; }
#apple-sign-in-button .apple-auth-button svg { display: block; overflow: visible; }

/* skeleton loading */
.skeleton .sk-row { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.skeleton .sk-row + .sk-row { border-top: 1px solid var(--rule); }
.sk { display: block; height: 14px; width: 80%; border-radius: 6px; background: linear-gradient(90deg, var(--sunk) 0%, var(--rule) 50%, var(--sunk) 100%); background-size: 200% 100%; animation: sh 1.4s infinite linear; }
.sk.short { width: 30%; height: 11px; }
.skeleton .sk-row:nth-child(2n) .sk:first-child { width: 68%; }
.skeleton .sk-row:nth-child(3n) .sk:first-child { width: 90%; }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* phone: bottom tab bar */
@media (max-width: 640px) {
  header#bar { padding: 10px 16px; gap: 12px; }
  .nav, .hsearch kbd, header#bar .spacer { display: none; }
  .hsearch { width: auto; flex: 1; }
  main { padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 27px; }
  .row { padding: 13px 14px; }
  .row .chev { display: none; }
  .qcard { padding: 18px; }
  .excerpt mark { font-size: 19px; }
  .yr { grid-template-columns: 1fr; }
  .yr .y { position: static; text-align: left; padding: 14px 0 4px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; justify-content: space-around; padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current] { color: var(--accent); }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  body:has(#bar[hidden]) .tabbar { display: none; }
}
