/* Opparounds — the whole stylesheet. No build step, no framework.
   The serif/navy typography matches the email so the site and the briefing
   read as one thing. Dark mode is honored because half of these page views
   happen at 5:50am. */

:root {
  --navy: #1d3d63;
  --navy-deep: #16304e;
  --gold: #b08a3e;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --rule: #e5e7eb;
  --bg: #f7f8fa;
  --card: #ffffff;
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #8ab4e8;
    --navy-deep: #0e1621;
    --gold: #d4ab5f;
    --ink: #e8eaed;
    --muted: #9aa3af;
    --rule: #2a3341;
    --bg: #11161d;
    --card: #171d26;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* --- chrome --------------------------------------------------------------- */

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: var(--navy-deep);
  color: #fff;
  flex-wrap: wrap;
}
header.site .brand {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
header.site nav { display: flex; gap: 18px; }
header.site nav a {
  color: rgba(255, 255, 255, .88);
  text-decoration: none;
  font-size: 14px;
}
header.site nav a:hover { color: #fff; text-decoration: underline; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 34px 22px 60px;
}

footer.site {
  border-top: 1px solid var(--rule);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* --- type ---------------------------------------------------------------- */

h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.16;
  color: var(--ink);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
h2 {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--navy);
  margin: 44px 0 16px;
}
h3 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 0 0 6px;
  color: var(--ink);
}
p { line-height: 1.62; }

.kicker {
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 12px;
}
.lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 22px;
}
.fine { font-size: 13px; color: var(--muted); line-height: 1.6; }
.flash {
  background: #e8f5ee;
  border: 1px solid #bfe3ce;
  color: #17603c;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin: 0 0 18px;
}
@media (prefers-color-scheme: dark) {
  .flash { background: #14301f; border-color: #24523a; color: #8fd5aa; }
}

/* Callout under the lede on the signup-outcome pages. Amber rather than the
   green .flash: this is guidance to act on ("go look in spam"), not a
   confirmation that something succeeded. */
.notice {
  background: #fdf6e9;
  border: 1px solid #efdfc0;
  border-left: 3px solid var(--gold);
  color: var(--ink);
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 22px;
}
/* `:not(.btn)` matters: this selector outranks .btn, and in dark mode --navy is
   the button's own background, so a .btn inside a notice lost its label to an
   invisible same-on-same colour. */
.notice a:not(.btn) { color: var(--navy); }
.notice .btn { margin: 4px 0 2px; }
.notice small { color: var(--muted); font-size: 13px; line-height: 1.55; display: inline-block; }
@media (prefers-color-scheme: dark) {
  .notice { background: #241f16; border-color: #3d3320; border-left-color: var(--gold); }
}

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

.hero { padding: 10px 0 6px; }

/* --- section cards ------------------------------------------------------- */

.cards {
  list-style: none;
  counter-reset: card;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}
.cards li {
  counter-increment: card;
  position: relative;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px 18px 16px 54px;
}
.cards li::before {
  content: counter(card);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
@media (prefers-color-scheme: dark) {
  .cards li::before { color: var(--navy-deep); }
}
.cards p { margin: 0; font-size: 14.5px; color: var(--muted); }
.cards li.featured { border-color: var(--gold); border-left-width: 3px; }
.cards li.optional { border-style: dashed; }
.tag {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px 8px;
  vertical-align: 2px;
  font-weight: 700;
}

/* --- forms --------------------------------------------------------------- */

.signup, .prefs {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  display: grid;
  gap: 14px;
}
.field { display: grid; gap: 6px; }
.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.field > span em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}
.field input, .field textarea {
  font: inherit;
  font-size: 16px; /* 16px keeps iOS Safari from zooming on focus */
  padding: 11px 13px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}
.field textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.field input:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
  border-color: var(--navy);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  font-size: 14.5px;
  line-height: 1.5;
}
.check input { width: 18px; height: 18px; margin-top: 2px; }
.check em {
  display: block;
  font-style: normal;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* Honeypot — off-screen rather than display:none, which some bots detect. */
.hp {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.btn {
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .btn { color: var(--navy-deep); }
}
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--rule);
  font-weight: 600;
}
.btn.ghost:hover { color: #c0392b; border-color: #c0392b; filter: none; }

form.danger { margin-top: 24px; }

/* --- archive ------------------------------------------------------------- */

.archive-head { margin-bottom: 8px; }
.archive-head h1 { margin-bottom: 12px; }

/* Standfirst rule, the way a periodical would set it. */
.archive-head .stat {
  font-size: 13.5px;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin: 18px 0 0;
}
.archive-head .stat b { color: var(--ink); font-size: 15px; }
.archive-head .stat a { color: var(--navy); }

.month { margin-top: 30px; }
.month-label {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.archive { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  /* The gold edge is the same accent the vignette box uses inside an issue, so
     a card reads as a smaller version of the thing it links to. */
  border-left: 3px solid transparent;
  transition: border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.card:hover {
  border-left-color: var(--gold);
  transform: translateX(2px);
  box-shadow: 0 4px 16px rgba(16, 28, 48, .07);
}
@media (prefers-color-scheme: dark) {
  .card:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, .35); }
}
.card:focus-within {
  border-left-color: var(--gold);
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.card-link { display: block; padding: 15px 18px; text-decoration: none; }
.card-link:focus-visible { outline: none; } /* the card itself shows the ring */

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.no {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.when {
  font-size: 11.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.card-title {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.32;
  color: var(--navy);
  margin: 0 0 9px;
}
.card:hover .card-title { text-decoration: underline; text-underline-offset: 2px; }

.card-row {
  display: flex;
  gap: 9px;
  align-items: baseline;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 4px;
}
.card-row:last-child { margin-bottom: 0; }
.lbl {
  flex: none;
  width: 40px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: .75;
  padding-top: 2px;
}
.modality {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 5px;
  white-space: nowrap;
  vertical-align: 1px;
}

/* Narrow screens stack the label above its line. Deliberately `block` and not
   `grid`: as a grid item the modality chip becomes a stretched full-width pill
   instead of sitting inline after the pearl title. */
@media (max-width: 460px) {
  .card-row { display: block; }
  .lbl { display: block; width: auto; padding-top: 0; margin-bottom: 1px; }
  .card-title { font-size: 16.5px; }
}

/* --- a rendered issue ---------------------------------------------------- */

.issue h2 {
  font-size: 19px;
  margin: 30px 0 12px;
}
.issue p { font-family: var(--serif); font-size: 16.5px; }
.issue a { color: var(--navy); }
.backlink { margin-top: 40px; font-size: 14px; }
.backlink a { color: var(--navy); }

/* Inline styles inside a rendered issue carry hardcoded light-mode colors so
   the email and the archive page match. Neutralize them in dark mode so the
   text stays legible. */
@media (prefers-color-scheme: dark) {
  .issue [style*="color:#1a1a1a"] { color: var(--ink) !important; }
  .issue [style*="color:#1d3d63"] { color: var(--navy) !important; }
  .issue [style*="background:#f6f8fb"] { background: #1b2431 !important; }
  .issue [style*="background:#fbf8f2"] { background: #241f16 !important; }
}

/* --- admin --------------------------------------------------------------- */

/* The reading measure that suits prose is far too narrow for a seven-column
   table, so the admin pages opt out of it. */
body.wide main { max-width: 1040px; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-head h1 { margin-bottom: 0; }

.btn.tiny { font-size: 13px; padding: 7px 14px; border-radius: 8px; }
/* .btn.ghost turns red on hover because its only previous use was Unsubscribe.
   Sign out is not destructive, so this cancels that. */
.btn.ghost.quiet:hover { color: var(--ink); border-color: var(--muted); }

.flash.error { background: #fdecea; border-color: #f5c2bd; color: #922b21; }
@media (prefers-color-scheme: dark) {
  .flash.error { background: #331916; border-color: #5b2a24; color: #f0a79c; }
}

.fb-list { display: grid; gap: 12px; margin-top: 8px; }
.fb {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px 18px;
}
.fb header { margin-bottom: 8px; }
.fb header .sub { display: block; margin-top: 3px; }
.fb p { margin: 0; white-space: pre-wrap; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 20px;
}
.stat-box {
  flex: 1 1 116px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat-box b {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.1;
  color: var(--ink);
}
.stat-box span {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
}
.stat-box.ok b { color: var(--navy); }
.stat-box.warn { border-color: var(--gold); }
.stat-box.warn b { color: var(--gold); }

/* Seven columns will not fit a phone, and squeezing them produces an unreadable
   table rather than a responsive one. Scroll the table, never the page. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--card);
}
table.admin {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 720px;
}
table.admin th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.admin td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  color: var(--ink);
}
table.admin tr:last-child td { border-bottom: 0; }
table.admin td.em { font-weight: 600; word-break: break-all; min-width: 190px; }
table.admin td.num { white-space: nowrap; color: var(--muted); }
table.admin td.act { text-align: right; }
table.admin .sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--rule);
  color: var(--muted);
}
.badge.ok   { background: #e8f5ee; color: #17603c; }
.badge.warn { background: #fdf3e0; color: #8a6d1f; }
.badge.bad  { background: #fdecea; color: #922b21; }
@media (prefers-color-scheme: dark) {
  .badge.ok   { background: #14301f; color: #8fd5aa; }
  .badge.warn { background: #2e2513; color: #ddb968; }
  .badge.bad  { background: #331916; color: #f0a79c; }
}

/* "General medicine OR psychotherapy research" — the conjunction in that card's
   heading is set quieter than the two things it joins, so the heading still
   scans as one label rather than two competing ones. */
.cards h3 .alt {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 0 2px;
}
