:root {
  --brand: #d32f2f;
  --brand-dark: #b71c1c;
  --bg: #ffffff;
  --surface: #f6f6f7;
  --text: #1b1b1f;
  --muted: #5b5b66;
  --line: #e3e3e8;
  --link: #b71c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101012;
    --surface: #1a1a1e;
    --text: #ececf1;
    --muted: #a3a3b0;
    --line: #2c2c33;
    --link: #ff8a80;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.top {
  background: var(--brand);
  color: #fff;
}
.top .wrap { display: flex; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.top a { color: #fff; text-decoration: none; font-weight: 600; }
.top img { width: 28px; height: 28px; display: block; }
.top nav { margin-left: auto; display: flex; gap: 16px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { font-weight: 500; opacity: .92; }
.top nav a:hover { opacity: 1; text-decoration: underline; }

.wrap { max-width: 780px; margin: 0 auto; padding: 0 20px; }

main { padding: 32px 0 56px; }

h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2.2rem 0 .5rem; padding-top: .4rem; border-top: 1px solid var(--line); }
h2:first-of-type { border-top: 0; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .3rem; }

p, li { color: var(--text); }
.meta { color: var(--muted); font-size: .95rem; margin: 0 0 1.5rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.2rem; }

ul, ol { padding-left: 1.3rem; }
li { margin: .25rem 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 1rem 0;
}
.card p:first-child, .card ul:first-child { margin-top: 0; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .94rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--surface); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.toc { columns: 2 260px; column-gap: 28px; padding-left: 1.2rem; font-size: .96rem; }
.toc li { break-inside: avoid; }

.button {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}
.button:hover { background: var(--brand-dark); }

.links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 1.4rem 0; }
.links a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
}
.links a strong { display: block; color: var(--link); margin-bottom: 2px; }
.links a span { color: var(--muted); font-size: .94rem; }
.links a:hover { border-color: var(--brand); }

footer { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--muted); font-size: .9rem; }
footer a { color: var(--muted); }

@media (max-width: 520px) {
  h1 { font-size: 1.6rem; }
  .top nav { gap: 12px; }
}

@media print {
  .top, footer .links { display: none; }
  body { font-size: 12pt; }
}

@media (max-width: 600px) {
  .table-wrap { overflow-x: visible; border: 0; }
  table, thead, tbody, tr, th, td { display: block; min-width: 0; width: 100%; }
  thead { position: absolute; left: -9999px; }
  tr { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 10px; padding: 6px 2px; background: var(--surface); }
  td { border: 0; padding: 4px 12px; }
  td:first-child { font-weight: 600; }
  td:nth-child(2)::before { content: "Collected: "; color: var(--muted); }
  td:nth-child(3)::before { content: "Why: "; color: var(--muted); }
  td:nth-child(4)::before { content: "Shared with: "; color: var(--muted); }
}
