/* Agentic-AI Security Incident Database browser.
   Built on the same --rs- tokens as the reading stats and the map sidebar, set
   in reading-stats.css and re-stepped for dark in dark.css, so the accent and
   the grid lines live in one place and the dark theme needs almost nothing. */

.aid {
  --rs-surface: #ffffff;
  --rs-ink: #284d36;
  --rs-ink-2: #52514e;
  --rs-muted: #7d8a80;
  --rs-grid: #e4e8e0;
  --rs-s1: #2e7d46;
  --aid-wild: #9e3410;
  --rs-sans: 'Mulish', system-ui, sans-serif;

  font-family: var(--rs-sans);
  color: var(--rs-ink-2);
  background: var(--rs-surface);
  border: 1px solid var(--rs-grid);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.1rem;
  margin: 1.5rem 0;
}

.aid-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rs-grid);
}

.aid-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--rs-ink);
  letter-spacing: 0.01em;
}

.aid-sub { font-size: 0.78rem; color: var(--rs-muted); margin-left: 0.45rem; }

.aid-dl {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--rs-s1);
  border: 1px solid var(--rs-s1);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  text-decoration: none;
  white-space: nowrap;
}

.aid-dl:hover { background: var(--rs-s1); color: var(--rs-surface); }

/* ---------- quarterly chart ---------- */

.aid-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: end;
  gap: 0.25rem;
  height: 128px;
  margin: 0.9rem 0 0.35rem;
}

.aid-bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }

/* The stack is the quarter's total; the inner segment is the in-the-wild share,
   drawn from the bottom so the two read as parts of one column. */
.aid-bar-stack {
  position: relative;
  background: var(--rs-s1);
  opacity: 0.45;
  border-radius: 2px 2px 0 0;
  min-height: 3px;
}

.aid-bar-wild {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--aid-wild);
  border-radius: 0 0 2px 2px;
}

.aid-bar-n { font-size: 0.62rem; font-weight: 700; color: var(--rs-ink-2); margin-top: 0.15rem; }
.aid-bar-q { font-size: 0.54rem; color: var(--rs-muted); white-space: nowrap; }

.aid-legend { font-size: 0.68rem; color: var(--rs-muted); margin: 0 0 0.9rem; }

.aid-key {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin: 0 0.25rem 0 0.7rem;
}

.aid-key:first-child { margin-left: 0; }
.aid-key--wild { background: var(--aid-wild); }
.aid-key--rest { background: var(--rs-s1); opacity: 0.45; }

/* ---------- controls ---------- */

.aid-search {
  width: 100%;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--rs-ink-2);
  background: var(--rs-surface);
  border: 1px solid var(--rs-grid);
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
}

.aid-search:focus { outline: none; border-color: var(--rs-s1); box-shadow: 0 0 0 0.15rem rgba(46, 125, 70, 0.18); }
.aid-search::placeholder { color: var(--rs-muted); }

.aid-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }

.aid-chip {
  font-family: inherit;
  font-size: 0.68rem;
  color: var(--rs-ink-2);
  background: none;
  border: 1px solid var(--rs-grid);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  cursor: pointer;
  text-transform: capitalize;
}

.aid-chip:hover { border-color: var(--rs-s1); color: var(--rs-s1); }

.aid-chip.is-on {
  background: var(--rs-s1);
  border-color: var(--rs-s1);
  color: var(--rs-surface);
}

.aid-chip-n { font-variant-numeric: tabular-nums; opacity: 0.75; margin-left: 0.15rem; }

.aid-count { font-size: 0.7rem; color: var(--rs-muted); margin: 0.6rem 0 0.2rem; }
.aid-empty { font-size: 0.78rem; color: var(--rs-muted); margin: 0.6rem 0 0; }

/* ---------- incident rows ---------- */

.aid-list { list-style: none; padding: 0; margin: 0; }
.aid-item { border-top: 1px solid var(--rs-grid); }
.aid-item[hidden] { display: none; }

.aid-rec > summary {
  display: grid;
  grid-template-columns: 3.6rem 1fr auto;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
  padding: 0.4rem 0;
  cursor: pointer;
  font-size: 0.78rem;
  list-style: none;
}

.aid-rec > summary::-webkit-details-marker { display: none; }
.aid-rec > summary:hover { background: rgba(46, 125, 70, 0.05); }

.aid-date { font-size: 0.68rem; font-variant-numeric: tabular-nums; color: var(--rs-muted); }
.aid-name { color: var(--rs-ink); font-weight: 600; }
.aid-tags { display: flex; flex-wrap: wrap; gap: 0.2rem; justify-content: flex-end; }

.aid-tag {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 3px;
  padding: 0.05rem 0.28rem;
  border: 1px solid transparent;
  white-space: nowrap;
  text-transform: capitalize;
}

.aid-tag--class { color: var(--rs-ink-2); border-color: var(--rs-grid); }

/* Evidence: hollow for a demonstration, filled once it was seen in the wild. */
.aid-tag--ev { font-variant-numeric: tabular-nums; text-transform: none; }
.aid-tag--e1, .aid-tag--e2 { color: var(--rs-ink-2); border-color: var(--rs-grid); }
.aid-tag--e3, .aid-tag--e4 { color: #ffffff; background: var(--aid-wild); border-color: var(--aid-wild); }

.aid-tag--prov { color: #7a5c00; border-color: #e0cf95; background: #fdf6e0; }
.aid-tag--conflict { color: #7d280b; border-color: #edc7b6; background: #fdeee7; }

.aid-body { padding: 0.15rem 0 0.7rem; }
.aid-summary { font-size: 0.8rem; line-height: 1.5; color: var(--rs-ink-2); margin: 0 0 0.5rem; }

.aid-fields {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.15rem 0.6rem;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
}

.aid-fields--wide { grid-template-columns: 9.5rem 1fr; }
.aid-fields dt { color: var(--rs-muted); font-weight: 700; }
.aid-fields dd { margin: 0; color: var(--rs-ink-2); overflow-wrap: anywhere; }
.aid-dim { color: var(--rs-muted); }

/* A row whose source is still the string "citation needed" should look unlike
   a row with a link, without the reader having to read the text first. */
.aid-nocite { color: #7a5c00; background: #fdf6e0; border-radius: 3px; padding: 0 0.2rem; }

/* ---------- apparatus ---------- */

.aid-apparatus { margin-top: 0.6rem; border-top: 1px solid var(--rs-grid); padding-top: 0.5rem; }
.aid-apparatus > summary { cursor: pointer; font-size: 0.74rem; font-weight: 700; color: var(--rs-s1); }
.aid-apparatus > summary:hover { color: #1f5c32; }
.aid-apparatus .aid-fields, .aid-apparatus .aid-notes { margin-top: 0.5rem; }

.aid-notes { list-style: none; padding: 0; margin: 0; }

.aid-notes li {
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 0.3rem 0;
  border-top: 1px solid var(--rs-grid);
}

.aid-notes li:first-child { border-top: none; }
.aid-notes strong { color: var(--rs-ink); }

/* ---------- phones ---------- */

@media (max-width: 575.98px) {
  .aid { padding: 0.8rem 0.7rem 0.9rem; }

  /* Fifteen quarters will not hold a readable label at this width, so the
     chart keeps its shape and loses the per-quarter captions. */
  .aid-chart { height: 96px; gap: 0.15rem; }
  .aid-bar-q, .aid-bar-n { display: none; }

  /* Name over tags rather than beside them: at 320px the two columns leave the
     name about nine characters. */
  .aid-rec > summary { grid-template-columns: 3.4rem 1fr; }
  .aid-tags { grid-column: 1 / -1; justify-content: flex-start; }
  .aid-fields { grid-template-columns: 1fr; gap: 0 0; }
  .aid-fields dt { margin-top: 0.3rem; }
  .aid-fields--wide { grid-template-columns: 1fr; }
}
