/* ablations widget styles: #tb-ablations and #tb-comparison. Prefixes: .tbab- (ablations), .tbcm- (comparison). */

/* ================================ #tb-ablations ================================ */
#tb-ablations .figure__head { align-items: flex-start; }
#tb-ablations .tbab-tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
#tb-ablations .tbab-tabs::-webkit-scrollbar { display: none; }
#tb-ablations .tbab-tabs.has-more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
#tb-ablations .tbab-tabs.has-more-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
#tb-ablations .tbab-tabs.has-more-l.has-more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
#tb-ablations .tbab-tabs button { white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; flex: none; }
#tb-ablations .tbab-tabnum { font-size: 0.72rem; color: var(--faint); font-weight: 600; }
#tb-ablations .tbab-tabs button[aria-selected="true"] .tbab-tabnum { color: var(--ours); }
@media (max-width: 700px) { #tb-ablations .figure__head > .tbab-tabs { width: 100%; } }

.tbab-stage { overflow: hidden; }
.tbab-panel { outline: none; }
.tbab-panel:focus-visible { outline: 2px solid var(--ours); outline-offset: 4px; border-radius: 6px; }
.tbab-panel__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 18px; }
.tbab-takeaway { font-size: clamp(1.12rem, 2vw, 1.36rem); }
.tbab-panel.is-on .tbab-takeaway { animation: tbab-in .5s cubic-bezier(.2,.7,.2,1) both; }
.tbab-sentence { margin: 18px 0 0; color: var(--ink-2); font-size: 0.95rem; max-width: 80ch; }
.tbab-foot { margin: 12px 0 0; }
.tbab-readout { margin-top: 18px; }
.tbab-readout .readout__value { font-size: 1.12rem; }
@keyframes tbab-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- multi-metric bar chart ---- */
.tbab-mm { container-type: inline-size; --label: minmax(170px, 1.25fr); }
.tbab-mm__head, .tbab-mm__row { display: grid; grid-template-columns: var(--label) repeat(var(--cols), minmax(0, 1fr)); gap: 0 22px; align-items: center; }
.tbab-mm--single .tbab-mm__head, .tbab-mm--single .tbab-mm__row { grid-template-columns: minmax(200px, 1fr) minmax(0, 2.2fr); }
.tbab-mm__head { padding: 0 0 6px; border-bottom: 1px solid var(--rule-2); }
.tbab-mm__metric { font: 600 0.74rem/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tbab-mm__metric small { font-weight: 500; letter-spacing: .02em; text-transform: none; margin-left: 5px; color: var(--faint); font-size: 0.74rem; }
.tbab-mm__group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 16px 0 6px; }
.tbab-mm__group--flush { padding-top: 0; }
.tbab-mm__head + .tbab-mm__group { padding-top: 12px; }
.tbab-mm__gtitle { font: 600 0.86rem/1.3 var(--sans); color: var(--ink); }
.tbab-cohort { font-weight: 600; }
.tbab-mm__row { padding: 7px 0; border-bottom: 1px solid var(--rule); min-height: 46px; }
.tbab-mm__row.tone-ours { background: linear-gradient(to right, var(--ours-soft), transparent 70%); border-radius: 6px; }
.tbab-mm__label { display: flex; flex-direction: column; font-size: 0.9rem; line-height: 1.25; padding-left: 8px; color: var(--ink); }
.tbab-mm__row.tone-ours .tbab-mm__label { font-weight: 650; }
.tbab-mm__label small { font-size: 0.78rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.tbab-mm__cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tbab-track { position: relative; flex: 1; height: 20px; border-radius: 4px; background: var(--surface-2); min-width: 40px; }
.tbab-zero { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--rule-2); margin-left: -0.5px; z-index: 1; }
.tbab-fill { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; background: var(--neutral); transform: scaleX(0);
  transition: transform .65s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 55ms); }
.tbab-fill.fill-ours { background: var(--ours); }
.tbab-fill.fill-bad { background: var(--bad); }
.tbab-panel.is-on .tbab-fill { transform: scaleX(1); }
.tbab-fill.is-broken { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tbab-break { position: absolute; left: 10px; top: -4px; bottom: -4px; width: 5px; background: var(--surface); transform: skewX(-22deg);
  border-left: 1px solid var(--bad); border-right: 1px solid var(--bad); }
.tbab-val { flex: none; width: 50px; text-align: left; font-size: 0.86rem; font-weight: 600; color: var(--ink-2);
  opacity: 0; transition: opacity .4s ease; transition-delay: calc(var(--i, 0) * 55ms + 250ms); }
.tbab-panel.is-on .tbab-val { opacity: 1; }
.tbab-mm__row.tone-ours .tbab-val { color: var(--ours-ink); }
.tbab-val.c-bad { color: var(--bad); }
.tbab-val.is-short { color: var(--bad); }

/* accuracy-guard dots: two rows, filled = passes, hollow red = fails */
.tbab-mm__cell--guard { gap: 10px; }
.tbab-gdots { display: grid; grid-template-columns: repeat(var(--gc), 7px); gap: 3px; flex: none; }
.tbab-gdot { width: 7px; height: 7px; border-radius: 50%; transform: scale(0); transition: transform .3s cubic-bezier(.3,1.4,.5,1);
  transition-delay: calc(var(--i, 0) * 55ms + var(--k) * 14ms + 150ms); }
.tbab-gdot.is-pass { background: var(--good); }
.tbab-gdot.is-fail { box-shadow: inset 0 0 0 1.5px var(--bad); }
.tbab-mm__row.tone-ours .tbab-gdot.is-pass { background: var(--good); }
.tbab-panel.is-on .tbab-gdot { transform: scale(1); }
.tbab-mm__cell--guard .tbab-val { width: auto; min-width: 40px; text-align: left; }

/* narrow container: label on its own line, metrics in a two-column grid with their own captions */
@container (max-width: 620px) {
  .tbab-mm__head { display: none; }
  .tbab-mm__row, .tbab-mm--single .tbab-mm__row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; padding: 9px 0 10px; }
  .tbab-mm--single .tbab-mm__row { grid-template-columns: minmax(0, 1fr); }
  .tbab-mm__label { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding-left: 6px; }
  .tbab-mm__label small { margin-top: 0; }
  .tbab-mm__cell { flex-wrap: wrap; gap: 2px 8px; padding-left: 6px; }
  .tbab-mm__cell::before { content: attr(data-label); flex: 0 0 100%; font: 600 0.72rem/1.3 var(--sans); color: var(--muted); letter-spacing: .03em; }
  .tbab-mm--single .tbab-mm__cell::before { display: none; }
  .tbab-val { width: 50px; }
  .tbab-mm__cell--guard:nth-child(even) { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .tbab-readout { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .tbab-readout .readout__item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 12px; }
  .tbab-readout .readout__value { font-size: 1rem; margin: 0; text-align: right; white-space: nowrap; }
}

/* ---- uniform vs weighted ---- */
.tbab-uw { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(18px, 3vw, 36px); align-items: stretch; }
.tbab-uw__schem, .tbab-uw__res { border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 16px 18px; background: var(--surface); }
.tbab-uw__res { background: var(--surface-2); }
.tbab-uw__cap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; font: 600 0.78rem/1.3 var(--sans); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 12px; }
.tbab-uw__cap .chip { text-transform: none; letter-spacing: 0; }
.tbab-strip { margin-bottom: 14px; }
.tbab-strip__name { font-size: 0.88rem; color: var(--ink-2); margin-bottom: 6px; line-height: 1.35; }
.tbab-strip__name b { font-weight: 650; }
.tbab-strip__bars { display: flex; align-items: flex-end; gap: 2px; height: 58px; border-bottom: 1px solid var(--rule-2); }
.tbab-sbar { flex: 1; border-radius: 2px 2px 0 0; transform: scaleY(0); transform-origin: bottom; transition: transform .5s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--k) * 14ms); }
.tbab-sbar.is-uniform { background: var(--ours); }
.tbab-sbar.is-weighted { background: var(--neutral); }
.tbab-panel.is-on .tbab-sbar { transform: scaleY(1); }
.tbab-strip__axis { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-top: -6px; }
.tbab-cdots { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 8px; }
.tbab-cdot { width: 20px; height: 20px; border-radius: 50%; background: var(--ours); position: relative; transform: scale(0);
  transition: transform .35s cubic-bezier(.3,1.5,.5,1); transition-delay: calc(var(--k) * 45ms + 200ms); }
.tbab-cdot::after { content: ""; position: absolute; left: 7px; top: 4px; width: 5px; height: 9px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tbab-panel.is-on .tbab-cdot { transform: scale(1); }
.tbab-uw__dotcap { margin: 0 0 16px; }
.tbab-uw__stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; border-top: 1px solid var(--rule); padding-top: 14px; }
.tbab-uw__stats .stat__value { font-size: clamp(1.7rem, 3vw, 2.2rem); }
@media (max-width: 760px) { .tbab-uw { grid-template-columns: minmax(0, 1fr); } }

/* ---- towers + construction images ---- */
.tbab-towers { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; }
.tbab-line__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 18px; margin-bottom: 6px; }
.tbab-lg-solid { background: var(--ours) !important; }
.tbab-lg-dash { background: repeating-linear-gradient(to right, var(--ours) 0 5px, transparent 5px 8px) !important; }
.tbab-line { width: 100%; }
.tbab-line__svg { overflow: visible; }
.tbab-line .tbab-grid { stroke: var(--rule); stroke-width: 1; }
.tbab-line .tbab-axis { stroke: var(--rule-2); stroke-width: 1; }
.tbab-line .tbab-tick { fill: var(--muted); font: 500 12px var(--mono); }
.tbab-line .tbab-tick.is-default { fill: var(--ours-ink); font-weight: 700; }
.tbab-line .tbab-axlabel { fill: var(--muted); font: 500 12px var(--sans); }
.tbab-line .tbab-default { stroke: var(--ours); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.tbab-line .tbab-note-txt { fill: var(--ours-ink); font: 600 12px var(--sans); }
.tbab-line .tbab-series { fill: none; stroke: var(--ours); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.tbab-line .tbab-series.is-dash { stroke-dasharray: 6 5; stroke-width: 2; }
.tbab-line .tbab-pt { stroke: var(--ours); stroke-width: 2; fill: var(--ours); cursor: default; outline: none; }
.tbab-line .tbab-pt.is-dash { fill: var(--surface); }
.tbab-line .tbab-pt:hover, .tbab-line .tbab-pt:focus-visible { stroke-width: 4; }
.tbab-line .tbab-ptval { font: 600 12px var(--mono); fill: var(--ours-ink); }
.tbab-line .tbab-ptval.is-dash { fill: var(--muted); font-weight: 500; }

/* reduced motion: final state, no transitions */
.tbab-static .tbab-fill, .tbab-static .tbab-val, .tbab-static .tbab-gdot, .tbab-static .tbab-sbar, .tbab-static .tbab-cdot { transition: none !important; }
.tbab-static .tbab-takeaway { animation: none !important; }

/* ================================ #tb-comparison ================================ */
#tb-comparison .tbcm-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.tbcm-main { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(220px, 1fr); gap: clamp(18px, 3vw, 36px); align-items: start; }
.tbcm-chart { min-width: 0; container-type: inline-size; }
.tbcm-list { position: relative; }
.tbcm-row { display: grid; grid-template-columns: minmax(150px, 1.05fr) minmax(170px, 1.2fr) minmax(0, 2.4fr); gap: 0 18px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--rule); min-height: 42px; background: var(--surface); position: relative; border-radius: 4px; }
.tbcm-row:focus-visible { outline: 2px solid var(--ours); outline-offset: -2px; }
.tbcm-row:hover { background: var(--surface-2); }
.tbcm-row--head { min-height: 0; padding-bottom: 8px; border-bottom: 1px solid var(--rule-2); font: 600 0.74rem/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tbcm-row--head:hover { background: var(--surface); }
.tbcm-row--axis { border-bottom: 0; min-height: 26px; padding-top: 2px; }
.tbcm-row--axis:hover { background: transparent; }
.tbcm-row.kind-ours { background: linear-gradient(to right, var(--ours-soft), var(--surface) 75%); }
.tbcm-group { padding: 14px 4px 4px; font: 600 0.8rem/1.3 var(--sans); color: var(--ink-2); }
.tbcm-list.is-sorted .tbcm-group { display: none; }
.tbcm-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.92rem; font-weight: 600; }
.tbcm-row.kind-ours .tbcm-name, .tbcm-row.kind-combined .tbcm-name { color: var(--ours-ink); }
.tbcm-needs { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 0.85rem; color: var(--muted); line-height: 1.3; }
.tbcm-tag { display: none; font-size: 0.7rem; padding: 2px 8px; background: var(--neutral-soft); color: var(--ink-2); }
.tbcm-tag.is-on { display: inline-flex; animation: tbab-in .35s ease both; }
.tbcm-tag--legend { display: inline-flex; }
.tbcm-barcell { min-width: 0; }
.tbcm-plot { position: relative; display: block; height: 22px; margin-right: 52px; }
.tbcm-ticks i { position: absolute; top: -8px; bottom: -8px; width: 1px; background: var(--rule); opacity: .8; }
.tbcm-plot::before { content: ""; position: absolute; left: 0; top: -8px; bottom: -8px; width: 1px; background: var(--rule-2); }
.tbcm-fill { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 0 4px 4px 0; background: var(--neutral); width: 0;
  transform: scaleX(0); transform-origin: left center; transition: width .55s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.tbcm-fill.kind-ours { background: var(--ours); }
.tbcm-fill.kind-combined { background: var(--ours-soft); box-shadow: inset 0 0 0 2px var(--ours); }
.tbcm-list.is-on .tbcm-fill { transform: scaleX(1); }
.tbcm-val { position: absolute; top: 50%; transform: translate(7px, -50%); font-size: 0.84rem; font-weight: 600; color: var(--ink-2); white-space: nowrap;
  transition: left .55s cubic-bezier(.2,.7,.2,1), opacity .4s ease .35s; opacity: 0; }
.tbcm-list.is-on .tbcm-val { opacity: 1; }
.tbcm-row.kind-ours .tbcm-val, .tbcm-row.kind-combined .tbcm-val { color: var(--ours-ink); }
.tbcm-axis { height: 18px; }
.tbcm-axis::before { display: none; }
.tbcm-axis span { position: absolute; top: 2px; transform: translateX(-50%); font-size: 0.75rem; color: var(--muted); }
.tbcm-legend { margin-top: 12px; }
.tbcm-lg { width: 14px !important; height: 12px !important; border-radius: 3px; background: var(--neutral) !important; }
.tbcm-lg.kind-ours { background: var(--ours) !important; }
.tbcm-lg.kind-combined { background: var(--ours-soft) !important; box-shadow: inset 0 0 0 2px var(--ours); }
.tbcm-says { border-left: 3px solid var(--ours); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 14px 16px; font-size: 0.92rem; color: var(--ink-2); }
.tbcm-says p { margin: 0 0 10px; line-height: 1.5; }
.tbcm-says p:last-child { margin: 0; }
.tbcm-says b { font-weight: 650; }
.tbcm-grid { margin-top: clamp(22px, 3vw, 32px); padding-top: clamp(18px, 2.5vw, 24px); border-top: 1px solid var(--rule); }
.tbcm-grid__title { font-size: 1.05rem; margin-bottom: 10px; }
.tbcm-table th[scope="row"] { font: 500 0.9rem/1.3 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink); border-bottom: 1px solid var(--rule); padding: 9px 10px; }
.tbcm-table thead th small { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 0.75rem; color: var(--faint); margin-top: 2px; }
.tbcm-table thead th.tbcm-th-ours { color: var(--ours-ink); }
.tbcm-table td:nth-child(2) { background: color-mix(in srgb, var(--ours-soft) 55%, transparent); }
.tbcm-table td { white-space: nowrap; }
.tbcm-table .chip { min-width: 38px; justify-content: center; }
.tbcm-sub { margin-left: 8px; font-size: 0.78rem; color: var(--muted); }
.tbcm-na { color: var(--faint); padding-left: 22px !important; }
.tbcm-grid__foot { margin: 8px 0 0; }

@media (max-width: 900px) { .tbcm-main { grid-template-columns: minmax(0, 1fr); } }
@container (max-width: 600px) {
  .tbcm-row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 9px 4px 10px; }
  .tbcm-row--head { display: none; }
  .tbcm-row--axis { grid-template-columns: minmax(0, 1fr); }
  .tbcm-row--axis > span:not(.tbcm-barcell) { display: none; }
  .tbcm-needs { font-size: 0.8rem; margin-bottom: 4px; }
}
@media (max-width: 520px) {
  .tbcm-table th, .tbcm-table td { padding: 8px 6px; }
  .tbcm-table thead th { text-transform: none; letter-spacing: 0; font-size: 0.78rem; vertical-align: bottom; }
  .tbcm-table td { white-space: normal; }
  .tbcm-table { table-layout: fixed; }
  .tbcm-table thead th:first-child { width: 34%; }
  .tbcm-table thead th { padding: 8px 4px; font-size: 0.74rem; hyphens: auto; }
  .tbcm-table td { padding: 8px 4px; }
  .tbcm-table .chip { min-width: 34px; padding: 4px 8px; }
  .tbcm-table th[scope="row"] { font-size: 0.82rem; white-space: normal; padding: 8px 4px; hyphens: auto; overflow-wrap: anywhere; }
  .tbcm-sub { display: block; margin: 3px 0 0; }
  .tbcm-na { padding-left: 14px !important; }
}
.tbcm-static .tbcm-fill, .tbcm-static .tbcm-val { transition: none !important; }
