/* AI Atlas - the stack view. Loaded after atlas.css, whose tokens, header, cards and table it reuses. */

:root {
  /* One colour per band, fixed order: Atoms, Bits, People. The layer is shown by position and label, never by colour. */
  --band-atoms: #2a78d6;
  --band-bits: #eb6834;
  --band-people: #1baf7a;
  --muted: #898781;
}
@media (prefers-color-scheme: dark) {
  :root { --band-atoms: #3987e5; --band-bits: #d95926; --band-people: #199e70; }
}

.intro .rule-note { margin-top: 10px; color: var(--text); border-left: 3px solid var(--text); padding-left: 10px; }
.jump { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 0 2px; font-size: 14px; }

.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 22px; padding: 14px 0 0; margin-top: 12px; border-top: 1px solid var(--grid); }
.controls legend.field-label { margin-bottom: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13.5px; color: var(--text); background: var(--surface); cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; height: 32px; padding: 0 10px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .n { opacity: 0.7; margin-left: 4px; }
.period-inputs { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
input[type="month"] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; height: 34px; padding: 0 8px; max-width: 150px; }

/* ---------- Chart ---------- */
.stack-wrap { display: flex; align-items: flex-start; min-width: 0; }
.layer-labels { flex: none; width: 250px; }
@media (min-width: 1700px) { .layer-labels { width: 330px; } }
.stack-wrap.tilted .layer-labels { display: none; }
.layer-label { box-sizing: border-box; padding: 5px 10px 0 12px; border-left: 5px solid var(--band); border-top: 1px solid var(--grid); overflow: hidden; line-height: 1.25; }
.layer-label.band-start { border-top: 1px solid var(--border); }
.layer-label .nm { font-weight: 650; font-size: 13.5px; }
.layer-label .nm .no { color: var(--text-2); font-weight: 400; font-variant-numeric: tabular-nums; margin-right: 5px; }
.layer-label .nm .bd { float: right; font-weight: 400; font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.layer-label .tn, .layer-label .ck { font-size: 11.5px; color: var(--text-2); }
.layer-label .tn, .layer-label .ck { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.axis-spacer { font-size: 11px; color: var(--text-2); padding: 8px 10px 0 17px; }
.stack-wrap .chart-scroll { flex: 1 1 auto; min-width: 0; }
#chart { display: block; width: auto; height: auto; max-width: none; touch-action: pan-x pan-y; }
#chart.grab { cursor: grab; }
#chart.pointing { cursor: pointer; }

.lane-bg { fill: var(--surface-2); opacity: 0.55; }
.lane-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.lane-line.band { stroke: var(--border); }
.year-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.year-line.break { stroke: var(--border); stroke-dasharray: 3 3; }
.year-tick { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; text-anchor: middle; }
.axis-note { fill: var(--text-2); font-size: 10.5px; }
.rug { stroke: var(--text-2); stroke-width: 1; opacity: 0.28; shape-rendering: crispEdges; }
.period { fill: var(--text); opacity: 0.07; }
.period-edge { stroke: var(--text); stroke-width: 1; opacity: 0.5; shape-rendering: crispEdges; }
.floor { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; }
.floor-band { stroke-width: 3; fill: none; }
.floor-name { fill: var(--text); font-size: 12px; font-weight: 650; text-anchor: end; }
.floor-sub { fill: var(--text-2); font-size: 10.5px; text-anchor: end; }
.region-name { fill: var(--text-2); font-size: 11px; }
.region-line { stroke: var(--grid); stroke-width: 1; }

.mark { stroke: var(--surface); stroke-width: 2; transition: opacity 120ms linear; }
.mark.hollow { fill: var(--surface); stroke-width: 2.25; }
#chart.focused .mark { opacity: 0.38; }
#chart.focused .mark.on { opacity: 1; }
.mark-ring { fill: none; stroke: var(--text); stroke-width: 2; pointer-events: none; }
.mark-ring.thread { stroke-width: 1.5; stroke-dasharray: 2.5 2.5; }
.mark-ring.kb { stroke-width: 1.5; stroke-dasharray: 1 2; }
.link { fill: none; stroke: var(--edge); stroke-width: 1.25; opacity: 0.5; pointer-events: none; stroke-linecap: round; }
.link.direct { stroke-width: 2; opacity: 0.9; }
.mark-label { font-size: 11.5px; fill: var(--text); pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round; }
.mark-label.strong { font-weight: 650; }
@media (prefers-reduced-motion: reduce) { .mark { transition: none; } }

.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { flex: none; }

/* ---------- Panel ---------- */
.detail-card .kicker { font-size: 12px; color: var(--text-2); margin: 0 0 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.band-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--band); flex: none; }
.detail-card .lead { margin: 0 0 10px; }
.detail-card .why { border-left: 3px solid var(--border); padding-left: 10px; color: var(--text); }
.detail-card h3 .n { color: var(--text-2); font-weight: 400; }
.detail-card h3 small { display: block; font-weight: 400; color: var(--text-2); font-size: 12px; }
.detail-card blockquote { margin: 4px 0 4px; padding: 0 0 0 10px; border-left: 2px solid var(--border); color: var(--text-2); font-size: 13px; }
.detail-card .src { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.detail-card .stmt { margin: 2px 0 0; font-size: 13.5px; }
.reading { border: 1px dashed var(--text-2); border-radius: 6px; padding: 8px 10px; margin: 0 0 8px; }
.reading .tag { font-weight: 650; }
.reading p { margin: 2px 0 0; font-size: 13.5px; }
.reading-note { font-size: 12.5px; color: var(--text-2); margin: 0 0 8px; }
.indirect { font-size: 13px; color: var(--text-2); margin: 6px 0 0; }
.indirect .link-btn { font-weight: 400; }
.tagline { display: inline-block; border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-size: 11.5px; color: var(--text-2); margin-left: 6px; white-space: nowrap; }
.period-layer { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 2px 10px; padding: 7px 0; border-top: 1px solid var(--grid); }
.period-layer:first-of-type { border-top: 0; }
.period-layer .pl-name { font-size: 12.5px; font-weight: 650; }
.period-layer .pl-none { color: var(--text-2); font-size: 13px; }
.period-layer ul { list-style: none; margin: 0; padding: 0; }
.period-layer li { margin: 0 0 4px; font-size: 13.5px; }
.period-layer li .d { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; margin-right: 6px; white-space: nowrap; }

.table-filters { padding: 0 0 12px; }
td .th-tag { display: inline-block; border: 1px dashed var(--text-2); border-radius: 4px; padding: 0 5px; font-size: 12px; margin: 0 4px 2px 0; white-space: nowrap; }
td.src a { white-space: nowrap; }
.foot-note p { margin: 0 0 6px; }
#attribution ul { margin: 0; padding-left: 18px; }

@media (max-width: 760px) {
  .view-field { display: none; }
  .layer-labels { width: 96px; }
  .layer-label { padding: 4px 4px 0 6px; }
  .layer-label .nm { font-size: 12px; }
  .layer-label .nm .bd, .layer-label .tn { display: none; }
  .layer-label .ck { font-size: 10.5px; }
  .axis-spacer { padding-left: 11px; }
  .period-layer { grid-template-columns: 78px minmax(0, 1fr); }
}

.detail-card .conn-head { flex-wrap: nowrap; align-items: baseline; }
.detail-card .conn-head .band-dot { align-self: center; }
.detail-card .conn-list .conn-meta { display: block; margin: 1px 0 0 17px; }

.stack-intro { max-width: none; padding: 22px 0 4px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 32px; }
.stack-intro h1 { grid-column: 1 / -1; }
.stack-intro p { max-width: 76ch; }
@media (min-width: 1100px) { .stack-intro { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; } .intro.stack-intro .rule-note { margin-top: 2px; } }
.jump { padding: 6px 0 2px; }
.status { margin: 8px 0 10px; }

/* ---------- Opening a layer ---------- */
button.layer-label { display: block; width: 100%; text-align: left; font: inherit; line-height: 1.22; padding-top: 4px; vertical-align: top; color: inherit; background: none; border: 0; border-left: 5px solid var(--band); border-top: 1px solid var(--grid); cursor: pointer; }
button.layer-label.band-start { border-top: 1px solid var(--border); }
button.layer-label:hover, button.layer-label:focus-visible { background: var(--surface-2); }
button.layer-label .nm .bd { text-transform: none; letter-spacing: 0; text-decoration: underline; text-underline-offset: 2px; }
.lv-back-row { margin: 0 0 10px; }
#lv-title { font-size: 20px; }
.thin-note { border-left: 3px solid var(--text-2); padding-left: 10px; color: var(--text); }
.lv-controls { border-top: 0; margin-top: 0; padding: 4px 0 12px; }
.lv-wrap { align-items: flex-start; border-top: 1px solid var(--border); }
.lv-labels { flex: none; width: 210px; }
.lv-canvas-wrap { flex: 1 1 0; width: 0; min-width: 0; overflow: hidden; }
#lv-canvas { display: block; touch-action: pan-y; cursor: grab; }
.lv-strip { display: block; width: 100%; box-sizing: border-box; text-align: left; font: inherit; font-size: 11.5px; line-height: 1; color: var(--text-2); background: none; border: 0; border-left: 5px solid var(--band); border-top: 1px solid var(--grid); padding: 0 6px 0 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-strip:first-child { border-top: 0; margin-top: 2px; }
.lv-strip:hover, .lv-strip:focus-visible { color: var(--text); background: var(--surface-2); text-decoration: underline; }
.lv-strip .no { font-variant-numeric: tabular-nums; margin-right: 5px; }
.lv-open { box-sizing: border-box; border-left: 5px solid var(--band); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lv-lane { box-sizing: border-box; padding: 4px 6px 0 10px; border-top: 1px solid var(--grid); overflow: hidden; line-height: 1.25; }
.lv-lane:first-child { border-top: 0; }
.lv-lane .nm { font-size: 12.5px; font-weight: 650; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lv-lane .ct { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-axis-spacer { box-sizing: border-box; font-size: 11px; color: var(--text-2); padding: 8px 6px 0 15px; }
.lv-hint { margin-top: 6px; }
.tier-ic { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 4px; flex: none; box-sizing: border-box; --band: var(--text-2); }
.tier-landmark { border-radius: 50%; background: var(--band); border: 2px solid var(--text); }
.tier-notable { width: 9px; height: 9px; margin: 0 6px 0 2px; background: var(--band); transform: rotate(45deg); }
.tier-catalogue { width: 6px; height: 6px; margin: 0 7px 0 3px; border-radius: 50%; background: var(--text-2); vertical-align: 1px; }
.tier-ic.unv { background: var(--surface); border: 1.5px dashed var(--band); }
.tagline.unv { border-style: dashed; border-color: var(--text); color: var(--text); font-weight: 600; white-space: normal; }
.unverified-note { border: 1.5px dashed var(--text); border-radius: 6px; padding: 8px 10px; margin: 0 0 10px; font-size: 13.5px; }
.mark.unverified { stroke-dasharray: 2.5 2; }
.link.unverified { stroke-dasharray: 5 4; }
.lv-h3 { font-size: 14px; margin: 18px 0 8px; }
.lv-series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.lv-fig { margin: 0; border: 1px solid var(--grid); border-radius: 6px; padding: 10px; min-width: 0; }
.lv-fig figcaption { font-size: 13px; margin-bottom: 4px; }
.lv-fig figcaption .u { color: var(--text-2); }
.lv-chart { display: block; width: 100%; height: auto; touch-action: pan-y; }
.lv-read { margin: 2px 0 4px; font-size: 12.5px; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.lv-credit { margin: 4px 0 0; font-size: 11.5px; color: var(--text-2); overflow-wrap: anywhere; }
#lv-credits { margin-top: 14px; max-width: none; font-size: 12.5px; color: var(--text-2); }
#lv-credits ul { margin: 0; padding-left: 18px; }
.detail-card dl.facts dt .tier-ic { margin-right: 2px; }
@media (max-width: 760px) {
  .lv-labels { width: 104px; }
  .lv-lane { padding: 3px 4px 0 6px; }
  .lv-lane .nm { font-size: 11.5px; }
  .lv-strip { padding-left: 6px; font-size: 11px; }
  button.layer-label .nm .bd { display: inline; float: none; display: block; font-size: 10.5px; }
  button.layer-label .ck { display: none; }
}

body.layer-open #chart-title, body.layer-open #chart-sub { display: none; }

.mark-ring.org { stroke-width: 1.5; }
