/* policynews.uk */

:root {
  color-scheme: light dark;

  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-2: #f2f0ec;
  --ink: #16202e;
  --ink-soft: #3c4a5c;
  --muted: #667588;
  --line: #e2ded7;
  --line-strong: #cdc7bd;
  --accent: #1a4d8f;
  --accent-ink: #ffffff;

  --ok: #1f7a4d;
  --warn: #a9660d;
  --bad: #b3261e;

  --radius: 10px;
  --wrap: 62rem;
  --shadow: 0 1px 2px rgba(20, 28, 40, 0.05), 0 4px 14px rgba(20, 28, 40, 0.04);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e242c;
    --ink: #e7eaef;
    --ink-soft: #c2c9d3;
    --muted: #8e9aa9;
    --line: #262d36;
    --line-strong: #363f4a;
    --accent: #7fb0f0;
    --accent-ink: #0f1216;

    --ok: #4ec98a;
    --warn: #e2a44b;
    --bad: #f2726a;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--ink); }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  z-index: 50;
}
.skip:focus { left: 0; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--serif);
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand strong { font-weight: 700; }
.brand-text { font-weight: 400; }

.brand-mark {
  width: 0.7rem;
  height: 1.15rem;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent) 0 55%, var(--muted) 55% 100%);
  flex: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-size: 0.9rem;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }
.nav-rss {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
}

/* ---------- hero ---------- */

.hero {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 2.4rem 0 2rem;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
.hero-sub {
  margin: 0;
  max-width: 44rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
}
.hero-stats {
  margin: 1rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- filters ---------- */

.filters {
  margin: 1.5rem 0 1.25rem;
  padding: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.filter-row--secondary { margin-top: 0.5rem; }

.field { flex: 0 1 auto; }
.field--search { flex: 1 1 16rem; min-width: 12rem; }

input[type="search"], select {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0.45rem 0.6rem;
  appearance: none;
}
select {
  padding-right: 1.8rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 0.95rem) 55%, calc(100% - 0.62rem) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type="search"]:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.45rem 1rem;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { filter: brightness(1.08); color: var(--accent-ink); }

.clear {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: underline;
}

.result-count {
  margin: 0.7rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- feed ---------- */

.feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.05rem;
  box-shadow: var(--shadow);
}
.card:hover { border-color: var(--line-strong); }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.card-head .src {
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
}
.card-head .src:hover { color: var(--accent); text-decoration: underline; }
.card-head time { font-variant-numeric: tabular-nums; }

.kind {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.kind--government  { border-color: #6a8fc4; color: #40639b; }
.kind--statistics  { border-color: #77a58a; color: #3f7a58; }
.kind--parliament  { border-color: #b08fbf; color: #7a5490; }
.kind--think-tank  { border-color: #c2a26b; color: #8a6a2e; }
.kind--fact-check  { border-color: #c98f8f; color: #9c5555; }

@media (prefers-color-scheme: dark) {
  .kind--government { color: #93b6e8; }
  .kind--statistics { color: #86ccA5; }
  .kind--parliament { color: #cfa9dd; }
  .kind--think-tank { color: #d9bb84; }
  .kind--fact-check { color: #e5a3a3; }
}

.score {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 1.9rem;
  text-align: center;
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
}
.score--top  { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); color: var(--accent); }
.score--high { background: color-mix(in srgb, var(--ok) 16%, var(--surface-2)); color: var(--ok); }
.score--mid  { background: var(--surface-2); color: var(--ink-soft); }
.score--low  { background: transparent; color: var(--muted); opacity: 0.65; }

.card-title {
  font-family: var(--serif);
  font-size: 1.16rem;
  line-height: 1.28;
  letter-spacing: -0.008em;
  margin: 0 0 0.4rem;
  font-weight: 600;
}
.card-title a {
  color: var(--ink);
  text-decoration: none;
}
.card-title a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.card-summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 1.55;
}
/* Publisher's own blurb, shown until our summary is written. */
.card-summary--raw {
  color: var(--muted);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topics {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.6rem 0 0;
  padding: 0;
}
.topics a {
  display: inline-block;
  font-size: 0.72rem;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
}
.topics a:hover { background: var(--accent); color: var(--accent-ink); }

.empty {
  text-align: center;
  padding: 3rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty h2 { font-family: var(--serif); margin: 0 0 0.4rem; color: var(--ink); }

/* ---------- pagination ---------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.page-link {
  text-decoration: none;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}
.page-link.is-disabled { opacity: 0.35; border-style: dashed; color: var(--muted); }
.page-of { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- content pages ---------- */

.page { padding: 2.2rem 1.25rem 3.5rem; max-width: 48rem; }
.page h1 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  line-height: 1.15;
  margin: 0 0 0.7rem;
  letter-spacing: -0.02em;
}
.page h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin: 2rem 0 0.5rem;
}
.page p, .page li { color: var(--ink-soft); }
.lede { font-size: 1.05rem; color: var(--ink-soft); }
.page code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}
.steps li { margin-bottom: 0.6rem; }
.small { font-size: 0.82rem; color: var(--muted); }

/* ---------- sources table ---------- */

.table-scroll { overflow-x: auto; margin: 1.2rem 0; }
.sources {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 40rem;
}
.sources th, .sources td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.sources th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom-color: var(--line-strong);
}
.sources td a { text-decoration: none; font-weight: 600; }
.sources td a:hover { text-decoration: underline; }
.sources .num { text-align: right; font-variant-numeric: tabular-nums; }
.sources .when, .sources .status { color: var(--muted); white-space: nowrap; }
.note { display: block; font-size: 0.74rem; color: var(--muted); font-weight: 400; }

.dot {
  display: inline-block;
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  margin-right: 0.4rem;
}
.dot--ok  { background: var(--ok); }
.dot--bad { background: var(--bad); }
.dot--off { background: var(--line-strong); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 1.8rem 0 2.5rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.site-footer p { margin: 0 0 0.6rem; max-width: 46rem; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 34rem) {
  .hero { padding: 1.8rem 0 1.5rem; }
  .card { padding: 0.85rem 0.9rem; }
  .card-title { font-size: 1.06rem; }
  .field { flex: 1 1 46%; }
  .site-nav { gap: 0.75rem; font-size: 0.84rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
