/* History of Iraq — overrides loaded after core/css/style.css: the inline
   SVG logo, the "Iraq Through Time" map layers (js/iraq-map.js), the
   prime ministers in "Who Was in Power", ten At a Glance ages in one row,
   and two rulers-tab icons. Adapted from the Israel site's theme. */

/* Inline SVG logo (partials/logo.php, site.php logo_partial) — sized like
   the image logo of the other sites. */
#app-logo.app-logo-svg { height:auto; overflow:visible; }

/* ════════════════════════════════════════
   Rulers page — Sumer, Babylon & Assyria (ziggurat) and Empires & Caliphs
   (domed mosque) tab icons; site.php gives those tabs icon 'none', so they
   are drawn here in the tab's text colour.
════════════════════════════════════════ */
.rp-tab[data-tab="mesopotamia"]::before,
.rp-tab[data-tab="empires"]::before {
  content:''; flex-shrink:0; width:14px; height:14px;
  background-color:currentColor;
  -webkit-mask:var(--iq-tab-icon) center / contain no-repeat;
  mask:var(--iq-tab-icon) center / contain no-repeat;
}
.rp-tab[data-tab="mesopotamia"] {
  --iq-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 14h13M2.8 14v-3h10.4v3M4.4 11V8h7.2v3M6 8V5h4v3M7.2 5V2.5h1.6V5' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}
.rp-tab[data-tab="empires"] {
  --iq-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 14.2h13M3 14.2V9.5h10v4.7M4 9.5a4 4 0 0 1 8 0M8 5.5V3.6M7 2.6a1.3 1.3 0 1 0 2 0M6.5 14.2v-2.4a1.5 1.5 0 0 1 3 0v2.4' fill='none' stroke='%23000' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ════════════════════════════════════════
   At a Glance — ten ages: one column per age, all in a single row (core
   lays out eight); bibliography in four columns.
════════════════════════════════════════ */
@media (min-width:901px) {
  .ag-era-list { grid-template-columns:none; grid-auto-flow:column; grid-auto-columns:minmax(0, 1fr); }
}
.bib-groups { grid-template-columns:repeat(4, minmax(0, 1fr)); }

/* ════════════════════════════════════════
   "Who Was in Power" — ruler and prime minister side by side (event modal
   and map panel); the columns stack once each would drop below ~200px.
════════════════════════════════════════ */
.em-power {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap:12px 20px;
  align-items:start;
}
.em-power > .em-power-heading { grid-column:1 / -1; margin-bottom:1px; }
a.em-power-card--pm { color:inherit; text-decoration:none; }
.em-power-party {
  display:flex; align-items:center; gap:6px;
  font-family:var(--f-ui); font-size:13px; line-height:1.3; color:var(--white-dim);
}
.em-power-party i { width:9px; height:9px; border-radius:50%; flex:none; }

/* ════════════════════════════════════════
   MAP — "Iraq Through Time" (js/iraq-map.js). Reuses core's .cm-* page,
   controls, panel and legend; these rules style the map layers (sea, land,
   one fading path per region, the modern lines and place labels) and the panel parts
   shared with the other country maps.
════════════════════════════════════════ */
.cm-year-note {
  margin-top:4px;
  font-family:var(--f-ui); font-size:13px; color:var(--white-dim);
}
.cm-year-note:empty { display:none; }
.cm-tip-dates { margin-top:3px; font-variant-numeric:tabular-nums; color:var(--white-dim); }

/* Chapter events: dates can be long ("13–20 Jul 2026"), so a wider,
   right-aligned year column with the day/month on a smaller line below. */
.cm-events .ag-event { grid-template-columns:78px 9px minmax(0, 1fr); column-gap:16px; }
.cm-events .ag-event::before { left:98px; }
.cm-events .ag-event-year { overflow-wrap:break-word; text-align:right; }
.cm-event-day {
  display:block; margin-top:2px;
  font-family:var(--f-ui); font-size:12px; line-height:1.3; letter-spacing:0.2px;
  color:rgba(255,255,255,0.45);
}
.cm-events-heading { margin:30px 0 6px; }

/* Highlighted powers of the chapter: the states ruling Iraq, in three gold
   shades. */
.cm-chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.cm-chips[hidden] { display:none; }
.cm-chip {
  display:inline-flex; align-items:center; gap:7px;
  padding:3px 10px;
  border:1px solid rgba(255,255,255,0.14); border-radius:999px;
  background:rgba(255,255,255,0.03);
  font-family:var(--f-ui); font-size:13px; line-height:1.35; color:var(--white);
}

/* "Who Was in Power" in the year shown: the event modal's .em-power cards,
   compacted for the panel. */
.em-power.cm-power { display:block; margin-top:4px; } /* beats .em-power's grid; the cards grid below */
.em-power.cm-power[hidden] { display:none; }
.em-power.cm-power > .em-power-heading { margin:26px 0 10px; }
.cm-power-cards {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap:10px 16px;
}
.cm-power .em-power-card { padding:6px 8px 6px 6px; border:1px solid rgba(255,255,255,0.1); border-radius:4px; gap:12px; }
.cm-power .em-power-portrait { width:42px; height:48px; }
.cm-power .em-power-name { font-size:16px; }
.cm-power .em-power-title,
.cm-power .em-power-reign { margin-top:2px; }
.cm-power .cm-power-static { cursor:default; }
.cm-power .cm-power-static:hover { border-color:rgba(255,255,255,0.1); background:none; }

.hm-sea { fill:#0f1a21; }
.hm-land { fill:#262f33; }
/* Each region path is shown (display) by iraq-map.js, then faded in with
   .is-on; a fading-out path no longer takes the pointer. */
.hm-regions path {
  stroke:#08060f; stroke-width:0.7; stroke-linejoin:round;
  vector-effect:non-scaling-stroke; cursor:pointer;
  opacity:0; pointer-events:none;
  transition:opacity 0.45s ease, fill 0.6s ease, filter 0.15s ease;
}
.hm-regions path.is-on { opacity:1; pointer-events:auto; }
.hm-regions.is-instant path { transition:none; }
.hm-regions path:hover { filter:brightness(1.25); stroke:var(--gold); stroke-width:1.4; }
/* The lineage of the chapter in three gold shades (as in
   data/iraq-map.html), other rulers of Iraq green, the rest grey. */
.hm-focus { fill:#c9a844; }
.hm-focus2 { fill:#a9763c; }
.hm-focus3 { fill:#8c4a3a; }
.hm-related { fill:#6f8f80; }
.hm-neighbor { fill:#3b474e; fill-opacity:0.88; }
.hm-ref {
  fill:none; stroke:#f1e6cf; stroke-width:1.2; stroke-dasharray:5 4;
  vector-effect:non-scaling-stroke; opacity:0.8; pointer-events:none;
}
@media (prefers-reduced-motion: reduce) {
  .hm-regions path { transition:none; }
}

/* Places: radius, font size and halo are set in map units by iraq-map.js
   so they read at a constant screen size at every zoom; it also shows only
   the ranks that fit the zoom (.is-on). */
.hm-cities { pointer-events:none; }
.hm-city { opacity:0; visibility:hidden; transition:opacity 0.4s ease, visibility 0s linear 0.4s; }
.hm-city.is-on { opacity:1; visibility:visible; transition:opacity 0.4s ease; }
.hm-city circle { fill:#f4ecd6; stroke:#08060f; stroke-width:1.2; vector-effect:non-scaling-stroke; }
.hm-city text {
  font-family:var(--f-heading); font-weight:600; fill:var(--white);
  paint-order:stroke; stroke:#08060f; stroke-linejoin:round;
}
/* Ancient sites: italic serif name, gold ring. */
.hm-city--site circle { fill:#08060f; stroke:#e3c46a; }
.hm-city--site text { font-family:Georgia, 'Times New Roman', serif; font-style:italic; fill:#f3dc9a; }
@media (prefers-reduced-motion: reduce) {
  .hm-city { transition:none; }
}

/* Legend and tooltip swatches */
.hm-sw { display:inline-block; width:11px; height:11px; flex:none; }
.hm-sw--focus { background:#c9a844; }
.hm-sw--focus2 { background:#a9763c; }
.hm-sw--focus3 { background:#8c4a3a; }
.hm-sw--related { background:#6f8f80; }
.hm-sw--neighbor { background:#3b474e; box-shadow:inset 0 0 0 1px rgba(255,255,255,0.18); }
.cm-lg i.hm-sw--ref { width:18px; height:0; background:none; }
.hm-sw--ref { border-top:2px dashed #f1e6cf; }
.cm-lg i.hm-sw--city { width:7px; height:7px; margin:0 2px; border-radius:50%; background:#f4ecd6; box-shadow:0 0 0 1.5px #08060f; }
.cm-lg i.hm-sw--site { width:7px; height:7px; margin:0 2px; border-radius:50%; background:#08060f; box-shadow:0 0 0 1.5px #e3c46a; }

/* 47 keyframes on a stretched scale: iraq-map.js marks the labels that
   would collide at the track's width (the current one always shows). */
.cm-tick-labels button.hm-minor:not(.cur) { display:none; }
/* Keep the first and last keyframe years inside the track. */
.cm-tick-labels button:first-child { transform:none; }
.cm-tick-labels button:last-child { transform:translateX(-100%); }
@media (max-width:900px) {
  /* The era count is set inline by iraq-map.js; wrap to rows here. */
  .cm-eras { grid-template-columns:repeat(3, minmax(0, 1fr)) !important; }
}

/* Event modal / timeline map cards: the borders of the year. */
.em-map-thumb .hm-thumb-land { fill:#2a2633; }
.em-map-thumb .hm-thumb-focus { fill:var(--gold); filter:drop-shadow(0 0 6px rgba(201,168,68,0.6)); }
.em-map-thumb .hm-thumb-focus2 { fill:#a9763c; }
.em-map-thumb .hm-thumb-focus3 { fill:#8c4a3a; }
.em-map-thumb .hm-thumb-related { fill:#5f7a6d; }
.em-map-thumb .hm-thumb-ref {
  fill:none; stroke:#f1e6cf; stroke-width:1.2; stroke-dasharray:3 3;
  vector-effect:non-scaling-stroke; opacity:0.6;
}
