/* =========================================================================
   STRÁNKA PŘÍBĚH SVĚTA (Lore)
   ========================================================================= */

/* Layout: sidebar + content */
.lore-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ===== SIDEBAR NAVIGACE ===== */
.lore-sidebar {
  align-self: start;
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.lore-sidebar__scroll {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

/* Lore sidebar title, nav list, nav icon → moved to nav.css */

/* ===== HLAVNÍ OBSAH ===== */
.lore-content {
  min-width: 0;
}

.lore-page-title {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.lore-page-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-style: italic;
}

/* ===== SEKCE ===== */
.lore-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: 80px;
}

.lore-section__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-dim);
}

.lore-section__icon {
  font-size: 1.5rem;
}
.lore-section__race-img { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; border: 2px solid var(--gold); box-shadow: 0 0 10px rgba(201,162,39,0.2); flex-shrink: 0; }
.lore-section__race-img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; background: #fff; }

.lore-section__title {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  color: var(--gold);
  margin: 0;
}

/* ===== OBRÁZEK SEKCE ===== */
.lore-section__image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-dim);
  margin-bottom: 1.5rem;
  background: var(--bg-card);
}

.lore-section__image-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(201, 162, 39, 0.05) 100%);
  border: 1px dashed var(--border-dim);
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ===== BLOKY OBSAHU ===== */
.lore-block {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.2rem;
}

.lore-block__heading {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--gold-light);
  margin-bottom: 0.6rem;
}

.lore-block__text {
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-dim);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.lore-block__list {
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-dim);
  padding-left: 1.5rem;
  margin: 0;
}
.lore-block__list li { margin-bottom: 0.3rem; }

/* Nav sublist, nav-item-row, nav-divider → moved to nav.css */

/* ===== RACE CARD GRID ===== */
.lore-race-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-top: 1.5rem;
}

/* Standard race card: horizontal portrait + text */
.lore-race-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
}
.lore-race-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 6px 22px rgba(0,0,0,0.38);
  background: rgba(201,162,39,0.04);
}

/* Portrait circle */
.lore-race-card__portrait {
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 0 14px rgba(201,162,39,0.22);
  background: var(--bg-card2);
}
.lore-race-card__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.lore-race-card__portrait--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  width: 100%;
  height: 100%;
}

/* Text block */
.lore-race-card__body {
  flex: 1;
  min-width: 0;
  padding-top: 0.15rem;
}
.lore-race-card__name {
  font-family: 'Cinzel', serif;
  font-size: 0.98rem;
  color: var(--gold-light);
  display: block;
  margin-bottom: 0.38rem;
  letter-spacing: 0.025em;
}
.lore-race-card__desc {
  font-family: 'Crimson Text', serif;
  font-size: 0.88rem;
  line-height: 1.52;
  color: var(--text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* "Ostatní rasy" — same cell as others but visually distinct (dashed border) */
.lore-race-card--wide {
  border-style: dashed;
  border-color: rgba(201,162,39,0.35);
  opacity: 0.82;
}
.lore-race-card--wide:hover {
  opacity: 1;
  border-style: solid;
}

/* Responsive */
@media (max-width: 560px) {
  .lore-race-grid { grid-template-columns: 1fr; }
}

/* ===== SUBPAGE LINK CARDS =====
   Flex (not grid) so that the LAST partial row is centered instead of
   left-aligned. Cards have a fixed flex-basis so they stay the same size
   no matter how many fill the row. */
.lore-subpage-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.lore-subpage-card {
  flex: 1 1 220px;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.lore-subpage-card:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 8px rgba(201, 162, 39, 0.1);
}
.lore-subpage-card__icon {
  font-size: 1.4rem;
  line-height: 1;
}
.lore-subpage-card__title {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold-light);
}
.lore-subpage-card__desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ===== DEITY CARDS (richer than subpage cards) =====
   Used on /svet#religion. Each card shows the deity portrait, name,
   epithet, a short bio excerpt and alignment tag. Last partial row
   stays centred thanks to flex + justify-content: center. */
.lore-deity-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.5rem;
}
.lore-deity-card {
  flex: 1 1 320px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.lore-deity-card:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 8px rgba(201, 162, 39, 0.15);
}
.lore-deity-card__img {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 0 10px rgba(201, 162, 39, 0.2);
  background: var(--bg-card2);
}
.lore-deity-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.lore-deity-card__img-placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.4rem;
}
.lore-deity-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 auto;
}
.lore-deity-card__name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}
.lore-deity-card__epithet {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.lore-deity-card__desc {
  margin: 0.15rem 0 0;
  font-family: 'Crimson Text', serif;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-dim);
}
.lore-deity-card__alignment {
  align-self: flex-start;
  margin-top: 0.4rem;
  padding: 0.1rem 0.5rem;
  font-family: 'Crimson Text', serif;
  font-size: 0.7rem;
  color: var(--gold);
  background: rgba(201, 162, 39, 0.08);
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 3px;
}

/* ===== UNIFIED SECTION-CARD BOXES =====
   Used on long lore articles (Pradávná historie, První království, …)
   to wrap a whole topic — heading + portrait + summary + sub-sections —
   into a single visually distinct rounded box. Replaces the older
   "many disconnected lore-block divs" pattern.
   ----------------------------------------------------------------- */
.lore-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 1.4rem 1.6rem 1.6rem;
  margin: 0 0 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  scroll-margin-top: 80px;
}
.lore-section-card__head {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-dim);
}
.lore-section-card__portrait {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 0 14px rgba(201, 162, 39, 0.22);
  background: var(--bg-card2);
}
.lore-section-card__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.lore-section-card__portrait-placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  color: var(--gold);
}
.lore-section-card__head-text {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
}
.lore-section-card__title {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  color: var(--gold);
  margin: 0;
}
.lore-section-card__summary {
  font-family: 'Crimson Text', serif;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 1rem;
}
.lore-section-card__sub {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed rgba(107, 84, 0, 0.4);
}
.lore-section-card__sub:first-of-type {
  margin-top: 0.6rem;
}
.lore-section-card__sub-heading {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--gold-light);
  margin: 0 0 0.5rem;
}
.lore-section-card__sub-text {
  font-family: 'Crimson Text', serif;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0 0 0.55rem;
}
.lore-section-card__sub-text:last-child { margin-bottom: 0; }

/* ----- Banner variant (large image on top) for First Kingdoms ----- */
.lore-section-card--banner { padding: 0; overflow: hidden; }
.lore-section-card__banner {
  position: relative;
  aspect-ratio: 16 / 5;
  max-height: 260px;
  min-height: 140px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-card2) 0%, rgba(201,162,39,0.08) 100%);
}
.lore-section-card__banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}
.lore-section-card__banner-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13,13,26,0.05) 0%, rgba(13,13,26,0.85) 100%);
  pointer-events: none;
}
.lore-section-card__banner-title {
  position: absolute;
  left: 1.6rem;
  bottom: 0.9rem;
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: var(--gold-light);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  letter-spacing: 0.03em;
}
.lore-section-card__banner--missing {
  /* When the placeholder image fails to load, show a calm gradient
     instead of a broken image silhouette. */
  background: linear-gradient(135deg, var(--bg-card2) 0%, rgba(201,162,39,0.12) 100%);
}
.lore-section-card__banner--missing::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 30%, rgba(201,162,39,0.15) 0%, transparent 40%),
    radial-gradient(circle at 75% 70%, rgba(201,162,39,0.1) 0%, transparent 50%);
}
.lore-section-card__body {
  padding: 1.2rem 1.6rem 1.6rem;
}

@media (max-width: 720px) {
  .lore-section-card { padding: 1.1rem 1rem 1.2rem; }
  .lore-section-card__head { flex-direction: column; align-items: center; text-align: center; }
  .lore-section-card__portrait { flex-basis: 80px; width: 80px; height: 80px; }
  .lore-section-card__title { font-size: 1.1rem; }
  .lore-section-card__banner-title { font-size: 1.05rem; left: 1rem; bottom: 0.6rem; }
  .lore-section-card__body { padding: 1rem 1rem 1.2rem; }
}

/* ===== SUBRACE PORTRAIT ===== */
.lore-subrace-portrait {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 0 16px rgba(201, 162, 39, 0.2);
  margin: 0 auto 1.2rem;
}
.lore-subrace-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  background: #fff;
}

/* ===== BACK LINK ===== */
.lore-back-link {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-dim);
}
.lore-back-link a {
  color: var(--gold);
  text-decoration: none;
  font-family: 'Crimson Text', serif;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.lore-back-link a:hover { color: var(--gold-light); }

/* =========================================================================
   ENTITY CARDS (list pages)
   ========================================================================= */

/* Flex (not grid) — partial last rows stay centred instead of left-aligned. */
.lore-entity-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.lore-entity-card {
  flex: 1 1 320px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 1.2rem 1.4rem;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  color: inherit;
}

a.lore-entity-card:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.04);
  transform: translateY(-2px);
}

.lore-entity-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.lore-entity-card__title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--gold-light);
  margin: 0;
}

.lore-entity-card__title em {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lore-entity-card__role {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.lore-entity-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.lore-entity-card__summary {
  font-family: 'Crimson Text', serif;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 0;
}

.lore-entity-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: auto;
}

.lore-entity-card__footer {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-dim);
}

/* =========================================================================
   TAGS / LABELS
   ========================================================================= */

.lore-tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-family: 'Crimson Text', serif;
  font-size: 0.78rem;
  background: var(--bg-card2);
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
  white-space: nowrap;
}

.lore-tag--accent {
  background: rgba(201, 162, 39, 0.12);
  color: var(--gold-light);
  border-color: var(--gold);
}

.lore-tag--era {
  background: rgba(142, 68, 173, 0.12);
  color: #c39bd3;
  border-color: rgba(142, 68, 173, 0.3);
}
.lore-tag--era[onclick] {
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.lore-tag--era[onclick]:hover {
  border-color: rgba(142, 68, 173, 0.6);
  background: rgba(142, 68, 173, 0.2);
}
a.lore-tag--era {
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
a.lore-tag--era:hover {
  border-color: rgba(142, 68, 173, 0.6);
  background: rgba(142, 68, 173, 0.2);
  color: #d4b5e8;
}

.lore-tag--type {
  background: rgba(41, 128, 185, 0.12);
  color: #7fb3d8;
  border-color: rgba(41, 128, 185, 0.3);
}

.lore-tag--date {
  background: rgba(39, 174, 96, 0.12);
  color: #7dcea0;
  border-color: rgba(39, 174, 96, 0.3);
}

.lore-tag--small {
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
}

.lore-tag--link {
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.lore-tag--link:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.15);
  color: var(--gold-light);
}

.lore-tag--search {
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.lore-tag--search:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.15);
  color: var(--gold-light);
}

/* =========================================================================
   DETAIL PAGE
   ========================================================================= */

.lore-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.lore-block--summary {
  border-left: 3px solid var(--gold);
}

.lore-block--dynasty {
  border-left: 3px solid var(--purple);
}

.lore-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.lore-related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lore-dynasty-info__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.lore-dynasty-info__label {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 80px;
}

/* =========================================================================
   RULERS TIMELINE
   ========================================================================= */

.lore-layout--wide {
  max-width: 1400px;
  grid-template-columns: 300px 1fr;
}

.lore-sidebar--timeline {
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.lore-timeline-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

/* "Back to overview" link sitting above the timeline */
.lore-timeline-nav__back {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0 0 0.6rem;
  border-bottom: 1px solid var(--border-dim);
}

.lore-timeline-nav::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-dim);
}

.lore-timeline-nav__era {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  padding: 0.6rem 0 0.3rem 1.8rem;
  position: relative;
}

.lore-timeline-nav__era-link {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s;
}
.lore-timeline-nav__era-link:hover {
  color: var(--gold-light);
  text-decoration: underline;
}

.lore-timeline-nav__era::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-radius: 50%;
  transform: translateY(-50%);
}

.lore-timeline-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 1.8rem;
  text-decoration: none;
  color: var(--text-dim);
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  transition: color 0.2s, background 0.2s;
  position: relative;
  border-radius: 4px;
  cursor: pointer;
}

.lore-timeline-item__dot {
  position: absolute;
  left: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-card2);
  border: 2px solid var(--border-dim);
  transition: background 0.2s, border-color 0.2s;
  z-index: 1;
}

.lore-timeline-item__line {
  display: none;
}

.lore-timeline-item:hover {
  color: var(--gold);
  background: rgba(201, 162, 39, 0.04);
}

.lore-timeline-item:hover .lore-timeline-item__dot {
  border-color: var(--gold);
}

.lore-timeline-item.active {
  color: var(--gold-light);
  background: rgba(201, 162, 39, 0.1);
  font-weight: 600;
}

.lore-timeline-item.active .lore-timeline-item__dot {
  background: var(--gold);
  border-color: var(--gold-light);
  box-shadow: 0 0 8px rgba(201, 162, 39, 0.4);
}

.lore-timeline-item__info {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lore-timeline-item__name {
  font-size: 0.85rem;
}

.lore-timeline-item__years {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lore-rulers-intro {
  text-align: center;
  padding: 4rem 2rem;
}

.lore-ruler-panel {
  animation: fadeIn 0.3s ease;
}

.lore-ruler-panel__links {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   DYNASTY BRANCH TITLE
   ========================================================================= */

.lore-dynasty-branch-title {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-dim);
}

/* =========================================================================
   FAMILY TREE
   ========================================================================= */

.lore-family-tree {
  overflow-x: auto;
  padding: 1rem 0;
}

.lore-tree-node {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.2rem;
}

.lore-tree-node::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-dim);
}

.lore-tree-node__card {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  margin-bottom: 0.3rem;
  position: relative;
}

.lore-tree-node__card::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 50%;
  width: 1.2rem;
  height: 2px;
  background: var(--border-dim);
}

.lore-tree-node--ruler > .lore-tree-node__card {
  border-color: var(--gold);
  border-left: 3px solid var(--gold);
}

.lore-tree-node--female > .lore-tree-node__card {
  border-color: rgba(142, 68, 173, 0.4);
}

.lore-tree-node__name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--gold-light);
}

.lore-tree-node__name a {
  color: var(--gold-light);
  text-decoration: none;
  transition: color 0.2s;
}

.lore-tree-node__name a:hover {
  color: var(--gold);
  text-decoration: underline;
}

.lore-tree-node__name em {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lore-tree-node__years,
.lore-tree-node__reign,
.lore-tree-node__spouse {
  font-family: 'Crimson Text', serif;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lore-tree-node__reign {
  color: var(--gold);
}

.lore-tree-children {
  padding-left: 1rem;
}

/* =========================================================================
   FILTER BAR
   ========================================================================= */

.lore-filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.lore-filter-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  padding: 0.35rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.lore-filter-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.lore-filter-btn.active {
  background: rgba(201, 162, 39, 0.12);
  border-color: var(--gold);
  color: var(--gold-light);
}

/* =========================================================================
   ENTITY CARD OVERLAY LINK (rulers click-through)
   ========================================================================= */

.lore-entity-card {
  position: relative;
}

.lore-entity-card__link {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 8px;
}

.lore-entity-card--clickable {
  cursor: pointer;
}

.lore-entity-card--clickable:hover,
.lore-entity-card[onclick]:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.04);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.15);
}

/* =========================================================================
   MODAL / SIDE PANEL
   ========================================================================= */

.lore-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 900;
  transition: opacity 0.25s;
}

.lore-modal-backdrop.hidden {
  display: none;
}

/* Persistent panel chování (globální): když je otevřený lore modal, backdrop
   je transparentní a propouští kliknutí na obsah pod ním. Uživatel tak může
   procházet stránku, klikat na další kartu (která panel přepne) nebo modal
   zavřít křížkem či Escapem. */
body.lore-modal-open .lore-modal-backdrop {
  background: transparent;
  pointer-events: none;
}

.lore-modal {
  position: fixed;
  top: 0;
  right: 0;
  width: min(480px, 90vw);
  height: 100vh;
  background: var(--bg-card);
  border-left: 2px solid var(--gold);
  z-index: 910;
  overflow-y: auto;
  padding: 2rem 1.5rem;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.5);
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.lore-modal.hidden {
  display: none;
}

.lore-modal__close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: none;
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 1.1rem;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  z-index: 1;
}

.lore-modal__close:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.lore-modal__content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lore-modal__content .lore-section__header {
  justify-content: flex-start;
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.lore-modal__content .lore-section__title {
  font-size: 1.3rem;
}

/* =========================================================================
   FAMILY TREE CLICKABLE NODES
   ========================================================================= */

.lore-tree-node__card--clickable,
.lore-tree-node--ruler > .lore-tree-node__card {
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.lore-tree-node__card--clickable:hover,
.lore-tree-node--ruler > .lore-tree-node__card:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.06);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.15);
  transform: scale(1.02);
}

/* =========================================================================
   RULER META (structured metadata row)
   ========================================================================= */

.lore-ruler-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
  padding: 0.6rem 0;
}

.lore-ruler-meta__item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lore-ruler-meta__item .lore-icon {
  width: 0.9em;
  height: 0.9em;
}

.lore-ruler-meta__item--reign {
  color: var(--gold);
}

.lore-ruler-meta__separator {
  width: 1px;
  height: 1rem;
  background: var(--border-dim);
}

/* =========================================================================
   VISUAL HIERARCHY
   ========================================================================= */

.lore-ruler-panel .lore-block {
  margin-bottom: 1.5rem;
}

.lore-ruler-panel .lore-block + .lore-block {
  border-top: 1px solid var(--border-dim);
  padding-top: 1.5rem;
}

.lore-section__title {
  font-weight: 700;
}

.lore-entity-card {
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}

a.lore-entity-card:hover {
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.15);
}

/* ===== RESPONSIVITA ===== */
@media (max-width: 768px) {
  .lore-layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  .lore-sidebar {
    position: static;
    order: -1;
  }
  .lore-nav__list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .lore-nav__list a {
    border-left: none;
    border-bottom: 2px solid var(--border-dim);
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }
  .lore-nav__list a:hover,
  .lore-nav__list a.active {
    border-left: none;
    border-bottom-color: var(--gold);
  }
  /* Collapsible submenus */
  .lore-nav__sublist.open {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .lore-nav__sublist a {
    padding-left: 0.6rem;
  }
  .lore-page-title { font-size: 1.5rem; }
  .lore-section__title { font-size: 1.3rem; }

  .lore-layout--wide { grid-template-columns: 1fr; }
  .lore-sidebar--timeline {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .lore-timeline-nav { display: flex; flex-wrap: wrap; gap: 0.3rem; }
  .lore-timeline-nav::before { display: none; }
  .lore-timeline-nav__era { padding-left: 0; width: 100%; }
  .lore-timeline-nav__era::before { display: none; }
  .lore-timeline-item { padding-left: 0.6rem; font-size: 0.78rem; }
  .lore-timeline-item__dot { display: none; }
  .lore-entity-grid > .lore-entity-card { flex-basis: 100%; max-width: 100%; }
  .lore-subpage-links > .lore-subpage-card { flex-basis: 100%; max-width: 100%; }
}

/* =========================================================================
   ARTICLE INTRO ZÓNA (pravek, první království)
   ========================================================================= */

.lore-intro-zone {
  background: rgba(201, 162, 39, 0.03);
  border: 1px solid rgba(201, 162, 39, 0.18);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 1.6rem 1.8rem 1.3rem;
  margin-bottom: 2.5rem;
}

.lore-intro-lead {
  margin-bottom: 1.4rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.2);
}

.lore-intro-lead__text {
  font-family: 'Crimson Text', serif;
  font-size: 1.07rem;
  line-height: 1.8;
  color: var(--text);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  font-style: italic;
  margin: 0;
}

.lore-intro-section {
  padding: 0.9rem 0;
  border-bottom: 1px dashed rgba(107, 84, 0, 0.3);
  scroll-margin-top: 80px;
}
.lore-intro-section:last-child { border-bottom: none; padding-bottom: 0; }

.lore-intro-section__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.55rem;
}

.lore-intro-section__num {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.1);
  border: 1px solid rgba(201, 162, 39, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  color: var(--gold);
  flex-shrink: 0;
}

.lore-intro-section__title {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  color: var(--gold-light);
  margin: 0;
}

.lore-intro-section__text {
  font-family: 'Crimson Text', serif;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-dim);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  margin: 0 0 0.45rem;
  padding-left: 2.25rem;
}
.lore-intro-section__text:last-child { margin-bottom: 0; }

/* =========================================================================
   ARTICLE RACE LINK (odkaz na detail rasy v kartičkách)
   ========================================================================= */

.lore-section-card__race-link {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(107, 84, 0, 0.3);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.lore-article-race-link {
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  letter-spacing: 0.025em;
  color: var(--gold);
  text-decoration: none;
  padding: 0.28rem 0.75rem;
  border: 1px solid rgba(201, 162, 39, 0.38);
  border-radius: 4px;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.lore-article-race-link:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.1);
  color: var(--gold-light);
}

/* =========================================================================
   DYNASTY SEARCH BAR
   ========================================================================= */

.lore-dynasty-search {
  position: relative;
  margin-bottom: 0.75rem;
}

.lore-dynasty-search__input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Crimson Text', serif;
  font-size: 0.97rem;
  padding: 0.55rem 2.4rem 0.55rem 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.lore-dynasty-search__input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.12);
}
.lore-dynasty-search__input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.lore-dynasty-search__clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.15rem 0.3rem;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: color 0.15s;
}
.lore-dynasty-search__clear:hover { color: var(--gold); }

/* =========================================================================
   DYNASTY CARD — stavy při vyhledávání
   ========================================================================= */

.dynasty-card--match {
  border-color: rgba(201, 162, 39, 0.75) !important;
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.18) !important;
}

.dynasty-card--related {
  opacity: 0.55;
}

.dynasty-card--related::after {
  content: 'příbuzný';
  position: absolute;
  bottom: 0.45rem;
  right: 0.65rem;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  opacity: 0.75;
  pointer-events: none;
}

/* =========================================================================
   MODAL — patička s odkazem na plný detail
   ========================================================================= */

.lore-modal__footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-dim);
  display: flex;
  justify-content: center;
}

.lore-modal__detail-link {
  font-family: 'Cinzel', serif;
  font-size: 0.84rem;
  letter-spacing: 0.025em;
  color: var(--gold);
  text-decoration: none;
  padding: 0.55rem 1.6rem;
  border: 1px solid var(--gold);
  border-radius: 5px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.lore-modal__detail-link:hover {
  background: rgba(201, 162, 39, 0.12);
  color: var(--gold-light);
  box-shadow: 0 2px 10px rgba(201, 162, 39, 0.22);
}

.lore-modal__more-hint {
  font-family: 'Crimson Text', serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: right;
  margin: 0.3rem 0 0;
}
