/* The Rebuild Tree. Courses of stone on a survey grid. Tokens come from base.css. */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.plate { margin: var(--s4, 1.5rem) 0; }
.plate-count { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--ink); min-height: 1.5em; margin: 0 0 var(--s2, 0.5rem); }
.plate-tools { display: flex; gap: var(--s2, 0.5rem); margin: 0 0 var(--s3, 1rem); }
.plate-tools[hidden] { display: none; }
.plate-tools button[disabled] { color: var(--ink-dim); border-color: var(--rule); cursor: default; background: transparent; }
.plate-mini, .plate-back { display: none; }

.plate-view { overflow: auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.plate-sheet { position: relative; container-type: inline-size; aspect-ratio: 1384 / 1108; width: 100%; min-width: 960px; }
.plate-sheet.z-2 { width: 150%; }
.plate-sheet.z-3 { width: 225%; }
.plate-edges { position: absolute; inset: 0; width: 100%; height: 100%; }
.plate-nav ol { list-style: none; margin: 0; padding: 0; max-width: none; }
.plate-nav li + li, .ladder li + li, .teaches li + li { margin-top: 0; }
.plate, .plate-caption, .plate-key { max-width: none; }
.plate-nav .courses, .plate-nav .course, .plate-nav .course > ol { position: static; }
.course-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.node { position: absolute; width: 8.0925%; height: 3.9711%; margin: 0; transition: opacity 180ms linear; }
.node > a, .node > .node-box { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; box-sizing: border-box; width: 100%; height: 100%; padding: 0 4%; border: 1px solid var(--ink-dim); background: var(--ground); color: var(--ink); text-decoration: none; transition: border-color 180ms linear, color 180ms linear; }
.node-label { font-family: var(--f-display); font-size: 10px; font-size: clamp(8px, 0.78cqw, 22px); line-height: 1.12; letter-spacing: 0.07em; text-transform: uppercase; }
.node-mark { position: absolute; left: 3%; top: 4%; font-family: var(--f-mono); font-size: 6px; font-size: clamp(5px, 0.47cqw, 13px); line-height: 1; color: var(--ink-dim); letter-spacing: 0; }
.node-note { position: absolute; right: 3%; bottom: 5%; font-family: var(--f-mono); font-size: 6px; font-size: clamp(5px, 0.47cqw, 13px); line-height: 1; color: var(--ink-dim); }
.node--wanted > .node-box { border-style: dashed; color: var(--ink-dim); }
.node--prep > .node-box { color: var(--ink-dim); }
.node--wanted .node-label, .node--prep .node-label { transform: translateY(-12%); }
.node > a:hover { border-color: var(--ink); }
.node > a:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
.node.is-kin > a, .node.is-kin > .node-box { border-color: var(--ink); color: var(--ink); }
.node.is-active > a, .node.is-active > .node-box { border-color: var(--lamp); color: var(--lamp); border-style: solid; }
.node.is-active .node-mark { color: var(--lamp); }
.plate.has-active .node:not(.is-kin):not(.is-active) { opacity: 0.35; }

.plate-edges .plot, .plate-svg .plot { fill: none; stroke: var(--ink-dim); stroke-width: 1; stroke-dasharray: 1 5; opacity: 0.5; vector-effect: non-scaling-stroke; }
.plate-edges .course-mark, .plate-svg .course-mark { font-family: var(--f-mono); font-size: 8px; fill: var(--ink-dim); }
.plate-edges .e, .plate-svg .e { fill: none; stroke: var(--ink-dim); stroke-width: 1; vector-effect: non-scaling-stroke; transition: stroke 180ms linear, opacity 180ms linear; }
.plate.has-active .e:not(.is-lit), .plate-svg.has-active .e:not(.is-lit) { opacity: 0.3; }
.plate.has-active .e.is-lit, .plate-svg.has-active .e.is-lit { stroke: var(--ink); }

/* Static drawings: home plate, minimap, lineage. */
.plate-svg { display: block; width: 100%; height: auto; }
.plate-svg rect.n { fill: var(--ground); stroke: var(--ink-dim); stroke-width: 1; vector-effect: non-scaling-stroke; }
.plate-svg rect.n--wanted { stroke-dasharray: 3 3; }
.plate-svg text.n-label { font-family: var(--f-display); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; fill: var(--ink); stroke: none; }
.plate-svg text.n--wanted { fill: var(--ink-dim); }
.plate-svg.has-active rect.n:not(.is-kin):not(.is-active), .plate-svg.has-active text.n:not(.is-kin):not(.is-active) { opacity: 0.35; }
.plate-svg rect.is-kin { stroke: var(--ink); }
.plate-svg rect.is-active { stroke: var(--lamp); }
.plate-svg text.is-active { fill: var(--lamp); }
.plate-svg--mini rect.is-kin { fill: var(--ink); }
.plate-svg--mini rect.is-active { fill: var(--lamp); }
.plate-svg--lineage text.n-label { font-size: 8.5px; }
.plate-svg--lineage { max-width: 40rem; }

.plate-caption { font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-dim); margin: var(--s2, 0.5rem) 0 0; }
.plate-key { display: flex; flex-wrap: wrap; gap: var(--s2, 0.5rem) var(--s4, 1.5rem); list-style: none; padding: 0; margin: var(--s3, 1rem) 0 0; font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-dim); }
.plate-key .k { display: inline-block; width: 1.75rem; height: 0.7rem; margin-right: 0.5rem; border: 1px solid var(--ink); vertical-align: -1px; }
.plate-key .k--wanted { border-style: dashed; border-color: var(--ink-dim); }
.plate-key .k--plot { border: 1px dotted var(--ink-dim); }

/* Node page: the ladder. Unlocks above, the node, needs below. */
.ladder { margin: var(--s4, 1.5rem) 0; border-top: 1px solid var(--rule); }
.ladder h2 { font-family: var(--f-mono); font-size: 0.75rem; font-weight: 400; letter-spacing: 0.04em; text-transform: none; color: var(--ink-dim); margin: 0; padding: var(--s2, 0.5rem) 0 0; }
.ladder ul { list-style: none; margin: 0; padding: var(--s1, 0.25rem) 0 var(--s2, 0.5rem); }
.ladder li { padding: 0.3rem 0; }
.ladder li a { display: inline-block; padding: 0.35rem 0; }
.ladder .rung-mark { font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-dim); display: inline-block; min-width: 4.25rem; }
.ladder .rung-note { font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-dim); margin-left: 0.5rem; }
.ladder .rung-none { color: var(--ink-dim); }
.ladder-part { border-bottom: 1px solid var(--rule); }
.ladder-here { margin: 0; padding: var(--s3, 1rem) 0 var(--s3, 1rem) var(--s3, 1rem); border-bottom: 1px solid var(--rule); border-left: 2px solid var(--lamp); font-family: var(--f-display); font-size: 1.25rem; letter-spacing: 0.06em; text-transform: uppercase; }
.ladder-here .rung-mark { font-size: 0.75rem; letter-spacing: 0; }
.lineage { margin: var(--s5, 2rem) 0; }
.lineage figcaption { font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-dim); margin-top: var(--s2, 0.5rem); }
.teaches { margin: var(--s5, 2rem) 0; }
.teaches ul { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.teaches li { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 5.5rem 1fr; gap: 0 var(--s2, 0.5rem); }
.teaches .mono { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--ink-dim); }
.teaches .pub { display: block; color: var(--ink-dim); font-size: 0.875rem; }
.slip-plate { display: block; text-decoration: none; color: inherit; }
.slip-plate .plate-caption { text-decoration: none; }
.scope-note { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--ink-dim); border-left: 1px solid var(--ink-dim); padding-left: var(--s3, 1rem); }
.tree-intro { max-width: 42rem; }

@media (max-width: 699px) {
  .plate-tools { display: none; }
  .plate-mini { display: flex; align-items: center; gap: var(--s3, 1rem); position: sticky; top: calc(3.75rem + 3px); z-index: 2; background: var(--ground); border-bottom: 1px solid var(--rule); padding: var(--s1, 0.25rem) 0; color: var(--ink); text-decoration: none; }
  .plate-mini .plate-svg { width: auto; height: 96px; flex: none; }
  .plate-mini-cap { font-family: var(--f-mono); font-size: 0.75rem; text-decoration: underline; text-underline-offset: 3px; }
  .plate-view:not(:target) { overflow: visible; border: 0; }
  .plate-view:not(:target) .plate-sheet { aspect-ratio: auto; min-width: 0; container-type: normal; }
  .plate-view:not(:target) .plate-edges { display: none; }
  .plate-view:not(:target) .course-h { position: static; width: auto; height: auto; clip-path: none; display: block; font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-dim); padding: var(--s3, 1rem) 0 var(--s1, 0.25rem); border-bottom: 1px solid var(--rule); }
  .plate-view:not(:target) .node { position: static; width: auto; height: auto; border-bottom: 1px solid var(--rule); }
  .plate-view:not(:target) .node > a, .plate-view:not(:target) .node > .node-box { justify-content: flex-start; text-align: left; border: 0; border-left: 2px solid transparent; padding: 0 0 0 var(--s2, 0.5rem); min-height: 44px; gap: var(--s3, 1rem); background: none; }
  .plate-view:not(:target) .node.is-active > a, .plate-view:not(:target) .node.is-active > .node-box { border-left-color: var(--lamp); }
  .plate-view:not(:target) .node-mark, .plate-view:not(:target) .node-note { position: static; font-size: 0.75rem; }
  .plate-view:not(:target) .node-mark { min-width: 3.5rem; }
  .plate-view:not(:target) .node-note { margin-left: auto; }
  .plate-view:not(:target) .node-label { font-size: 0.9375rem; transform: none; }
  .plate-view:target .plate-sheet { width: 1100px; min-width: 1100px; }
  .plate-view:target .plate-back { display: block; position: sticky; left: 0; font-family: var(--f-mono); font-size: 0.75rem; padding: var(--s2, 0.5rem) 0; }
  .ladder-here { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .node, .node > a, .node > .node-box, .plate-edges .e, .plate-svg .e { transition: none; }
}

@media print {
  .plate-tools, .plate-mini, .plate-back, .plate-count { display: none; }
  .plate-view { overflow: visible; border: 0; }
  .plate-sheet, .plate-sheet.z-2, .plate-sheet.z-3 { width: 100%; min-width: 0; }
  .plate.has-active .node:not(.is-kin):not(.is-active), .plate.has-active .e:not(.is-lit) { opacity: 1; }
}

/* Seats on the survey grid: 10 columns, 15 courses. Generated once from the plate geometry. */
.pc-0 { left: 1.7341%; }
.pc-1 { left: 11.5607%; }
.pc-2 { left: 21.3873%; }
.pc-3 { left: 31.2139%; }
.pc-4 { left: 41.0405%; }
.pc-5 { left: 50.8671%; }
.pc-6 { left: 60.6936%; }
.pc-7 { left: 70.5202%; }
.pc-8 { left: 80.3468%; }
.pc-9 { left: 90.1734%; }
.pr-0 { top: 93.5018%; }
.pr-1 { top: 87.0036%; }
.pr-2 { top: 80.5054%; }
.pr-3 { top: 74.0072%; }
.pr-4 { top: 67.5090%; }
.pr-5 { top: 61.0108%; }
.pr-6 { top: 54.5126%; }
.pr-7 { top: 48.0144%; }
.pr-8 { top: 41.5162%; }
.pr-9 { top: 35.0181%; }
.pr-10 { top: 28.5199%; }
.pr-11 { top: 22.0217%; }
.pr-12 { top: 15.5235%; }
.pr-13 { top: 9.0253%; }
.pr-14 { top: 2.5271%; }
@media (max-width: 699px) { .plate-view:not(:target) .node { left: auto; top: auto; } }
