/* AJO dataset lineage page. Scoped under .lineage; tokens follow site.css. */
.lineage {
  --bg: #f6f8fb; --surface: #ffffff; --fg: #0f172a; --muted: #475569; --line: #e2e8f0;
  --accent: #0d9488; --accent-soft: rgba(13, 148, 136, 0.1);
  --rec: #6a4c9e; --rec-soft: #ece6f6; --prof: #2d64a6; --prof-soft: #e2ebf6;
  --logic: #9a5f00; --logic-soft: #fbefd6; --risk: #b0365a; --risk-soft: #f8e2e9; --idc: #64748b;
  --display: var(--font); --body: var(--font);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  display: grid; gap: 3rem; padding-block: 2.5rem 4rem; color: var(--fg);
}
.lineage > * { min-width: 0; }
.lineage h2, .lineage h3, .lineage h4 { margin: 0; }
.lineage h1, .lineage h2, .lineage h3, .lineage h4 { font-family: var(--display); text-wrap: balance; line-height: 1.2; margin: 0; }
.lineage h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: -0.01em; }
.lineage h2 { font-size: 1.6rem; font-weight: 800; }
.lineage h3 { font-size: 1.15rem; font-weight: 600; }
.lineage h4 { font-size: 0.95rem; font-weight: 600; }
.lineage p { margin: 0; max-width: 70ch; }
.lineage ul, .lineage ol { margin: 0; padding-left: 1.2rem; }
.lineage li { max-width: 70ch; }
.lineage section { display: grid; gap: 1rem; }
.lineage a { color: var(--accent); }
.lineage .eyebrow { font: 600 0.75rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.lineage .lede { color: var(--muted); font-size: 1.08rem; }
.lineage code, .lineage pre { font-family: var(--mono); font-size: 0.84em; }
.lineage code { background: var(--accent-soft); padding: 0.05em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
.lineage nav.toc { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.92rem; }
.lineage .ln-stats { display: flex; flex-wrap: wrap; gap: 0.75rem 2.2rem; font-variant-numeric: tabular-nums; }
.lineage .ln-stats div { display: grid; }
.lineage .ln-stats b { font: 800 1.8rem/1.1 var(--display); }
.lineage .ln-stats span { color: var(--muted); font-size: 0.85rem; }
.lineage .legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; font-size: 0.86rem; color: var(--muted); align-items: center; }
.lineage .sw { display: inline-block; width: 30px; height: 0; border-top: 2.5px solid; vertical-align: middle; margin-right: 6px; }
.lineage .sw.doc { border-color: var(--accent); }
.lineage .sw.verified { border-color: var(--prof); border-top-width: 3px; }
.lineage .sw.logic { border-color: var(--logic); border-top-style: dashed; }
.lineage .sw.unproven { border-color: var(--risk); border-top-style: dotted; border-top-width: 3px; }
.lineage .sw.id { border-color: var(--idc); border-top-style: dotted; border-top-width: 2px; }
.lineage .box { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.lineage .pill { display: inline-block; font: 600 0.68rem/1.55 var(--mono); padding: 0 0.45rem; border-radius: 99px; white-space: nowrap; letter-spacing: 0.02em; }
.lineage .p-doc { background: var(--accent-soft); color: var(--accent); }
.lineage .p-logic { background: var(--logic-soft); color: var(--logic); }
.lineage .p-unproven { background: var(--risk-soft); color: var(--risk); }
.lineage .p-id { background: var(--line); color: var(--fg); }
.lineage .p-verified { background: var(--accent); color: var(--surface); }
.lineage .p-ev { background: var(--accent-soft); color: var(--accent); }
.lineage .p-rc { background: var(--rec-soft); color: var(--rec); }
.lineage .p-pf { background: var(--prof-soft); color: var(--prof); }
/* map */
.lineage .mapwrap { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) {.lineage .mapwrap { grid-template-columns: 1fr; }
 }
.lineage .map { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; position: relative; overflow: hidden; }
.lineage .toolbar { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.lineage .toolbar .sp { flex: 1; }
.lineage button { font: 600 0.8rem var(--body); background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.7rem; cursor: pointer; }
.lineage button:hover { border-color: var(--accent); }
.lineage button.primary { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.lineage button[aria-pressed="false"] { opacity: 0.5; text-decoration: line-through; }
.lineage button:focus-visible, .lineage summary:focus-visible, .lineage .ent:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lineage #erd { display: block; width: 100%; height: min(80vh, 860px); min-height: 440px; touch-action: none; cursor: grab; color: var(--fg); }
.lineage #erd.dragging { cursor: grabbing; }
.lineage .hint { position: absolute; left: 0.75rem; bottom: 0.6rem; font-size: 0.75rem; color: var(--muted); background: var(--surface); padding: 0.1rem 0.4rem; border-radius: 4px; pointer-events: none; }
.lineage .lane-t { fill: var(--muted); font: 600 13px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.lineage .lane-bg { fill: var(--bg); }
.lineage .e-box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.lineage .ent.hub .e-box { stroke-dasharray: 6 4; stroke: var(--idc); }
.lineage .e-head { fill: var(--accent); }
.lineage .ent.k-record .e-head { fill: var(--rec); }
.lineage .ent.k-profile .e-head { fill: var(--prof); }
.lineage .ent.k-summary .e-head { fill: var(--logic); }
.lineage .ent.hub .e-head { fill: var(--idc); }
.lineage .e-title { fill: var(--surface); font: 600 13px var(--display); }
.lineage .e-kind { fill: var(--surface); font: 400 9.5px var(--mono); opacity: 0.9; }
.lineage .e-row { fill: var(--fg); font: 400 11.5px var(--mono); }
.lineage .e-tag { fill: var(--accent); font: 600 9.5px var(--mono); }
.lineage .ent { cursor: pointer; transition: opacity .15s; }
.lineage .ent.sel .e-box { stroke: var(--fg); stroke-width: 2.5; }
.lineage .edge { transition: opacity .15s; }
.lineage .edge .line { fill: none; stroke-width: 1.8; }
.lineage .edge .hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.lineage .ev-doc .line { stroke: var(--accent); stroke-width: 2.4; }
.lineage .ev-verified .line { stroke: var(--prof); stroke-width: 2.4; }
.lineage .ev-logic .line { stroke: var(--logic); stroke-dasharray: 7 5; }
.lineage .ev-unproven .line { stroke: var(--risk); stroke-dasharray: 2 5; stroke-width: 2.2; }
.lineage .ev-id .line { stroke: var(--idc); stroke-dasharray: 1.5 4; stroke-width: 1.4; opacity: 0.8; }
.lineage .elabel { display: none; font: 600 11px var(--body); fill: var(--fg); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.lineage .edge.on .elabel { display: block; }
.lineage .edge.on .line { stroke-width: 3.2; }
.lineage #erd.focus .ent:not(.sel):not(.nb) { opacity: 0.22; }
.lineage #erd.focus .edge:not(.on) { opacity: 0.06; }
.lineage #erd.hide-doc .ev-doc, .lineage #erd.hide-verified .ev-verified, .lineage #erd.hide-logic .ev-logic, .lineage #erd.hide-unproven .ev-unproven, .lineage #erd.hide-id .ev-id { display: none; }
.lineage .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; display: grid; gap: 0.7rem; font-size: 0.9rem;  }
.lineage .panel > * { min-width: 0; }
.lineage .panel h3 { font-size: 1.05rem; }
.lineage .panel ul { display: grid; gap: 0.35rem; }
.lineage .panel .jl button { all: unset; cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.lineage .muted { color: var(--muted); }
/* lifecycle */
.lineage .steps { list-style: none; padding: 0; display: grid; gap: 0.75rem; counter-reset: s; }
.lineage .steps li { counter-increment: s; display: grid; grid-template-columns: 2.2rem 1fr; gap: 0.75rem; max-width: none; }
.lineage .steps li::before { content: counter(s); font: 800 1.1rem/2.2rem var(--display); text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: 50%; width: 2.2rem; height: 2.2rem; }
.lineage .steps p { max-width: 75ch; }
/* cards */
.lineage .lane-h { margin-top: 1rem; display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.lineage .cards { display: grid; gap: 1rem; }
.lineage .ln-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; display: grid; gap: 0.85rem; scroll-margin-top: 1rem; }
.lineage .ln-card.flash { box-shadow: 0 0 0 3px var(--accent); }
.lineage .ln-card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.75rem; }
.lineage .ln-card header code { font-size: 0.78rem; }
.lineage .cgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 0.9rem 1.5rem; }
.lineage .cgrid > div { min-width: 0; display: grid; gap: 0.3rem; align-content: start; }
.lineage .cgrid h4 { color: var(--muted); font: 600 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.lineage .cgrid p, .lineage .cgrid li { font-size: 0.92rem; }
.lineage .cgrid ul { display: grid; gap: 0.3rem; }
.lineage .joins li { list-style: none; margin-left: -1.2rem; }
.lineage .ev-note { font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 0.6rem; }
/* tables and code */
.lineage .tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.lineage table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.lineage th, .lineage td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.lineage th { font: 600 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
.lineage tr:last-child td { border-bottom: 0; }
.lineage td code { background: none; padding: 0; }
.lineage details.q { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.lineage details.q summary { cursor: pointer; padding: 0.8rem 1rem; display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; align-items: baseline; }
.lineage details.q summary h3 { display: inline; font-size: 1rem; }
.lineage .qbody { padding: 0 1rem 1rem; display: grid; gap: 0.6rem; }
.lineage .qbody > * { min-width: 0; }
.lineage .qbody p { font-size: 0.92rem; }
.lineage .codehead { display: flex; justify-content: flex-end; }
.lineage pre { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.8rem 1rem; overflow-x: auto; line-height: 1.5; }
.lineage .callout { background: var(--logic-soft); border-radius: 10px; padding: 0.9rem 1.1rem; display: grid; gap: 0.4rem; max-width: 80ch; }
.lineage .callout b { color: var(--logic); }
.lineage .src li { font-size: 0.88rem; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) {.lineage * { transition: none !important; }
 }

.lineage section, .lineage .ln-card, .lineage details.q { scroll-margin-top: calc(var(--header-h) + 1rem); }
