/* =========================================================================
   netex · engines/ai-answer.css · the before/after AI answer, the query ledger, the crawler panel
   The interface is our own: two plain answer panes, a spec table, cyan citation lines on 47° segments.
   ========================================================================= */
@layer reset, tokens, base, components, layout, pages, utilities;

@layer pages {

.ai-demo { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
.ai-demo__sim { margin: 0; }
.ai-demo__picker { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.ai-demo__pickl { font: 500 .6875rem/1.3 var(--f-mono); letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--fg-2); }
.ai-demo__picker .nx-seg > button { min-height: 44px; text-transform: none; letter-spacing: 0; font: 500 .875rem/1.2 var(--f-sans); text-align: left; }
.ai-demo__ask { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); background: var(--bg-2); border: var(--bw) solid var(--rule); }
.ai-demo__query { flex: 1 1 18rem; display: flex; gap: var(--s-3); align-items: baseline; font: 500 .9375rem/1.45 var(--f-mono); color: var(--fg); }
.ai-demo__prompt { color: var(--cyan); }

/* The stage: before | after, then "what changed" | spec table. Paint order inside the stage (its own
   stacking context): pane paper → citation lines → pane text. A line that leaves a [n] marker passes
   BEHIND the words below it, and a halo in the pane colour keeps every glyph whole where it crosses. */
.ai-stage { position: relative; isolation: isolate; display: grid; gap: var(--s-5) var(--gutter); grid-template-columns: minmax(0, 1fr); }
.ai-pane { position: relative; display: grid; gap: var(--s-3); align-content: start; padding: var(--s-5); min-height: 15rem; }
.ai-pane::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink-2); border: var(--bw) solid var(--rule); clip-path: var(--clip-sheet); }
.ai-pane__head { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding-bottom: var(--s-3); border-bottom: var(--bw) solid var(--rule); font: 500 .6875rem/1.3 var(--f-mono); letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--fg-2); }
.ai-pane__tag { padding: 2px 6px; border: var(--bw) solid var(--fg-3); color: var(--fg); }
.ai-pane__tag--after { border-color: var(--cyan); color: var(--cyan); }
.ai-pane__state { margin-left: auto; color: var(--cyan); }
.ai-pane__state:empty { display: none; }
.ai-pane__text { position: relative; z-index: 2; font: 400 1.0625rem/1.65 var(--f-sans); color: var(--fg); max-width: 60ch; text-shadow: 0 0 2px var(--ink-2), 0 0 3px var(--ink-2), 0 0 5px var(--ink-2), 0 0 7px var(--ink-2); }
.ai-pane--before .ai-pane__text { color: var(--fg-2); }
.ai-cite { position: relative; z-index: 2; margin: 0 1px; padding: 0 2px; font: 600 .75rem/1 var(--f-mono); color: var(--ink); background: var(--cyan); vertical-align: .35em; cursor: help; }
.ai-caret { display: inline-block; width: .55em; height: 1em; margin-left: 1px; vertical-align: -.12em; background: var(--cyan); animation: ai-blink 900ms steps(1, jump-end) 5; }
@keyframes ai-blink { 50% { opacity: 0; } }
.ai-changes { display: grid; gap: var(--s-3); align-content: start; justify-items: start; }
.ai-changes__list { display: grid; gap: var(--s-3); margin: 0; padding: var(--s-4) var(--s-4) var(--s-4) var(--s-7); background: var(--bg-2); border-top: var(--bw-2) solid var(--cyan); clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--ch-ui) * var(--nx-tan)), calc(100% - var(--ch-ui)) 100%, 0 100%); font-size: var(--t-small); line-height: 1.55; } /* a ruled sheet, not a side-bordered card (bible §1.4) */
.ai-changes__list[hidden] { display: none; }
.ai-changes__list li::marker { font: 600 .75rem var(--f-mono); color: var(--cyan); }
.ai-demo__ctl { display: flex; flex-wrap: wrap; gap: 0 var(--s-5); }
.ai-spec { position: relative; z-index: 1; padding: var(--s-4) var(--s-5) var(--s-5); background: var(--paper); color: var(--ink); --fg: var(--ink); --fg-2: var(--steel-dark); --fg-3: var(--steel-dark); --rule: var(--rule-light); clip-path: var(--clip-sheet); }
.ai-spec__title { font: 600 .9375rem/1.35 var(--f-sans); }
.ai-spec__src { margin-top: 2px; font: 500 .75rem/1.4 var(--f-mono); color: var(--cyan-deep); }
.ai-spec__rows { margin: var(--s-4) 0 0; padding: 0; list-style: none; border-bottom: var(--bw) solid var(--rule); }
.ai-spec__row { display: grid; grid-template-columns: minmax(7rem, 38%) minmax(0, 1fr); gap: var(--s-3); padding: var(--s-2) 0 var(--s-2) var(--s-3); border-top: var(--bw) solid var(--rule); font-size: var(--t-small); line-height: 1.4; }
.ai-spec__k { font: 500 .6875rem/1.5 var(--f-mono); letter-spacing: .03em; text-transform: uppercase; color: var(--fg-2); }
.ai-spec__label { margin-top: var(--s-3); }
.ai-lines { position: absolute; left: 0; top: 0; z-index: 1; max-width: none; pointer-events: none; overflow: visible; }
.ai-lines path { fill: none; stroke: var(--cyan); stroke-width: 1.5; stroke-linecap: square; }
.ai-lines rect { fill: var(--cyan); }
/* Single column (phones, tablets): the spec sits under the answer, so a line would cross the text it
   cites. The numbered markers and the spec's source line carry the link instead. */
@media (max-width: 1023px) { .ai-lines { display: none; } }
@media (min-width: 1024px) {
	.ai-stage { grid-template-columns: repeat(12, minmax(0, 1fr)); row-gap: var(--s-8); }
	.ai-pane--before { grid-column: 1 / span 5; }
	.ai-pane--after { grid-column: 6 / -1; }
	.ai-changes { grid-column: 1 / span 5; grid-row: 2; }
	.ai-spec { grid-column: 7 / -1; grid-row: 2; }
}
.ai-transcript { margin-top: var(--s-8); border-top: var(--bw) solid var(--rule); }
.ai-transcript__note { margin: var(--s-3) 0; font-size: var(--t-small); color: var(--fg-2); }
.js .ai-transcript__note { display: none; } /* the no-JS line only: with JS the demo runs above */
.ai-transcript__q { padding: var(--s-4) 0; border-top: var(--bw) solid var(--rule); max-width: var(--measure); }
.ai-transcript__q h3 { font: 500 .875rem/1.45 var(--f-mono); color: var(--cyan); margin-bottom: var(--s-2); }
.ai-transcript__q p, .ai-transcript__q li { font-size: var(--t-small); line-height: 1.55; }
.ai-transcript__q ul { margin-top: var(--s-2); padding-left: 1.2em; }
html.rm .ai-caret { animation: none; }

/* ---- the query ledger (demo data) --------------------------------------------------------- */
.av-ledger { container-type: inline-size; display: grid; gap: var(--s-4); padding: var(--s-5); background: var(--ink-2); border: var(--bw) solid var(--rule); }
.av-ledger__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); }
.av-ledger__title { font: 600 .75rem/1.3 var(--f-mono); letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--fg); }
.av-ledger__month { display: grid; grid-template-columns: 6rem minmax(0, 1fr); align-items: center; gap: var(--s-3); font: 600 .8125rem/1 var(--f-mono); color: var(--cyan); }
.av-ledger__table { width: 100%; border-collapse: collapse; font: 500 .6875rem/1.3 var(--f-mono); }
.av-ledger__table th, .av-ledger__table td { padding: 3px 4px; border-top: var(--bw) solid var(--rule); text-align: left; vertical-align: middle; }
.av-ledger__table thead th { padding-bottom: var(--s-2); font-size: .625rem; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-2); border-top: 0; white-space: nowrap; }
.av-ledger__table tbody th { width: 52%; color: var(--fg); font-weight: 500; }
.av-ledger__table td { width: 12%; text-align: center; }
/* Engine names centred over their marks, so neighbouring names never read as one. */
.av-ledger__table thead th:not(:first-child) { text-align: center; }
.av-ledger__table td i { display: block; width: 14px; height: 10px; margin-inline: auto; border: var(--bw) solid var(--fg-3); }
.av-ledger__table td.is-yes i { background: var(--cyan); border-color: var(--cyan); }
.av-redact { display: block; width: var(--w, 60%); height: 7px; background: var(--fg-3); opacity: .38; }
.av-ledger__total { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); font: 600 .875rem/1 var(--f-mono); color: var(--fg); }
.av-ledger__key { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 500; font-size: .75rem; color: var(--fg-2); }
.av-ledger__key i { width: 14px; height: 10px; background: var(--cyan); }
@container (max-width: 480px) {
	.av-ledger { padding: var(--s-4) var(--s-3); }
	.av-ledger__table thead th { font-size: .5625rem; letter-spacing: .02em; vertical-align: bottom; }
	/* Engine names stand on end so four columns fit a phone without breaking a word. */
	/* In a vertical writing mode vertical-align runs along the row: "top" keeps the name over its boxes. */
	.av-ledger__table thead th:not(:first-child) { writing-mode: sideways-lr; vertical-align: top; padding: 4px 0 4px 2px; text-align: start; }
	.av-ledger__table tbody th { width: 36%; }
	.av-ledger__table td { width: 16%; }
}

/* ---- the crawler panel ------------------------------------------------------------------------- */
.av-robots { padding: var(--s-5); background: var(--ink); color: var(--paper); --fg: var(--paper); --fg-2: var(--paper-72); --rule: var(--rule-dark); font: 500 .875rem/1.5 var(--f-mono); clip-path: var(--clip-sheet); }
.av-robots__file { margin-bottom: var(--s-3); padding-bottom: var(--s-2); border-bottom: var(--bw) solid var(--rule); font-size: .6875rem; letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--fg-2); }
.av-robots__row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-1) var(--s-4); padding: var(--s-2) 0; border-top: var(--bw) dashed var(--rule); }
.av-robots__ua { font-size: .875rem; color: var(--paper); background: none; padding: 0; }
.av-robots__k { color: var(--fg-2); }
.av-robots__state { font-weight: 600; letter-spacing: var(--tr-label); text-transform: uppercase; font-size: .75rem; color: var(--cyan); }
.av-robots__row.is-checking .av-robots__state { color: var(--fg-2); }

} /* end @layer pages */
