:root {
  --paper: #f5f4ef;
  --white: #fffefa;
  --ink: #213c38;
  --muted: #586d67;
  --line: #d4dbd2;
  --green: #256959;
  --pale: #e8eee5;
  --ochre: #93672c;
  --red: #963e37;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    15px/1.55 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  padding: 8px 12px;
}
button:hover {
  background: var(--pale);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
a {
  color: var(--green);
  text-underline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--ochre);
  outline-offset: 3px;
}
header {
  padding: 24px 3%;
  display: flex;
  align-items: center;
  gap: 32px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font:
    16px/1.1 Georgia,
    serif;
  min-width: 180px;
}
.brand strong {
  font-size: 29px;
  display: block;
  font-weight: 400;
}
header nav {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
}
header nav button {
  background: none;
  border-color: transparent;
}
header nav a {
  padding: 8px;
  text-decoration: none;
}
header nav [aria-current="page"] {
  border-bottom-color: var(--green);
  border-radius: 0;
}
.intro {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 40px 4%;
  border-bottom: 1px solid var(--line);
}
.intro h1 {
  font:
    clamp(30px, 3vw, 46px) / 1.1 Georgia,
    serif;
  letter-spacing: -1px;
  margin: 12px 0 0;
}
.intro p {
  color: var(--muted);
  margin-left: auto;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-size: 10px;
  color: var(--green);
}
main {
  display: grid;
  grid-template-columns: 240px minmax(350px, 1fr) 330px;
  min-height: 680px;
}
.shelf {
  padding: 24px 18px;
  border-right: 1px solid var(--line);
}
h2 {
  font:
    24px/1.2 Georgia,
    serif;
  margin: 0 0 12px;
}
h3 {
  font:
    20px/1.3 Georgia,
    serif;
  margin: 20px 0 8px;
}
label {
  display: block;
  font-size: 12px;
  margin: 12px 0 5px;
  font-weight: 600;
}
input,
textarea,
select {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  width: 100%;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
.shelf-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}
.shelf-heading h2 {
  font-size: 20px;
  margin: 0;
}
.shelf-heading select {
  width: auto;
  max-width: 100px;
  font-size: 12px;
}
.muted,
small {
  color: var(--muted);
  font-size: 12px;
}
.shelf button.entry {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  padding: 18px 8px;
  border-radius: 0;
}
.entry small {
  display: block;
  margin-top: 7px;
}
.entry.selected {
  background: var(--pale) !important;
}
.workspace {
  min-width: 0;
}
#map-heading {
  padding: 24px 28px 4px;
}
#map-heading h2 {
  font-size: 28px;
}
#map-heading p {
  margin: 8px 0;
  white-space: pre-wrap;
}
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 28px 20px;
}
.toolbar button {
  font-size: 12px;
}
#canvas {
  height: 570px;
  overflow: auto;
  border-block: 1px solid var(--line);
  background: radial-gradient(var(--line) 0.7px, transparent 0.7px);
  background-size: 20px 20px;
}
#graph {
  display: block;
  max-width: none;
}
.graph-node {
  cursor: pointer;
}
.graph-node rect {
  fill: var(--white);
  stroke: #96afa1;
  stroke-width: 1.2;
}
.graph-node.selected rect {
  stroke: var(--green);
  stroke-width: 3;
  fill: var(--pale);
}
.graph-node text {
  fill: var(--ink);
  font-size: 12px;
  pointer-events: none;
}
.graph-node .node-type {
  font-size: 9px;
  letter-spacing: 1px;
  fill: var(--muted);
}
.dependency {
  stroke: #94ab9d;
  stroke-width: 1.4;
  fill: none;
}
.crosslink {
  stroke: var(--ochre);
  stroke-dasharray: 4 5;
  fill: none;
  opacity: 0.75;
}
.sky {
  font:
    italic 18px Georgia,
    serif;
  fill: var(--muted);
}
.floor {
  font-size: 11px;
  fill: var(--muted);
}
#outline,
#map-activity {
  padding: 20px 28px;
}
#outline summary {
  cursor: pointer;
  font-weight: 600;
}
#outline button {
  display: block;
  margin: 6px 0;
  text-align: left;
  width: 100%;
}
#inspector {
  padding: 26px 22px;
  border-left: 1px solid var(--line);
  background: var(--white);
  min-width: 0;
  overflow-wrap: anywhere;
}
#inspector h2 {
  font-size: 26px;
}
.prose {
  white-space: pre-wrap;
}
.tag {
  display: inline-block;
  font: 10px/1.5 monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 7px;
  background: var(--pale);
  color: var(--green);
  margin: 4px 0 12px;
}
.actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.actions button {
  font-size: 11px;
  padding: 6px 9px;
}
[aria-pressed="true"] {
  background: var(--green);
  color: white;
}
.card {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.card p {
  margin: 6px 0;
}
.card button {
  font-size: 12px;
}
.hash {
  font: 10px/1.6 monospace;
  overflow-wrap: anywhere;
}
#status {
  padding: 0 4%;
  color: var(--red);
}
#status:not(:empty) {
  padding-block: 12px;
}
.comment {
  border-left: 2px solid var(--line);
  padding-left: 12px;
  margin: 15px 0;
}
.comment p {
  white-space: pre-wrap;
}
.comment button {
  font-size: 11px;
}
footer {
  padding: 28px 4%;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
footer small {
  display: block;
  margin-top: 8px;
  max-width: 850px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  width: min(780px, 94vw);
  max-height: 90vh;
  padding: 28px;
  background: var(--white);
  color: var(--ink);
}
dialog::backdrop {
  background: #122e2866;
}
.close {
  float: right;
}
#editor-error {
  color: var(--red);
}
.row {
  display: flex;
  gap: 8px;
  align-items: end;
  margin: 10px 0;
}
.row > * {
  min-width: 0;
  flex: 1;
}
.row button {
  flex: 0 0 auto;
}
.node-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.node-row span {
  flex: 1;
}
.node-row button {
  font-size: 12px;
}
.compare {
  font: 12px/1.5 monospace;
  white-space: pre-wrap;
  max-height: 250px;
  overflow: auto;
  background: var(--pale);
  padding: 14px;
}
.note {
  border-left: 3px solid var(--ochre);
  padding: 8px 12px;
  font-size: 12px;
}
.sources a {
  display: block;
  margin: 8px 0;
}
.danger {
  color: var(--red);
}
@media (min-width: 1700px) {
  main {
    grid-template-columns: 280px minmax(500px, 1fr) 390px;
  }
}
@media (max-width: 1150px) {
  main {
    grid-template-columns: 210px minmax(300px, 1fr);
  }
  #inspector {
    grid-column: 2;
    border-top: 1px solid var(--line);
  }
  header {
    gap: 16px;
    flex-wrap: wrap;
  }
  .intro {
    gap: 20px;
  }
  .intro p {
    font-size: 13px;
  }
}
@media (max-width: 680px) {
  header {
    padding: 20px;
  }
  header nav {
    order: 3;
    width: 100%;
    flex-basis: 100%;
    gap: 0;
    font-size: 12px;
  }
  header > button {
    margin-left: auto;
    font-size: 11px;
  }
  .intro {
    padding: 24px;
    flex-wrap: wrap;
  }
  .intro p {
    margin: 0;
  }
  .intro h1 {
    font-size: 34px;
  }
  main {
    display: block;
  }
  .shelf {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 24px;
  }
  #catalogue {
    max-height: 190px;
    overflow: auto;
  }
  .shelf-heading {
    margin-top: 12px;
  }
  #inspector {
    border-left: 0;
  }
  #canvas {
    height: 470px;
  }
  .row {
    flex-wrap: wrap;
  }
  .row > * {
    flex-basis: 40%;
  }
  .toolbar,
  #map-heading,
  #outline,
  #map-activity {
    padding-inline: 22px;
  }
  dialog {
    padding: 20px;
  }
  .brand {
    min-width: 140px;
  }
  .brand strong {
    font-size: 24px;
  }
}

.toolbar { align-items: center; }
.toolbar .actions { margin: 0; }
