/* gangsan.css: 강산 · 江山 · Rivers and Mountains. One printed sheet: cream paper, one navy ink, hairlines.
   Person inks only on people; red only for the seal. Two tools inside the frame: dots and hairlines.
   No gradient, wash, tint, halo, fade or flat fill inside the frame (a knock-out is paper: no ink). */

:root {
  --paper: #F1E6D3;
  --mount: #F4E9D6;
  --ink: #1F2878;
  --mute: #5D618C;              /* secondary type only, never a mark */
  --hair: #1F2878;
  --red: #E0533A;

  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --sans: 'Zen Kaku Gothic New', system-ui, sans-serif;
  --kr: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  --serif: 'Noto Serif KR', 'AppleMyungjo', serif;

  --inset: 26px;
  --mini-top: calc(100vh - 54px);
  --mini-h: 28px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}
@media (max-width: 979px) { :root { --inset: 14px; } }
@media (max-width: 699px) { :root { --inset: 8px; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--mount); color: var(--ink); overflow: hidden; }
body { font-family: var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.boot-err { position: fixed; left: 32px; top: 72px; font: 300 12px/1.5 var(--mono); color: var(--mute); }
[lang="ko"] { font-family: var(--kr); }

/* ---------- the sheet ---------- */
#stage { position: fixed; inset: 0; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
body.air #stage { cursor: zoom-in; }
#stage.dragging { cursor: grabbing; }
#stage.point { cursor: pointer; }
#stage canvas, #marks, #caps { position: absolute; inset: 0; width: 100%; height: 100%; }
#marks, #caps { pointer-events: none; overflow: hidden; clip-path: inset(calc(var(--inset) + 1px)); }
#marks > *, #caps > * { position: absolute; left: 0; top: 0; visibility: hidden; will-change: transform; }

/* the mountain's name box (E3): a hairline box, every line horizontal (§23.8: no turned or stacked text):
   한글 and 漢字 on the first line, ENGLISH, then the years. Its paper is a knock-out (no ink inside), not a
   tint. Ink when you stand under the range, muted otherwise. */
.mbox {
  pointer-events: auto; cursor: pointer;
  display: grid; grid-auto-flow: row; grid-template-columns: auto auto; align-items: baseline; justify-content: center; justify-items: center; column-gap: 5px; row-gap: 3px;
  padding: 6px 8px; margin: 0; text-align: center;
  border: 1px solid var(--hair); background: var(--paper);
  color: var(--mute);
}
/* measuring only, never shown: the room an upright box would take, which the sky keeps (§23.8) */
.mbox.reserve { writing-mode: vertical-rl; display: flex; flex-flow: column nowrap; align-items: flex-start; padding: 9px 5px; gap: 4px; }
.mbox .ko { font: 400 16px/1 var(--kr); letter-spacing: .12em; }
.mbox .hj { font: 400 12px/1 var(--serif); letter-spacing: .06em; }
.mbox .en { grid-column: 1 / -1; font: 400 9px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.mbox .yr { color: inherit; }
.mbox.on { color: var(--ink); }
.mline {
  pointer-events: auto; cursor: pointer;
  display: flex; align-items: baseline; gap: 6px; white-space: nowrap;
  padding: 2px 6px; margin: 0;
  border: 1px solid var(--hair); background: var(--paper); color: var(--mute);
}
.mline .ko { font: 400 12px/1.2 var(--kr); }
.mline .hj { font: 400 10px/1.2 var(--serif); }
.mline .en, .mline .yr { font: 400 9px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.mline.on { color: var(--ink); }
.mline .yr2 { display: none; font: 400 9px/1.2 var(--mono); letter-spacing: .04em; }
.mline.air { color: var(--ink); }

/* the head of the scroll: the title slip and the frontispiece, on their own sheet (no grain; drawn on canvas) */
.head { display: flex; align-items: center; gap: 22px; padding: 0 24px 0 18px; pointer-events: none; }
.head .slip {
  flex: none; max-width: 86px;
  display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center;
  padding: 12px 8px; border: 1px solid var(--hair); color: var(--ink);
}
/* §23.9: the family's crest above the title, for a real family only (the example carries none) */
.slip .crest, #fardom .gslip .crest { display: block; width: 32px; height: auto; margin: 0 auto 1px; pointer-events: none; }
.head.air .slip .crest { width: 28px; }
@media (max-width: 699px) { .slip .crest, .head.air .slip .crest, #fardom .gslip .crest { width: 24px; } }
.slip .hj { font: 400 28px/1 var(--serif); letter-spacing: .1em; }
.slip .ko { font: 400 16px/1 var(--kr); letter-spacing: .14em; }
.slip .tn { font: 400 11px/1.2 var(--sans); letter-spacing: .06em; }
.slip .en { font: 400 9px/1.35 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.head .fp { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; pointer-events: auto; }
.fp .none { margin: 0; font: 400 13px/1.4 var(--sans); color: var(--mute); }
.fp .add, .mouth .add, .p-card .add {
  border: 0; background: none; padding: 2px 0; cursor: pointer;
  font: 400 11px/1.3 var(--mono); letter-spacing: .06em; color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.fp .none-air { display: none; border: 0; background: none; padding: 0; cursor: pointer; font: 400 10px/1.2 var(--kr); color: var(--mute); }
.fp figure { margin: 0; }
.fp figure img { display: block; width: 300px; height: 200px; object-fit: cover; object-position: 50% 40%; border: 1px solid var(--hair); }
.fp figcaption { margin-top: 6px; font: 400 9px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.head.air { gap: 10px; padding: 0 6px 0 8px; }
.head.air .slip { padding: 8px 6px; gap: 5px; max-width: 70px; }
.head.air .slip .hj { font-size: 20px; }
.head.air .slip .ko { font-size: 12px; }
.head.air .slip .tn { font-size: 9px; }
.head.air .slip .en { display: none; }
.head.air .fp .none, .head.air .fp .add { display: none; }
.head.air .fp .none-air { display: block; white-space: nowrap; }

/* the colophon on the unwritten paper (E20): the living, in the order their strands run */
.colophon { display: flex; flex-direction: column; align-items: flex-end; pointer-events: auto; }
.cname { border: 0; background: none; padding: 0; margin: 0; cursor: pointer; text-align: right; white-space: nowrap; line-height: 14px; }
.cname .ko { font: 400 12px/14px var(--kr); }
.cname .hj { font: 400 10px/14px var(--serif); color: var(--ink); }
.cname .en, .cname .yr { font: 400 9.5px/14px var(--mono); color: var(--mute); }
.cname:hover, .cname.lit { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.colophon.air { align-items: flex-start; }
.colophon.air .grp { margin-top: 6px; font: 400 9px/12px var(--mono); letter-spacing: .06em; color: var(--ink); white-space: nowrap; }
.colophon.air .grp:first-child { margin-top: 0; }
.colophon.air .grp .nm-ko { font-size: 10px; }
.colophon.air .grp .nm-hanja { font-size: 9px; }
.colophon.air .cname { line-height: 13px; text-align: left; padding-left: 6px; }
.colophon.air .cname .ko { font-size: 11px; line-height: 13px; }
.colophon.air .cname .hj { font-size: 9.5px; line-height: 13px; }
.colophon.air.ko-only .cname .hj { display: none; }
.colophon.air.ko-only .grp { display: none; }
.colophon.air.ko-only .cname { padding-left: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* §21.12: the air's list counted (taller than the frame): one line per foot, "· N명" */
.colophon.air .grp .cnt { display: none; }
.colophon.air.counted .grp .cnt { display: inline; }
.colophon.air.counted .cname { display: none; }
.colophon.grouped .grp { margin-top: 5px; font: 400 9px/12px var(--mono); color: var(--ink); white-space: nowrap; }
/* §21.12 (gangsan.js fitColophon): no room for one name a line → the names only, in columns
   read down then across; the count form waits aside, hidden, until it is the one that fits */
.colophon.cols { display: grid; grid-auto-flow: column; justify-items: end; align-content: end; column-gap: 14px; }
.colophon.cols .cname .en, .colophon.cols .cname .yr { display: none; }
.colophon.cols .grp { margin-top: 0; }
.colophon.grouped .grp .nm-ko { font-size: 10px; }
/* §13.14: no colophon head below 9 px (漢字 and an English-only place were .86em and .8em of 9 px) */
.colophon.grouped .grp .nm-hanja, .colophon.grouped .grp .nm-en, .colophon.air .grp .nm-en { font-size: 9px; }
/* the air's list may have to stand across the strands (no room above or below the band): its lines sit on
   paper, as the name labels do (§15.3), so no strand runs through a name */
.colophon.air .grp, .colophon.air .cname { background: var(--paper); box-shadow: 0 0 0 2px var(--paper); }
.mouth { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; pointer-events: auto; }
.mouth .l1, .mouth .l2 { font: 400 12px/1.35 var(--kr); color: var(--mute); white-space: nowrap; }
.mouth .l2 { font-family: var(--sans); }
.mouth .add { text-align: right; margin-top: 2px; }

/* tree captions (E15): the year and the title; on focus a sealed memory's words as a third line */
.cap { width: 180px; text-align: center; pointer-events: none; }
.cap .y { display: block; font: 400 10px/1.1 var(--mono); letter-spacing: .12em; color: var(--ink); }
.cap .t {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 3px; font: 400 13px/1.25 var(--sans); color: var(--ink);
}
.cap .seal { display: none; margin-top: 3px; font: 400 9px/1.2 var(--mono); color: var(--ink); }
.cap .seal [lang="ko"] { font-size: 10px; }
.cap.sealed .seal { display: block; }
.cap.short .t, .cap.short .seal { display: none; }

/* ---------- chrome (the reader's instruments: type and hairlines only) ---------- */
#top { position: fixed; z-index: 3; left: var(--inset); top: calc(var(--inset) / 2 - 5px); display: flex; gap: 18px; line-height: 1; pointer-events: none; }
#top > * { pointer-events: auto; }
#top a { font: 400 9.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); text-decoration: none; }
#top a [lang="ko"] { font-size: 10px; letter-spacing: .04em; }
#top a:hover { color: var(--ink); }
@media (max-width: 979px) { #top { top: calc(var(--inset) + 8px); left: calc(var(--inset) + 10px); } #top .notes { display: none; } }

#readout { position: fixed; z-index: 3; top: calc(var(--inset) + 8px); left: 0; text-align: center; pointer-events: none; will-change: transform; }
#ro-year { font: 300 40px/1 var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--ink); }
#ro-place { margin-top: 6px; font: 400 12px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; color: var(--ink); }
#ro-also { margin-top: 3px; font: 400 10px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); white-space: nowrap; min-height: 12px; }
#ro-place .nm-ko { font-size: 13px; letter-spacing: .06em; }
#ro-place .nm-hanja { font-size: 11px; }
#ro-also [lang="ko"] { font-size: 10px; }
#readout.short { left: calc(var(--inset) + 10px); top: calc(var(--inset) + 4px); text-align: left; transform: none; }
@media (max-width: 979px) { #readout.short { left: 50%; transform: translateX(-50%) !important; text-align: center; } }
#readout.short #ro-year { font-size: 20px; }
#readout.short #ro-place, #readout.short #ro-also { display: none; }
#readout.air { left: auto; right: calc(var(--inset) + 48px); top: calc(var(--inset) + 10px); text-align: right; transform: none; }
#readout.air #ro-year { font-size: 12px; font-weight: 400; letter-spacing: .1em; }
#readout.air #ro-place { margin-top: 4px; font-size: 11px; letter-spacing: .02em; text-transform: none; }
#readout.air #ro-also { margin-top: 2px; font-size: 9px; letter-spacing: .14em; }
@media (max-width: 699px) {
  #ro-year { font-size: 32px; }
  #readout { top: calc(var(--inset) + 28px); }
  #ro-place { font-size: 10px; }
  #readout.air { right: calc(var(--inset) + 10px); top: calc(var(--inset) + 28px); }
  #readout.air #ro-also { letter-spacing: .04em; }
}

/* margin notes (E29): outside the frame, wide screens only. Every line horizontal (§23.8): the glyph, then
   its 한글 beneath it; the 26 px margin has no room for the English word set level, so it is the note's
   title (and in the legend, as before). */
#bands { position: fixed; top: 0; right: 0; width: var(--inset); height: 100%; z-index: 2; pointer-events: none; }
#bands p { position: absolute; left: 50%; top: 0; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; white-space: nowrap; }
#bands p i { display: none; }
#bands b { font: 400 12px/1 var(--serif); color: var(--ink); }
#bands .k { font: 400 10px/1 var(--kr); color: var(--ink); letter-spacing: .1em; }
#bands i { font: 400 9px/1 var(--mono); font-style: normal; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
#bands.off { visibility: hidden; }
#bands p.short i { display: none; }
#bands p[hidden] { display: none; }
@media (max-width: 979px) { #bands { display: none; } }

#help {
  position: fixed; z-index: 4; top: calc(var(--inset) + 10px); right: calc(var(--inset) + 12px);
  width: 26px; height: 26px; padding: 0; border: 1px solid var(--hair); border-radius: 50%; background: var(--paper);
  font: 400 11px/1 var(--mono); color: var(--ink); cursor: pointer;
}
#help[aria-expanded="true"] { color: var(--paper); background: var(--ink); }
@media (max-width: 699px) { #help { top: calc(var(--inset) + 6px); right: calc(var(--inset) + 6px); } }

#legend {
  position: fixed; z-index: 6; right: calc(var(--inset) + 12px); top: calc(var(--inset) + 44px);
  width: min(400px, calc(100vw - 2 * var(--inset) - 24px)); max-height: calc(100vh - 2 * var(--inset) - 100px); overflow-y: auto;
  padding: 16px 18px 14px; background: var(--paper); border: 1px solid var(--hair); color: var(--ink);
}
#legend[hidden] { display: none; }
#legend .three { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--hair); }
#legend .three p { margin: 0 0 3px; font: 400 13px/1.45 var(--sans); }
#legend .three p[lang="ko"] { font-family: var(--kr); }
#legend dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: baseline; }
#legend dt { font: 400 9px/1.35 var(--mono); letter-spacing: .12em; white-space: nowrap; }
#legend dt [lang="ko"] { font-size: 11px; letter-spacing: .02em; margin-right: 4px; }
#legend dd { margin: 0; font: 400 11.5px/1.45 var(--sans); color: var(--ink); }
#legend dd [lang="ko"] { font-size: 11px; }
#legend svg { width: 11px; height: 11px; vertical-align: -1px; fill: var(--ink); stroke: var(--ink); }
#legend svg .o { fill: var(--paper); stroke-width: 1.1; }
#legend svg .h { fill: none; stroke-width: 1; }
#legend svg .ring { fill: none; stroke-width: 1.4; }
#legend svg .red-o { fill: none; stroke: var(--red); stroke-width: 1.4; }
#legend svg .red-f { fill: var(--red); stroke: none; }
#legend h3 { margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--hair); font: 400 9px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
#legend h3 [lang="ko"] { font-size: 10px; }
#legend .fine { margin: 0; padding-left: 14px; font: 400 10px/1.5 var(--sans); color: var(--mute); }
#legend .keys-hint { margin: 12px 0 0; padding-top: 9px; border-top: 1px solid var(--hair); font: 300 9px/1.6 var(--mono); color: var(--mute); }
@media (max-width: 699px) { #legend { left: calc(var(--inset) + 6px); right: calc(var(--inset) + 6px); width: auto; top: auto; bottom: calc(var(--inset) + 40px); max-height: 66vh; } }

#foot { position: fixed; left: 0; right: 0; top: var(--mini-top); z-index: 3; display: flex; justify-content: center; align-items: center; gap: 12px; pointer-events: none; }
#foot.off { visibility: hidden; }
#mini { display: block; height: var(--mini-h); pointer-events: auto; cursor: pointer; touch-action: none; }

#actions { position: fixed; z-index: 4; right: var(--inset); bottom: calc(var(--inset) / 2 - 6px); display: flex; gap: 18px; }
#actions button { border: 0; background: none; padding: 0; cursor: pointer; font: 400 9.5px/1 var(--mono); letter-spacing: .08em; color: var(--ink); white-space: nowrap; }
#actions button [lang="ko"] { font-size: 10.5px; }
#actions button.on { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
#actions button[hidden] { display: none; }
@media (max-width: 979px) { #actions { bottom: auto; top: calc(var(--inset) + 12px); right: calc(var(--inset) + 44px); } }
@media (max-width: 699px) {
  #actions { top: auto; bottom: calc(var(--inset) + 8px); right: calc(var(--inset) + 10px); gap: 14px; }
  body.valley #actions { bottom: auto; top: calc(var(--inset) + 10px); right: calc(var(--inset) + 40px); }
  body.valley #actions .en, body.valley #actions .ls { display: none; }
  .head.air { padding: 0 2px; gap: 4px; flex-direction: column; justify-content: center; }
  .head.air .slip { padding: 6px 3px; gap: 4px; }
  .head.air .slip .hj { font-size: 15px; }
  .head.air .slip .ko { font-size: 10px; }
  .head.air .slip .tn { display: none; }
  .head.air .fp { flex: none; }
  .mline.air .en, .mline.air .yr { display: none; }
  /* a place with no 한글 or 漢字 (Busan, Tokyo): its English is its only name, so it stays (§13.10: no empty box) */
  .mline.air .en:first-child { display: inline; }
  .mline.air.recur .yr2 { display: inline; }
}

#note { position: fixed; z-index: 8; left: 50%; bottom: calc(var(--inset) + 48px); transform: translateX(-50%); padding: 6px 10px; background: var(--paper); border: 1px solid var(--hair); font: 400 11px/1.3 var(--mono); color: var(--ink); }
#note[hidden] { display: none; }

/* ---------- the card: a paper panel with a hairline (E28) ---------- */
#card {
  position: fixed; z-index: 5;
  left: calc(var(--inset) + 14px); top: calc(var(--inset) + 46px); bottom: calc(var(--inset) + 46px);
  width: min(360px, calc(100vw - 32px)); background: var(--paper); border: 1px solid var(--hair); overflow: hidden;
  animation: card-in .32s var(--ease);
}
@keyframes card-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
#card[hidden] { display: none; }
#card .x { position: absolute; top: 2px; right: 2px; z-index: 1; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; font: 300 13px/1 var(--mono); color: var(--mute); }
#card .x:hover { color: var(--ink); }
#card .body { height: 100%; overflow-y: auto; padding: 18px 22px 26px; outline: none; overscroll-behavior: contain; }
/* more below: a hairline at the card's foot and an arrow (no fade) */
#card .more { display: none; position: absolute; left: 0; right: 0; bottom: 0; height: 18px; border-top: 1px solid var(--hair); background: var(--paper); text-align: center; font: 400 10px/17px var(--mono); color: var(--ink); }
#card.has-more .more { display: block; }
body.carding .head .slip { visibility: hidden; }

.c-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; padding-right: 30px; font: 400 9.5px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.c-meta .c-yr { font: 300 20px/1 var(--mono); letter-spacing: .02em; }
.c-meta .nm-ko { font-size: 12px; letter-spacing: .04em; }
.c-meta .nm-hanja { font-size: 10.5px; }
.c-title { margin: 10px 0 0; font: 300 22px/1.3 var(--sans); color: var(--ink); }
.c-sum { margin: 8px 0 0; font: 400 9px/1.4 var(--mono); letter-spacing: .12em; color: var(--mute); }
.c-sum [lang="ko"] { font-size: 11px; letter-spacing: .02em; color: var(--ink); margin-right: 8px; }
.c-state { display: flex; align-items: center; gap: 8px; margin-top: 10px; font: 400 10.5px/1.3 var(--mono); color: var(--ink); }
.c-state [lang="ko"] { font-size: 11.5px; }
.c-state .s { width: 8px; height: 8px; flex: none; border: 1.5px solid var(--red); }
.c-sec { margin-top: 20px; padding-top: 11px; border-top: 1px solid var(--hair); }
.c-h { margin: 0 0 10px; font: 400 8.5px/1 var(--mono); letter-spacing: .18em; color: var(--mute); }
.c-h [lang="ko"] { font-size: 10px; letter-spacing: .04em; color: var(--ink); }
.c-there { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0; padding: 0; list-style: none; }
.who-btn, .chip { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.c-there .nm-stack { gap: 3px; }
.c-there .nm-lead .nm-ko { font-size: 15px; }
.c-there .nm-sub { font: 400 8.5px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.c-there .nm-sub .nm-hanja { font-size: 10.5px; letter-spacing: .04em; }
.c-there .yrs { color: var(--ink); letter-spacing: .04em; }
.c-there .nothing { color: var(--mute); }
.c-there .nothing [lang="ko"] { font-size: 10px; }
.telling { padding-left: 10px; border-left: 1px solid var(--who, var(--hair)); }
.telling + .telling { margin-top: 14px; }
.who { font: 400 9.5px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.who .nm-ko { font-size: 13px; letter-spacing: .02em; }
.who .nm-hanja { font-size: 11px; }
.who .nt { color: var(--mute); text-transform: none; letter-spacing: .02em; }
.who .nt [lang="ko"] { font-size: 10.5px; }
.it { margin: 0; }
.it + .it { margin-top: 8px; }
.it.line { font: 400 13.5px/1.55 var(--sans); color: var(--ink); }
.it .g { display: inline-block; width: 18px; font: 400 12px/1 var(--mono); color: var(--ink); }
.it.photo-img img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.it.photo-img figcaption { margin-top: 4px; font: 400 12px/1.4 var(--sans); color: var(--mute); }
.it.voice { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 4px 8px; }
.it.voice .bar { height: 1px; background: var(--ink); position: relative; }
.it.voice .bar i { position: absolute; left: 0; top: -1px; height: 3px; }
.it.voice .d { font: 400 10px/1 var(--mono); color: var(--mute); font-variant-numeric: tabular-nums; }
.it.voice p { grid-column: 2 / -1; margin: 2px 0 0; font: 400 13px/1.5 var(--sans); color: var(--ink); }
.echo { display: block; width: 100%; text-align: left; color: var(--ink); padding: 8px 0 9px; border: 0; border-top: 1px solid var(--hair); background: none; cursor: pointer; }
.c-h + .echo { border-top: 0; padding-top: 0; }
.echo:hover .et { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.echo .ey { font: 400 10px/1 var(--mono); letter-spacing: .06em; color: var(--mute); margin-right: 8px; }
.echo .et { font: 400 13px/1.4 var(--sans); }
.echo .ew { display: block; margin-top: 3px; font: 400 10px/1.45 var(--mono); color: var(--mute); }
.echo .ew .nm-ko { font-size: 10.5px; }
.c-read { margin: 6px 0 0; font: 400 9px/1.3 var(--mono); color: var(--mute); }
.c-read [lang="ko"] { font-size: 9.5px; }

/* person and place cards */
.p-top { display: flex; align-items: center; gap: 12px; padding-right: 30px; }
.p-top .sample { display: block; width: 24px; height: 1.2px; flex: none; }
.p-top .portrait { width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--hair); border-radius: 2px; }
.p-name .nm-lead .nm-ko { font-size: 22px; }
.p-name .nm-sub { margin-top: 3px; font: 400 9.5px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.p-name .nm-sub .nm-hanja { font-size: 12px; letter-spacing: .04em; }
#card[data-type="place"] .p-name { display: inline-flex; }
.p-yrs { margin: 8px 0 0; font: 400 11px/1.2 var(--mono); letter-spacing: .06em; color: var(--ink); }
.p-ph, .p-kin { margin: 6px 0 0; font: 400 10.5px/1.4 var(--mono); color: var(--mute); }
.p-ph [lang="ko"] { font-size: 11px; color: var(--ink); }
#card .add { display: block; margin-top: 8px; border: 0; background: none; padding: 0; cursor: pointer; font: 400 10.5px/1.3 var(--mono); color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.p-about { margin: 0; font: 400 13.5px/1.6 var(--sans); color: var(--ink); }
.row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.row .how { font: 400 10px/1.3 var(--mono); color: var(--mute); }
.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.chip .nm-ko { font-size: 13px; }
.chip .nm-hanja { font-size: 10.5px; }
.chip .nm-en { font-size: 10px; font-family: var(--mono); }
.chip .cx { margin-left: 6px; font: 400 9.5px/1 var(--mono); color: var(--mute); }
.chip:hover .nm { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.none { margin: 0; font: 400 10.5px/1.4 var(--mono); color: var(--mute); }
.none [lang="ko"] { font-size: 11px; }
.places { margin: 0; padding: 0; list-style: none; }
.places li { display: flex; gap: 10px; align-items: baseline; padding: 2px 0; font: 400 11px/1.4 var(--mono); color: var(--ink); }
.places li .nm-ko { font-size: 12.5px; }
.places li .y { color: var(--mute); }
.places li.unrec { color: var(--mute); }

#tip { position: fixed; left: 0; top: 0; z-index: 7; pointer-events: none; max-width: 300px; padding: 6px 9px; background: var(--paper); border: 1px solid var(--hair); font: 400 11px/1.45 var(--mono); color: var(--ink); }
#tip[hidden] { display: none; }
#tip b { font-weight: 400; }
#tip .m { color: var(--mute); }
#tip .nm-ko { font-size: 12px; }
#tip .nm-hanja { font-size: 10.5px; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sr-only:focus-within { position: fixed; left: 24px; bottom: 120px; width: auto; height: auto; clip: auto; margin: 0; z-index: 8; background: var(--paper); border: 1px solid var(--hair); padding: 6px; white-space: normal; max-width: 320px; max-height: 60vh; overflow: auto; }
.sr-only button { display: block; border: 0; background: none; text-align: left; padding: 3px 4px; font: 400 12px/1.3 var(--sans); cursor: pointer; color: var(--ink); }

/* the strip (a window too short for the valley): the air only */
body.strip #foot, body.strip #read { visibility: hidden; }

/* ---------- phone: the card is a bottom sheet; the art lifts above it ---------- */
@media (max-width: 699px) {
  .mbox { padding: 7px 4px; gap: 3px; }
  .mbox .ko { font-size: 14px; }
  .mbox .hj { font-size: 11px; }
  .cap { width: 220px; }
  #card {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 52vh; height: 52dvh;
    border-width: 1px 0 0; animation-name: sheet-in;
  }
  #card .body { padding: 16px 18px calc(26px + env(safe-area-inset-bottom)); }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  body.sheet #actions, body.sheet #foot { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  #card { animation: none; }
  * { transition: none !important; }
}

/* ---------- the family tree (the headwaters sheet · 발원지; §19, §23, §24) ---------- */
#stage { background: var(--paper); }
#far { pointer-events: none; }
body.going #readout, body.far #readout, body.going #bands, body.far #bands, body.going #foot, body.far #foot,
body.going #read, body.far #read, body.going #legend { visibility: hidden !important; }
body.going #stage, body.far #stage { cursor: default; }
body.far #stage { cursor: default; }
body.far #stage.point { cursor: pointer; }
body.far #stage.dragging { cursor: grabbing; }
#fardom { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
#fardom[hidden] { display: none; }
#fardom > * { position: absolute; left: 0; top: 0; }
body.going #stage { clip-path: inset(var(--inset)); }
#fardom .gslip { background: var(--paper); border: 1px solid var(--hair); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 9px 10px; }
#fardom .gslip .ko { font: 400 18px/1.15 var(--kr); letter-spacing: .04em; }
#fardom .gslip .src { font: 400 11px/1.1 var(--kr); color: var(--mute); }
#fardom .gslip .src .hj { font: 400 12px/1 var(--serif); color: var(--ink); }
#fardom .gslip .tn { font: 400 11px/1.1 var(--sans); letter-spacing: .04em; }
#fardom .gslip .en { font: 400 9px/1.2 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
#fardom .gro { left: auto; right: calc(var(--inset) + 48px); top: calc(var(--inset) + 18px); text-align: right; }
#fardom .gro .l1 { font: 400 13px/1.3 var(--kr); color: var(--ink); }
#fardom .gro .l2 { margin-top: 3px; font: 400 9.5px/1.2 var(--mono); letter-spacing: .1em; color: var(--mute); }
#fardom .gro .l3 { margin-top: 5px; font: 400 9.5px/1.2 var(--mono); letter-spacing: .06em; color: var(--mute); }
#fardom .gro .l3 [lang="ko"] { font-size: 11px; letter-spacing: 0; }
/* §25: the family tree's key to its colours, under the counts */
#fardom .gro .gkey { margin-top: 7px; display: flex; justify-content: flex-end; gap: 12px; font: 400 9.5px/1.2 var(--mono); letter-spacing: .06em; color: var(--mute); }
#fardom .gro .gkey [lang="ko"] { font: 400 11px/1 var(--kr); letter-spacing: 0; color: var(--ink); }
#fardom .gro .gkey .dot { margin-right: 4px; font-size: 11px; }
#fardom .gro .add, #fardom .gfp .add { pointer-events: auto; border: 0; background: none; padding: 0; cursor: pointer; font: 400 9.5px/1.2 var(--mono); color: var(--ink); }
#fardom .gro .add [lang="ko"], #fardom .gfp .add [lang="ko"] { font-size: 11px; }
#fardom .gfp .none { margin: 0 0 5px; font: 400 12.5px/1.3 var(--sans); color: var(--mute); }
#fardom .gfp figure { margin: 0; pointer-events: auto; }
#fardom .gfp img { display: block; width: 150px; height: 100px; object-fit: cover; border: 1px solid var(--hair); }
#fardom .gfp figcaption { margin-top: 4px; font: 400 9px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
#card.far-right { left: auto; right: calc(var(--inset) + 14px); }
#fardom .gdown { margin: 0; text-align: right; color: var(--mute); line-height: 1; }
#fardom .gdown .ko { display: block; font: 300 12px/1.2 var(--kr); }
#fardom .gdown .en { display: block; margin-top: 4px; font: 400 8.5px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
body.far.carding #fardom .gslip { visibility: hidden; }
#card .p-count { margin: 0 0 8px; font: 400 10px/1.4 var(--mono); letter-spacing: .03em; color: var(--mute); }
#card .p-count [lang="ko"] { font-size: 11.5px; letter-spacing: 0; color: var(--ink); }
#card .p-in { margin: 0 0 8px; font: 400 10px/1.4 var(--mono); color: var(--mute); }
#card .p-in [lang="ko"] { font-size: 11.5px; }
#card .on-river { display: block; margin: 2px 0 10px; border: 0; background: none; padding: 0; cursor: pointer; font: 400 10px/1.3 var(--mono); letter-spacing: .04em; color: var(--ink); }
#card .on-river [lang="ko"] { font-size: 12px; letter-spacing: 0; }
#far-sr.sr-only:focus-within { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
@media (max-width: 699px) {
  #fardom .gslip { gap: 5px; padding: 6px 0; }
  #fardom .gslip .ko { font-size: 14px; }
  #fardom .gslip .src { font-size: 9.5px; }
  #fardom .gslip .src .hj { font-size: 10px; }
  #fardom .gslip .tn { font-size: 9px; }
  #fardom .gslip .en { font-size: 7.5px; }
  #fardom .gro { right: calc(var(--inset) + 8px); top: calc(var(--inset) + 40px); max-width: 230px; }
  #fardom .gro .l1 { font-size: 11.5px; }
  #fardom .gro .l2, #fardom .gro .l3 { font-size: 8px; letter-spacing: .04em; }
  #fardom .gfp .none { font-size: 11px; }
  body.air #actions .en, body.air #actions .ls { display: none; }
  #fardom .gdown .ko { font-size: 10.5px; }
  #fardom .gdown .en { font-size: 7.5px; }
}
@media (prefers-reduced-motion: reduce) { #stage canvas, #marks, #caps { transition: none; } }

/* ---------- §24 the view switcher (E58): one obvious way between the three views ----------
   On a desk it stands in the mount above the frame, at the top centre: outside the painting, so it never
   covers the year, the readout or a crown, and in the same place in every view. Below 980 px (phones,
   small tablets) it is a bottom bar that the sheet stands above (the stage ends at its top). */
#views { position: fixed; z-index: 6; top: 1px; left: var(--views-x, 50%); transform: translateX(-50%); display: flex; height: 32px;
  border: 1px solid var(--ink); border-radius: 17px; overflow: hidden; background: var(--paper); }
#views .vw { display: flex; align-items: center; gap: 6px; height: 100%; margin: 0; padding: 0 18px; border: 0; border-radius: 0; background: transparent;
  color: var(--ink); font: 400 11px/1 var(--mono); letter-spacing: .06em; white-space: nowrap; cursor: pointer; }
#views .vw + .vw { border-left: 1px solid var(--ink); }
#views .vw .k { font: 400 14px/1 var(--kr); letter-spacing: 0; }
#views .vw .ic { flex: none; width: 21px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; }
#views .vw .sub { font: 400 9px/1 var(--mono); color: var(--mute); letter-spacing: .04em; }
#views .vw .sub:empty { display: none; }
@media (max-width: 1240px) { body:not(.viewbar) #views .vw .sep, body:not(.viewbar) #views .vw .en { display: none; } body:not(.viewbar) #views .vw { padding: 0 15px; } }
#views .vw[aria-current="true"] { background: var(--ink); color: var(--paper); cursor: default; }
#views .vw[aria-current="true"] .sub { color: var(--paper); opacity: .8; }
#views .vw:not([aria-current="true"]):hover { background: rgba(31, 40, 120, .09); }
#views .vw:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3.5px var(--paper); }
#views .vw[aria-current="true"]:focus-visible { box-shadow: inset 0 0 0 2px var(--paper); }
#viewhint { position: fixed; z-index: 6; top: var(--hint-y, 112px); left: var(--hint-x, 60%); margin: 0; display: grid; grid-template-columns: auto auto auto; align-items: center; column-gap: 6px; row-gap: 4px;
  padding: 7px 6px 7px 9px; border: 1px solid var(--ink); background: var(--paper); white-space: nowrap; color: var(--ink); }
#viewhint[hidden] { display: none; }
#viewhint .k { font: 400 11.5px/1 var(--kr); }
#viewhint .vh-arrow { font: 400 11px/1 var(--mono); }
#viewhint .en { grid-column: 2 / 3; font: 400 9.5px/1 var(--mono); letter-spacing: .04em; color: var(--mute); }
#viewhint .x { grid-row: 1; grid-column: 3; border: 0; background: none; padding: 0 3px; cursor: pointer; font: 400 10px/1 var(--mono); color: var(--mute); }
#viewhint .x:hover, #viewhint .x:focus-visible { color: var(--ink); }
body.viewbar #views { top: auto; bottom: 0; left: 0; right: 0; transform: none; height: auto; border-width: 1px 0 0; border-radius: 0;
  padding-bottom: env(safe-area-inset-bottom); }
body.viewbar #views .vw { flex: 1 1 0; flex-direction: column; justify-content: center; gap: 4px; height: 56px; padding: 0 4px; }
body.viewbar #views .vw .lb { display: flex; flex-direction: column; align-items: center; gap: 3px; }
body.viewbar #views .vw .en { font-size: 8.5px; letter-spacing: .04em; }
body.viewbar #views .vw .sep { display: none; }
body.viewbar #views .vw .k { font-size: 12px; }
body.viewbar #views .vw .sub { font-size: 8px; }
body.viewbar #stage, body.viewbar #fardom { bottom: var(--viewbar-h, 57px); }
body.viewbar #card { bottom: var(--viewbar-h, 57px); }
body.viewbar #actions, body.viewbar #toast { margin-bottom: var(--viewbar-h, 57px); }
body.viewbar #viewhint { top: auto; left: auto; right: 8px; bottom: calc(var(--viewbar-h, 57px) + 8px); }
#viewhint .dn, body.viewbar #viewhint .up { display: none; }
body.viewbar #viewhint .dn { display: inline; }

/* ---------- §21.5: the card's row of action links (the app only), underlined mono like .add ---------- */
.c-acts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 18px; margin-top: 10px; }
.c-act {
  border: 0; background: none; padding: 7px 0; margin: 0; cursor: pointer; text-align: left;
  font: 400 10.5px/1.3 var(--mono); letter-spacing: .04em; color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.c-act [lang="ko"] { font-size: 11.5px; letter-spacing: 0; }
.c-act:hover, .c-act:focus-visible { text-decoration-thickness: 2px; }
/* §21.7.7: 44 px tall on a phone, without moving the row (the padding is given back by the margin) */
@media (max-width: 699px) { .c-act { padding: 14px 0; margin: -7px 0; } }
/* an author with only an English name is set like the names beside it, never below 9 px (§13.14) */
.who .nm-compact .nm-en.nm-solo { font-size: 10.5px; }
@media (max-width: 699px) { .chip .nm-en, #card .nm-sub .nm-en, #card .nm-compact .nm-en { font-size: 9.5px; } }
/* printing a card: the card as a plain page, without the scroll behind it (the canvases cannot be scaled) */
@media print {
  #stage, #mini, #readout, #top, #actions, #views, #viewhint, #help, #bands, #foot, #toast, #drawer, #peekbar, #fardom { display: none !important; }
  #card { position: static; width: auto; height: auto; overflow: visible; border: 0; animation: none; }
  #card .body { height: auto; overflow: visible; }
  #card .x, #card .more, #card .c-acts { display: none; }
}
/* a photo that arrived (§21.3): a button that opens the lightbox; a voice telling plays in the teller's ink */
#card button.it.photo-img { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; }
#card .it.photo-img img { border: 1px solid var(--hair); }
#card .it.photo-img .cap { display: block; margin-top: 4px; font: 400 12px/1.4 var(--sans); color: var(--mute); }
#card .it.voice-live .vcap { margin: 4px 0 0; font: 400 13px/1.5 var(--sans); color: var(--ink); }
#card .it .g { color: var(--ink); }
/* the family photo's edit link once it exists; the mouth's count of memories with no year; the sheet's add someone */
.fp .edit { margin-top: 2px; }
.fp .fp-line { margin: 0; font: 400 12px/1.4 var(--sans); color: var(--mute); }
.mouth .undated { margin-top: 0; }
#fardom .gro .l4 { margin-top: 5px; }
/* a family photo (§21.3) keeps to the head's sheet however wide the slip is */
.head .fp { min-width: 0; }
.fp figure { max-width: 100%; }
.fp figure img { max-width: 100%; height: auto; aspect-ratio: 3 / 2; }

/* ---------- §25 the language of the labels: 한 · EN · 둘 다 Both (one mechanism; web/js/lang.js) ----------
   .lk 한글 half · .ls separator · .le English half · .lx English-only twin of a 한글-only label. "Both" is
   the page as it always was (.lx hidden). Names and what the family wrote are never marked. */
.lx { display: none; }
/* .lbo: the separator and English as one run, shown only in "Both" (where a split would move later text by 1/64 px) */
body.lang-ko .le, body.lang-ko .ls, body.lang-ko .lx, body.lang-ko .lbo { display: none !important; }
body.lang-en .lbo { display: none !important; }
body.lang-en .lk, body.lang-en .ls { display: none !important; }
body.lang-en .lx { display: inline; }
#langs { position: fixed; z-index: 6; top: 2px; right: calc(var(--inset) + 2px); display: flex; height: 22px;
  border: 1px solid var(--ink); border-radius: 12px; overflow: hidden; background: var(--paper); }
#langs[hidden] { display: none; }
#langs button { margin: 0; padding: 0 10px; border: 0; background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap;
  font: 400 9.5px/1 var(--mono); letter-spacing: .06em; }
#langs button + button { border-left: 1px solid var(--ink); }
#langs button [lang="ko"] { font: 400 11px/1 var(--kr); letter-spacing: 0; }
#langs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); cursor: default; }
#langs button:not([aria-pressed="true"]):hover { background: rgba(31, 40, 120, .09); }
#langs button:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3.5px var(--paper); }
#langs button[aria-pressed="true"]:focus-visible { box-shadow: inset 0 0 0 2px var(--paper); }
body.viewbar #langs { display: none; }
#views.tight .vw .sep, #views.tight .vw .en { display: none; }
#views.tight .vw { padding: 0 13px; }
@media print { #langs { display: none !important; } }
