/* The incident timeline (js/views/incidents.js): public incidents of 2025 and 2026, one dot each.
   Wide frames: months across, six lanes down, the panel under the plot. Narrow frames, and touch screens until a
   month across is a full tap target: time down the page, one column per lane, one dot per row, the panel in the
   slot under the month just picked. White and grey only: nothing here is a defense that held. Without scripting
   the figure is its plain list; .is-ready swaps the list for the picture.
   Dot sizes. With a finger every dot is a 44px target in both layouts. With a mouse and the months across, a
   stacked dot keeps a 24px row so the plot and its panel fit one screen: the same exception for dense data marks
   as the technique map's tiles, and never under 24px on either side. */

.view--incidents { overflow: clip; border-radius: var(--radius-frame); background: var(--color-paper-2); box-shadow: inset 0 0 0 1px var(--color-frame-edge); }
.inc {
  --inc-axis: var(--space-xl); --inc-pitch: var(--space-lg); --inc-lane: var(--control-hit); --inc-gap: var(--space-xs);
  --inc-tap: var(--control-hit); --inc-sep: var(--space-xl); --inc-idle: var(--space-md);
  --inc-dot: var(--space-sm); --inc-ring: 18px; --inc-tile: 26px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); margin: 0; padding: var(--space-xl);
}

/* The lead: what a dot is and what to do with it. Then the bar, one counted line: how many incidents are shown,
   the way back to all of them, and how many carry a ring (the ring's key). */
.inc__lead { margin: 0; font-size: var(--text-md); line-height: 1.4; color: var(--color-ink); }
.inc__bar { position: relative; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); min-height: var(--control-hit); }
.inc__count { margin: 0; font-size: var(--text-md); line-height: 1.3; color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.inc__key { display: flex; align-items: center; gap: var(--space-xs); margin: 0; font-size: var(--text-md); line-height: 1.3; color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.inc__all:focus-visible, .inc__go:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }

.inc__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
.inc__plot { position: relative; display: grid; }

/* Marks. A plain dot is an incident; a ringed dot is one that involves AI. */
.inc__mark { position: relative; z-index: 1; display: block; flex: none; width: var(--inc-dot); height: var(--inc-dot); border-radius: 50%; background: var(--color-ink); transition: transform 200ms var(--ease-out), opacity 300ms var(--ease-out); }
.inc__mark--ai { width: var(--inc-ring); height: var(--inc-ring); background: none; box-shadow: inset 0 0 0 2px var(--color-ink); }
.inc__mark--ai::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; background: var(--color-ink); }

/* A dot is a button the size of its cell; the mark sits in the middle. The picked one stands on a white tile. */
.inc__dot { position: relative; z-index: 2; display: grid; place-items: center; min-width: 0; padding: 0; border: 0; border-radius: var(--radius-pill); background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.inc__dot::before { content: ""; position: absolute; top: 50%; left: 50%; width: var(--inc-tile); height: var(--inc-tile); translate: -50% -50%; border-radius: var(--space-xs); background: var(--color-ink); opacity: 0; transition: opacity 200ms var(--ease-out); }
.inc__dot.is-picked::before { opacity: 1; }
.inc__dot.is-picked .inc__mark { background: var(--color-paper); }
.inc__dot.is-picked .inc__mark--ai { background: none; box-shadow: inset 0 0 0 2px var(--color-paper); }
.inc__dot.is-picked .inc__mark--ai::after { background: var(--color-paper); }
.inc__dot:hover .inc__mark, .inc__dot.is-shown .inc__mark { transform: scale(1.35); }
.inc__dot:active .inc__mark { transform: scale(0.9); }
.inc__dot:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }
.inc__dot.is-dim .inc__mark { opacity: 0.16; }

/* Dots arrive in time order once the plot is in view. Only with scripting and with motion. The arrival is an
   animation that waits on its first frame, so a mark's own transition stays free: hover, preview, pick and
   dimming answer at once on every dot that has arrived. */
html:not(.rm) .inc.is-ready:not(.is-settled) .inc__dot .inc__mark { animation: inc-in 520ms var(--ease-expo) calc(var(--i) * 28ms) backwards paused; }
html:not(.rm) .inc.is-ready:not(.is-settled) .inc__dot::before { animation: inc-tile 300ms var(--ease-out) calc(var(--i) * 28ms + 240ms) backwards paused; }
html:not(.rm) .inc.is-live:not(.is-settled) .inc__dot .inc__mark, html:not(.rm) .inc.is-live:not(.is-settled) .inc__dot::before { animation-play-state: running; }
@keyframes inc-in { from { opacity: 0; transform: scale(0.3); } }
@keyframes inc-tile { from { opacity: 0; } }

.inc__tick { font-size: var(--text-md); line-height: 1.3; color: var(--color-ink-3); font-variant-numeric: tabular-nums; }
.inc__tick.is-year { color: var(--color-ink); }
.inc__lane { position: relative; z-index: 2; white-space: nowrap; }
/* Each lane name carries the count of its incidents. */
.inc__lane-n { margin-left: var(--space-xs); color: var(--color-ink-3); font-variant-numeric: tabular-nums; }
.inc[data-layout="rows"] .inc__lane[aria-pressed="true"] .inc__lane-n { color: inherit; }

/* ---------- Lanes as rows: months across ---------- */
.inc[data-layout="rows"] .inc__plot { grid-template-columns: max-content repeat(var(--inc-months), minmax(0, 1fr)); grid-template-rows: var(--inc-rows); }
.inc[data-layout="rows"] .inc__band { grid-column: 2 / -1; grid-row: var(--r0) / span var(--rn); border-radius: var(--radius-card); background: var(--color-paper-3); color: var(--color-ink); transition: opacity 300ms var(--ease-out); }
.inc[data-layout="rows"] .inc__band.is-dim { opacity: 0.5; }
.inc[data-layout="rows"] .inc__rule { z-index: 1; grid-column: var(--c); grid-row: 1 / -1; justify-self: start; width: 1px; background: var(--color-paper-4); }
.inc[data-layout="rows"] .inc__rule.is-year { background: var(--color-dust-far); }
.inc[data-layout="rows"] .inc__tick { grid-column: var(--c) / span var(--span); grid-row: 1; padding-left: var(--space-xs); }
.inc[data-layout="rows"] .inc__lane { grid-column: 1; grid-row: var(--r0) / span var(--rn); align-self: center; justify-self: start; margin-right: var(--space-md); }
.inc[data-layout="rows"] .inc__dot { grid-column: var(--rc); grid-row: var(--rr); transform: translateY(calc(var(--rshift) * 100%)); }
.inc[data-layout="rows"] .inc__heads { display: none; }

/* ---------- Lanes as columns: time down the page ---------- */
.inc[data-layout="cols"] .inc__plot { grid-template-columns: var(--inc-lane-widths, repeat(var(--inc-lanes), minmax(0, 1fr))); grid-template-rows: var(--inc-cols); }
.inc[data-layout="cols"] .inc__band { grid-column: var(--c0); grid-row: 2 / -1; box-shadow: inset 1px 0 0 var(--color-rule); }
.inc[data-layout="cols"] .inc__band:first-child { box-shadow: none; }
.inc[data-layout="cols"] .inc__rule { display: none; }
.inc[data-layout="cols"] .inc__tick { z-index: 1; grid-column: 1 / -1; grid-row: var(--sep); align-self: end; padding-bottom: var(--space-2xs); box-shadow: inset 0 -1px 0 var(--color-rule); }
.inc[data-layout="cols"] .inc__heads { position: sticky; top: var(--nav-clear); z-index: 3; grid-column: 1 / -1; grid-row: 1; background: var(--color-paper-2); box-shadow: inset 0 -1px 0 var(--color-rule); }
/* The strip between the nav and the stuck lane names is backed too, so no dot or card text shows around the nav. */
.inc[data-layout="cols"] .inc__heads::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: var(--nav-clear); background: var(--color-paper-2); }
.inc[data-layout="cols"] .inc__lane {
  position: sticky; top: var(--nav-clear); z-index: 4; grid-column: var(--c0); grid-row: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: var(--space-2xs) 0; border-radius: 0;
  background: none; box-shadow: none; color: var(--color-ink-3);
}
.inc[data-layout="cols"] .inc__lane-n { margin-left: 0; }
.inc[data-layout="cols"] .inc__lane:hover { background: none; color: var(--color-ink); }
.inc[data-layout="cols"] .inc__lane[aria-pressed="true"] { background: none; color: var(--color-ink); box-shadow: inset 0 -2px 0 var(--color-ink); }
.inc[data-layout="cols"] .inc__dot { grid-column: var(--cc); grid-row: var(--cr); transform: translateY(calc(var(--cshift) * 100%)); }

/* ---------- The panel ---------- */
.inc__panel {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 3fr); gap: var(--space-xl); align-items: start;
  padding: var(--space-lg); border-radius: var(--radius-view); background: var(--color-paper-3); color: var(--color-ink);
  box-shadow: inset 0 0 0 1px var(--color-frame-edge);
}
.inc__panel p, .inc__panel dl, .inc__panel dd { margin: 0; }
.inc__p-head { display: grid; justify-items: start; gap: var(--space-2xs); min-width: 0; }
.inc__p-when, .inc__p-kind, .inc__p-by { font-size: var(--text-md); line-height: 1.4; color: var(--color-ink-3); }
/* The lane (where the lanes stand as columns) and, for an AI agent under test, the label that says so. */
.inc__p-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-md); }
.inc__p-tag { display: inline-flex; align-items: center; gap: var(--space-xs); color: var(--color-ink-2); }
.inc__p-when { font-variant-numeric: tabular-nums; }
.inc__p-name { font-size: var(--text-title); line-height: 1.2; letter-spacing: var(--tracking-title); color: var(--color-ink); overflow-wrap: anywhere; }
.inc__p-go { margin-top: var(--space-xs) !important; }
.inc__go { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.inc__p-list { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-lg); }
.inc__p-list > div { display: grid; align-content: start; gap: var(--space-2xs); min-width: 0; }
.inc__p-list dt { font-size: var(--text-md); line-height: 1.4; color: var(--color-ink-3); }
.inc__p-list dd { font-size: var(--text-md); line-height: 1.4; color: var(--color-ink-2); }
html:not(.rm) .inc__panel.is-swap > * { animation: tl-in 360ms var(--ease-out) both; }
/* With the lanes as rows the dot's own row names its lane: the line shows only the under-test label, if any. */
.inc[data-layout="rows"] .inc__p-lane { display: none; }
.inc[data-layout="rows"] .inc__p-kind:has(> .inc__p-tag[hidden]) { display: none; }
.inc[data-layout="cols"] .inc__panel { z-index: 2; grid-column: 1 / -1; grid-row: var(--slot); grid-template-columns: minmax(0, 1fr); gap: var(--space-md); margin-block: var(--space-xs) var(--space-md); padding: var(--space-md); }
.inc[data-layout="cols"] .inc__p-list { grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); padding-top: var(--space-md); border-top: 1px solid var(--color-rule); }

/* ---------- Without scripting: the list ---------- */
.inc__list { font-size: var(--text-md); line-height: 1.45; color: var(--color-ink-2); }
.inc__list ol { display: grid; gap: var(--space-sm); max-width: 72ch; margin: var(--space-md) 0 0; padding: 0; list-style: none; }
.inc__list strong { font-weight: inherit; color: var(--color-ink); }
.inc__list-note { margin: 0; color: var(--color-ink-3); }
.inc.is-ready .inc__list { display: none; }

@media (pointer: coarse) {
  .inc { --inc-pitch: var(--control-hit); }
}
@media (max-width: 74.99rem) {
  .inc[data-layout="rows"] .inc__panel { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
  /* The head has the full width here: the under-test label sits beside the date. */
  .inc[data-layout="rows"] .inc__p-head { grid-template-columns: max-content minmax(0, 1fr); column-gap: var(--space-md); }
  .inc[data-layout="rows"] .inc__p-name, .inc[data-layout="rows"] .inc__p-by { grid-column: 1 / -1; }
}
/* A wide touch screen keeps the columns; its panel has room for the three parts side by side. */
@media (min-width: 60rem) {
  .inc[data-layout="cols"] .inc__panel { gap: var(--space-lg); padding: var(--space-lg); }
  .inc[data-layout="cols"] .inc__p-list { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-lg); padding-top: 0; border-top: 0; }
}
@media (max-width: 39.99rem) {
  .view--incidents { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; box-shadow: inset 0 1px 0 var(--color-frame-edge), inset 0 -1px 0 var(--color-frame-edge); }
  .inc { padding: var(--space-lg) var(--gutter); }
  /* The bar is always two rows here: the count with room for Show all beside it, then the key. Choosing a lane
     moves nothing. */
  .inc__count { display: flex; align-items: center; min-height: var(--control-hit); }
  .inc__key { flex: 1 0 100%; }
}
/* On the narrowest phones the six lane names need the full width. */
@media (max-width: 21.25rem) {
  .inc { padding-inline: var(--space-xs); }
}
