/* History of Islam — site styles loaded after core/css/style.css. */

/* The History of Islam lockup is taller than the core default logo. */
#app-logo { width:180px; }
@media (max-width:1200px) { #app-logo { width:142.5px; } }
@media (max-width:960px)  { #app-logo { width:170px; } }
@media (max-width:760px)  { #app-logo { width:150px; } }
@media (max-width:520px)  { #app-logo { width:130px; } }

/* Caliph profile badges (site.php 'rulers.badges'). */
.rp-badge--rival { border-color:rgba(200,110,95,0.6); color:#d99a8e; }
.rp-badge--office { border-color:rgba(255,255,255,0.25); color:var(--white-mid); }
.rp-badge--branch { border-color:rgba(122,170,120,0.55); color:#9cc59a; }

/* ════════════════════════════════════════
   MAP — "The Islamic World Through Time" (js/islam-map.js). Reuses core's
   .cm-* page, controls, panel and legend, like the country maps
   (countries/saudi/css/theme.css); these rules style the map layers (sea,
   land, one fading path per region, the modern outline, Mecca and Medina)
   and the panel parts. Muslim states take their colour inline from the
   dataset; context states are grey.
════════════════════════════════════════ */
.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 ("17 June 656"), 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; }

/* Chapter sources (keyframe.sources) under the events. */
.cm-k-src {
  margin:18px 0 0;
  font-family:var(--f-ui); font-size:12.5px; line-height:1.55; color:rgba(255,255,255,0.5);
}
.cm-k-src[hidden] { display:none; }
.cm-k-src-label { color:rgba(255,255,255,0.62); }
.cm-k-src a { color:rgba(255,255,255,0.72); text-decoration:underline; text-decoration-color:rgba(255,255,255,0.25); text-underline-offset:2px; }
.cm-k-src a:hover { color:var(--gold); text-decoration-color:currentColor; }

/* States featured in the chapter, in their map colours. */
.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 caliph?" in the year shown: the event modal's .em-power card,
   compacted for the panel. */
.em-power.cm-power { display:block; margin-top:4px; }
.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; }

.hm-sea { fill:#0a0f1a; }
.hm-land { fill:#1b1f2a; }
/* Each region path is shown (display) by islam-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, filter 0.15s ease, stroke 0.3s ease;
}
.hm-regions path.is-on { opacity:1; pointer-events:auto; }
.hm-regions path.hm-isl.is-on { opacity:0.9; }
.hm-regions.is-instant path { transition:none; }
.hm-regions path:hover { filter:brightness(1.25); stroke:var(--gold); stroke-width:1.4; }
.hm-neighbor { fill:#34313f; fill-opacity:0.85; }
.hm-regions path.hm-lineage { stroke:#f3e2b8; stroke-width:1.5; }
.hm-ref {
  fill:none; stroke:#f1e6cf; stroke-width:1.2; stroke-dasharray:5 4;
  vector-effect:non-scaling-stroke; opacity:0.55; pointer-events:none;
}

/* Mecca and Medina while the state is tiny (622–640). */
.hm-city { opacity:0; visibility:hidden; transition:opacity 0.4s ease, visibility 0s linear 0.4s; pointer-events:none; }
.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;
}
@media (prefers-reduced-motion: reduce) {
  .hm-regions path, .hm-city { transition:none; }
}

/* Legend: ten regional groups in two columns, dimmed when absent. */
.cm-legend-col--groups { flex:2 1 auto; }
.cm-lg--groups { display:grid; grid-template-columns:repeat(2, minmax(0, auto)); gap:5px 18px; }
.cm-lg--groups span { transition:opacity 0.3s ease; }
.cm-lg--groups span.is-off { opacity:0.32; }
.hm-sw { display:inline-block; width:11px; height:11px; flex:none; }
.hm-sw--neighbor { background:#34313f; box-shadow:inset 0 0 0 1px rgba(255,255,255,0.18); }
.hm-sw--lineage { background:transparent; box-shadow:inset 0 0 0 1.5px #f3e2b8; }
.cm-lg i.hm-sw--ref { width:18px; height:0; background:none; }
.hm-sw--ref { border-top:2px dashed #f1e6cf; }
@media (max-width:520px) {
  .cm-lg--groups { grid-template-columns:minmax(0, 1fr); }
}

/* 41 keyframes on a stretched scale: islam-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; }
.cm-tick-labels button:first-child { transform:none; }
.cm-tick-labels button:last-child { transform:translateX(-100%); }
/* Ten era buttons: two rows of five on mid-size screens, then three. */
@media (max-width:1280px) {
  .cm-eras { grid-template-columns:repeat(5, minmax(0, 1fr)) !important; }
}
@media (max-width:900px) {
  .cm-eras { grid-template-columns:repeat(3, minmax(0, 1fr)) !important; }
}

/* Event modal / timeline map cards: the Muslim states of the year. */
.em-map-thumb .hm-thumb-land { fill:#2a2633; }
.em-map-thumb .hm-thumb-neighbor { fill:#3a3646; }
.em-map-thumb .hm-thumb-isl { stroke:#08060f; stroke-width:0.6; vector-effect:non-scaling-stroke; }
