:root {
  --bg: #0e1418;
  --panel: #131c22;
  --panel-2: #17242d;
  --text: #ecf2f0;
  --muted: #a7b5b0;
  --accent: #76d1c2;
  --accent-2: #f2b875;
  --border: #2b3b45;
  --context: #20333a;
  --opinion: #3a2f22;
  --shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  --card: rgba(255, 255, 255, 0.03);
  --target: #2a3f3f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 700px at 20% -10%, #1e3434 0%, transparent 65%),
    radial-gradient(900px 600px at 95% 0%, #26313b 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  line-height: 1.75;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page {
  width: min(1200px, 94vw);
  margin: 0 auto;
  padding: 28px 0 72px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.hero,
.summary,
.toc,
.section,
.card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero {
  background: linear-gradient(170deg, #18252d 0%, #11181d 100%);
  border-radius: 20px;
  padding: 26px 22px;
}

.eyebrow,
.tag,
.source,
.meta,
.pill {
  font-family: "IBM Plex Mono", Consolas, monospace;
}

.eyebrow {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  font-family: "Fraunces", Georgia, serif;
}

h1 {
  font-size: clamp(1.8rem, 2.4vw + 1rem, 3rem);
  margin-bottom: 12px;
}

h2 {
  font-size: clamp(1.3rem, 1vw + 1rem, 1.8rem);
  margin-bottom: 12px;
  color: #f3f9f6;
}

h3 {
  font-size: 1.08rem;
  margin-bottom: 6px;
  color: #f0f8f4;
}

.lead {
  margin: 0;
  max-width: 80ch;
  color: #d7e1dd;
  font-size: clamp(1rem, 0.3vw + 0.95rem, 1.12rem);
}

.summary,
.toc,
.section {
  background: var(--panel);
  border-radius: 16px;
  padding: 18px;
}

.section {
  background: var(--panel-2);
  scroll-margin-top: 20px;
  margin-bottom: 6px;
}

.summary ul,
.toc ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.summary li,
.toc li {
  margin: 8px 0;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.section p {
  margin: 0 0 12px;
  max-width: 80ch;
}

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

.source {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 8px;
}

.note-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 10px;
}

.note {
  border-radius: 12px;
  padding: 12px 13px;
  border: 1px solid var(--border);
}

.note.context {
  background: var(--context);
}

.note.opinion {
  background: var(--opinion);
}

.tag {
  font-size: 0.73rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #cfddd8;
  display: inline-block;
  margin-bottom: 4px;
}

.footer {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0 4px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: linear-gradient(180deg, rgba(23, 36, 45, 0.95) 0%, rgba(19, 28, 34, 0.95) 100%);
  border-radius: 16px;
  padding: 18px;
}

.card p {
  margin: 0 0 10px;
  color: #d7e1dd;
}

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

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-head a {
  color: var(--text);
  text-decoration: none;
}

.card-head a:hover {
  color: var(--accent);
  text-decoration: none;
}

.pill {
  white-space: nowrap;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #d0ddd9;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--card);
}

.pill.migrated {
  color: #8ce8d8;
  border-color: #315a59;
}

.small-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.small-links a {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.82rem;
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.hero-head .eyebrow {
  margin-bottom: 0;
}

.hero-head-link {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

.hero-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
  margin-bottom: -2px;
}

.hero-links a {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
  color: var(--accent);
}

.hero-links a:hover {
  text-decoration: none;
  border-color: #3e7870;
  color: #cbfff6;
}

.top-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.top-nav a {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
}

.top-nav a.current {
  border-color: #3e7870;
  color: #cbfff6;
}

.desc {
  margin-top: 0;
  color: var(--muted);
}

.turn {
  margin: 0 0 14px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
  max-width: 90ch;
  scroll-margin-top: 22px;
}

.turn:last-child {
  margin-bottom: 0;
}

.meta {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.line-anchor {
  display: block;
  position: relative;
  top: -14px;
  visibility: hidden;
}

:target.turn {
  background: var(--target);
  border-color: #4f7f7b;
}

@media (min-width: 980px) {
  .layout {
    grid-template-columns: 280px 1fr;
    align-items: start;
  }

  .toc {
    position: sticky;
    top: 18px;
  }
}
