/* =========================================================
   Iraq page: components layered over styles.css + ui.css.
   Same graphite system; no sides here, so the data marks use
   one neutral ink instead of the olive/navy pair.
   ========================================================= */
.rd { --iq: #2b2f36; --iq-soft: rgba(43, 47, 54, 0.22); --iq-band: rgba(118, 122, 132, 0.07); }
@media (prefers-color-scheme: dark) {
  .rd:not([data-theme="light"]) { --iq: #d9dde3; --iq-soft: rgba(217, 221, 227, 0.26); --iq-band: rgba(160, 166, 178, 0.07); }
}

/* ---------- Chapter 1: documented deaths by year ---------- */
.yr { margin: var(--s-8) 0 0; }
.yr-readout { margin: 0 0 var(--s-16); min-height: 1.6em; font-size: var(--text-sm); color: var(--text-3); }
.yr-readout strong { font: 600 1.35rem/var(--lh-figure) var(--font-ui); color: var(--text); font-variant-numeric: tabular-nums; margin-right: var(--s-4); }
.yr-readout b { color: var(--text); font-weight: 600; }
.yr:focus-visible { outline: 2px solid var(--focus); outline-offset: var(--s-8); border-radius: var(--r-xs); }
.yr-plot { --cols: 24; position: relative; }
.yr-bands, .yr-bars, .yr-us { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--s-4); }
.yr-bands span {
  grid-column: var(--from) / var(--to);
  grid-row: 1;
  padding: var(--s-8) var(--s-8) 0;
  border-left: 1px solid var(--rule-2);
  font-size: var(--text-micro);
  font-weight: 600;
  line-height: var(--lh-label);
  color: var(--text-3);
}
.yr-bands span:nth-child(odd) { background: linear-gradient(var(--iq-band), var(--iq-band)); }
.yr-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  height: clamp(220px, 32vw, 340px);
  align-items: end;
  border-bottom: 1px solid var(--rule-3);
  position: relative;
}
.yr-bars li { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; cursor: default; }
.yr-bar { display: block; height: calc(var(--v) * 100%); min-height: 2px; }
.yr-bar i { display: block; height: 100%; background: var(--iq); border-radius: 4px 4px 0 0; transition: opacity var(--dur-micro) var(--ease-out); }
.yr-bars li.is-partial .yr-bar i { background: repeating-linear-gradient(135deg, var(--iq) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--iq); }
.yr-x { position: absolute; top: calc(100% + var(--s-8)); left: 50%; transform: translateX(-50%); font: 500 0.68rem/var(--lh-figure) var(--font-mono); color: var(--text-4); white-space: nowrap; }
.yr-bars { margin-bottom: var(--s-24); }
/* Hover/focus: the pointed year stays solid, the rest recede */
.yr-bars:hover li:not(.is-on) .yr-bar i,
.yr-bars.has-on li:not(.is-on) .yr-bar i { opacity: 0.35; }
.yr-bars li.is-on .yr-x { color: var(--text); font-weight: 600; }
/* US presence strip under the axis */
.yr-us { align-items: center; margin-top: var(--s-4); row-gap: var(--s-8); }
.yr-us-label { grid-column: 1 / -1; grid-row: 1; font-size: var(--text-micro); font-weight: 600; color: var(--text-3); }
.yr-us i { grid-row: 2; grid-column: var(--from) / var(--to); height: 6px; border-radius: var(--pill); background: var(--iq-soft); }

.yr-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-12);
  margin: var(--s-32) 0 0;
}
.yr-facts > div { padding: var(--s-16) var(--s-16); border-radius: var(--r-sm); background: var(--surface-2); display: grid; gap: var(--s-8); align-content: start; }
.yr-facts strong { font: 500 1.7rem/var(--lh-figure) var(--font-display); letter-spacing: var(--track-title); color: var(--text); font-variant-numeric: lining-nums tabular-nums; }
.yr-facts span { font-size: var(--text-note); line-height: var(--lh-caption); color: var(--text-3); }
.yr-facts--band > div { background: var(--fill); }
.yr-table td:first-child { font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .yr-bands, .yr-bars, .yr-us { column-gap: var(--s-4); }
  .yr-bands span { font-size: var(--text-3xs); padding: var(--s-8) var(--s-4) 0; }
  .yr-bands span:nth-child(2) { font-size: 0; }   /* "US drawdown" has no room; the strip below says it */
  .yr-x--minor { display: none; }
  .yr-bar i { border-radius: 2px 2px 0 0; }
}

/* ---------- Chapter 2: estimates on one scale ---------- */
.est { margin: var(--s-8) 0 0; --label-w: 17rem; --label: minmax(0, var(--label-w)); --val: 8.5rem; }   /* label column width: the axis aligns to it */
.est-rows { list-style: none; margin: 0; padding: 0; }
.est-rows li:not(.est-group) {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr) var(--val);
  align-items: center;
  gap: var(--s-16);
  padding: var(--s-12) 0;
  border-top: 1px solid var(--hair);
}
.est-group { padding: var(--s-16) 0 var(--s-8); font-size: var(--text-xs); font-weight: 600; color: var(--text-3); }   /* sentence case, like every kicker */
.est-src { display: grid; gap: var(--s-4); }
.est-src strong { font-weight: 600; color: var(--text); font-size: var(--text-sm); }
.est-src span { font-size: var(--text-xs); line-height: var(--lh-label); color: var(--text-3); }
.est-plot { position: relative; height: 18px; background: linear-gradient(90deg, var(--hair) 1px, transparent 1px) 0 0 / 20.8333% 100%; }
.est-plot i { position: absolute; top: 50%; }
.est-span { left: var(--a); width: calc(var(--b) - var(--a)); height: 12px; transform: translateY(-50%); min-width: 6px; border-radius: 4px; background: var(--iq); }
.est-ci { left: var(--a); width: calc(var(--b) - var(--a)); height: 2px; transform: translateY(-50%); background: var(--iq-soft); border-radius: 2px; }
.est-dot { left: var(--a); width: 12px; height: 12px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--iq); box-shadow: 0 0 0 2px var(--surface); }
.est-val { text-align: right; font-weight: 600; font-size: var(--text-sm); color: var(--text); font-variant-numeric: tabular-nums; }
.est-axis {
  position: relative;
  height: 18px;
  margin-left: calc(var(--label-w) + var(--s-16));
  margin-right: calc(var(--s-128) + var(--s-16));
  font: 500 0.68rem/var(--lh-figure) var(--font-mono);
  color: var(--text-4);
}
.est-axis span { position: absolute; left: var(--a); transform: translateX(-50%); }
.est-axis span:first-child { transform: none; }
.est-key { display: flex; flex-wrap: wrap; gap: var(--s-8) var(--s-24); margin-top: var(--s-16); font-size: var(--text-xs); color: var(--text-3); }
.est-key span { display: inline-flex; align-items: center; gap: var(--s-8); }
.est-key i { position: static; display: inline-block; transform: none; }
.est-key .est-span { width: 18px; height: 10px; }
.est-key .est-dot { width: 10px; height: 10px; box-shadow: none; }
.est-key .est-ci { width: 18px; height: 2px; }
.est-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s-12) var(--s-32); margin-top: var(--s-32); }
.est-notes p { margin: 0; font-size: var(--text-sm); line-height: var(--lh-ui); color: var(--text-2); }
.est-notes strong { color: var(--text); }

@media (max-width: 900px) {
  .est-rows li:not(.est-group) { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "src val" "plot plot"; row-gap: var(--s-12); }
  .est-src { grid-area: src; }
  .est-val { grid-area: val; align-self: start; }
  .est-plot { grid-area: plot; }
  .est-axis { margin-left: 0; margin-right: 0; order: 2; }
  .est { display: flex; flex-direction: column; }
  .est-rows { order: 1; }
  .est-axis { order: 2; margin-top: var(--s-8); }
  .est-key { order: 3; }
}

/* ---------- Chapter 3: who was killed (century-chart rows, with ranges) ---------- */
.rd .who-chart { margin-top: var(--s-8); }
.who-chart .cc-rows li { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 9.5rem; }
.who-chart .cc-bar { position: relative; }
.who-chart .cc-bar i, .who-chart .cc-bar u { position: absolute; left: 0; top: 0; height: 100%; width: var(--w); min-width: 2px; border-radius: 0 4px 4px 0; }
.who-chart .cc-bar i { background: var(--iq); z-index: 1; }
.who-chart .cc-bar u { background: var(--iq-soft); text-decoration: none; }
.who-chart .cc-rows li.is-lead .cc-what, .who-chart .cc-rows li.is-lead .cc-val { color: var(--text); font-weight: 600; }
@media (max-width: 640px) {
  .who-chart .cc-rows li { grid-template-columns: minmax(0, 1fr) auto; row-gap: var(--s-8); }
  .who-chart .cc-what { grid-column: 1; grid-row: 1; }
  .who-chart .cc-val { grid-column: 2; grid-row: 1; }
  .who-chart .cc-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Chapter 4: US toll ---------- */
.us-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-12); }
.us-grid .cell { padding: var(--s-16); border-radius: var(--r-sm); background: var(--surface-2); }
.us-grid .lbl { font-size: var(--text-xs); color: var(--text-3); }
.us-grid .val { margin-top: var(--s-12); font: 500 1.9rem/var(--lh-figure) var(--font-display); letter-spacing: var(--track-title); color: var(--text); font-variant-numeric: lining-nums tabular-nums; }
@media (max-width: 1023px) { .us-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .us-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Part two: timeline ---------- */
.tl {
  list-style: none;
  margin: 0;
  padding: var(--pad-card);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--e1);
  position: relative;
}
.tl { --tl-date: 11rem; }   /* date column width: the rail and its dots align to it */
.tl > li { position: relative; display: grid; grid-template-columns: var(--tl-date) minmax(0, 1fr); gap: var(--s-24); padding: 0 0 var(--s-32); }
.tl > li:last-child { padding-bottom: 0; }
/* the spine */
.tl > li::before { content: ""; position: absolute; left: calc(var(--tl-date) + var(--s-12)); top: var(--s-12); bottom: calc(-1 * var(--s-12)); width: 1px; background: var(--rule-2); transform: translateX(-0.5px); }
.tl > li:last-child::before { display: none; }
.tl > li::after { content: ""; position: absolute; left: calc(var(--tl-date) + var(--s-12)); top: var(--s-8); width: 9px; height: 9px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--text-3); transform: translateX(-50%); }
.tl > li.is-now::after { background: var(--brand); box-shadow: 0 0 0 4px var(--fill); }
.tl > li.tl-fig::after { display: none; }
.tl-when { text-align: right; padding-right: var(--s-16); font: 500 0.78rem/var(--lh-caption) var(--font-mono); color: var(--text-3); }
.tl-body { padding-left: var(--s-16); max-width: var(--measure); }
.tl-body h3 { margin: 0 0 var(--stack-related); font: 600 1.2rem/var(--lh-label) var(--font-display); color: var(--text); }
.tl-body p { margin: 0; color: var(--text-2); line-height: var(--lh-ui); }
.tl-stat { margin-top: var(--s-12); display: inline-flex; align-items: baseline; gap: var(--s-8); padding: var(--s-8) var(--s-16); border-radius: var(--pill); background: var(--fill); font-size: var(--text-note); color: var(--text-2); }
.tl-stat strong { font-variant-numeric: tabular-nums; color: var(--text); }
.tl-fig { grid-template-columns: var(--tl-date) minmax(0, 1fr); }
.tl-fig figure { grid-column: 2; margin: 0 0 0 var(--s-16); }
.tl-fig img { display: block; width: 100%; height: auto; border-radius: var(--r-md); }
.tl-fig figcaption { margin-top: var(--s-12); font-size: var(--text-xs); line-height: var(--lh-caption); color: var(--text-3); max-width: 72ch; }
.tl-fig .credit { color: var(--text-4); }
.tl > li.is-now .tl-when { color: var(--text); font-weight: 600; }
@media (max-width: 640px) {
  .tl > li, .tl-fig { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); padding-left: var(--s-24); }
  .tl > li::before, .tl > li::after { left: var(--s-4); }
  .tl-when { text-align: left; padding-right: 0; }
  .tl-body { padding-left: 0; }
  .tl-fig figure { grid-column: 1; margin: 0; }
}

/* Coda without a names wall needs less room */

/* ---------- Fixes after first render ---------- */
/* Ranges are long: sized to fit their tiles in the interface numeral face  */
.rd .who-chart { background: none; box-shadow: none; padding: 0; border-radius: 0; }
/* Indirect-deaths band: neutral numbers, facts span the card */
.rd .context-inner > .yr-facts { grid-column: 1 / -1; margin-top: 0; }
.rd .context-card .rm-num { color: var(--text); font-size: var(--fs-context-card-rm-num); white-space: nowrap; }
.rd .context-card .rm-col--now .rm-num { color: var(--text-2); }
