/* ─── Tokens ─── */
:root {
  --white: #fafaf8;
  --ink:   #1a1a18;
  --mid:   #4a4a47;  /* WCAG AA on --white: ~7.5:1 */
  --red:   #b01a14;  /* WCAG AA on --white: ~5.1:1 */
  --rule:  #d0d0cc;
  /*
   * System font stacks only — no external requests, no tracking.
   * Body: prefers Charter/Georgia (serif with good screen rendering).
   * Mono: prefers ui-monospace, then common system monospace faces.
   */
  --body: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif;
  --mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ─── Base ─── */
body {
  background: var(--white);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;  /* 18px */
  line-height: 1.75;
}

/* ─── Skip link ─── */
.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  overflow: hidden;
}
.skip:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--white);
  font-family: var(--mono);
  font-size: 0.875rem;
  z-index: 999;
  text-decoration: none;
}

/* ─── Layout ─── */
.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.wrap--wide {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ─── Typography ─── */
h1 {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 1.25rem;
  display: block;
}

/* ─── Header ─── */
header {
  padding: 5rem 0 4rem;
  border-bottom: 2px solid var(--ink);
}

header .kicker { color: var(--red); }

.hero-sub {
  margin-top: 2rem;
  font-size: 1.25rem;
  line-height: 1.6;
  font-style: italic;
  color: var(--mid);
  max-width: 36ch;
}

/* ─── Page nav ─── */
.page-nav {
  border-bottom: 1px solid var(--rule);
  padding: 0.75rem 0;
}

.page-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.page-nav a {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid);
  text-decoration: none;
}

.page-nav a:hover,
.page-nav a:focus { color: var(--ink); text-decoration: underline; }

/* ─── Sections ─── */
section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--rule);
}

section.section--last { border-bottom: none; }

/* ─── Problem ─── */
.lede {
  font-size: 1.25rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.callout {
  border-left: 3px solid var(--red);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--mid);
}

/* ─── Compare: desktop table ─── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 2rem;
}

table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}

thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  font-weight: 500;
  border-bottom: 2px solid var(--ink);
  vertical-align: bottom;
}

thead th .th-date {
  display: block;
  font-weight: 400;
  color: var(--mid);
  margin-top: 0.1rem;
}

thead th.th-b          { color: var(--red); border-bottom-color: var(--red); }
thead th.th-b .th-date { color: var(--red); }

tbody tr               { border-bottom: 1px solid var(--rule); }
tbody tr:last-child    { border-bottom: none; }

td { padding: 0.875rem 1rem; vertical-align: top; }

td.td-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid);
  white-space: nowrap;
}

td.td-old { color: var(--mid); }

td.td-b {
  color: var(--ink);
  font-weight: 700;
  border-left: 2px solid var(--red);
}

.table-note {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--mid);
}

/* ─── Compare: mobile cards ─── */
/*
 * DUPLICATION NOTE:
 * The table above and the cards below contain the same data.
 * This is intentional — the page works without JavaScript.
 * If you update one, update the other. Both blocks are clearly
 * labelled in the HTML with matching comments.
 */
.era-cards { display: none; margin-top: 2rem; }

.era-card {
  border: 1px solid var(--rule);
  border-radius: 2px;
  margin-bottom: 1rem;
}

.era-card:last-child { margin-bottom: 0; }

.era-card summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.era-card summary::-webkit-details-marker { display: none; }

/* Focus fix: explicit outline on summary for keyboard users */
.era-card summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.era-toggle {
  font-size: 1rem;
  color: var(--mid);
  line-height: 1;
}

.era-card[open] summary { border-bottom: 1px solid var(--rule); }
.era-card.era-b         { border-color: var(--red); }
.era-card.era-b summary { color: var(--red); }

.era-rows { padding: 0; }

.era-row {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.era-row:last-child { border-bottom: none; }

.row-k {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mid);
  padding-top: 0.1rem;
}

.row-v                  { color: var(--mid); }
.era-card.era-b .row-v  { color: var(--ink); font-weight: 700; }

/* Era summary date labels */
.era-date    { color: var(--mid); font-weight: 400; }
.era-date--b { color: var(--red); font-weight: 400; }

/* Callout with top spacing */
.callout--spaced { margin-top: 2rem; }

/* ─── Principles ─── */
.principles-list { list-style: none; margin-top: 2rem; }

.principles-list li {
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 1.25rem;
  align-items: start;
}

.principles-list li:last-child { border-bottom: 1px solid var(--rule); }

.p-n {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--mid);
  padding-top: 0.2rem;
}

/* ─── Shifts ─── */
.shifts { list-style: none; margin-top: 2rem; }

.shifts li {
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-size: 1.125rem;
}

.shifts li:last-child { border-bottom: 1px solid var(--rule); }

.s-from {
  color: var(--mid);
  text-decoration: line-through;
  text-decoration-color: var(--red);
  min-width: 9rem;
  font-style: italic;
}

.s-arrow { color: var(--rule); flex-shrink: 0; font-family: var(--mono); }
.s-to    { font-weight: 700; }

/* ─── Actions ─── */
.actions { list-style: none; margin-top: 2rem; }

.actions li {
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 1.25rem;
}

.actions li:last-child { border-bottom: 1px solid var(--rule); }

.act-n {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--mid);
  padding-top: 0.2rem;
}

/* ─── Closing ─── */
.closing { padding: 5rem 0 4rem; }

.verdict {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.verdict .old { color: var(--mid); font-weight: 400; font-style: italic; display: block; }
.verdict .new { color: var(--ink); display: block; }

.coda {
  margin-top: 2rem;
  font-size: 1rem;
  color: var(--mid);
  font-style: italic;
}

.coda--final {
  margin-top: 1.25rem;
  font-size: 1.125rem;
  color: var(--ink);
  font-style: normal;
  font-weight: 700;
}

/* ─── Footer ─── */
footer {
  border-top: 2px solid var(--ink);
  padding: 1.5rem;
  max-width: 64rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

.footer-col {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  line-height: 1.8;
}

.footer-col a {
  color: var(--mid);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.footer-col a:hover,
.footer-col a:focus { color: var(--ink); }

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .shifts li { flex-direction: column; gap: 0.25rem; }
  .s-from    { min-width: 0; }
}

@media (max-width: 700px) {
  .table-scroll { display: none; }
  .table-note   { display: none; }
  .era-cards    { display: block; }
}

/* ─── FAQ page ─── */

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  text-decoration: none;
  margin-bottom: 0.75rem;
}

.back-link:hover,
.back-link:focus { color: var(--ink); text-decoration: underline; }

/* Count line */
.faq-meta {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

/* FAQ list */
.faq-list {
  list-style: none;
  margin-top: 2rem;
}

.faq-item {
  border-top: 1px solid var(--rule);
}

.faq-item:last-child {
  border-bottom: 1px solid var(--rule);
}

/* summary = question row */
.faq-item summary {
  display: grid;
  grid-template-columns: 1fr 1.5rem;
  align-items: start;
  gap: 1rem;
  padding: 1.5rem 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* Question text + badge stacked */
.faq-q-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.faq-q {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}

.faq-item[open] .faq-q { color: var(--red); }

/* Category badge */
.faq-badge {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
  display: inline-block;
}

/* Toggle symbol — static, CSS only */
.faq-toggle {
  font-family: var(--mono);
  font-size: 1.125rem;
  color: var(--mid);
  line-height: 1;
  padding-top: 0.15rem;
  text-align: right;
  flex-shrink: 0;
}

.faq-item[open] .faq-toggle { color: var(--red); }

/* Answer body */
.faq-body {
  padding-bottom: 1.75rem;
  padding-right: 2rem;
}

.faq-body p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--mid);
  margin-bottom: 0.75rem;
}

.faq-body p:last-child { margin-bottom: 0; }

.faq-body strong { color: var(--ink); font-weight: 700; }

.faq-body .callout { font-size: 1rem; margin: 1rem 0; }

/* Responsive */
@media (max-width: 480px) {
  .faq-item summary { padding: 1.25rem 0; }
  .faq-q            { font-size: 1rem; }
}
