/* Signal. Read-mode stylesheet. Tokens and reasoning live in DESIGN.md. */

:root {
  color-scheme: light dark;

  /* Colour: light theme. Contrast against --bg in DESIGN.md. */
  --bg: #fbf9f4;
  --text: #1d1b17;
  --muted: #555047;
  --rule: #dcd6ca;
  --edge: #8a8274;      /* tag and disclosure borders */
  --fill-1: #e8e1d4;    /* tag fill, light step */
  --fill-2: #e3a184;    /* tag fill, strong step */
  --hover: #f1ece2;
  --accent: #b23d16;
  --on-accent: #ffffff;
  --select: #f3d9cc;

  /* Type */
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step--2: 0.75rem;   /* tags */
  --step--1: 0.875rem;  /* meta, labels, nav */
  --step-dense: 1rem;   /* coverage list */
  --step-0: 1.0625rem;  /* body */
  --step-1: 1.25rem;    /* h2, dek */
  --step-lead: 1.3125rem; /* lead items */
  --step-2: 1.5rem;     /* index issue titles */
  --step-3: 2.25rem;    /* h1 */

  /* Space: 4px base, used in these steps only */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2.25rem;
  --s7: 3.5rem;

  --measure: 40rem;
  --tag-w: 6.25rem;      /* tag box width */
  --tag-gap: var(--s3);  /* 12px between tag and summary */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --text: #ece8df;
    --muted: #b3ac9f;
    --rule: #38352e;
    --edge: #7d766a;
    --fill-1: #36332c;
    --fill-2: #87421f;
    --hover: #221f1b;
    --accent: #f0895a;
    --on-accent: #1a1410;
    --select: #5a2f1c;
  }
}

@media (min-width: 48rem) {
  :root {
    --step-0: 1.125rem;
    --step-1: 1.375rem;
    --step-lead: 1.5rem;
    --step-3: 3rem;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  accent-color: var(--accent);
  caret-color: var(--accent);
}

body {
  margin: 0 auto;
  max-width: calc(var(--measure) + 2 * var(--s5));
  padding: 0 var(--s5) var(--s7);
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.55;
  overflow-wrap: break-word;
}

::selection { background: var(--select); color: var(--text); }

/* Links: underlined, accent, offset so descenders stay readable */
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -999px;
  top: var(--s2);
  padding: var(--s2) var(--s3);
  background: var(--bg);
  font-family: var(--sans);
  font-size: var(--step--1);
}
.skip:focus { left: var(--s4); }

/* Site chrome: small sans, out of the way */
header.site,
footer.site,
nav[aria-label="Issue navigation"] {
  font-family: var(--sans);
  font-size: var(--step--1);
}

header.site {
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--rule);
}
header.site a {
  display: inline-block;
  padding: var(--s2) 0;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}
header.site a::before {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-right: 0.45em;
  background: var(--accent);
  border-radius: 50%;
  vertical-align: 0.05em;
}

footer.site {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
  color: var(--muted);
}
footer.site a,
nav[aria-label="Issue navigation"] a {
  display: inline-block;
  padding: var(--s2) 0;
}

/* Headings */
h1, h2, h3 {
  font-family: var(--serif);
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: var(--s6);
}

h2 {
  font-size: var(--step-1);
  font-weight: 700;
  margin: var(--s6) 0 var(--s3);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
}

h3 {
  font-family: var(--sans);
  font-size: var(--step--1);
  font-weight: 600;
  margin: var(--s5) 0 var(--s2);
}

p { margin: 0 0 var(--s4); }

.meta {
  margin-top: var(--s3);
  color: var(--muted);
  font-family: var(--sans);
  font-size: var(--step--1);
  line-height: 1.5;
}
time { font-variant-numeric: tabular-nums; white-space: nowrap; }

ul, ol { margin: 0; padding: 0; list-style: none; }
li { margin: 0; }
strong { font-weight: 700; }

/* Lead: the most important thing on the page. Its heading matches the
   others; the emphasis is carried by the larger item type below it. */
#lead li {
  font-size: var(--step-lead);
  line-height: 1.5;
  text-wrap: pretty;
}
#lead li + li {
  margin-top: var(--s5);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule);
}

/* Your subscriptions: body size, separated items */
#your-subscriptions li + li { margin-top: var(--s4); }

/* Coverage list: dense and scannable. The tag flows inline before the headline
   at its natural width. An earlier version hung it into the left padding with a
   negative text-indent; that reserved a fixed gutter and was inherited by the
   summary block, which pushed anything on the summary's first line off the
   left edge. */
li:has(> .tag) {
  padding-left: 0;
  text-indent: 0;
  font-size: var(--step-dense);
  line-height: 1.5;
  text-wrap: pretty;
}
li:has(> .tag) + li:has(> .tag) {
  margin-top: var(--s2);
  padding-top: var(--s2);
  border-top: 1px solid var(--rule);
}

/* One tag shape for all three labels. Only the fill steps: strong, light,
   none. Text is always --text, so every tag clears AA in both themes and
   the steps stay apart in greyscale. */
.tag {
  display: inline-block;
  box-sizing: border-box;
  /* Auto width: with a summary line under each headline, a fixed tag rail
     steals width the headline needs. */
  max-width: 100%;
  margin-right: var(--tag-gap);
  padding: 0 0.5em;
  text-indent: 0;
  vertical-align: baseline;
  font-family: var(--sans);
  font-size: var(--step--2);
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 3px;
}
.tag-affects-you { background: var(--fill-2); }
.tag-worth-knowing { background: var(--fill-1); }

/* Source attribution: never broken, bound to the word before it. */
.src { white-space: nowrap; color: var(--muted); }

/* Details: a full-width row that looks pressable and says what it will do */
details { margin-top: var(--s4); }

summary {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 2.75rem;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--edge);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step--1);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  flex: none;
  width: 1em;
  font-size: 1.25em;
  line-height: 1;
  text-align: center;
}
summary::after {
  content: "Show";
  content: "Show" / "";
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
}
summary:hover { background: var(--hover); }
details[open] > summary {
  margin-bottom: var(--s4);
  background: var(--hover);
}
details[open] > summary::before { content: "\2212"; }
details[open] > summary::after { content: "Hide"; content: "Hide" / ""; }

/* Receipts: source excerpts, set as quotation */
blockquote {
  margin: 0 0 var(--s4);
  padding-left: var(--s4);
  border-left: 1px solid var(--rule);
  color: var(--muted);
}
blockquote p:last-child { margin-bottom: 0; }
.receipts h3:first-child { margin-top: 0; }

/* Issue navigation */
nav[aria-label="Issue navigation"] {
  margin-top: var(--s6);
  color: var(--muted);
}

/* Index page */
.dek {
  margin-top: var(--s3);
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.4;
}
.issues li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s1) var(--s4);
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--rule);
}
.issues a {
  font-size: var(--step-2);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.issues a:hover { text-decoration: underline; }
.issues time {
  color: var(--muted);
  font-family: var(--sans);
  font-size: var(--step--1);
}

.meta time { white-space: nowrap; }

.issues li:last-child { border-bottom: 0; }

/* coverage summary: its own line, quieter than the headline */
.sum {
  display: block;
  text-indent: 0;
  margin-top: var(--s1);
  color: var(--muted);
  font-size: var(--step--1);
  line-height: 1.5;
}

/* Summary written from the headline because the page gave us no text. */
.inferred {
  display: inline-block;
  white-space: nowrap;
  margin-right: 0.35em;
  padding: 0 0.4em;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  vertical-align: 0.05em;
}
