/* Reference-site styling: white, quiet, built for reading and scanning. */

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --surface-strong: #eef0f3;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #0b6e75;
  --accent-strong: #08545a;
  --accent-wash: #ecf6f6;
  --on-accent: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(17 24 39 / 4%), 0 4px 16px rgb(17 24 39 / 6%);
  --display: "Iowan Old Style", "Charter", "Sitka Text", Cambria, Georgia, serif;
  --text: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

/* A second accent for other sites in the network; the page stays white. */
.journal {
  --accent: #8a2e3b;
  --accent-strong: #6d2330;
  --accent-wash: #f8eef0;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 16px / 1.7 var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
}

a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

p {
  margin: 0 0 16px;
}

strong {
  color: var(--ink);
  font-weight: 600;
}

.skip {
  position: absolute;
  left: -10000px;
}

.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
}

.eyebrow,
.rail strong {
  display: block;
  color: var(--accent);
  font: 600 11px / 1.4 var(--text);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Edition bar */

.edition {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px max(4%, 20px);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.edition span:last-child {
  white-space: nowrap;
}

/* Header */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 16px max(4%, 20px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: saturate(180%) blur(10px);
}

.brand {
  color: var(--ink);
  font: 600 22px / 1.1 var(--display);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font: 500 11px / 1.2 var(--text);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

header nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  font-size: 14px;
}

header nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
}

header nav a:hover {
  background: var(--surface);
  color: var(--ink);
}

.cta {
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.cta:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
}

/* Page grid */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px max(4%, 20px) 96px;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.crumbs li + li::before {
  content: "›";
  margin-right: 6px;
  color: var(--line-strong);
}

.crumbs a {
  color: inherit;
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr) 264px;
  gap: 56px;
}

/* Left rail */

.rail {
  position: sticky;
  top: 96px;
  align-self: start;
  font-size: 14px;
}

.rail strong {
  margin-bottom: 10px;
  color: var(--muted);
}

.rail a {
  display: block;
  margin: 0 -10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
}

.rail a:hover {
  background: var(--surface);
  color: var(--ink);
}

.rail hr,
.record hr {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* Article */

article {
  min-width: 0;
  max-width: 760px;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
}

h1 {
  margin: 10px 0 24px;
  font-size: clamp(36px, 4.4vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

h2 {
  margin: 0 0 16px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h3 {
  font-size: 20px;
  line-height: 1.3;
}

.answer {
  padding: 22px 26px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-wash);
}

.answer p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.6;
}

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.toc {
  margin: 32px 0 8px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}

.toc strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toc ol {
  columns: 2;
  column-gap: 32px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.toc li {
  padding: 3px 0;
  break-inside: avoid;
}

.toc a {
  color: var(--ink-2);
  text-decoration: none;
}

.toc a:hover {
  color: var(--accent);
  text-decoration: underline;
}

section {
  margin-top: 48px;
}

.grid section > ul,
.grid section > ol {
  padding-left: 22px;
}

.grid section li + li {
  margin-top: 6px;
}

/* Featured-entity record */

.record {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  font-size: 14px;
}

.record h2 {
  margin: 6px 0 4px;
  font-size: 30px;
}

.record dl {
  margin: 16px 0;
}

.record dt {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.record dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.record > a {
  display: block;
  font-weight: 500;
  text-decoration: none;
}

.record > a:first-of-type {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  text-align: center;
}

.record > a:first-of-type:hover {
  background: var(--accent-strong);
}

/* Directory entries */

.directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.entry {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.entry:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  color: var(--ink-2);
}

.entry[hidden] {
  display: none;
}

.entry small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.entry h3 {
  margin: 8px 0 8px;
}

.entry p {
  flex: 1;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.entry span {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

/* Featured resources */

.resource-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.resource-list > a {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.resource-list > a:first-child {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.resource-list > a:hover {
  border-color: var(--accent);
  background: var(--bg);
}

.resource-list h3 {
  margin: 8px 0;
  font-size: 22px;
}

.resource-list p {
  flex: 1;
  color: var(--ink-2);
  font-size: 14px;
}

.resource-list span:last-child {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

/* Entity chain diagram */

.graph {
  margin-top: 28px;
  overflow-x: auto;
}

.graph svg {
  display: block;
  width: 100%;
  min-width: 560px;
  color: var(--line-strong);
}

.graph rect {
  fill: var(--bg);
  stroke: var(--line-strong);
}

.graph a:first-of-type rect {
  fill: var(--accent-wash);
  stroke: var(--accent);
}

.graph a:hover rect {
  stroke: var(--accent);
}

.graph text {
  fill: var(--ink);
  font: 500 14px var(--text);
}

.graph-caption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Q&A */

details {
  border-bottom: 1px solid var(--line);
}

details:first-of-type {
  border-top: 1px solid var(--line);
}

summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  flex: none;
  color: var(--muted);
  font-weight: 400;
}

details[open] summary::after {
  content: "−";
}

details p {
  margin: 0 0 18px;
  color: var(--ink-2);
  font-size: 15px;
}

/* Reading path, tables, code */

.paths {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paths a {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
}

.paths a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

thead th {
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

tbody th {
  color: var(--ink);
  font-weight: 600;
}

tbody tr:first-child {
  background: var(--accent-wash);
}

pre {
  margin: 0 0 16px;
  padding: 16px 18px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.6;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

pre code {
  font-size: inherit;
  overflow-wrap: normal;
}

.citation {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

#cite p {
  margin-bottom: 6px;
}

/* Library search */

.search-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 600;
}

#entry-search {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

#entry-search:focus {
  border-color: var(--accent);
}

#search-status {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.network-list li {
  margin-bottom: 12px;
}

/* Footer */

footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 32px;
  padding: 40px max(4%, 20px);
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

footer .foot-brand {
  color: var(--ink);
  font: 600 18px / 1.2 var(--display);
}

footer .foot-brand small {
  color: var(--muted);
  font: 500 11px / 2 var(--text);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

footer nav a {
  color: var(--ink-2);
  text-decoration: none;
}

footer nav a:hover {
  color: var(--ink);
}

footer p {
  grid-column: 1 / -1;
  max-width: 760px;
  margin: 0;
}

/* Narrower screens */

@media (max-width: 1280px) {
  .grid {
    grid-template-columns: minmax(0, 1fr) 248px;
    gap: 40px;
  }

  .rail {
    display: none;
  }
}

@media (max-width: 860px) {
  header {
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  header nav {
    order: 3;
    width: 100%;
    margin: 0 -12px;
    overflow-x: auto;
  }

  .cta {
    margin-left: auto;
  }

  .grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
  }

  .record {
    position: static;
    order: 2;
  }

  article {
    max-width: none;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 24px;
  }

  .edition span:first-child {
    display: none;
  }

  .edition {
    justify-content: flex-end;
  }

  header {
    position: static;
  }

  .brand {
    font-size: 20px;
  }

  .cta {
    padding: 7px 12px;
    font-size: 13px;
  }

  main {
    padding-top: 20px;
  }

  .crumbs ol {
    margin-bottom: 20px;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 24px;
  }

  .answer {
    padding: 18px 20px;
  }

  .answer p {
    font-size: 17px;
  }

  .toc ol {
    columns: 1;
  }

  .directory,
  .resource-list {
    grid-template-columns: 1fr;
  }

  footer {
    grid-template-columns: 1fr;
  }
}

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

  .entry,
  .resource-list > a {
    transition: none;
  }
}
