/* =====================================================================
   MIRROR of src/styles/global.css — served as a static asset.
   index.astro links this file directly (see <head>). Keep the two files
   in sync: edit src/styles/global.css, then copy it over this file.
   ===================================================================== */

/* Global styles — dark slate theme prioritizing historical polygon visibility */

:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #020617; /* slate-950 */
  color: #f1f5f9; /* slate-100 */
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- App shell ---------- */
.app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.map-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #0f172a; /* slate-900 while tiles load */
}

/* ---------- Title overlay ---------- */
.app-title {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  text-align: center;
  padding: 0.5rem 1.25rem;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid #1e293b;
  border-radius: 0.75rem;
  backdrop-filter: blur(8px);
}

.app-title h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fbbf24; /* amber-400 */
}

.app-title p {
  margin: 0;
  font-size: 0.72rem;
  color: #94a3b8; /* slate-400 */
}

/* ---------- Info panel (sidebar) ---------- */
.info-panel {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  width: min(21rem, calc(100vw - 2rem));
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.85);
  border: 1px solid #1e293b;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.info-panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: #fbbf24;
}

.info-panel h3 {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.95rem;
  color: #e2e8f0;
}

.info-panel p {
  margin: 0.4rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.info-panel .muted {
  color: #94a3b8;
  font-size: 0.8rem;
}

/* When a polity is selected, its scholarly record is the primary view;
   the compact Timeline Context strip below is separated with a divider. */
.info-panel .panel-context-compact {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #1e293b;
}

.info-panel .panel-context-compact h2 {
  font-size: 0.9rem;
  color: #e2e8f0;
}

.info-panel .panel-context-compact h3 {
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

.info-panel .panel-context-compact p {
  font-size: 0.78rem;
  line-height: 1.45;
}

.info-panel ul {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #94a3b8;
}

.info-panel .hint {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  font-style: italic;
  color: #64748b;
}

.info-panel .close-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  color: #e2e8f0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: background 0.15s;
}

.info-panel .close-btn:hover {
  background: #334155;
}

.info-panel .tag {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.15rem 0.6rem;
  font-size: 0.7rem;
  color: #fbbf24;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 999px;
}

/* Type / religion badges */
.info-panel .badges {
  margin: 0.35rem 0;
}

.info-panel .tag-type {
  color: #a5f3fc;
  border-color: #164e63;
  background: #083344;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.info-panel .tag-religion {
  color: #fbcfe8;
  border-color: #500724;
  background: #4a044e;
}

/* Alternate names */
.info-panel .alt-names {
  font-size: 0.72rem;
  font-style: italic;
}

/* Fact list (capital, region, dynasty, founder) */
.info-panel .facts {
  margin: 0.5rem 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #cbd5e1;
}

/* Confidence flags */
.info-panel .confidence {
  margin: 0.5rem 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.6);
  border-left: 2px solid #f59e0b;
  border-radius: 0.25rem;
}

/* Lineage (predecessor / successor) links */
.info-panel .lineage {
  font-size: 0.8rem;
  line-height: 1.6;
}

.info-panel .lineage-link {
  display: inline-block;
  margin: 0 0.15rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  color: #fbbf24;
  background: #1e293b;
  border: 1px solid #f59e0b;
  border-radius: 0.3rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.info-panel .lineage-link:hover {
  color: #0f172a;
  background: #fbbf24;
}

/* ---------- Legend overlay ---------- */
.legend {
  position: absolute;
  bottom: 6.5rem;
  right: 1rem;
  z-index: 10;
  padding: 0.65rem 0.85rem;
  font-size: 0.72rem;
  line-height: 1.7;
  color: #94a3b8;
  background: rgba(2, 6, 23, 0.85);
  border: 1px solid #1e293b;
  border-radius: 0.7rem;
  backdrop-filter: blur(10px);
  max-width: 14rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.legend-swatch {
  flex: 0 0 auto;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 0.2rem;
  border: 1px solid #334155;
  background: #f59e0b;
}

.legend-swatch--lowconf {
  background: transparent;
  border: 1.5px dashed #fbbf24;
}

.legend-swatch--capital {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: #fbbf24;
}

.legend-note {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid #1e293b;
  font-size: 0.66rem;
  font-style: italic;
  color: #64748b;
}

/* ---------- Timeline bar ---------- */
.timeline-bar {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: min(56rem, calc(100vw - 2rem));
  padding: 0.9rem 1.1rem;
  background: rgba(2, 6, 23, 0.9);
  border: 1px solid #1e293b;
  border-radius: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.timeline-year {
  font: 700 1.15rem ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color: #fbbf24;
}

.timeline-era {
  font-size: 0.78rem;
  color: #94a3b8;
}

.milestones {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.milestone-btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
  color: #e2e8f0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.milestone-btn:hover {
  background: #334155;
  border-color: #475569;
}

.milestone-btn.active {
  color: #0f172a;
  font-weight: 600;
  background: #f59e0b;
  border-color: #f59e0b;
}

.slider {
  width: 100%;
  cursor: pointer;
  accent-color: #f59e0b;
}
