:root {
  --ink: #16181d;
  --muted: #5d6470;
  --rule: #dcdfe4;
  --paper: #fbfaf7;
  --card: #ffffff;
  --accent: #b3122e;
  --accent-ink: #ffffff;
  --link: #16181d;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceae4;
    --muted: #a3a8b2;
    --rule: #2f333b;
    --paper: #121418;
    --card: #191c21;
    --accent: #e5485f;
    --link: #eceae4;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Masthead */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.topline { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; font-size: 13px; color: var(--muted); }
.search input { font: inherit; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); color: var(--ink); width: 160px; }
.brand { text-align: center; padding: 14px 16px 12px; }
.logo { font: 700 clamp(34px, 6vw, 60px)/1 var(--serif); letter-spacing: -0.02em; }
.logo:hover { text-decoration: none; }
.logo.small { font-size: 24px; }
.tagline { margin: 6px 0 0; font: italic 16px var(--serif); color: var(--muted); }
.sections { border-top: 3px double var(--ink); }
.sections .wrap { display: flex; gap: 4px 22px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; font-size: 14px; font-weight: 600; scrollbar-width: none; }
.sections a { white-space: nowrap; }
.sections a[aria-current] { color: var(--accent); }

main.wrap { padding-top: 24px; padding-bottom: 48px; }

/* Cards */
.kicker { display: inline-block; font: 600 12px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 8px; }
.card h3, .lead h1 { font-family: var(--serif); font-weight: 600; margin: 0 0 8px; line-height: 1.15; letter-spacing: -0.01em; }
.card h3 { font-size: 21px; }
.standfirst { color: var(--muted); margin: 0 0 8px; }
.meta { font-size: 13px; color: var(--muted); margin: 0; }

.top { display: grid; grid-template-columns: 2fr 1.3fr 1fr; gap: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--rule); }
.lead h1 { font-size: clamp(30px, 4.2vw, 46px); line-height: 1.05; }
.lead .standfirst { font: 20px/1.45 var(--serif); }
.secondary { display: flex; flex-direction: column; gap: 18px; border-left: 1px solid var(--rule); padding-left: 28px; }
.secondary .card + .card { border-top: 1px solid var(--rule); padding-top: 18px; }
.latest { border-left: 1px solid var(--rule); padding-left: 24px; }
.latest h2, .section-title { font: 700 13px var(--sans); text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 12px; }
.latest ol { list-style: none; margin: 0; padding: 0; }
.latest li { padding: 10px 0; border-top: 1px solid var(--rule); font: 600 16px/1.3 var(--serif); }
.latest time { display: block; font: 500 12px var(--sans); color: var(--accent); margin-bottom: 3px; }

.section-block { padding: 26px 0; border-bottom: 1px solid var(--rule); }
.section-title { border-top: 3px solid var(--ink); padding-top: 10px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.grid .card h3 { font-size: 19px; }

.page-head { border-bottom: 3px solid var(--ink); margin-bottom: 8px; }
.page-head h1 { font: 700 40px/1.1 var(--serif); margin: 0 0 8px; }
.page-head p { color: var(--muted); margin: 0 0 16px; max-width: 70ch; }
.list .card.row { padding: 18px 0; border-bottom: 1px solid var(--rule); max-width: 820px; }
.list .card.row h3 { font-size: 24px; }

/* Article */
.story { max-width: 720px; margin: 0 auto; }
.story h1 { font: 700 clamp(32px, 5vw, 48px)/1.08 var(--serif); letter-spacing: -0.015em; margin: 0 0 14px; }
.story > header .standfirst { font: 22px/1.45 var(--serif); }
.byline { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 10px 0; margin: 18px 0 26px; }
.byline a { font-weight: 600; color: var(--ink); }
.story-body { font: 19px/1.7 var(--serif); }
.story-body p { margin: 0 0 1.1em; }
.story-body h2 { font: 700 23px/1.25 var(--serif); margin: 1.6em 0 0.6em; }
.story footer { margin-top: 32px; border-top: 1px solid var(--rule); padding-top: 18px; }
.tags { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { display: inline-block; font-size: 13px; border: 1px solid var(--rule); border-radius: 999px; padding: 3px 12px; }
.sourcing, .ai-note { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.sourcing a, .ai-note a { text-decoration: underline; }
.draft-flag { background: #fff3c4; color: #5c4400; padding: 8px 12px; border-radius: 6px; font-size: 14px; }

/* Authors */
.authors { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 20px; }
.author-card { display: block; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 20px; }
.author-card:hover { text-decoration: none; border-color: var(--ink); }
.avatar { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 600 16px var(--sans); margin-bottom: 10px; }
.author-card strong { display: block; font: 600 20px var(--serif); }
.author-card .desk { font-size: 13px; color: var(--accent); font-weight: 600; }
.author-card p { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

.empty { text-align: center; padding: 60px 0; color: var(--muted); }
.empty h1 { font-family: var(--serif); color: var(--ink); }

.site-footer { border-top: 3px double var(--ink); padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.site-footer nav { display: flex; gap: 18px; }
.site-footer p { margin: 0; }

@media (max-width: 980px) {
  .top { grid-template-columns: 1fr 1fr; }
  .latest { grid-column: 1 / -1; border-left: 0; padding-left: 0; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .top { grid-template-columns: 1fr; }
  .secondary { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 18px; }
  .grid { grid-template-columns: 1fr; }
  .search input { width: 120px; }
  .story-body { font-size: 18px; }
}

/* ---------------- Admin ---------------- */
body.admin { background: #f3f4f6; color: #16181d; }
.admin-bar { background: #16181d; color: #fff; }
.admin-bar .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
.admin-bar nav { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; }
.admin-bar a { color: #d6d9de; }
.admin main.wrap { max-width: 1000px; }
.panel { background: #fff; border: 1px solid #e2e5ea; border-radius: 10px; padding: 22px; margin-bottom: 20px; overflow-x: auto; }
.panel h1, .panel h2 { margin: 0 0 8px; font-family: var(--sans); }
.panel h1 { font-size: 22px; } .panel h2 { font-size: 18px; }
.hint { color: #5d6470; margin: 0 0 16px; font-size: 14px; }
.admin label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.admin input:not([type=checkbox]), .admin textarea { display: block; width: 100%; margin-top: 4px; font: 15px var(--sans); padding: 9px 11px; border: 1px solid #cfd4db; border-radius: 7px; background: #fff; color: #16181d; }
.admin label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.admin details { margin-bottom: 14px; } .admin summary { cursor: pointer; font-size: 14px; color: #5d6470; margin-bottom: 10px; }
.admin button { font: 600 14px var(--sans); background: #16181d; color: #fff; border: 0; border-radius: 7px; padding: 9px 16px; cursor: pointer; }
.admin button:disabled { opacity: 0.6; cursor: progress; }
.admin button.danger { background: #fff; color: #b3122e; border: 1px solid #e7b6bf; }
.admin table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0 16px; }
.admin th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #5d6470; border-bottom: 1px solid #e2e5ea; padding: 8px 6px; }
.admin td { border-bottom: 1px solid #eef0f3; padding: 10px 6px; vertical-align: top; }
.admin td a { text-decoration: underline; }
.sub { color: #5d6470; font-size: 12px; margin-top: 2px; }
.trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.actions button { padding: 6px 10px; font-size: 13px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef0f3; }
.pill.done { background: #dcf5e3; color: #11602c; } .pill.failed { background: #fde2e4; color: #93101f; }
.pill.queued { background: #fff3c4; color: #5c4400; }
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.flash.ok { background: #dcf5e3; color: #11602c; } .flash.err { background: #fde2e4; color: #93101f; }
.flash a { font-weight: 600; text-decoration: underline; color: inherit; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; } form.inline input { flex: 1 1 200px; margin: 0 !important; }
.row { display: flex; flex-wrap: wrap; gap: 12px; } .row > label { flex: 1 1 200px; }
.author-row { align-items: center; margin-bottom: 8px; }
.author-row input { flex: 1 1 200px; margin: 0 !important; } .author-row input:last-child { flex: 3 1 300px; }
.desk-label { width: 120px; font-size: 13px; font-weight: 600; }
.signout { display: flex; align-items: center; gap: 8px; margin: 0; }
.signout span { color: #9aa0aa; font-size: 13px; }
.admin .signout button { background: transparent; border: 1px solid #4a4f58; padding: 4px 10px; font-size: 13px; }
