/* ── WorldForge Viewer v2 — Mundos Forge Theme Integration ───────────────── */

/* ── Universele fallback-tokens ──────────────────────────────────────────
   Deze laag bestaat puur voor sites ZONDER het Mundos Forge thema. Ze
   worden hieronder pas gebruikt als laatste schakel in de var()-keten,
   dus zodra --mf-* variabelen aanwezig zijn (op het MF-thema) blijven
   die altijd leidend en verandert er voor Mundo's Forge zelf niets.
   Op elk ander thema/site zorgt dit voor een neutrale, nette weergave
   die ook netjes meebeweegt met de systeem-/browser donker-modus. */
:root {
  --wf-default-accent:  #8a6dd9;
  --wf-default-ink:     #1c1c1f;
  --wf-default-bg:      #ffffff;
  --wf-default-card:    #f7f7f9;
  --wf-default-border:  rgba(0, 0, 0, .12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --wf-default-accent:  #a594f2;
    --wf-default-ink:     #ededf0;
    --wf-default-bg:      #18181b;
    --wf-default-card:    #222226;
    --wf-default-border:  rgba(255, 255, 255, .14);
  }
}

/* ── Custom properties — erft direct van het Mundos Forge thema ── */
/* --mf-* variabelen worden gezet door het MF thema op :root (light)
   en html[data-theme="dark"] (dark). WorldForge hoeft niets zelf te
   weten over light/dark — als het MF thema schakelt, volgt de viewer
   automatisch mee.

   Fallback-volgorde per kleur (1 = hoogste prioriteit):
   1. --mf-*                      → eigen Mundos Forge thema (ongewijzigd)
   2. --wp--preset--color--*      → WordPress Global Styles (block-thema's
                                      die in theme.json een palet definiëren)
   3. --wf-default-*              → neutrale, dark-mode-bewuste fallback
   Zo werkt de viewer overal, zonder dat de MF-weergave ooit verandert. */
.worldforge-viewer {
  --wf-accent:         var(--mf-primary,  var(--wp--preset--color--primary,    var(--wf-default-accent)));
  --wf-ink:            var(--mf-text,     var(--wp--preset--color--contrast,   var(--wf-default-ink)));
  --wf-primary:        var(--mf-bg,       var(--wp--preset--color--background, var(--wf-default-bg)));
  --wf-surface-raised: var(--mf-card-bg,  var(--wf-default-card));
  --wf-border:         var(--mf-border,   var(--wf-default-border));

  /* Afgeleid van bovenstaande — passen automatisch mee als het thema wisselt */
  --wf-ink-muted:      color-mix(in srgb, var(--wf-ink) 45%, transparent);
  --wf-ink-dim:        color-mix(in srgb, var(--wf-ink) 70%, transparent);
  --wf-surface:        color-mix(in srgb, var(--wf-primary) 88%, var(--wf-ink) 12%);
  --wf-surface-hover:  color-mix(in srgb, var(--wf-accent)  8%, transparent);
  --wf-border-accent:  color-mix(in srgb, var(--wf-accent) 45%, transparent);
  --wf-radius:         6px;
  --wf-sidebar-w:      260px;
  --wf-topbar-h:       52px;

  font-family: 'Plus Jakarta Sans', Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--wf-ink);
  background: var(--wf-primary);
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  /* container-type removed — stacking context breaks position:fixed mobile overlay */
  transition: background 0.6s cubic-bezier(0.23,1,0.32,1), color 0.6s ease;
}

/* ── Reset ── */
.worldforge-viewer *, .worldforge-viewer *::before, .worldforge-viewer *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.worldforge-viewer a { color: inherit; text-decoration: none; }
.worldforge-viewer ul, .worldforge-viewer ol { list-style: none; }
.worldforge-viewer button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ── Loading bar ── */
.wf-loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--wf-accent), color-mix(in srgb, var(--wf-accent) 60%, #fff));
  transition: width .4s ease, opacity .3s ease;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
}

.worldforge-viewer.is-loading .wf-loading-bar {
  opacity: 1;
  width: 75%;
  transition: width 1.2s ease;
}

/* ── Top bar (mobile) ── */
.wf-topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--wf-topbar-h);
  background: var(--wf-surface);
  border-bottom: 1px solid var(--wf-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.wf-topbar-title {
  flex: 1;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--wf-accent);
  letter-spacing: 1px;
}

.wf-nav-toggle,
.wf-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--wf-radius);
  color: var(--wf-ink-dim);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.wf-nav-toggle:hover, .wf-search-toggle:hover {
  background: var(--wf-surface-hover);
  color: var(--wf-ink);
}

.wf-hamburger,
.wf-hamburger::before,
.wf-hamburger::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s;
}

.wf-hamburger { position: relative; }
.wf-hamburger::before,
.wf-hamburger::after { content: ''; position: absolute; left: 0; }
.wf-hamburger::before { top: -5px; }
.wf-hamburger::after  { top:  5px; }

.is-nav-open .wf-hamburger    { transform: rotate(45deg); }
.is-nav-open .wf-hamburger::before { opacity: 0; }
.is-nav-open .wf-hamburger::after  { transform: rotate(-90deg) translateX(5px); }

/* ── World header — hidden ── */
.wf-world-header {
  display: none !important;
}

/* ── (legacy, hidden) ── */
._wf-world-header-legacy {
  min-height: 220px;
  background-color: var(--wf-primary);
  background-size: cover;
  background-position: center 30%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 20px;
  padding: 36px 36px 28px;
  border-bottom: 1px solid var(--wf-border);
  position: relative;
}

@media (min-width: 900px) {
  .wf-world-header {
    flex-direction: row;
    align-items: flex-end;
    min-height: 260px;
  }
}

.wf-world-header::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--wf-accent), transparent);
  opacity: .5;
}

.wf-header-inner {
  flex: 1;
  position: relative;
  z-index: 1;
}

.wf-kicker {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--wf-accent);
  margin-bottom: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.wf-world-title {
  font-family: 'Cinzel', Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5vw, 64px);
  font-weight: 700;
  line-height: 1.0;
  color: var(--wf-ink);
  margin-bottom: 8px;
}

.wf-world-tagline {
  font-size: 15px;
  color: var(--wf-ink-dim);
  max-width: 520px;
  margin-bottom: 10px;
}

.wf-header-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--wf-ink-muted);
  font-weight: 600;
}

.wf-header-meta span::before {
  content: '·';
  margin-right: 8px;
}
.wf-header-meta span:first-child::before { display: none; }

/* ── Header search ── */
.wf-header-search {
  position: relative;
  width: 100%;
  max-width: 340px;
  flex-shrink: 0;
  align-self: flex-end;
  z-index: 1;
}

.wf-search-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.wf-search-icon {
  position: absolute;
  left: 14px;
  color: var(--wf-ink-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.wf-search {
  width: 100%;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--wf-border);
  background: var(--wf-surface-raised);
  color: var(--wf-ink);
  padding: 0 48px 0 40px;
  font-size: 14px;
  outline: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: border-color .2s, box-shadow .2s;
}

.wf-search::placeholder { color: var(--wf-ink-muted); }

.wf-search:focus {
  border-color: var(--wf-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wf-accent) 22%, transparent);
}

.wf-search-kbd {
  position: absolute;
  right: 14px;
  font-size: 11px;
  font-family: inherit;
  border: 1px solid var(--wf-border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--wf-ink-muted);
  pointer-events: none;
}

.wf-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--wf-surface-raised);
  border: 1px solid var(--wf-border);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 20px 50px rgba(0,0,0,.18);
  z-index: 60;
  max-height: 420px;
  overflow-y: auto;
}

.wf-search-results a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background .15s;
  color: var(--wf-ink);
}

.wf-search-results a:hover {
  background: var(--wf-surface-hover);
}

.wf-search-results a img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.wf-search-results .wf-sr-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--wf-surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.wf-search-results .wf-sr-body {
  flex: 1;
  min-width: 0;
}

.wf-search-results span.wf-sr-type {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--wf-accent);
  margin-bottom: 2px;
}

.wf-search-results strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--wf-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-search-results small {
  display: block;
  font-size: 12px;
  color: var(--wf-ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.wf-search-empty {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--wf-ink-muted);
  text-align: center;
}

/* ── Backdrop (mobile nav) ── */
.wf-nav-backdrop {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  z-index: 39;
  opacity: 0;
  transition: opacity .25s;
}

/* ── Shell grid — 2 columns (sidebar + content) ── */
.wf-shell {
  display: grid;
  grid-template-columns: var(--wf-sidebar-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
  position: relative;
}

/* ── Sidebar ── */
.wf-sidebar {
  grid-column: 1;
  grid-row: 1;
  background: var(--wf-surface);
  border-right: 1px solid var(--wf-border);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--wf-border) transparent;
  padding: 12px 0 24px;
  transition: background 0.6s ease, border-color 0.6s ease;
}

/* Sidebar header */
.wf-sidebar-header {
  padding: 16px 14px 10px;
  border-bottom: 1px solid var(--wf-border);
  margin-bottom: 6px;
  position: relative;
}

.wf-sidebar-world-title {
  display: block;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--wf-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}

.wf-sidebar-world-title:hover { color: var(--wf-accent); opacity: .8; }

.wf-sidebar-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--wf-ink-muted);
}

.wf-sidebar-search-wrap svg { flex-shrink: 0; }

.wf-sidebar-search {
  flex: 1;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--wf-border);
  background: var(--wf-surface-raised);
  color: var(--wf-ink);
  padding: 0 10px;
  font-size: 13px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  outline: none;
  width: 100%;
}

.wf-sidebar-search:focus { border-color: var(--wf-accent); }

/* Home link */
.wf-home-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--wf-ink-dim);
  border-radius: var(--wf-radius);
  margin: 2px 8px 8px;
  transition: background .15s, color .15s;
}

.wf-home-link:hover {
  background: var(--wf-surface-hover);
  color: var(--wf-accent);
}

/* Nav sections */
.wf-nav-section {
  margin-bottom: 2px;
}

.wf-nav-section-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 16px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--wf-ink-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: color .15s;
}

.wf-nav-section-toggle:hover { color: var(--wf-accent); }

.wf-nav-section-icon { font-size: 13px; flex-shrink: 0; }

.wf-nav-section-label { flex: 1; }

.wf-nav-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--wf-accent) 12%, transparent);
  color: var(--wf-accent);
}

.wf-chevron {
  flex-shrink: 0;
  transition: transform .2s ease;
  color: var(--wf-ink-muted);
}

/* Collapse/expand */
.wf-nav-items {
  display: none;
}

.wf-nav-section.is-open > .wf-nav-items {
  display: block;
}

.wf-nav-section.is-open .wf-chevron {
  transform: rotate(180deg);
}

/* Timeline button inside nav */
.wf-timeline-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 16px 7px 36px;
  font-size: 13px;
  color: var(--wf-ink-dim);
  border-radius: var(--wf-radius);
  margin: 0 8px;
  width: calc(100% - 16px);
  transition: background .15s, color .15s;
}

.wf-timeline-btn:hover {
  background: var(--wf-surface-hover);
  color: var(--wf-ink);
}

.wf-timeline-btn.is-active {
  color: var(--wf-accent);
  font-weight: 700;
}

/* Recent nav links */
.wf-nav-link--recent {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 16px;
}

.wf-nav-link--recent::before { display: none; }

.wf-nav-link-icon {
  font-size: 12px;
  flex-shrink: 0;
  opacity: .7;
}

/* Nav links */
.wf-nav-link {
  display: block;
  padding: 6px 16px 6px 36px;
  font-size: 13px;
  color: var(--wf-ink-dim);
  border-radius: var(--wf-radius);
  margin: 0 8px;
  width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s;
  position: relative;
}

.wf-nav-link::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--wf-border);
  transition: background .15s;
}

.wf-nav-link:hover {
  background: var(--wf-surface-hover);
  color: var(--wf-ink);
}

.wf-nav-link:hover::before { background: var(--wf-accent); }

.wf-nav-link.is-active {
  color: var(--wf-accent);
  font-weight: 700;
  background: color-mix(in srgb, var(--wf-accent) 10%, transparent);
}

.wf-nav-link.is-active::before { background: var(--wf-accent); }

/* ── Main content ── */
.wf-content {
  grid-column: 2;
  grid-row: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--wf-border) transparent;
  position: relative;
  background: var(--wf-surface-raised);
  transition: background 0.6s ease;
}

.wf-content-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 36px 64px;
}

.wf-content:focus { outline: none; }

.wf-content[aria-busy="true"] .wf-content-inner {
  opacity: .4;
  pointer-events: none;
  transition: opacity .2s;
}

/* ── Inline article relations ── */
.wf-article-relations {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--wf-border);
}

.wf-relation-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.wf-rel-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--wf-border);
  background: var(--wf-surface-hover);
  transition: border-color .15s, background .15s;
}

.wf-rel-card:hover {
  border-color: var(--wf-border-accent);
  background: color-mix(in srgb, var(--wf-accent) 8%, transparent);
}

.wf-rel-thumb {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
}

.wf-rel-icon {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--wf-accent) 10%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.wf-rel-body { flex: 1; min-width: 0; }

.wf-rel-type {
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--wf-accent);
  margin-bottom: 2px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.wf-rel-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--wf-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-rel-label {
  font-size: 11px;
  color: var(--wf-ink-muted);
}

/* ── Article ── */
.wf-article-hero {
  margin: -32px -36px 0;
  height: 220px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.wf-article-hero-meta { display: flex; gap: 10px; }

.wf-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--wf-accent) 20%, rgba(255,255,255,.08));
  border: 1px solid var(--wf-border-accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--wf-accent);
  margin-bottom: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.wf-article-header { margin-bottom: 24px; }

.wf-article-title {
  font-family: 'Cinzel', Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 4vw, 38px);
  font-weight: 700;
  color: var(--wf-ink);
  line-height: 1.15;
  margin-bottom: 12px;
  letter-spacing: .5px;
}

.wf-article-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.wf-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--wf-ink-muted);
}

.wf-article-excerpt {
  font-size: 15px;
  color: var(--wf-ink-dim);
  font-style: italic;
  line-height: 1.6;
  border-left: 3px solid var(--wf-accent);
  padding-left: 14px;
  margin-top: 14px;
}

.wf-article-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--wf-border-accent), transparent);
  margin: 0 0 28px;
}

/* Article body typography */
.wf-article-body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--wf-ink-dim);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.wf-article-body h2,
.wf-article-body h3,
.wf-article-body h4 {
  font-family: 'Cinzel', Georgia, "Times New Roman", serif;
  color: var(--wf-ink);
  margin: 28px 0 12px;
  line-height: 1.3;
  letter-spacing: .5px;
}

.wf-article-body h2 { font-size: 22px; color: var(--wf-accent); }
.wf-article-body h3 { font-size: 18px; }
.wf-article-body h4 { font-size: 15px; font-weight: 700; }

.wf-article-body p { margin-bottom: 16px; }

.wf-article-body a {
  color: var(--wf-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.wf-article-body a:hover { opacity: .8; }

.wf-article-body blockquote {
  border-left: 3px solid var(--wf-accent);
  margin: 20px 0;
  padding: 10px 18px;
  color: var(--wf-ink-muted);
  font-style: italic;
  background: color-mix(in srgb, var(--wf-accent) 5%, transparent);
  border-radius: 0 8px 8px 0;
}

.wf-article-body ul, .wf-article-body ol {
  margin: 0 0 16px 20px;
  list-style: inherit;
}

.wf-article-body li { margin-bottom: 6px; }

.wf-article-body img {
  max-width: 100%;
  border-radius: 10px;
  margin: 16px 0;
}

.wf-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.wf-article-body th,
.wf-article-body td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--wf-border);
}

.wf-article-body th {
  background: color-mix(in srgb, var(--wf-accent) 8%, transparent);
  font-weight: 700;
  font-family: 'Cinzel', Georgia, serif;
  color: var(--wf-ink);
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ── World home ── */
.wf-world-home { }

.wf-home-header { margin-bottom: 28px; }

.wf-home-header h1 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(24px, 5vw, 48px);
  color: var(--wf-accent);
  font-weight: 700;
  line-height: 1.1;
  margin: 8px 0 10px;
  letter-spacing: 1px;
}

.wf-home-tagline {
  font-size: 15px;
  color: var(--wf-ink-dim);
  line-height: 1.5;
}

/* ── Homepage body: beschrijving + kaart naast elkaar ── */
.wf-home-body {
  margin-bottom: 32px;
}

/* Als beide aanwezig zijn: twee kolommen op desktop */
.wf-home-body--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* Kaart vult zijn kolom volledig */
.wf-home-body--split .wf-map-block {
  margin-top: 0;
}

/* Kaart en beschrijving vullen de volle hoogte in de kolom */
.wf-home-body--split .wf-world-description,
.wf-home-body--split .wf-map-block {
  margin-bottom: 0;
  height: 100%;
}

/* Mobile: gewoon gestapeld */
@media (max-width: 640px) {
  .wf-home-body--split {
    grid-template-columns: 1fr;
  }
}

/* World description */
.wf-world-description {
  margin-bottom: 32px;
  padding: 20px 22px;
  background: color-mix(in srgb, var(--wf-accent) 5%, transparent);
  border: 1px solid var(--wf-border);
  border-radius: 4px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--wf-ink-dim);
}

.wf-world-description p { margin-bottom: 1em; }
.wf-world-description p:last-child { margin-bottom: 0; }
.wf-world-description h2,
.wf-world-description h3 {
  color: var(--wf-accent);
  font-family: 'Cinzel', Georgia, serif;
  margin: 1.2em 0 .5em;
  letter-spacing: .5px;
}

/* Type group headings */
.wf-type-group {
  margin-bottom: 28px;
}

.wf-type-group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--wf-ink-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--wf-border);
}

.wf-type-group-count {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--wf-accent) 14%, transparent);
  color: var(--wf-accent);
  margin-left: 2px;
}

.wf-section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--wf-ink-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--wf-border);
}

/* Type stat grid */
.wf-type-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.wf-type-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 10px 16px;
  border-radius: 4px;
  border: 1px solid var(--wf-border);
  background: color-mix(in srgb, var(--wf-accent) 4%, transparent);
  text-align: center;
  text-decoration: none;
  transition: border-color .2s, transform .2s, background .2s;
}

.wf-type-stat-card:hover {
  border-color: var(--wf-accent);
  transform: translateY(-3px);
  background: color-mix(in srgb, var(--wf-accent) 8%, transparent);
}

.wf-type-stat-icon {
  font-size: 22px;
  margin-bottom: 4px;
  line-height: 1;
}

.wf-type-stat-count {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--wf-accent);
  font-family: 'Cinzel', Georgia, serif;
}

.wf-type-stat-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--wf-ink-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin-top: 2px;
}

/* Article grid (home) */
.wf-article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.wf-article-card {
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  border: 1px solid var(--wf-border);
  background: var(--wf-surface-raised);
  overflow: hidden;
  text-decoration: none;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.wf-article-card:hover {
  border-color: var(--wf-accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,.10);
}

.wf-article-card-thumb {
  height: 120px;
  object-fit: cover;
  width: 100%;
  flex-shrink: 0;
}

.wf-article-card-thumb--empty {
  height: 120px;
  background: color-mix(in srgb, var(--wf-accent) 8%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.wf-article-card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wf-article-card-type {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--wf-accent);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.wf-article-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--wf-ink);
  line-height: 1.3;
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: .3px;
}

.wf-article-card-excerpt {
  font-size: 12px;
  color: var(--wf-ink-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Map block ── */
.wf-map-block {
  margin-top: 32px;
}

.wf-map-block .wf-section-heading { margin-bottom: 16px; }

/* ── Interactive map canvas ── */
.wf-map-canvas {
  position: relative;
  display: block;
  width: 100%;
  border: 1px solid var(--wf-border);
  border-radius: 4px;
  overflow: hidden;
  background: #111;
  line-height: 0;
}

.wf-map-canvas img.wf-map-image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

/* Pins */
.wf-map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  width: 28px;
  height: 36px;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
  transition: transform .15s ease, filter .15s ease;
  z-index: 2;
}

.wf-map-pin:hover,
.wf-map-pin:focus-visible {
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.6));
  transform: translate(-50%, -100%) scale(1.18);
  outline: none;
}

.wf-map-pin svg { display: block; width: 100%; height: 100%; }

/* Linked pins get accent colour */
.wf-map-pin--linked svg .pin-head { fill: var(--wf-accent, #c8aa6e); }
.wf-map-pin:not(.wf-map-pin--linked) svg .pin-head { fill: var(--wf-ink-muted, #7a7060); }

/* ── Pin hover tooltip ── */
.wf-pin-tooltip {
  position: absolute;
  z-index: 20;
  max-width: min(220px, 72vw);
  background: var(--wf-surface-raised, #fff);
  border: 1px solid var(--wf-border, rgba(200,170,110,.22));
  border-radius: 5px;
  padding: 6px 10px 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--wf-ink, #1a1a1a);
  line-height: 1.4;
  box-shadow: 0 3px 10px rgba(0,0,0,.22);
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .15s ease, transform .15s ease;
}

.wf-pin-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.wf-pin-tooltip strong {
  display: block;
  font-family: 'Cinzel', Georgia, serif;
  color: var(--wf-accent, #c8aa6e);
}

.wf-pin-tooltip-hint {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--wf-ink-muted, #7a7060);
  margin-top: 2px;
}

/* Popup */
.wf-map-popup {
  position: absolute;
  z-index: 10;
  width: min(300px, 80vw);
  background: var(--wf-card, #fff);
  border: 1px solid var(--wf-border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  padding: 14px 16px 12px;
  line-height: 1.5;
  pointer-events: all;
}

.wf-map-popup[hidden] { display: none; }

.wf-map-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.wf-map-popup-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--wf-accent);
  flex: 1;
  min-width: 0;
}

.wf-map-popup-close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--wf-ink-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .15s;
}

.wf-map-popup-close:hover { background: var(--wf-border); }

.wf-map-popup-img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 8px;
  display: block;
}

.wf-map-popup-desc {
  font-size: 13px;
  color: var(--wf-ink-dim);
  margin: 0;
}

/* ── Timeline ── */
.wf-timeline-view { }

.wf-timeline-header {
  margin-bottom: 32px;
}

.wf-timeline-header h1 {
  font-family: 'Cinzel', Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 5vw, 40px);
  color: var(--wf-accent);
  font-weight: 700;
  margin: 8px 0 0;
  letter-spacing: 1px;
}

.wf-timeline-name {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--wf-accent);
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 24px 0 12px;
}

.wf-timeline-track {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wf-event {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 0 16px;
  align-items: flex-start;
}

.wf-event-node {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wf-event-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--wf-accent);
  border: 2px solid var(--wf-surface-raised);
  box-shadow: 0 0 0 2px var(--wf-border-accent);
  flex-shrink: 0;
  margin-top: 4px;
  transition: transform .15s;
}

.wf-event:hover .wf-event-dot { transform: scale(1.3); }

.wf-event-line {
  width: 2px;
  flex: 1;
  min-height: 24px;
  background: linear-gradient(to bottom, var(--wf-border-accent), var(--wf-border));
  margin-top: 4px;
}

.wf-event-card {
  padding: 0 0 28px;
}

.wf-event-date {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--wf-accent);
  background: color-mix(in srgb, var(--wf-accent) 12%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.wf-event-title {
  font-family: 'Cinzel', Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--wf-ink);
  margin-bottom: 8px;
  line-height: 1.3;
  letter-spacing: .3px;
}

.wf-event-description {
  font-size: 14px;
  color: var(--wf-ink-dim);
  line-height: 1.65;
  margin-bottom: 10px;
}

.wf-event-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--wf-accent);
  border: 1px solid var(--wf-border-accent);
  padding: 5px 12px;
  border-radius: 999px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: background .15s, border-color .15s;
}

.wf-event-link:hover {
  background: color-mix(in srgb, var(--wf-accent) 12%, transparent);
}

.wf-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--wf-ink-muted);
}

.wf-empty-icon { font-size: 40px; display: block; margin-bottom: 12px; }

/* ── Scrollbar styling ── */
.wf-sidebar::-webkit-scrollbar,
.wf-content::-webkit-scrollbar,
.wf-relations::-webkit-scrollbar { width: 4px; }
.wf-sidebar::-webkit-scrollbar-thumb,
.wf-content::-webkit-scrollbar-thumb,
.wf-relations::-webkit-scrollbar-thumb { background: var(--wf-border); border-radius: 4px; }

/* ── Responsive ── */

/* Mobile */
@media (max-width: 640px) {
  /* iOS-fix: voorkomt dat de pagina achter het geopende menu doorscrolt. */
  html.wf-nav-locked {
    overflow: hidden;
  }

  .wf-topbar { display: flex; }

  /* iOS Safari-fix: een ouder-element met overflow:hidden breekt
     position:fixed kinderen (de zijbalk + de backdrop erachter) — Safari
     clipt/herberekent ze dan verkeerd t.o.v. het echte viewport, waardoor
     bijv. de zoekbalk onder de topbar terecht kan komen. Android/Chrome
     heeft dit probleem niet. Op mobiel is overflow:hidden hier ook niet
     nodig (de layout is dan toch al normale document-flow), dus dit is
     veilig om uit te zetten zonder iets anders te breken. */
  .worldforge-viewer {
    overflow: visible;
  }

  .wf-shell {
    display: block;
    height: auto;
    min-height: unset;
  }

  .wf-sidebar {
    position: fixed;
    /* Wordt live overschreven door JS (--wf-sidebar-offset) met de
       werkelijke hoogte van alles wat boven onze topbar staat (bijv.
       de header van het WordPress-thema). De vaste waarde hierna is
       puur een fallback voor het allereerste moment vóór JS actief is. */
    top: var(--wf-sidebar-offset, var(--wf-topbar-h));
    left: 0;
    bottom: 0;
    width: min(82vw, 300px);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
  }

  .wf-sidebar-header { padding-top: 12px; }

  .worldforge-viewer.is-nav-open .wf-sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }

  .worldforge-viewer.is-nav-open .wf-nav-backdrop {
    display: block;
    opacity: 1;
  }

  .wf-nav-backdrop { display: none; }

  .wf-content {
    height: auto;
    overflow-y: visible;
  }

  .wf-content-inner {
    padding: 20px 18px 48px;
  }

  .wf-article-hero {
    margin: -20px -18px 0;
  }

  .wf-type-stat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .wf-article-grid {
    grid-template-columns: 1fr;
  }

  .wf-relation-list {
    grid-template-columns: 1fr;
  }

  .wf-search-kbd { display: none; }
}

/* ── Utility ── */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.worldforge-error {
  padding: 12px 16px;
  background: rgba(220, 38, 38, .1);
  border: 1px solid rgba(220, 38, 38, .3);
  border-radius: 4px;
  color: #dc2626;
  font-size: 14px;
}

html[data-theme="dark"] .worldforge-error {
  color: #fca5a5;
}
