/* History of Saudi Arabia — overrides loaded after core/css/style.css: the
   inline SVG logo, the "Arabia Through Time" map layers (js/saudi-map.js),
   the prime minister in "Who Was in Power", ten At a Glance ages in one row,
   and three rulers-tab icons. */

/* 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 — Ancient Arabia (a Hegra tomb facade), Caliphs & Sultans
   (dome and crescent) and House of Saud (palm) tab icons; site.php gives
   those tabs icon 'none', so they are drawn here in the tab's text colour.
════════════════════════════════════════ */
.rp-tab[data-tab="ancient"]::before,
.rp-tab[data-tab="islamic"]::before,
.rp-tab[data-tab="saudi"]::before {
  content:''; flex-shrink:0; width:14px; height:14px;
  background-color:currentColor;
  -webkit-mask:var(--sa-tab-icon) center / contain no-repeat;
  mask:var(--sa-tab-icon) center / contain no-repeat;
}
.rp-tab[data-tab="ancient"] {
  --sa-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 14.5V5.5h10v9M1.5 14.5h13M3 5.5l1.2-1.5 1.2 1.5 1.3-1.5 1.3 1.5 1.3-1.5 1.3 1.5 1.2-1.5 1.2 1.5M6.2 14.5v-4.2h3.6v4.2M5 8h6' fill='none' stroke='%23000' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}
.rp-tab[data-tab="islamic"] {
  --sa-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8.9 1.6a1.5 1.5 0 1 0 0 2.4 1.9 1.9 0 0 1 0-2.4zM8 4.3v1.2M3.8 9.5a4.2 4.2 0 0 1 8.4 0M2.5 14.5v-5h11v5M1.5 14.5h13M7 14.5v-2.4a1 1 0 0 1 2 0v2.4' fill='none' stroke='%23000' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}
.rp-tab[data-tab="saudi"] {
  --sa-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 14.5c.2-3 .2-6 0-8.5M8 6C6.5 4.3 4 3.8 2 4.8M8 6c1.5-1.7 4-2.2 6-1.2M8 6C7 4 7.2 2.5 8.3 1.5M8 6c-1.6-.5-3.8.3-5 2.2M8 6c1.6-.5 3.8.3 5 2.2M4.5 14.5h7' fill='none' stroke='%23000' stroke-width='1.3' 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 — "Arabia Through Time" (js/saudi-map.js). Reuses core's .cm-* page,
   controls, panel and legend; these rules style the map layers (sea, land,
   one fading path per region and the modern outline) 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 (gold = Arabian, green = other power). */
.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:#0a0f1a; }
.hm-land { fill:#1b1f2a; }
/* Each region path is shown (display) by saudi-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; }
.hm-focus { fill:#c9a844; }
.hm-related { fill:#6f8f80; }
.hm-neighbor { fill:#3a3646; fill-opacity:0.92; }
/* Extents drawn for this project from written descriptions (approx). */
.hm-regions path.hm-approx { stroke:#f3e2b8; stroke-width:1.1; stroke-dasharray:4 3; }
.hm-ref {
  fill:none; stroke:#f1e6cf; stroke-width:1.4; 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; }
}

/* Legend and tooltip swatches */
.hm-sw { display:inline-block; width:11px; height:11px; flex:none; }
.hm-sw--focus { background:#c9a844; }
.hm-sw--related { background:#6f8f80; }
.hm-sw--neighbor { background:#3a3646; 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; }
.hm-sw--approx { background:transparent; border:1px dashed #f3e2b8; }

/* 48 keyframes on a stretched scale: saudi-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 saudi-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-related { fill:#8a7a4a; }
.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;
}
