:root {
  --bg: #0f1419;
  --panel: #171d26;
  --ink: #eef1f5;
  --muted: #8a94a3;
  --line: rgba(238,241,245,0.12);
  --building: #d6a24a;
  --person: #4a9fd6;
  --institution: #4ad69b;
  --conflict: #d64a5c;
  /* Kategorická paleta pre regióny na mapách správneho členenia (spravne-clenenie.html) —
     len na vizuálne odlíšenie susedných regiónov, bez sémantického významu farby. */
  --region-1: #d6a24a; --region-2: #4a9fd6; --region-3: #4ad69b; --region-4: #d64a5c;
  --region-5: #9b6fd6; --region-6: #d6c14a; --region-7: #4ad6c1; --region-8: #d68a4a;
  --region-9: #6f9bd6; --region-10: #a3d64a; --region-11: #d64a9b; --region-12: #4ad673;
  --region-13: #c14ad6; --region-14: #d65a4a; --region-15: #4a73d6; --region-16: #d6a24a;
  --region-17: #73d64a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Navbar — spoločná pre všetky stránky (base.html). Farby/font/aktívny stav sú redesign;
   Tera logika, ktorá priraďuje class="active" (base.html), sa nemení — len jej CSS. */
#navbar {
  position: sticky; top: 0; z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 52px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
#navbar::-webkit-scrollbar { display: none; }
#navbar .brand {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  margin-right: auto;
  white-space: nowrap;
  flex: 0 0 auto;
}
#navbar .sep { color: var(--line); font-size: 12px; user-select: none; flex: 0 0 auto; }
#navbar .links { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
#navbar a {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.15s ease;
}
#navbar a:hover { color: var(--ink); }
#navbar a.active {
  color: var(--building);
  font-weight: 600;
}
#navbar .links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -9px;
  height: 2px;
  background: var(--building);
  border-radius: 2px;
  box-shadow: 0 0 7px rgba(214,162,74,0.65);
}

/* Mind mapa (sloh.html) */
#wrap {
  position: relative;
  width: 100%;
  height: 78vh;
  min-height: 460px;
  max-height: 720px;
  overflow: hidden;
}
/* Bare "svg" by tag (not scoped to #wrap) previously leaked into Leaflet's own internal renderer
   <svg> on spravne-clenenie.html, overriding its pixel width/height attributes with percentage
   sizing and collapsing it to 0×0 against its unsized parent pane — scope to sloh.html's own
   top-level map svg only. */
#wrap > svg { width: 100%; height: 100%; cursor: grab; touch-action: none; }
#wrap > svg:active { cursor: grabbing; }

.node circle {
  stroke: var(--bg);
  stroke-width: 2px;
  cursor: pointer;
  transition: r 0.15s ease;
}
.node { -webkit-tap-highlight-color: transparent; user-select: none; }
.node:hover circle { filter: brightness(1.25); }
.node text {
  font-size: 12px;
  fill: var(--ink);
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.link { stroke: var(--line); stroke-width: 1.4px; }
.link-label {
  font-size: 10px;
  fill: var(--muted);
  pointer-events: none;
}

#legend {
  position: absolute; top: 20px; left: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.9;
}
#legend .dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:8px; }

#title {
  max-width: 560px;
  margin: 20px auto 16px;
  padding: 0 20px;
  text-align: center;
}
#title h1 { font-size: 20px; font-weight: 600; margin: 0; }
#title p { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
#title .teaser { font-size: 12.5px; font-weight: 600; margin: 10px 0 0; line-height: 1.4; }

#card {
  position: absolute; top: 20px; right: 20px; width: 300px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  opacity: 0; transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
#card.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#card-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 22px; line-height: 1; padding: 4px 6px;
  cursor: pointer;
}
#card-close:hover { color: var(--ink); }
#card .card-image {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: contain;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 6px;
}
#card .card-image-credit {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 12px;
}
#card .tag {
  display: inline-block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 2px 8px; border-radius: 20px;
  margin-bottom: 10px;
}
#card h2 { font-size: 17px; margin: 0 0 6px; }
#card .meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
#card p { font-size: 13.5px; line-height: 1.6; color: #dbe0e6; margin: 0 0 14px; }
#card .conn-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
#card .conn-item { font-size: 13px; padding: 5px 0; border-top: 1px solid var(--line); cursor: pointer; }
#card .conn-item:hover { color: var(--ink); }
#card .conn-rel { color: var(--muted); font-size: 11px; }
#card .portal-link {
  display: block;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1.5px dashed var(--ink);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
#card .portal-link:hover { background: rgba(255,255,255,0.05); }

.node.portal-highlight circle {
  stroke: var(--ink);
  stroke-width: 4px;
  filter: brightness(1.3);
}

#hint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--muted);
}

#scroll-cue {
  position: absolute; left: 20px; bottom: 18px;
  display: none;
  align-items: center; gap: 6px;
  background: none; border: none; padding: 4px 6px;
  font-size: 12px; color: var(--muted);
  cursor: pointer;
}
#scroll-cue.show { display: flex; }
#scroll-cue:hover { color: var(--ink); }
#scroll-cue .arrow {
  display: inline-block;
  animation: scroll-cue-bounce 1.6s ease-in-out infinite;
}
@keyframes scroll-cue-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

#zoom-controls {
  position: absolute; right: 20px; bottom: 56px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 15;
}
#zoom-controls button {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
#zoom-controls button:hover { background: rgba(255,255,255,0.05); }

#highlight {
  display: none;
  max-width: 560px;
  margin: 24px auto 0;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
#highlight.show { display: block; }
#highlight h2 { font-size: 15px; margin: 0 0 10px; color: var(--ink); }
#highlight p { font-size: 13.5px; line-height: 1.6; color: #dbe0e6; margin: 0; }

/* Rozcestníky (index.html, slohy-index.html) */
header {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 24px 32px;
  text-align: center;
}
header h1 { font-size: 30px; font-weight: 650; margin: 0 0 12px; letter-spacing: -0.01em; }
header p { font-size: 15px; line-height: 1.6; color: var(--muted); margin: 0; }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 24px 80px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent);
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.category-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.category-card { padding: 32px; }
.category-card h2 { font-size: 24px; margin: 0 0 10px; }
.category-card p { font-size: 14.5px; margin: 0; }

.card .period {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 10px;
}
.card h2 { font-size: 19px; margin: 0 0 10px; }
.card p { font-size: 13.5px; line-height: 1.6; color: #c3c9d2; margin: 0 0 16px; }
.card .stats { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }

.card-maps { display: flex; flex-direction: column; gap: 8px; }
.card-map-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.card-map-link:hover { border-color: var(--accent); background: rgba(255,255,255,0.03); }
.card-map-link .card-map-stats { font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; }

footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 60px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

/* Vizuálny slovník slohu (sloh.html, pod mapou) */
#prvky {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}
#prvky h2 {
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 16px;
  text-align: center;
}
.prvky-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
}
.prvok-card {
  flex: 0 0 240px;
  scroll-snap-align: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.prvok-card img { display: block; width: 100%; height: 140px; object-fit: contain; background: var(--bg); }
.prvok-card .prvok-body { padding: 14px 16px; }
.prvok-card h3 { font-size: 15px; margin: 0 0 6px; }
.prvok-card p { font-size: 13px; line-height: 1.55; color: #c3c9d2; margin: 0 0 8px; }
.prvok-credit { font-size: 10px; color: var(--muted); }

/* Mapa správneho členenia (spravne-clenenie.html) */
#layer-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 700px;
  margin: 0 auto 12px;
  padding: 0 20px;
}
#layer-switch button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 16px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
#layer-switch button:hover { color: var(--ink); }
#layer-switch button.active {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
  font-weight: 600;
}
#map {
  position: absolute; inset: 0;
  background: var(--bg); /* viditeľné cez dlaždice, kým sa načítajú */
}
.leaflet-interactive { cursor: pointer; transition: fill-opacity 0.15s ease; }
.leaflet-interactive:hover { fill-opacity: 1 !important; }
/* Leaflet vlastné ovládacie prvky (zoom, attribution) prelaďené na tmavú tému projektu —
   #legend a #card musia byť nad nimi (Leaflet control pane má z-index 1000). */
.leaflet-control-zoom a {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
.leaflet-control-zoom a:hover { background: var(--bg) !important; }
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--panel) 80%, transparent) !important;
  color: var(--muted) !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-tooltip {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  font-size: 12px !important;
}
#legend, #card { z-index: 1000; }
#legend .legend-count {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

/* Naračný panel (spravne-clenenie.html, pod mapou) */
#narrative {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}
#narrative h2 {
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 20px;
  text-align: center;
}
#narrative .step {
  margin-bottom: 22px;
  padding-left: 18px;
  border-left: 2px solid var(--line);
}
#narrative .step h3 {
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--ink);
}
#narrative .step .step-meta {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
#narrative .step p {
  font-size: 13.5px;
  line-height: 1.6;
  color: #c3c9d2;
  margin: 0;
}

/* Mobile (telefóny, malé tablety) */
@media (max-width: 720px) {
  #navbar {
    height: 46px;
    padding: 0 14px;
    font-size: 12.5px;
  }
  #navbar .links { gap: 12px; }

  #wrap {
    height: 62vh;
    min-height: 380px;
    max-height: none;
  }

  #legend {
    top: 12px; left: 12px;
    padding: 8px 10px;
    font-size: 11.5px;
    line-height: 1.6;
    border-radius: 8px;
  }

  #title { margin: 14px auto 10px; padding: 0 16px; }
  #title h1 { font-size: 16px; line-height: 1.3; }
  #title p { font-size: 11.5px; }
  #title .teaser { font-size: 11px; }

  #card {
    top: auto; bottom: 0; left: 0; right: 0;
    width: auto; max-width: none;
    max-height: 65vh; overflow-y: auto;
    border-radius: 16px 16px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    transform: translateY(16px);
    padding: 20px 20px 24px;
  }
  #card.show { transform: translateY(0); }

  #hint { display: none; }

  #scroll-cue { left: 12px; bottom: 12px; font-size: 11.5px; }

  #zoom-controls { right: 12px; bottom: 12px; }
  #zoom-controls button { width: 40px; height: 40px; }

  #highlight { margin: 20px 16px 0; padding: 14px 16px; }

  header { padding: 40px 20px 24px; }
  header h1 { font-size: 23px; }
  header p { font-size: 14px; }

  main { padding: 4px 16px 60px; }
  .grid { gap: 14px; }
  .card, .category-card { padding: 18px 20px; }

  #prvky { padding: 24px 16px 40px; }
  #prvky h2 { font-size: 18px; }
  .prvok-card { flex-basis: 190px; }
  .prvok-card img { height: 110px; }

  #layer-switch { padding: 0 16px; }
  #layer-switch button { font-size: 12px; padding: 6px 12px; }
  #narrative { padding: 24px 16px 40px; }
}
