:root {
  --paper: #f3efe6;
  --paper-raised: #fbf9f4;
  --ink: #1c1915;
  --ink-soft: #5e584e;
  --line: #d5cec2;
  --accent: #1c3d4e;
  --accent-hover: #24495c;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --serif: "IBM Plex Serif", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(980px 420px at 8% -12%, rgba(28, 61, 78, 0.06), transparent 55%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

body::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--accent);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3.25rem 1.75rem 4.5rem;
}

.site-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 2.25rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.site-name {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
}

.site-name:hover {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}

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

.site-nav a[aria-current="page"] {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.35rem, 4.4vw, 3.45rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.lede {
  max-width: 38rem;
  margin: 0.85rem 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.5;
}

.as-of {
  min-height: 1.2rem;
  margin: 0.7rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.intro {
  max-width: 42rem;
  margin-top: 1.75rem;
}

.intro p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
}

.intro p + p {
  margin-top: 0.95rem;
}

.kicker {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.35;
  text-transform: uppercase;
}

.chapters {
  max-width: 32rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: chapter;
}

.chapters li {
  counter-increment: chapter;
  border-top: 1px solid var(--line);
}

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

.chapters a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 0.15rem;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.chapters a::before {
  content: counter(chapter, decimal-leading-zero);
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

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

.search {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.75rem;
}

.search-label {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.35;
  text-transform: uppercase;
}

.search input {
  width: min(100%, 28rem);
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

.search input:disabled {
  opacity: 0.6;
}

.map {
  margin-top: 1.75rem;
}

.colophon {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.colophon p {
  margin: 0;
}

.contact-form {
  max-width: 32rem;
  margin-top: 1.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 1rem;
}

.field label {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
}

.field textarea {
  min-height: 8rem;
  resize: vertical;
}

.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.form-submit {
  margin-top: 0.35rem;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: var(--accent);
  color: var(--paper-raised);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.form-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.form-submit:disabled {
  cursor: default;
  opacity: 0.7;
}

.form-status {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e3cfc8;
  background: #fbf6f4;
  color: #6d3330;
}

.form-thanks {
  max-width: 32rem;
  margin: 1.75rem 0 0;
  color: var(--ink);
}

.hint {
  margin: 1.15rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.map-error {
  margin-top: 1.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e3cfc8;
  background: #fbf6f4;
  color: #6d3330;
}

.peers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.peer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.75rem;
  padding: 0.85rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

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

.peer.is-open {
  border-color: var(--accent);
  background: var(--accent);
  color: #f6f3ec;
}

.peer.is-open:hover {
  background: var(--accent-hover);
}

.branch {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 2.25rem;
  align-items: start;
  margin-top: 1.5rem;
}

.pressures {
  position: sticky;
  top: 1.25rem;
  min-width: 0;
}

.pressures h2 {
  margin: 0 0 0.95rem;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.35;
  text-transform: uppercase;
}

.pressures ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pressures li {
  position: relative;
  padding-left: 0.95rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.pressures li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.4rem;
  height: 1px;
  background: var(--accent);
}

.tree-scroll {
  min-width: 0;
  overflow-x: auto;
  padding: 0.4rem 0.75rem 1.25rem 0.15rem;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.tree-scroll::-webkit-scrollbar {
  height: 8px;
}

.tree-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.nodes {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 0 0 0 1.7rem;
  list-style: none;
}

.nodes li {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.32rem 0;
}

.nodes > li::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -1.7rem;
  width: 1.7rem;
  height: 1px;
  background: var(--line);
}

.nodes > li::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1.7rem;
  width: 1px;
  background: var(--line);
}

.nodes > li:first-child::after {
  top: 50%;
}

.nodes > li:last-child::after {
  bottom: 50%;
}

.nodes > li:only-child::after {
  display: none;
}

.node {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 15.25rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
}

button.node {
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

button.node:hover {
  border-color: var(--accent);
}

.node.is-open {
  border-color: var(--accent);
  background: var(--accent);
  color: #f6f3ec;
}

.node.is-open:hover {
  background: var(--accent-hover);
}

.node-label {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  overflow-wrap: break-word;
}

.node-definition {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.4;
  text-wrap: pretty;
}

.node.is-open .node-definition {
  color: #d5e3ea;
}

.node-branch::after {
  content: "";
  flex: 0 0 auto;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-1px) rotate(-45deg);
}

.node-branch.is-open::after {
  transform: translateY(1px) rotate(45deg);
}

.node-leaf {
  color: var(--ink);
  font-weight: 400;
  cursor: default;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.22rem;
  width: min(100%, 40rem);
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

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

.result-title {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
}

.result-path,
.result-definition {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
}

.node:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.node.is-open:focus-visible,
.peer.is-open:focus-visible {
  outline-color: #8eb4c6;
}

@media (min-width: 981px) {
  .peer.is-open::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1.2rem;
    width: 1px;
    height: calc(1.2rem + 1px);
    background: var(--accent);
    transform: translateX(-50%);
  }
}

@media (max-width: 760px) {
  .page {
    padding: 2.25rem 1.15rem 3rem;
  }

  .branch {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .pressures {
    position: static;
  }

  .node {
    width: min(15.25rem, 72vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .peer,
  button.node {
    transition: none;
  }
}
