/* ==========================================================================
   history.devpy.eu — Dynastie a siete moci (dynastie.css)
   Clean native CSS for Metro Map SVG, Scrollytelling & Regional Vector Map.
   Zero CDN dependencies. Integrated with project dark theme tokens.
   ========================================================================== */

:root {
  /* Dynasties Palette */
  --line-anjou: #f59e0b;
  --line-anjou-bright: #fbbf24;
  --line-premysl: #e11d48;
  --line-premysl-bright: #fb7185;
  --line-wittelsbach: #38bdf8;
  --line-wittelsbach-bright: #7dd3fc;
  --line-piast: #10b981;
  --line-piast-bright: #34d399;

  /* Feudal Barrier */
  --barrier-iron: #94a3b8;
  --barrier-hazard: #f97316;
  --barrier-bg: rgba(148, 163, 184, 0.15);

  /* Trade Corridors */
  --route-bohemica: #f3d078;
  --route-polonica: #34d399;
  --route-danube: #38bdf8;

  /* Codex Gold & Tone */
  --codex-gold: #d6a24a;
  --codex-gold-bright: #f3d078;
  --codex-gold-soft: rgba(214, 162, 74, 0.14);
  --codex-gold-glow: rgba(214, 162, 74, 0.35);

  --codex-text-bright: #ffffff;
  --codex-text-main: #eef1f5;
  --codex-text-dim: #cbd5e1;
  --codex-text-sub: #9ba5b4;
  --codex-text-muted: #8a94a3;

  --line-soft: rgba(238, 241, 245, 0.12);
  --line-light: rgba(255, 255, 255, 0.08);

  --font-display: "Cinzel", "Baskerville", "Georgia", "Cambria", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --transition-standard: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dynastie-page {
  background-color: #0a0e14;
  color: var(--codex-text-main);
  background-image:
    radial-gradient(circle at 18% 12%, rgba(214, 162, 74, 0.08), transparent 45%),
    radial-gradient(circle at 85% 25%, rgba(56, 189, 248, 0.06), transparent 42%),
    radial-gradient(circle at 50% 80%, rgba(225, 29, 72, 0.04), transparent 50%),
    linear-gradient(rgba(238, 241, 245, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238, 241, 245, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 40px 40px, 40px 40px;
}

.dynastie-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* ==========================================================================
   SUBHEADER: BRAND, DYNASTIC LEGEND, QUICK TABS
   ========================================================================== */
.dynastie-subbar {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 14, 20, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.65rem 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.subbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.subbar-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #131923;
  border: 1px solid var(--codex-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 10px rgba(214, 162, 74, 0.25);
}

.subbar-titles {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.subbar-kicker {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--codex-gold-bright);
}

.subbar-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--codex-text-bright);
  letter-spacing: 0.02em;
  margin: 0;
}

.dynasty-legend-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  background: rgba(23, 29, 38, 0.75);
  border: 1px solid var(--line-soft);
  border-radius: 9999px;
  font-size: 0.72rem;
  color: var(--codex-text-dim);
  white-space: nowrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-anjou { background: var(--line-anjou); box-shadow: 0 0 6px var(--line-anjou); }
.dot-premysl { background: var(--line-premysl); box-shadow: 0 0 6px var(--line-premysl); }
.dot-wittelsbach { background: var(--line-wittelsbach); box-shadow: 0 0 6px var(--line-wittelsbach); }
.dot-piast { background: var(--line-piast); box-shadow: 0 0 6px var(--line-piast); }
.dot-barrier { background: var(--barrier-iron); border: 1px dashed var(--barrier-hazard); }

.quick-tabs {
  display: inline-flex;
  background: #0c1118;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.quick-tab-btn {
  background: transparent;
  border: none;
  color: var(--codex-text-sub);
  padding: 0.25rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-standard);
}
.quick-tab-btn:hover {
  color: var(--codex-text-bright);
  background: rgba(255, 255, 255, 0.05);
}
.quick-tab-btn.is-active {
  color: #0a0e14;
  background: var(--codex-gold);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(214, 162, 74, 0.4);
}

/* ==========================================================================
   ERA INTRO BANNER
   ========================================================================== */
.era-intro-banner {
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(19, 25, 35, 0.95) 0%, rgba(12, 16, 23, 0.98) 100%);
  border-bottom: 1px solid var(--line-soft);
  padding: 1.1rem 1.4rem;
  position: relative;
}

.era-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.era-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  color: var(--codex-text-dim);
}

.era-badge-pill.primary {
  background: var(--codex-gold-soft);
  border-color: rgba(214, 162, 74, 0.45);
  color: var(--codex-gold-bright);
}

.era-badge-pill.highlight {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--line-wittelsbach-bright);
}

.era-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr);
  gap: 1.5rem;
  align-items: center;
}

.era-title-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.era-main-heading {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
  letter-spacing: 0.01em;
  margin: 0;
}

.era-subtitle-text {
  font-size: 0.88rem;
  color: var(--codex-text-sub);
  line-height: 1.55;
  max-width: 760px;
  margin: 0;
}

.era-subtitle-text strong {
  color: var(--codex-text-bright);
}

/* Horizontal Milestone Stepper */
.era-milestones-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-light);
  border-radius: 8px;
  padding: 0.35rem;
}

.milestone-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-standard);
  outline: none;
}

.milestone-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-light);
}

.milestone-tab.is-active {
  background: rgba(214, 162, 74, 0.16);
  border-color: var(--codex-gold);
  box-shadow: 0 0 10px rgba(214, 162, 74, 0.25);
}

.milestone-tab-year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--codex-gold-bright);
  line-height: 1;
}

.milestone-tab-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--codex-text-dim);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.milestone-tab.is-active .milestone-tab-label {
  color: #ffffff;
  font-weight: 700;
}

/* ==========================================================================
   METRO PANE (SCHEMATIC SVG TIMELINE)
   ========================================================================== */
.dynasty-metro-pane {
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(15, 20, 27, 0.95) 0%, rgba(10, 14, 20, 0.9) 100%);
  border-bottom: 1px solid var(--line-soft);
  padding: 0.5rem 1rem;
  position: relative;
}

.metro-header-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  color: var(--codex-text-muted);
}

.metro-kicker {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--codex-gold);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.keyboard-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--codex-text-muted);
}
.kbd-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 4px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.metro-desktop {
  display: block;
  width: 100%;
  height: 185px;
}

.metro-mobile {
  display: none;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  height: auto;
}

.metro-svg,
.metro-map {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.track-bg {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
  transition: stroke-width 0.25s ease, opacity 0.25s ease;
}

.track-anjou { stroke: var(--line-anjou); stroke-width: 6px; }
.track-premysl { stroke: var(--line-premysl); stroke-width: 4px; }
.track-wittelsbach { stroke: var(--line-wittelsbach); stroke-width: 4px; }
.track-piast { stroke: var(--line-piast); stroke-width: 4px; }
.track-arpad { stroke: #8a94a3; stroke-width: 5px; }

.track-barrier {
  fill: none;
  stroke: var(--barrier-iron);
  stroke-width: 8px;
  stroke-dasharray: 6 5;
  opacity: 0.6;
}

.oligarch-barrier text {
  stroke: none;
}

/* Station Nodes */
.metro-station {
  cursor: pointer;
  outline: none;
}

.station-hit {
  fill: transparent;
}

.station-pulse {
  fill: none;
  stroke: var(--codex-gold-bright);
  stroke-width: 2px;
  opacity: 0;
  transform-origin: center;
}

.metro-station.is-active .station-pulse {
  animation: stationRipple 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.station-ring {
  fill: #171d26;
  stroke: var(--codex-gold);
  stroke-width: 2.5px;
  transition: var(--transition-standard);
}

.station-pin {
  fill: #ffffff;
  transition: var(--transition-standard);
}

.station-label-year {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  fill: var(--codex-gold-bright);
  letter-spacing: 0.04em;
}

.station-label-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  fill: var(--codex-text-main);
  letter-spacing: 0.02em;
}

.station-label-sub {
  font-family: var(--font-body);
  font-size: 10px;
  fill: var(--codex-text-muted);
}

.metro-station:hover .station-ring,
.metro-station:focus-visible .station-ring {
  stroke: var(--codex-gold-bright);
  stroke-width: 3.5px;
  filter: drop-shadow(0 0 6px var(--codex-gold-glow));
}

.metro-station.is-active .station-ring {
  stroke: var(--codex-gold-bright);
  stroke-width: 4px;
  fill: #131923;
  filter: drop-shadow(0 0 10px var(--codex-gold));
}

.metro-station.is-active .station-pin {
  fill: var(--codex-gold-bright);
  transform: scale(1.2);
}

.metro-station:focus-visible {
  outline: 2px solid var(--codex-gold-bright);
  outline-offset: 4px;
  border-radius: 50%;
}

@keyframes stationRipple {
  0% { r: 14px; opacity: 0.9; }
  50% { r: 24px; opacity: 0.3; }
  100% { r: 32px; opacity: 0; }
}

@keyframes routeFlow {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -32; }
}

/* ==========================================================================
   LOWER SPLIT GRID: STORY NARRATIVE + GEOGRAPHIC MAP
   ========================================================================== */
.dynasty-lower-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(380px, 1.05fr) minmax(420px, 1.25fr);
  height: calc(100vh - 315px);
  min-height: 500px;
  overflow: hidden;
}

/* Left: Narrative Scrollytelling Panel */
.dynasty-narrative-pane {
  background: rgba(12, 16, 23, 0.7);
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
  padding: 1.25rem 1.4rem;
  scroll-behavior: smooth;
}

.dynasty-narrative-pane::-webkit-scrollbar {
  width: 6px;
}
.dynasty-narrative-pane::-webkit-scrollbar-track {
  background: #0a0e14;
}
.dynasty-narrative-pane::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
}
.dynasty-narrative-pane::-webkit-scrollbar-thumb:hover {
  background: var(--codex-gold);
}

.pane-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-light);
}

.pane-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--codex-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pane-scroll-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--codex-text-muted);
}

/* Manuscript Corner Brackets */
.codex-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  border-color: var(--codex-gold);
  opacity: 0.35;
  transition: var(--transition-standard);
}
.corner-tl { top: 6px; left: 6px; border-top: 2px solid; border-left: 2px solid; }
.corner-tr { top: 6px; right: 6px; border-top: 2px solid; border-right: 2px solid; }
.corner-bl { bottom: 6px; left: 6px; border-bottom: 2px solid; border-left: 2px solid; }
.corner-br { bottom: 6px; right: 6px; border-bottom: 2px solid; border-right: 2px solid; }

/* Story Card */
.story-card {
  position: relative;
  background: linear-gradient(165deg, rgba(23, 29, 38, 0.85) 0%, rgba(15, 20, 27, 0.95) 100%);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 1.4rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.story-card:hover {
  border-color: rgba(214, 162, 74, 0.45);
}

.story-card.is-active {
  border-color: var(--codex-gold);
  background: linear-gradient(165deg, rgba(27, 34, 45, 0.96) 0%, rgba(17, 23, 32, 0.98) 100%);
  box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.85), 0 0 24px -4px var(--codex-gold-glow);
  transform: translateY(-2px);
}

.story-card.is-active .codex-corner {
  opacity: 1;
  border-color: var(--codex-gold-bright);
  width: 16px;
  height: 16px;
}

.card-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  gap: 0.5rem;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  background: var(--codex-gold-soft);
  border: 1px solid rgba(214, 162, 74, 0.35);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--codex-gold-bright);
  letter-spacing: 0.05em;
}

.card-year-tag {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--codex-gold-bright);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--codex-text-bright);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.card-perex {
  font-size: 0.92rem;
  font-style: italic;
  color: var(--codex-gold-bright);
  line-height: 1.5;
  padding: 0.6rem 0.8rem;
  background: rgba(214, 162, 74, 0.06);
  border-left: 3px solid var(--codex-gold);
  border-radius: 0 6px 6px 0;
  margin-bottom: 1rem;
}

.card-actors-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.actor-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.65rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 500;
  background: rgba(15, 20, 27, 0.75);
  border: 1px solid var(--line-soft);
  color: var(--codex-text-dim);
}
.actor-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.actor-anjou::before { background: var(--line-anjou); }
.actor-premysl::before { background: var(--line-premysl); }
.actor-wittelsbach::before { background: var(--line-wittelsbach); }
.actor-piast::before { background: var(--line-piast); }
.actor-oligarch::before { background: var(--barrier-iron); }
.actor-anjou { border-color: rgba(245, 158, 11, 0.35); }
.actor-premysl { border-color: rgba(225, 29, 72, 0.35); }
.actor-wittelsbach { border-color: rgba(56, 189, 248, 0.35); }
.actor-piast { border-color: rgba(16, 185, 129, 0.35); }
.actor-oligarch { border-color: rgba(148, 163, 184, 0.35); }

/* Structured 3-Step Narrative */
.narrative-steps {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.narrative-block {
  background: rgba(10, 14, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--codex-gold);
  border-radius: 0 8px 8px 0;
  padding: 0.85rem 1rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.narrative-block:hover {
  background: rgba(19, 25, 35, 0.85);
  border-color: rgba(255, 255, 255, 0.16);
}

.block-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--codex-gold);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.block-key-point {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.block-text {
  font-size: 0.88rem;
  color: var(--codex-text-dim);
  line-height: 1.55;
  margin: 0;
}

.block-text strong {
  color: #ffffff;
  font-weight: 600;
}

/* Card Interactive Location Triggers */
.card-locations {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line-light);
}

.locations-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--codex-text-muted);
  margin-right: 0.25rem;
}

.place-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.74rem;
  color: var(--codex-text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition-standard);
}
.place-btn:hover {
  background: var(--codex-gold-soft);
  border-color: var(--codex-gold);
  color: var(--codex-gold-bright);
}

/* Card Evidence & Sources Box (Historiographic Precision) */
.card-evidence-box {
  background: rgba(14, 20, 30, 0.7);
  border: 1px solid rgba(214, 162, 74, 0.25);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.evidence-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line-soft);
}

.evidence-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.evidence-badge.fact {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
.evidence-badge.interp {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}
.evidence-badge.caveat {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.evidence-row {
  margin-bottom: 0.45rem;
  color: var(--codex-text-dim);
}
.evidence-row strong {
  color: var(--codex-text-bright);
}

.evidence-sources {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
  color: var(--codex-text-muted);
}
.evidence-sources strong {
  color: var(--codex-gold-bright);
  font-family: var(--font-mono);
}

/* Metro Dynasty Explanation Bar */
.metro-dynasty-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.45rem;
  margin-top: 0.35rem;
  margin-bottom: 0.55rem;
  padding: 0.5rem 0.75rem;
  background: rgba(10, 14, 20, 0.65);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 0.72rem;
}
.dynasty-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  color: var(--codex-text-dim);
  line-height: 1.35;
}
.dynasty-legend-item strong {
  color: var(--codex-text-bright);
}

/* Historiography & Sources Section at bottom of page */
.dynasty-bibliography-pane {
  background: #0a0e14;
  border-top: 1px solid var(--line-soft);
  padding: 2.2rem 1.4rem 3rem;
}
.biblio-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.biblio-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--codex-gold-bright);
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.biblio-subtitle {
  font-size: 0.88rem;
  color: var(--codex-text-muted);
  margin-bottom: 1.4rem;
  max-width: 860px;
  line-height: 1.55;
}
.biblio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}
.biblio-card {
  background: rgba(15, 20, 27, 0.75);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 1.15rem;
}
.biblio-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--codex-text-bright);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.biblio-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.8rem;
  color: var(--codex-text-dim);
  line-height: 1.45;
}
.biblio-list li {
  padding-left: 0.9rem;
  position: relative;
}
.biblio-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--codex-gold);
}

/* ==========================================================================
   RIGHT: REGIONAL GEOGRAPHIC MAP
   ========================================================================== */
.dynasty-geomap-pane {
  position: relative;
  background: #080c12;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-header-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(15, 20, 27, 0.85);
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.75rem;
}

.map-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--codex-text-bright);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.map-legend-items {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--codex-text-muted);
}

.map-legend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.map-viewport {
  flex: 1 1 auto;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 380px;
}

.geo-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Cartographic Elements */
.land-base {
  fill: #0c121b;
  stroke: none;
}

.komitat-poly {
  fill: #111722;
  stroke: rgba(238, 241, 245, 0.12);
  stroke-width: 0.75px;
  transition: fill 0.3s ease, stroke 0.3s ease;
}
.komitat-poly:hover {
  fill: #192231;
  stroke: rgba(214, 162, 74, 0.4);
}

/* River Danube */
.water-danube {
  fill: none;
  stroke: var(--route-danube);
  stroke-width: 3.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
  filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.4));
}

.danube-tributary {
  fill: none;
  stroke: rgba(56, 189, 248, 0.45);
  stroke-width: 1.5px;
  stroke-linecap: round;
}

/* Territorial Overlays */
.territory-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.territory-overlay.is-visible {
  opacity: 1;
}

.cak-territory {
  fill: rgba(225, 29, 72, 0.14);
  stroke: var(--line-premysl);
  stroke-width: 1.8px;
  stroke-dasharray: 5 3;
}

.omodej-territory {
  fill: rgba(249, 115, 22, 0.14);
  stroke: var(--barrier-hazard);
  stroke-width: 1.8px;
  stroke-dasharray: 5 3;
}

.mining-glow {
  fill: radial-gradient(circle, rgba(245, 158, 11, 0.32) 0%, rgba(245, 158, 11, 0) 70%);
  pointer-events: none;
}

/* Trade Corridors */
.trade-corridor {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.15;
  stroke-dasharray: 6 4;
  cursor: pointer;
  transition: opacity 0.4s ease, stroke-width 0.4s ease;
}

.trade-corridor:hover {
  opacity: 0.8;
  stroke-width: 3px;
}

.trade-corridor:focus-visible {
  outline: 2px solid var(--codex-gold-bright);
  outline-offset: 4px;
}

.trade-corridor.is-active {
  opacity: 0.95;
  stroke-width: 3.5px;
  animation: routeFlow 2.8s linear infinite;
}

.corridor-bohemica {
  stroke: var(--route-bohemica);
}

.corridor-polonica {
  stroke: var(--route-polonica);
}

/* Vienna Stapelrecht Symbol */
.vienna-barrier {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.vienna-barrier.is-visible {
  opacity: 1;
}

/* City Nodes */
.geo-city-node {
  cursor: pointer;
  outline: none;
  transition: transform 0.25s ease;
}

.city-halo {
  fill: none;
  stroke: var(--codex-gold-bright);
  stroke-width: 2px;
  opacity: 0;
  transform-origin: center;
}

.geo-city-node.is-station-focus .city-halo {
  opacity: 0.8;
  animation: cityPulse 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.city-marker {
  fill: #171d26;
  stroke: var(--codex-text-sub);
  stroke-width: 1.5px;
  transition: var(--transition-standard);
}

.geo-city-node:hover .city-marker,
.geo-city-node:focus-visible .city-marker {
  fill: var(--codex-gold);
  stroke: #ffffff;
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 6px var(--codex-gold));
}

.geo-city-node.is-station-focus .city-marker {
  fill: var(--codex-gold-bright);
  stroke: #ffffff;
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 8px var(--codex-gold-bright));
}

.city-label-bg {
  fill: rgba(10, 14, 20, 0.82);
  rx: 4px;
  ry: 4px;
}

.city-label-text {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  fill: var(--codex-text-dim);
  pointer-events: none;
  transition: fill 0.2s ease, font-weight 0.2s ease;
}

.geo-city-node.is-station-focus .city-label-text {
  fill: #ffffff;
  font-weight: 700;
}

.geo-city-node:focus-visible {
  outline: 2px solid var(--codex-gold-bright);
  outline-offset: 4px;
}

@keyframes cityPulse {
  0% { r: 6px; opacity: 0.9; }
  50% { r: 16px; opacity: 0.25; }
  100% { r: 24px; opacity: 0; }
}

/* Map Status Overlay */
.map-status-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: rgba(15, 20, 27, 0.92);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  pointer-events: auto;
}

.status-text-group {
  display: flex;
  flex-direction: column;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--codex-gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-desc {
  font-size: 0.82rem;
  color: var(--codex-text-main);
  line-height: 1.35;
}

.status-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.status-mini-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  color: var(--codex-text-dim);
  cursor: pointer;
  font-family: var(--font-mono);
}
.status-mini-btn:hover {
  background: var(--codex-gold-soft);
  border-color: var(--codex-gold);
  color: var(--codex-gold-bright);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1023px) {
  .dynasty-lower-grid {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .dynasty-narrative-pane {
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
    height: auto;
    overflow-y: visible;
    max-height: none;
  }

  .dynasty-geomap-pane {
    height: 480px;
    min-height: 440px;
  }

  .metro-desktop {
    display: none;
  }

  .metro-mobile {
    display: block;
  }
}

@media (max-width: 767px) {
  .dynastie-subbar {
    padding: 0.5rem 0.75rem;
  }

  .subbar-title {
    font-size: 0.95rem;
  }

  .dynasty-legend-bar {
    display: none;
  }

  .dynasty-metro-pane {
    padding: 0.5rem 0.5rem;
  }

  .dynasty-narrative-pane {
    padding: 1rem 0.75rem;
  }

  .dynasty-geomap-pane {
    height: 420px;
  }

  .map-status-overlay {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 0.5rem 0.65rem;
  }
}

/* Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .station-pulse, .city-halo {
    display: none !important;
  }
  .trade-corridor.is-active {
    animation: none !important;
  }
}

