/* Who's Really Building AI: report-specific layer on top of the portal kit.
   Uses only kit tokens (colours, type, space). No new hex values except the image scrim. */

.skip { position: absolute; left: -999px; top: 0; z-index: 50; background: var(--surface); color: var(--ink); padding: var(--s-2) var(--s-3); }
.skip:focus { left: var(--s-3); top: var(--s-3); }

/* ---------- masthead with art ---------- */
.ahi-mast { position: relative; overflow: hidden; isolation: isolate; }
.ahi-mast-art { position: absolute; inset: 0; z-index: -2; }
.ahi-mast-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; display: block; }
.ahi-mast::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--band) 0%, color-mix(in srgb, var(--band) 88%, transparent) 42%, color-mix(in srgb, var(--band) 35%, transparent) 100%),
              linear-gradient(0deg, var(--band) 0%, transparent 45%);
}
.ahi-mast-inner { position: relative; }
.ahi-mast h1 { max-width: 22ch; }
.ahi-mast h1 em { font-style: normal; color: var(--on-band-accent); white-space: nowrap; }
.ahi-mast .lede { max-width: 58ch; color: var(--on-band-2); }
@media (max-width: 40rem) {
  .ahi-mast::before { background: linear-gradient(0deg, var(--band) 30%, color-mix(in srgb, var(--band) 72%, transparent) 100%); }
}

/* ---------- image plates and banners ---------- */
.ahi-plate { display: grid; gap: var(--s-6); align-items: center; grid-template-columns: 1fr; }
.ahi-plate > img { width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); display: block; background: var(--surface-2); }
@media (min-width: 60rem) {
  .ahi-plate { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .ahi-plate--rev { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); }
  .ahi-plate--rev > img { align-self: start; position: sticky; top: 4.5rem; }
}
.ahi-plate-text h3 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -0.01em; }
.ahi-banner { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 21 / 6; background: var(--surface-2); }
.ahi-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ahi-banner--short img { object-position: 50% 60%; }
@media (max-width: 40rem) { .ahi-banner { aspect-ratio: 16 / 7; } }

/* ---------- form controls ---------- */
.ahi-field { display: grid; gap: var(--s-1); font-size: var(--fs-small); color: var(--ink-2); font-weight: 550; min-width: 0; }
.ahi-field input, .ahi-field select {
  font: inherit; font-weight: 400; font-size: var(--fs-body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); padding: 0.55rem 0.7rem; width: 100%; min-width: 0;
}
.ahi-field input:focus-visible, .ahi-field select:focus-visible, .ahi-check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.ahi-check { display: inline-flex; gap: var(--s-2); align-items: center; font-size: var(--fs-small); color: var(--ink-2); }
.ahi-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule-strong); border-radius: 999px; padding: 3px; gap: 2px; background: var(--surface-2); justify-self: start; }
.ahi-seg button { font: inherit; font-size: var(--fs-small); font-weight: 600; border: 0; background: transparent; color: var(--ink-2); padding: 0.4rem 0.9rem; border-radius: 999px; cursor: pointer; }
.ahi-seg button[aria-checked="true"] { background: var(--ink); color: var(--surface); }
.ahi-seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ahi-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ahi-chip { font: inherit; font-size: var(--fs-small); border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 0.3rem 0.75rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4em; }
.ahi-chip[aria-pressed="true"] { border-color: var(--c, var(--accent)); color: var(--ink); background: var(--accent-wash); font-weight: 600; }
.ahi-chip[aria-pressed="true"]::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--c, var(--accent)); }
.ahi-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.ahi-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ahi-ts-add { max-width: 22rem; }

/* ---------- explorer ---------- */
.ahi-explorer { display: grid; gap: var(--s-5); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 62rem) { .ahi-explorer { grid-template-columns: minmax(17rem, 21rem) minmax(0, 1fr); } }
.ahi-finder { display: grid; gap: var(--s-3); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s-4); box-shadow: var(--shadow); }
@media (min-width: 62rem) { .ahi-finder { position: sticky; top: 4rem; max-height: calc(100vh - 5rem); grid-template-rows: auto auto auto minmax(0, 1fr); } }
.ahi-filters { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); align-items: end; }
.ahi-filters .ahi-check { grid-column: 1 / -1; }
.ahi-count { font-size: var(--fs-small); color: var(--ink-3); margin: 0; }
.ahi-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 24rem; border-top: 1px solid var(--rule); }
@media (min-width: 62rem) { .ahi-list { max-height: none; } }
.ahi-list li { border-bottom: 1px solid var(--rule); }
.ahi-list button { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) 4.6rem; gap: var(--s-2); align-items: center; padding: 0.5rem 0.4rem; font-size: var(--fs-small); }
.ahi-list button:hover { background: var(--surface-2); }
.ahi-list button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ahi-list button[aria-current="true"] { background: var(--accent-wash); }
.ahi-list .rk { color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.ahi-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 550; }
.ahi-list .nm small { display: block; color: var(--ink-3); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.ahi-list .bar { position: relative; height: 1.5rem; line-height: 1.1rem; font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }
.ahi-list .bar i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); border-radius: 2px; }

.ahi-profile { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-lift); padding: clamp(1rem, 0.5rem + 2vw, 2rem); display: grid; gap: var(--s-5); min-width: 0; outline: none; }
.ahi-prof-head { display: grid; gap: var(--s-1); }
.ahi-prof-head h3 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.1; letter-spacing: -0.01em; margin: 0; }
.ahi-tags { display: flex; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-small); color: var(--ink-2); }
.ahi-tag { border: 1px solid var(--rule-strong); border-radius: 999px; padding: 0.1rem 0.6rem; }
.ahi-tag--warn { border-color: var(--status-warn); color: var(--ink); }
.ahi-prof-grid { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 52rem) { .ahi-prof-grid { grid-template-columns: 1fr 1fr; } }
.ahi-block { display: grid; gap: var(--s-2); min-width: 0; align-content: start; }
.ahi-block h4 { font-size: var(--fs-small); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 0; font-weight: 650; }
.ahi-block p { margin: 0; font-size: var(--fs-small); color: var(--ink-2); }
.ahi-prof-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 46rem) { .ahi-prof-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ahi-prof-stats .stat-value { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }
.ahi-mix svg, .ahi-strip svg { display: block; width: 100%; height: auto; overflow: visible; }
.ahi-mix text, .ahi-strip text, .ahi-heat text, .ahi-net text, .ahi-pipe text { font-family: var(--font-body); fill: var(--ink-2); }
.ahi-titles { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; font-size: var(--fs-small); }
.ahi-titles li { padding-left: 0.9rem; position: relative; color: var(--ink); }
.ahi-titles li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.ahi-terms { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ahi-terms span { font-size: var(--fs-micro); font-weight: 600; letter-spacing: 0.02em; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.15rem 0.45rem; color: var(--ink-2); }
.ahi-peers { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); }
.ahi-peer { all: unset; box-sizing: border-box; cursor: pointer; border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.55rem 0.7rem; display: grid; gap: 0.25rem; background: var(--surface-2); font-size: var(--fs-small); }
.ahi-peer:hover { border-color: var(--accent); }
.ahi-peer:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ahi-peer b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahi-peer span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ahi-peer i { display: block; height: 3px; background: var(--rule); border-radius: 2px; position: relative; }
.ahi-peer i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); background: var(--accent); border-radius: 2px; }
.ahi-legend { display: flex; flex-wrap: wrap; gap: 0.25rem var(--s-4); font-size: var(--fs-small); color: var(--ink-2); }
.ahi-legend span { display: inline-flex; align-items: center; gap: 0.4em; }
.ahi-legend span::before { content: ""; width: 11px; height: 11px; border-radius: 2px; background: var(--c); }

/* ---------- heatmap ---------- */
.ahi-heat { position: relative; }
.ahi-heat svg { display: block; width: 100%; height: auto; }
.ahi-heat rect.cell { stroke: var(--surface); stroke-width: 2; }
.ahi-heat rect.cell:focus { outline: none; stroke: var(--ink); stroke-width: 2; }
.ahi-heat .thin { fill: url(#ahi-hatch); pointer-events: none; }
.ahi-heat-key { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-small); color: var(--ink-2); flex-wrap: wrap; margin-top: var(--s-2); }
.ahi-heat-key i { display: inline-block; width: 26px; height: 12px; }
.ahi-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 0.4rem 0.6rem; font-size: var(--fs-small); line-height: 1.35; max-width: 16rem; }
.ahi-tip b { display: block; }
.ahi-tip[hidden] { display: none; }

/* ---------- network ---------- */
.ahi-net-fig { margin: 0; }
.ahi-net svg { display: block; width: 100%; height: auto; max-height: 34rem; touch-action: manipulation; }
.ahi-net line { stroke: var(--rule-strong); transition: opacity 160ms; }
.ahi-net g.node { cursor: pointer; transition: opacity 160ms; }
.ahi-net g.node:focus { outline: none; }
.ahi-net g.node:focus circle { stroke: var(--ink); stroke-width: 2.5; }
.ahi-net circle { stroke: var(--surface); stroke-width: 1.5; }
.ahi-net text { font-size: 12px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.ahi-net.is-focus g.node:not(.on), .ahi-net.is-focus line:not(.on) { opacity: 0.14; }
.ahi-net.is-focus line.on { stroke: var(--ink-2); }
.ahi-net-info { min-height: 3.2rem; font-size: var(--fs-small); color: var(--ink-2); border-left: 3px solid var(--accent); padding: 0.2rem 0 0.2rem 0.8rem; }
.ahi-net-info b { color: var(--ink); }

/* ---------- pipeline ---------- */
.ahi-pipe { display: grid; gap: 0.6rem; }
.ahi-stage { display: grid; grid-template-columns: 2rem minmax(0, 15rem) minmax(0, 1fr); gap: var(--s-3); align-items: center; }
.ahi-stage .no { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-small); font-weight: 700; background: var(--band); color: var(--on-band); }
.ahi-stage .lb { font-size: var(--fs-small); color: var(--ink); font-weight: 600; line-height: 1.3; }
.ahi-stage .lb small { display: block; font-weight: 400; color: var(--ink-3); }
.ahi-stage .tr { position: relative; height: 1.9rem; background: var(--surface-2); border-radius: var(--radius-sm); overflow: hidden; }
.ahi-stage .fill { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--seq-3); border-radius: var(--radius-sm); transform-origin: left; }
.ahi-stage.out .fill { background: var(--seq-5); }
.ahi-stage .val { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); font-weight: 700; font-size: var(--fs-small); color: var(--on-band); font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,.35); white-space: nowrap; }
.ahi-stage .val.outside { color: var(--ink); text-shadow: none; left: calc(var(--w) + 0.5rem); }
.ahi-stage .tool { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-ink); font-weight: 700; }
@media (max-width: 40rem) {
  .ahi-stage { grid-template-columns: 2rem minmax(0, 1fr); }
  .ahi-stage .tr { grid-column: 2; }
}
@media (prefers-reduced-motion: no-preference) {
  .ahi-pipe.go .fill { animation: ahi-grow 900ms cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 90ms); }
  @keyframes ahi-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .ahi-reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms ease, transform 600ms ease; }
  .ahi-reveal.in { opacity: 1; transform: none; }
}

.ahi-stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--s-4); }
.ahi-stats-2 .stat-value { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }
.ahi-matrix { width: 100%; table-layout: fixed; }
.ahi-matrix th, .ahi-matrix td { padding: 0.5rem 0.35rem; }
.ahi-matrix th:first-child { width: 34%; }
.ahi-matrix thead th { text-align: center; }
.ahi-matrix td.cellv { text-align: center; font-variant-numeric: tabular-nums; font-weight: 650; }

/* ---------- architecture flow ---------- */
.ahi-flow { list-style: none; margin: 0 0 var(--s-5); padding: 0; display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); counter-reset: none; }
.ahi-flow li { position: relative; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.7rem 0.8rem; display: grid; gap: 0.2rem; font-size: var(--fs-small); }
.ahi-flow li b { color: var(--ink); }
.ahi-flow li span { color: var(--ink-3); line-height: 1.35; }
.ahi-flow li em { font-style: normal; font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--accent-ink); }
@media (min-width: 60rem) {
  .ahi-flow li:not(:last-child)::after { content: ""; position: absolute; right: -0.75rem; top: 50%; width: 0.75rem; height: 2px; background: var(--rule-strong); }
  .ahi-flow li:not(:last-child)::before { content: ""; position: absolute; right: -0.8rem; top: calc(50% - 4px); border: 5px solid transparent; border-left-color: var(--rule-strong); border-right: 0; }
}

@media (max-width: 40rem) { #stat-tiles > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.ahi-span2 { grid-column: 1 / -1; }
.topbar .ahi-about::before { display: none; }
.topbar .ahi-about { white-space: nowrap; }
@media (max-width: 40rem) { .topbar-title { display: none; } }

/* QA pass 2: section nav wraps on phones instead of scrolling off the edge */
@media (max-width: 40rem) {
  .topbar { position: static; }
  .topbar-inner { flex-wrap: wrap; row-gap: 0.25rem; padding-block: 0.35rem; }
  .topbar-nav { flex: 1 0 100%; margin-left: 0; flex-wrap: wrap; white-space: normal; overflow: visible; gap: 0.2rem 0.9rem; padding-inline: 0; mask-image: none; -webkit-mask-image: none; }
}

/* round 4: intensity table */
.ahi-int-wrap { max-height: 38rem; overflow: auto; }
.ahi-int th small { font-size: var(--fs-micro); }
.ahi-int td .v { display: block; font-size: var(--fs-micro); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ahi-ibar { position: relative; height: 10px; min-width: 9rem; background: var(--surface-2); border-radius: 2px; }
.ahi-ibar .rng { position: absolute; top: 3px; height: 4px; background: var(--seq-2); border-radius: 2px; }
.ahi-ibar .pt { position: absolute; top: 0; width: 3px; height: 10px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
