/* Ductus Atlas: timeline density upgrades and the infographic sections. Tokens live in styles.css. */

/* ── Timeline: tiers and evidence ─────────────── */
.node.tier-step { width: 10px; height: 10px; margin: -5px 0 0 -5px; border-width: 1.5px; }
.node.tier-ms { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
.node.ev-copy { background: var(--sheet); border: 3px solid var(--c); box-shadow: none; }
.node.ev-tradition { background: var(--sheet); border: 2px dashed var(--c); box-shadow: none; }
.node.ev-disputed { background: var(--sheet); border: 2px dotted var(--c); box-shadow: none; }
.node.tier-step.ev-copy { border-width: 2.5px; }
.node.tier-step.ev-tradition, .node.tier-step.ev-disputed { border-width: 1.6px; }
.node.is-sel.ev-copy, .node.is-sel.ev-tradition, .node.is-sel.ev-disputed { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 28%, transparent); }
.node-label.key { font-weight: 600; color: var(--ink); }
.links path.disputed { stroke-dasharray: 4 4; }
.prewriting {
  position: absolute; top: 4px; z-index: 1; text-align: center;
  font: 500 0.6rem/1 var(--f-data); text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-2);
  pointer-events: none;
}
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.filter-row > .kicker { min-width: 72px; }
.filters:has(.filter-row) { flex-direction: column; align-items: stretch; gap: 10px; }
.chip[data-milestones][aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); opacity: 1; }
.chip[data-milestones][aria-pressed="false"] { opacity: 1; }

/* evidence marks, shared by chart legend, detail panel, spine, paper route */
.evm, .ev-tag i {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: var(--ink-2); border: 1.5px solid var(--ink-2);
}
.evm.ev-copy, .ev-tag.ev-copy i { background: transparent; border-width: 3px; }
.evm.ev-tradition, .ev-tag.ev-tradition i { background: transparent; border-style: dashed; }
.evm.ev-disputed, .ev-tag.ev-disputed i { background: transparent; border-style: dotted; border-width: 2px; }
.ev-chip[aria-pressed="false"] .evm { opacity: 0.4; }
.ev-tag { display: inline-flex; align-items: center; gap: 6px; font: 400 0.68rem var(--f-data); color: var(--ink-2); text-transform: none; letter-spacing: 0; }
.go.disputed { text-decoration-style: dashed; }

/* ── Shared chart pieces ──────────────────────── */
.gx { margin-top: clamp(24px, 4vw, 40px); }
.gx-sub { font-size: 1.5rem; margin: 36px 0 12px; }
.gx-axis { position: relative; height: 22px; margin-left: var(--gx-label); margin-right: var(--gx-span); border-bottom: 1px solid var(--rule); }
.gx-axis span { position: absolute; bottom: 4px; transform: translateX(-50%); font: 400 0.64rem var(--f-data); color: var(--ink-2); white-space: nowrap; }
.gantt, .audit { --gx-label: 12rem; --gx-span: 10rem; display: grid; gap: 3px; }
.gx-row, .audit-row { display: grid; grid-template-columns: var(--gx-label) minmax(0, 1fr) var(--gx-span); align-items: center; gap: 0; min-height: 20px; }
.gx-label { font-size: 0.8rem; padding-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gx-span { font: 400 0.66rem var(--f-data); color: var(--ink-2); padding-left: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gx-track { position: relative; height: 12px; background: linear-gradient(var(--rule-soft), var(--rule-soft)) center / 100% 1px no-repeat; }
.gx-bar { position: absolute; top: 1px; bottom: 1px; background: var(--ink-2); opacity: 0.55; }
.gx-row.alive .gx-bar { background: var(--ink); opacity: 1; }
.gx-row.alive .gx-bar::after { content: ""; position: absolute; right: -6px; top: -2px; border: 7px solid transparent; border-left: 6px solid var(--ink); border-right: 0; }
.gx-group { margin-top: 12px; padding-top: 6px; border-top: 1px solid var(--rule); font: 500 0.66rem var(--f-data); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2); }

/* ── Milestone spine ──────────────────────────── */
.spine { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 28px; }
.ms { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 10px; padding-block: 16px; border-top: 1px solid var(--rule); }
.ms-n { font: 400 1.9rem/1 var(--f-display); font-style: italic; color: var(--c); font-variant-numeric: tabular-nums; }
.ms-body { display: grid; gap: 6px; align-content: start; min-width: 0; }
.ms-body .kicker { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.ms-name { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: 500 1.35rem/1.12 var(--f-display); color: var(--ink); }
.ms-name:hover { text-decoration: underline; text-decoration-color: var(--c); text-underline-offset: 4px; }
.ms-body p { font-size: 0.86rem; color: var(--ink-2); }
.between { font-size: 0.8rem; }
.between summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink); list-style: none; }
.between summary::-webkit-details-marker { display: none; }
.between summary::before { content: "+"; font: 500 0.8rem var(--f-data); color: var(--ink-2); }
.between[open] summary::before { content: "–"; }
.between summary span:first-of-type { font-weight: 600; }
.between .gap { font: 400 0.66rem var(--f-data); color: var(--ink-2); align-self: center; }
.between ul { margin: 8px 0 0; padding: 0 0 0 12px; list-style: none; display: grid; gap: 4px; border-left: 1px dotted var(--rule); }
.between li { display: grid; gap: 0; }
.between li span { font: 400 0.64rem var(--f-data); color: var(--ink-2); }
.between .go { font-size: 0.82rem; justify-self: start; text-align: left; }

/* ── Evidence audit ───────────────────────────── */
.audit-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; font-size: 0.8rem; }
.audit-legend span { display: inline-flex; align-items: center; gap: 6px; }
.audit-row { min-height: 26px; }
.audit-bar { display: flex; height: 18px; gap: 2px; }
.audit-bar .seg { display: grid; place-items: center; font: 500 0.62rem var(--f-data); min-width: 0; overflow: hidden; }
.seg.ev-original { background: var(--ink); color: var(--paper); }
.seg.ev-copy { background: var(--sheet); box-shadow: inset 0 0 0 2.5px var(--ink); color: var(--ink); }
.seg.ev-tradition { background: var(--sheet); border: 1.5px dashed var(--ink); color: var(--ink); }
.seg.ev-disputed { background: var(--sheet); border: 2px dotted var(--ink); color: var(--ink); }

/* ── Family tree ──────────────────────────────── */
.tree-scroll { overflow-x: auto; border: 1px solid var(--rule); background: var(--sheet); }
.tree svg { display: block; }
.tree-read { font-size: 0.9rem; margin-bottom: 10px; min-height: 1.5em; }
.t-grid { stroke: var(--rule-soft); stroke-width: 1; }
.t-tick { fill: var(--ink-2); font: 400 9px var(--f-data); }
.t-edge { fill: none; stroke: var(--ink-2); stroke-width: 1; opacity: 0.55; }
.t-edge.d { stroke-dasharray: 3 3; }
.t-edge.also { stroke: var(--t-reed); stroke-dasharray: 2 3; opacity: 0.7; }
.t-node { cursor: pointer; outline: none; }
.t-node circle { fill: var(--ink-2); stroke: var(--sheet); stroke-width: 2; }
.t-node.root circle { fill: var(--t-brush); }
.t-node text { fill: var(--ink); font: 500 11.5px var(--f-body); }
.t-node .t-year { fill: var(--ink-2); font: 400 9px var(--f-data); }
.t-node:focus-visible circle { stroke: var(--ink); }
.tree.focused .t-node:not(.lit) { opacity: 0.35; }
.tree.focused .t-edge:not(.lit):not(.also) { opacity: 0.2; }
.t-edge.lit { stroke: var(--ink); stroke-width: 2; opacity: 1; }
.t-node.lit circle { fill: var(--ink); }
.t-node.lit.root circle { fill: var(--t-brush); }

/* ── Paper’s journey ──────────────────────────── */
.paper-strip { position: relative; height: 56px; margin: 8px 12px 20px; }
.ps-rule { position: absolute; left: 0; right: 0; top: 18px; border-top: 2px solid var(--ink); }
.ps-tick { position: absolute; top: 34px; transform: translateX(-50%); font: 400 0.62rem var(--f-data); color: var(--ink-2); white-space: nowrap; }
.ps-dot { position: absolute; top: 18px; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--ink); border: 2px solid var(--paper); display: grid; place-items: center; }
.ps-dot b { font: 600 0.55rem var(--f-data); color: var(--paper); }
.ps-dot.ev-tradition { background: var(--paper); border: 2px dashed var(--ink); }
.ps-dot.ev-tradition b { color: var(--ink); }
.paper-route { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); counter-reset: none; }
.paper-route li { background: var(--sheet); padding: 12px 14px 14px; display: grid; gap: 4px; align-content: start; position: relative; }
.pr-n { font: 400 1.5rem/1 var(--f-display); font-style: italic; color: var(--ink-2); }
.paper-route b { font: 500 1.1rem/1.15 var(--f-display); }
.paper-route p { font-size: 0.8rem; color: var(--ink-2); }

/* ── Directions ───────────────────────────────── */
.dirs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px 24px; }
.dirs figure { margin: 0; display: grid; gap: 8px; align-content: start; }
.dirs svg { width: 100%; max-width: 240px; height: auto; background: var(--sheet); border: 1px solid var(--rule); }
.dirs figcaption { font-size: 0.8rem; color: var(--ink-2); }
.dirs figcaption b { display: block; font: 500 1.1rem/1.2 var(--f-display); color: var(--ink); margin-bottom: 2px; }
.dir-line { stroke: var(--ink); stroke-width: 2; }
.dir-turn { fill: none; stroke: var(--ink-2); stroke-width: 1.3; stroke-dasharray: 2 2; }
.dir-head { fill: var(--ink); }
.dir-start { fill: var(--t-brush); }
.dir-stone { stroke: var(--rule); stroke-width: 10; stroke-linecap: round; }

/* ── Deep dives ───────────────────────────────── */
.dd-body { border-top: 1px solid var(--ink); padding-top: 24px; display: grid; gap: 20px; }
.dd-lede { font-size: 1.05rem; max-width: 64ch; }
.dd-note { font-size: 0.82rem; color: var(--ink-2); max-width: 70ch; }
.chain { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0; }
.chain-step { position: relative; padding: 14px 18px 14px 14px; border-top: 3px solid var(--ink); display: grid; gap: 4px; align-content: start; }
.chain-step::after { content: "→"; position: absolute; right: 2px; top: 12px; color: var(--ink-2); font-size: 0.9rem; }
.chain-step:last-child::after { content: none; }
.chain-step.branch { border-top-color: var(--t-brush); }
.chain-step b { font: 500 1.25rem/1.1 var(--f-display); }
.chain-step p { font-size: 0.8rem; color: var(--ink-2); }
.kana-table { display: grid; max-width: 34rem; border-top: 1px solid var(--rule); }
.kt-head, .kt-row { display: grid; grid-template-columns: 3.5rem repeat(4, minmax(0, 1fr)); align-items: center; border-bottom: 1px solid var(--rule-soft); }
.kt-head span { font: 500 0.64rem var(--f-data); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); padding: 8px 0; }
.kt-r { font: 400 0.78rem var(--f-data); color: var(--ink-2); }
.kt-k { font-size: 1.7rem; color: var(--ink-2); padding: 4px 0; }
.kt-g { font-size: 2rem; color: var(--ink); }
.kt-k::after { content: " →"; font: 400 0.9rem var(--f-body); color: var(--rule); }
.f-hg { font-family: "Noto Serif KR", "Nanum Myeongjo", serif; }
.hg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.hg-card { background: var(--sheet); padding: 14px; display: grid; gap: 6px; align-content: start; }
.hg-g { font-size: 3rem; line-height: 1; }
.hg-card p { font-size: 0.8rem; color: var(--ink-2); }
.hg-der { display: flex; gap: 10px; font-size: 1.4rem; }
.hg-vowels { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: baseline; }
.hg-v { display: inline-flex; align-items: baseline; gap: 8px; font-size: 0.84rem; color: var(--ink-2); }
.hg-v b { font-size: 1.8rem; color: var(--ink); font-weight: 500; }
.table-wrap { overflow-x: auto; }
.pens { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.86rem; }
.pens th { text-align: left; font: 500 0.64rem var(--f-data); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--ink); }
.pens td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.pens td:first-child { display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.pen-ar { font-size: 1.7rem; line-height: 1.2; }
.pens b { font: 500 1.1rem var(--f-display); }
.pa { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
.pa-draw { display: grid; gap: 12px; }
.pa-draw svg { width: 100%; background: var(--sheet); border: 1px solid var(--rule); }
.pa-nib { stroke: var(--t-quill); stroke-width: 3; stroke-linecap: round; }
.pa-ctl { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; }
.pa-ctl input { flex: 1; accent-color: var(--ink); }
.pa-ctl output { font: 400 0.8rem var(--f-data); min-width: 3ch; }
.pa-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.pa-chart { --pa-label: 11rem; position: relative; display: grid; gap: 4px; }
.pa-chart .gx-label { width: var(--pa-label); }
.pa-row { display: grid; grid-template-columns: var(--pa-label) minmax(0, 1fr); align-items: center; min-height: 22px; }
.pa-axis { position: relative; height: 20px; margin-left: var(--pa-label); border-bottom: 1px solid var(--rule); }
.pa-axis span { position: absolute; bottom: 4px; transform: translateX(-50%); font: 400 0.62rem var(--f-data); color: var(--ink-2); }
.pa-bar { position: absolute; top: 1px; bottom: 1px; background: var(--t-quill); border-radius: 2px; }
.pa-now { position: absolute; top: 20px; bottom: 0; width: 0; border-left: 2px solid var(--ink); pointer-events: none; }

@media (max-width: 760px) {
  .gantt, .audit { --gx-label: 8.5rem; --gx-span: 0rem; }
  .gx-span { display: none; }
  .pa { grid-template-columns: minmax(0, 1fr); }
  .pa-chart { --pa-label: 8.5rem; }
  .spine { grid-template-columns: minmax(0, 1fr); }
}

.mw-grid { background: var(--sheet); gap: 0; }
.mw-cell { box-shadow: 0 0 0 0.5px var(--rule); }
.ms-pre .ms-n { color: var(--ink-2); }
.ms-pre .ms-name { cursor: default; }
.hg-grid { background: var(--sheet); gap: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.hg-card { box-shadow: 0 0 0 0.5px var(--rule); }
