/* =====================================================================
   Chains of Belief — Shared Widget Styles (cob-widgets.css)
   Floating-panel shell + global-chains panel, in the book's design
   language (navy / cream / gold). Loaded alongside book.css.
   ===================================================================== */

/* ---------- Floating shell ---------- */
.cob-float {
  position: fixed;
  z-index: 9000;
  width: 380px;
  max-width: calc(100vw - 16px);
  /* Top offset is 78px; the fixed bottom nav (.page-nav) is ~75px tall.
     Use dvh (dynamic viewport height) so the cap accounts for mobile/tablet
     browser UI chrome that 100vh wrongly includes. vh is the fallback. */
  max-height: calc(100vh - 78px - 100px);
  max-height: calc(100dvh - 78px - 100px);
  background: var(--cream, #F5F0E8);
  border: 1px solid var(--gold-soft, #B89A40);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(27, 39, 64, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
}
.cob-float--dual { width: 560px; }
/* CRITICAL: display:flex overrides the bare [hidden] attribute, so the panel
   would stay visible when hidden=true. This makes hidden actually hide it. */
.cob-float[hidden] { display: none !important; }

.cob-float__header {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--dark-navy, #1B2740);
  color: var(--cream, #F5F0E8);
  padding: 0.5rem 2.6rem 0.5rem 0.8rem;
  border-bottom: 2px solid var(--gold, #C8A84B);
  flex: 0 0 auto;
  user-select: none;
}
.cob-float__close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  background: transparent;
  border: none;
  color: var(--cream, #F5F0E8);
  font-size: 1.4rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  cursor: pointer;
}
.cob-float__close:hover { background: rgba(255, 255, 255, 0.15); }

.cob-float__title {
  font-family: var(--font-heading, 'Crimson Pro', serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.cob-float__body {
  padding: 0.8rem;
  overflow-y: auto;
  flex: 1 1 auto;
  /* Critical: without min-height:0 a flex item won't shrink below its content
     height, so overflow-y never engages and the panel grows past max-height,
     overlapping the bottom nav. This lets the body scroll internally instead. */
  min-height: 0;
}

/* ---------- Live region (screen-reader announcements) ---------- */
.cob-float__live {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Rail + list (single chain) ---------- */
.cob-chains__rail-list {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}
.cob-chains__rail {
  flex: 0 0 auto;
  display: block;
  margin-top: 2px;
}
.cob-chains__rail-list .cob-chains__list {
  flex: 1 1 auto;
  border-left: none;
  padding-left: 0;
}

.cob-chains__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Each link row is PITCH=40px tall to align with the rail ovals. */
.cob-chains__link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  padding: 0 0.5rem;
  min-height: 40px;
  cursor: pointer;
  border-radius: 0 4px 4px 0;
}
.cob-chains__link:hover { background: var(--off-white, #EAE4D9); }
.cob-chains__link.is-active {
  background: var(--off-white, #EAE4D9);
  border-left-color: var(--gold, #C8A84B);
}
.cob-chains__link-year {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--gold-deep, #7A5E12);
}
.cob-chains__link-name {
  font-size: 0.84rem;
  color: var(--charcoal, #2B2B2B);
  line-height: 1.2;
}
.cob-chains__link.is-active .cob-chains__link-name { font-weight: 600; }

/* ---------- Dual / paired chain ---------- */
.cob-chains__dual {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.4rem;
  align-items: start;
  margin-bottom: 0.8rem;
}
.cob-chains__list--left { text-align: right; }
.cob-chains__list--left .cob-chains__link {
  align-items: flex-end;
  border-left: none;
  border-right: 3px solid transparent;
  border-radius: 4px 0 0 4px;
}
.cob-chains__list--left .cob-chains__link.is-active {
  border-right-color: var(--med-navy, #2E4272);
}
.cob-chains__list--right .cob-chains__link.is-active {
  border-left-color: var(--brown, #8B5E3C);
}
.cob-chains__rail--dual { margin-top: 2px; }
.cob-chains__dual-footer {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--med-navy, #2E4272);
  margin: 0.6rem 0 0;
  text-align: center;
}

/* ---------- Mobile full-screen takeover ---------- */
@media (max-width: 600px) {
  .cob-float--fullscreen {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 0;
    border: none;
  }
  .cob-float--fullscreen .cob-float__header {
    padding: 0.9rem 0.6rem 0.9rem 1rem;
  }
  .cob-float--fullscreen .cob-float__close {
    width: 44px; height: 44px; font-size: 1.7rem;
  }
  /* dual chain stacks the rail columns tighter on small screens */
  .cob-float--dual { width: 100vw; }
}

/* ---------- Tagline / picker / detail (shared) ---------- */
.cob-chains__empty {
  color: var(--mid-gray, #6E6454);
  font-style: italic;
  font-size: 0.9rem;
  padding: 0.4rem 0 0.8rem;
}
.cob-chains__tagline {
  color: var(--med-navy, #2E4272);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 0.7rem;
  line-height: 1.4;
}
.cob-chains__picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}
.cob-chains__picker-btn {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--light-gray, #D4CFC6);
  background: var(--white, #fff);
  color: var(--mid-gray, #6E6454);
  cursor: pointer;
}
.cob-chains__picker-btn.is-active {
  background: var(--dark-navy, #1B2740);
  color: var(--cream, #F5F0E8);
  border-color: var(--dark-navy, #1B2740);
}
.cob-chains__detail {
  background: var(--white, #fff);
  border: 1px solid var(--light-gray, #D4CFC6);
  border-top: 3px solid var(--gold, #C8A84B);
  border-radius: 0 0 6px 6px;
  padding: 0.7rem 0.8rem;
}
.cob-chains__detail-year {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-deep, #7A5E12);
}
.cob-chains__detail-name {
  font-family: var(--font-heading, 'Crimson Pro', serif);
  font-size: 1rem;
  margin: 0.15rem 0 0.45rem;
  color: var(--dark-navy, #1B2740);
}
.cob-chains__detail-body {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--charcoal, #2B2B2B);
}
.cob-chains__detail-body em { color: var(--med-navy, #2E4272); }

/* ---------- "Go to where this is discussed" jump button ---------- */
.cob-chains__jump {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.7rem;
  padding: 0.4rem 0.7rem;
  background: var(--dark-navy, #1B2740);
  color: var(--cream, #F5F0E8);
  border: none;
  border-radius: 5px;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.cob-chains__jump:hover { background: var(--med-navy, #2E4272); }
.cob-chains__jump-arrow { font-weight: 700; color: var(--gold, #C8A84B); }

/* ---------- Nearby chains (no-chain page) ---------- */
.cob-chains__nearby { margin: 0.4rem 0 0.9rem; }
.cob-chains__nearby-group { margin-bottom: 0.7rem; }
.cob-chains__nearby-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mid-gray, #6E6454);
  margin-bottom: 0.35rem;
}
.cob-chains__nearby-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.3rem;
  background: var(--white, #fff);
  border: 1px solid var(--light-gray, #D4CFC6);
  border-left: 3px solid var(--gold, #C8A84B);
  border-radius: 0 5px 5px 0;
  font-family: var(--font-heading, 'Crimson Pro', serif);
  font-size: 0.92rem;
  color: var(--dark-navy, #1B2740);
  cursor: pointer;
}
.cob-chains__nearby-btn:hover { background: var(--off-white, #EAE4D9); }

/* ---------- Back button (chain viewing history) ---------- */
.cob-float__back {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(245,240,232,0.35);
  color: var(--cream, #F5F0E8);
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
}
.cob-float__back[hidden] { display: none; }
.cob-float__back:hover { background: rgba(255,255,255,0.22); }
/* when back is visible, pad the title so it doesn't sit under the button */
.cob-float__back:not([hidden]) ~ .cob-float__title { padding-left: 3.6rem; }

/* ============================================================================
   Map widget — reuses .cob-float shell; these add map-specific styling.
   ============================================================================ */
.cob-float--map { width: 680px; max-width: calc(100vw - 24px); }
.cob-map__body { padding: 0; display: flex; flex-direction: column; min-height: 0; }
/* The map surface flexes and scrolls; the controls, caption, and sources stay
   pinned at the bottom so the CC BY attribution is always visible (it was being
   pushed below the panel fold on tall maps). */
.cob-map__wrap {
  position: relative; width: 100%; background: var(--dark-navy, #1B2740);
  transition: opacity 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
  touch-action: none;
  flex: 1 1 auto; min-height: 0; overflow: hidden;
}
.cob-map__controls, .cob-map__caption, .cob-map__sources { flex: 0 0 auto; }
.cob-map__wrap[data-fading] { opacity: 0.15; }
.cob-map__wrap[data-panning] { cursor: grabbing; }
.cob-map__datetag {
  position: absolute; left: 84px; bottom: 12px; z-index: 7;
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(27,39,64,0.86); color: #F5F0E8;
  font-family: 'Crimson Pro', Georgia, serif; font-weight: 700; font-size: 1.05rem;
  letter-spacing: 0.02em; padding: 4px 11px; border-radius: 6px;
  border: 1px solid var(--gold, #C8A84B); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); -webkit-appearance: none; appearance: none;
}
.cob-map__datetag:hover { background: rgba(36,55,86,0.92); }
.cob-map__datetag:focus-visible { outline: 2px solid var(--gold, #C8A84B); outline-offset: 2px; }
.cob-map__datetag__icon { font-size: 0.8rem; line-height: 1; opacity: 0.85; }
.cob-map__datetag[hidden] { display: none; }
.cob-map__svg-host { width: 100%; position: relative; }
.cob-map__svg-host svg { display: block; width: 100%; height: auto; cursor: grab; }
.cob-bloom__halo { mix-blend-mode: multiply; }
.cob-bloom__dot { fill: #5A0F0F; stroke: #F5F0E8; stroke-width: 0.6; }
/* static location pins (Tier 1 'point'/'points') — a clear teardrop pin */
.cob-pinwrap { transform-box: view-box; }
.cob-pin {
  fill: var(--gold, #C8A84B);
  stroke: var(--dark-navy, #1B2740); stroke-width: 2.2;
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,0.4));
}
.cob-pin__hole { fill: var(--dark-navy, #1B2740); }
/* routes (Tier 2): traced trade/travel corridors */
.cob-route__glow {
  fill: none; stroke: #F8F3E9; stroke-width: 5;
  stroke-linecap: round; stroke-linejoin: round; opacity: 0.75;
}
.cob-route__line {
  fill: none; stroke: var(--dark-red, #8A2020); stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}
.cob-route__origin { fill: #F8F3E9; stroke: var(--dark-red, #8A2020); stroke-width: 1.6; }
.cob-route__via { fill: var(--dark-red, #8A2020); stroke: #F8F3E9; stroke-width: 1; opacity: 0.85; }
.cob-route__dest { fill: var(--dark-red, #8A2020); stroke: #F8F3E9; stroke-width: 1.2; }
/* per-leg cargo chips */
.cob-route__cargo-bg { fill: #2E2A24; opacity: 0.93; }
.cob-route__cargo-text { fill: #F8F3E9; font-family: 'Crimson Pro', Georgia, serif; dominant-baseline: middle; }
.cob-route__cargo-icon { fill: #E7C66B; stroke: none; }
.cob-route__cargo-icon-line { stroke: #2E2A24; stroke-width: 0.9; fill: none; }
.cob-route__cargo-icon--people { fill: #E0857A; }
.cob-route__cargo--clickable { pointer-events: all; cursor: pointer; }
.cob-route__cargo--clickable .cob-route__cargo-bg { stroke: #E7C66B; stroke-width: 0.6; stroke-opacity: 0.5; }
.cob-route__cargo-more { fill: #E7C66B; dominant-baseline: middle; font-family: 'Inter', system-ui, sans-serif; font-style: italic; }
.cob-route__cargo-more-ring { fill: none; stroke: #E7C66B; stroke-width: 1.1; }
.cob-route__cargo-divider { stroke: #E7C66B; stroke-width: 0.7; stroke-opacity: 0.4; }
/* cargo detail popup */
.cob-cargo-detail {
  position: absolute; z-index: 30; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(360px, 86%); max-height: 78%; overflow-y: auto;
  background: #FBF7EE; color: #2E2A24; border: 1px solid #C9B998;
  border-radius: 10px; padding: 18px 20px 20px; box-shadow: 0 10px 34px rgba(20,16,10,0.34);
  font-family: 'Crimson Pro', Georgia, serif;
}
.cob-cargo-detail__close {
  position: absolute; top: 8px; right: 10px; border: none; background: none;
  font-size: 22px; line-height: 1; cursor: pointer; color: #6B5E48;
}
.cob-cargo-detail__title { margin: 0 24px 10px 0; font-size: 1.15rem; color: #5A1A1A; }
.cob-cargo-detail__dir { margin: 0 0 10px; }
.cob-cargo-detail__dir h4 {
  margin: 0 0 3px; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: #8A6D3B; font-family: 'Inter', system-ui, sans-serif;
}
.cob-cargo-detail__dir ul { margin: 0 0 0 18px; padding: 0; }
.cob-cargo-detail__dir li { margin: 2px 0; font-size: 0.95rem; }
.cob-cargo-detail__note {
  margin: 12px 0 0; padding-top: 10px; border-top: 1px solid #E2D7C0;
  font-size: 0.92rem; font-style: italic; color: #4A4034;
}
/* onward dispersal arrows from a hub (thinner, lighter than the main route) */
.cob-route__disperse { fill: none; stroke: #8A2020; stroke-opacity: 0.7; stroke-dasharray: 5 4; }
.cob-pt__label--disperse { font-style: italic; font-size: 0.85em; }
/* the direction arrow drawn inside a cargo chip */
.cob-route__cargo-dir path { fill: none; stroke: #E7C66B; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cob-pt__label {
  font-family: var(--font-display, 'Crimson Pro', Georgia, serif);
  font-size: 12.5px; font-weight: 700; fill: #2c2114;
  paint-order: stroke; stroke: #F8F3E9; stroke-width: 2.8px; stroke-linejoin: round;
  pointer-events: none;
}
/* Crossfade layer for smooth era morphing (no white flash). The incoming map is
   layered absolutely over the current one and faded in, then promoted. */
.cob-map__svg-layer {
  position: absolute; top: 0; left: 0; width: 100%;
  transition: opacity 0.22s ease;
}

/* Zoom controls — lower right of the map surface */
.cob-map__zoom {
  position: absolute; right: 10px; bottom: 10px; z-index: 5;
  display: flex; flex-direction: column; gap: 4px;
}
.cob-map__zoom-btn {
  width: 30px; height: 30px; border: 1px solid var(--gold-soft, #B89A40);
  background: rgba(245,240,232,0.94); color: var(--dark-navy, #1B2740);
  border-radius: 5px; font-size: 1.05rem; line-height: 1; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(27,39,64,0.25); transition: background 0.12s;
  padding: 0;
}
.cob-map__zoom-btn:hover { background: #fff; }
.cob-map__zoom-btn:disabled { opacity: 0.4; cursor: default; }
.cob-map__zoom-reset { font-size: 0.95rem; }
.cob-map__wrap svg { display: block; width: 100%; height: auto; }
.cob-map__loading {
  padding: 2rem; text-align: center; color: var(--cream, #F5F0E8);
  font-family: var(--font-body, 'Inter', sans-serif); font-size: 0.85rem;
}
.cob-map__controls {
  display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap;
  padding: 0.45rem 0.8rem; background: var(--cream, #F5F0E8);
  border-top: 1px solid rgba(0,0,0,0.08);
  font-family: var(--font-body, 'Inter', sans-serif); font-size: 0.74rem;
}
.cob-map__toggle { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; color: var(--charcoal, #3a3a3a); }
.cob-map__toggle input { margin: 0; cursor: pointer; }
.cob-map__toggle--disabled { opacity: 0.4; cursor: default; }
.cob-map__caption {
  padding: 0.45rem 0.8rem; font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.72rem; color: var(--charcoal, #3a3a3a);
  background: var(--cream, #F5F0E8); border-top: 1px solid rgba(0,0,0,0.06);
}
.cob-map__attr { color: #777; font-style: italic; }
.cob-map__sources {
  padding: 0.3rem 0.8rem 0.5rem; font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.62rem; line-height: 1.35; color: #8a8276;
  background: var(--cream, #F5F0E8);
}
.cob-map__sources a { color: #8a8276; text-decoration: underline; }
.cob-map__sources a:hover { color: var(--charcoal, #3a3a3a); }

/* ===== Globe navigator ===== */
.cob-globe { position: relative; }
.cob-globe__svg { width: 100%; height: 100%; display: block; cursor: grab; }
.cob-globe__svg:active { cursor: grabbing; }
.cob-globe__ocean { /* fill set inline via gradient */ }
.cob-globe__land path { fill: #c9b896; stroke: #8a7a5c; stroke-width: 0.4; }
.cob-globe__rim { fill: none; stroke: #6a5a3c; stroke-width: 1.4; }
.cob-globe__shade { pointer-events: none; }

/* Region highlight zones: the land inside a covered region. Transparent until
   hover/focus, then it glows gold and becomes clearly clickable. */
.cob-globe__region { cursor: pointer; outline: none; }
.cob-globe__region-hit { fill: transparent; }
.cob-globe__region-land path {
  fill: transparent; stroke: none;
  transition: fill 0.18s ease, stroke 0.18s ease;
}
.cob-globe__region:hover .cob-globe__region-land path,
.cob-globe__region:focus-visible .cob-globe__region-land path {
  fill: var(--gold, #C8A24B);
  stroke: #8a6d24; stroke-width: 0.5;
}
/* In the enlarged or full globe, show covered regions with a soft persistent
   glow so the reader can see what's clickable (essential on touch, where there
   is no hover). Hovering still brightens the specific region. */
.cob-map__globe--big .cob-globe__region-land path,
.cob-map__globe--full .cob-globe__region-land path {
  fill: rgba(200, 162, 75, 0.4);
}
.cob-map__globe--big .cob-globe__region:hover .cob-globe__region-land path,
.cob-map__globe--full .cob-globe__region:hover .cob-globe__region-land path {
  fill: var(--gold, #C8A24B);
}
.cob-globe__region:focus-visible .cob-globe__region-hit {
  stroke: var(--gold, #C8A24B); stroke-width: 2; stroke-dasharray: 3 2;
}

/* Corner mode: globe docked lower-left inside the map window. */
.cob-map__globe {
  position: absolute; left: 12px; bottom: 12px;
  width: 92px; height: 92px; z-index: 6;
  border-radius: 50%;
  background: transparent;
  /* drop shadow strictly BENEATH the globe: vertical offset exceeds the blur
     radius, so no shadow bleeds above the circle (no halo/ring). */
  filter: drop-shadow(0 7px 5px rgba(27, 39, 64, 0.4));
  transform-origin: left bottom; /* grow from the corner anchor */
  transition: width 0.28s cubic-bezier(.2,.8,.3,1),
              height 0.28s cubic-bezier(.2,.8,.3,1),
              filter 0.28s ease;
}
/* Enlarged state (hover on desktop, tap on touch): grows ~2.6x in place. */
.cob-map__globe--big {
  width: 240px; height: 240px; z-index: 8;
  filter: drop-shadow(0 14px 10px rgba(27, 39, 64, 0.42));
}
.cob-map__globe--full {
  /* centered in the map area, sized to clear the bottom controls/attribution */
  left: 50%; bottom: 50%; width: 320px; height: 320px;
  max-width: 74%; max-height: 74%;
  transform: translate(-50%, 50%); transform-origin: center;
  filter: drop-shadow(0 16px 11px rgba(27, 39, 64, 0.4));
}
.cob-map__globe-hint {
  position: absolute; left: 0; right: 0; bottom: -16px;
  text-align: center; font-size: 0.6rem; color: #8a8276;
  font-family: var(--font-body, 'Inter', sans-serif); pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .cob-map__globe { transition: none; }
  .cob-globe__region-land path { transition: none; }
}

/* Base-map layers */
.cob-map__sea { fill: #C7D0DA; }
.cob-map__land path { fill: #F3EDE2; stroke: none; }
/* thematic zoomed-out base map (Atlantic trade) */
.cob-basemap__ocean { fill: #C7D0DA; }
.cob-basemap__land path { fill: #E4D8BE; stroke: #C9B998; stroke-width: 0.5; }
.cob-map__graticule { fill: none; stroke: #6E7C90; stroke-width: 0.3; opacity: 0.1; }

/* Historical political borders.
   When fills are ON, borders are a soft near-white (clean printed-atlas look);
   the fills define the countries, the pale outline just separates them.
   When fills are OFF, borders use the darker earth ink so they read on their own. */
.cob-map__borders { fill: none; }
.cob-map__polity {
  fill: transparent; stroke: #6E4A2E; stroke-width: 0.9;
  stroke-linejoin: round; vector-effect: non-scaling-stroke;
  transition: fill 0.15s;
}
.cob-map__polity--filled {
  fill-opacity: 0.88;
  stroke: #FBF6EC;            /* soft near-white clean outline */
  stroke-width: 0.8;
  stroke-opacity: 0.9;
}
/* Borders toggle OFF: hide the outline but keep the filled country shapes. */
.cob-map__polity--nostroke { stroke: none; }
.cob-map__polity:hover { fill: rgba(120,70,40,0.30); cursor: pointer; }

/* Country labels — larger, serif display, gentle cream halo for legibility.
   Progressive: hidden by default, fade in when zoom crosses their threshold. */
/* Labels are an HTML overlay (fixed screen-pixel size, immune to map zoom). */
.cob-map__label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}
.cob-map__label-layer--hidden { opacity: 0; }
.cob-map__pin-layer {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 5; overflow: visible;
}
.cob-map__hlabel {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  user-select: none; -webkit-user-select: none;
  font-family: var(--font-display, 'Crimson Pro', Georgia, 'Times New Roman', serif);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #2c2114;
  text-shadow:
     0 0 2px rgba(248,243,233,0.95),
     0 0 2px rgba(248,243,233,0.95),
     1px 1px 0 rgba(248,243,233,0.9),
    -1px -1px 0 rgba(248,243,233,0.9),
     1px -1px 0 rgba(248,243,233,0.9),
    -1px 1px 0 rgba(248,243,233,0.9);
}

.cob-float--map.cob-float--fullscreen { width: 100vw; }

/* ===== Map back arrow ===== */
.cob-map__back {
  background: none; border: none; color: var(--gold, #C8A24B);
  font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 2px 8px 2px 2px;
  margin-right: 2px; border-radius: 4px; transition: transform 0.15s, color 0.15s;
}
.cob-map__back:hover { transform: translateX(-2px); color: #e0c067; }




/* ===== Map footer (Layers button | caption | time nav) ===== */
.cob-map__footer {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.7rem; background: var(--cream, #F5F0E8);
  border-top: 1px solid rgba(0,0,0,0.08); position: relative;
  font-family: var(--font-body, 'Inter', sans-serif);
}
.cob-map__layers-btn {
  flex: 0 0 auto; border: none;
  background: var(--dark-navy, #1B2740); color: var(--gold, #C8A24B); cursor: pointer;
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 4px; white-space: nowrap;
  font-family: var(--font-body, 'Inter', sans-serif); transition: background 0.15s, color 0.15s;
}
.cob-map__layers-btn:hover { background: #243352; color: #e0c067; }
.cob-map__replay-btn {
  flex: 0 0 auto; border: none; background: var(--dark-navy, #1B2740);
  color: var(--gold, #C8A24B); cursor: pointer; padding: 0;
  width: 30px; height: 26px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.cob-map__replay-btn:hover { background: #243352; color: #e0c067; }
.cob-map__replay-btn[hidden] { display: none; }
.cob-map__footer .cob-map__caption {
  flex: 1 1 auto; border: none; background: none; padding: 0;
  font-size: 0.68rem; text-align: center;
}
/* Layers popup floats above the Layers button */
.cob-map__layers-pop {
  position: absolute; left: 8px; bottom: calc(100% + 4px); z-index: 9;
  background: #fff; border: 1px solid rgba(0,0,0,0.18); border-radius: 7px;
  box-shadow: 0 4px 14px rgba(27,39,64,0.22);
  padding: 0.5rem 0.7rem; display: flex; flex-direction: column; gap: 0.4rem;
}
.cob-map__layers-pop[hidden] { display: none; }
.cob-map__toggle--disabled { opacity: 0.4; }
.cob-map__layers-pop .cob-map__toggle { font-size: 0.78rem; }

/* Time nav (rewind / forward) in the footer, right-aligned */
.cob-map__timenav { flex: 0 0 auto; display: flex; align-items: center; gap: 0.3rem; }
.cob-map__timenav[hidden] { display: none; }
.cob-map__timenav-btn {
  border: none; background: var(--dark-navy, #1B2740); color: var(--gold, #C8A24B);
  cursor: pointer; font-size: 0.82rem; line-height: 1;
  width: 30px; height: 26px; border-radius: 4px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.cob-map__timenav-btn:hover { background: #243352; color: #e0c067; }
.cob-map__timenav-btn:disabled { opacity: 0.3; cursor: default; }
.cob-map__timenav-btn:disabled:hover { background: var(--dark-navy, #1B2740); color: var(--gold, #C8A24B); }
.cob-map__timenav-label {
  font-size: 0.66rem; color: var(--dark-navy, #1B2740); min-width: 52px;
  text-align: center; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; font-family: var(--font-body, 'Inter', sans-serif);
}

/* scrubbing blur (book content behind the panel) */
body.cob-scrubbing #book { filter: blur(3px); transition: filter 0.2s ease; }

/* ============================================================ *
 *  Inline embedded maps (cob-inline-map.js) — self-contained   *
 *  16:9 band. Stack: title bar -> map band -> controls strip   *
 *  -> attribution. Chrome lives OUTSIDE the band.              *
 * ============================================================ */
.cob-inline-map--full {
  width: 100%; max-width: 100%; margin: 1.8rem 0;
  /* Single outer frame around the whole embed. The inner pieces (header, band,
     bar) no longer carry their own side borders — three separately-bordered boxes
     stacked at fractional aspect-ratio heights left hairline white gaps where the
     gold lines failed to tile. One border on the container = one clean frame. */
  border: 1px solid #C9B998; border-radius: 8px; overflow: hidden;
}
.cob-inline-map--full * { box-sizing: border-box; }

/* title bar: back (left) · title · expand (right) */
.cob-inline-map__hdr {
  display: flex; align-items: center; gap: 8px;
  background: var(--dark-navy, #1B2740); color: var(--cream, #F5F0E8);
  border-bottom: 2px solid var(--gold, #C8A84B);
  padding: 0.4rem 0.6rem 0.4rem 0.85rem;
}
.cob-inline-map__title {
  flex: 1 1 auto; min-width: 0; font-family: 'Crimson Pro', Georgia, serif; font-weight: 700;
  font-size: 1rem; letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden;
}
/* When the header carries content-overlay labels, keep it to one line and fade the
   right edge out as it runs out of room. Full text is in the title= tooltip. */
.cob-inline-map__title--has-ovl {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
  cursor: help;
}
.cob-inline-map__title-ovl { font-weight: 500; color: var(--gold, #C8A84B); }
.cob-inline-map__back, .cob-inline-map__hdr .cob-inline-map__expand {
  flex: 0 0 auto; background: rgba(255,255,255,0.08); color: #F8F3E9;
  border: 1px solid rgba(255,255,255,0.25); border-radius: 5px; cursor: pointer;
  width: 30px; height: 28px; font-size: 1rem; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
}
.cob-inline-map__back:hover, .cob-inline-map__hdr .cob-inline-map__expand:hover { background: rgba(255,255,255,0.18); }
.cob-inline-map__back[hidden] { display: none; }

/* 16:9 map band — pure map, no overlays, no text selection on drag */
.cob-inline-map__band {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  overflow: hidden; background: #C9D2DB; cursor: grab; touch-action: pan-y;
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  font-size: 0; line-height: 0; /* kill inline-element whitespace gap under the svg */
}
.cob-inline-map__band[data-panning] { cursor: grabbing; }
.cob-inline-map__map { display: block; width: 100%; height: 100%; }
.cob-inline-map__map svg { display: block; width: 100%; height: 100%; cursor: inherit; }

/* controls strip BELOW the band. position:relative so the enlarged globe can be
   absolutely placed against it and spill UP into the band without resizing it. */
.cob-inline-map__bar {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; min-height: 40px; height: 40px;
  background: #F4ECDB; border-top: 1px solid #C9B998;
  overflow: visible; -webkit-user-select: none; user-select: none;
}
.cob-inline-map__spacer { flex: 1 1 auto; }
.cob-inline-map__btn {
  font: inherit; font-size: 0.82rem; line-height: 1; cursor: pointer;
  background: var(--dark-navy, #1B2740); color: #F8F3E9; border: none;
  border-radius: 5px; padding: 6px 9px; -webkit-appearance: none; appearance: none;
}
.cob-inline-map__btn:hover { background: #243756; }
.cob-inline-map__btn:focus-visible { outline: 2px solid #B8860B; outline-offset: 2px; }
.cob-inline-map__zin, .cob-inline-map__zout, .cob-inline-map__reset { width: 30px; padding: 6px 0; text-align: center; font-size: 1rem; }

/* timeline (FF/RW + date) */
.cob-inline-map__timewrap { display: inline-flex; align-items: center; gap: 5px; }
.cob-inline-map__date {
  font-family: 'Crimson Pro', Georgia, serif; font-weight: 600; font-size: 0.85rem;
  color: #2c2114; min-width: 74px; text-align: center;
}
.cob-inline-map__rw, .cob-inline-map__ff { font-size: 0.7rem; padding: 7px 7px; }

/* layers popup */
.cob-inline-map__layerswrap { position: relative; display: inline-flex; }
.cob-inline-map__layerspop {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 30;
  background: #1B2740; color: #F5F0E8; border: 1px solid var(--gold, #C8A84B);
  border-radius: 6px; padding: 8px 10px; box-shadow: 0 4px 14px rgba(20,16,10,0.35);
  display: flex; flex-direction: column; gap: 6px; white-space: nowrap;
  max-height: min(60vh, 340px); overflow-y: auto; overscroll-behavior: contain;
}
.cob-inline-map__layerspop[hidden] { display: none; }
.cob-inline-map__layerspop label { display: flex; align-items: center; gap: 7px; font-size: 0.85rem; cursor: pointer; }
.cob-inline-map__ovl-divider { height: 1px; background: rgba(245,240,232,0.2); margin: 6px 0; flex: 0 0 auto; }
.cob-inline-map__ovl-row { font-size: 0.82rem; }
.cob-inline-map__layerspop label { display: flex; align-items: center; gap: 7px; font-size: 0.85rem; cursor: pointer; }
.cob-inline-map__ovl-divider { height: 1px; background: rgba(0,0,0,0.12); margin: 6px 0; }
.cob-inline-map__ovl-row { font-size: 0.82rem; }

/* the little globe lives in the strip; on hover it scales up and repositions into
   the MAP's lower-left corner (above the controls bar) so it never covers the
   Layers button. The figure is the positioning context. */
.cob-inline-map--full { position: relative; }
.cob-inline-map__globe {
  position: relative; width: 30px; height: 30px; flex: 0 0 auto;
  border-radius: 50%; overflow: hidden; box-shadow: 0 1px 4px rgba(20,16,10,0.3);
  z-index: 5; cursor: grab; align-self: center;
  transition: width 0.16s ease, height 0.16s ease;
}
.cob-inline-map__globe svg { width: 100%; height: 100%; display: block; }
.cob-inline-map--full.cob-inline-map--globebig .cob-inline-map__globe {
  position: absolute; left: 10px; bottom: 50px; /* sit in the map's lower-left, above the 40px bar */
  width: 130px; height: 130px; z-index: 25; box-shadow: 0 4px 16px rgba(20,16,10,0.4);
}

/* attribution + caption */
.cob-inline-map .figure__source {
  border: 1px solid #C9B998; border-top: none; border-radius: 0 0 8px 8px;
  margin: 0; padding: 5px 8px; font-size: 0.72rem; color: #8a8276; background: #FBF7EE;
}
.cob-inline-map .figure__caption { margin: 0.5rem 0 0; }
.cob-inline-map__err { display: block; padding: 2rem 1rem; text-align: center; color: #8A7A5C; font-style: italic; }

/* SVG place labels */
.cob-inline-map__label {
  fill: #2c2114; font-family: 'Crimson Pro', Georgia, serif; font-weight: 600;
  paint-order: stroke; stroke: rgba(248,243,233,0.92); stroke-width: 2.6px; stroke-linejoin: round;
}

/* --- pin embed: small, clickable, wraps like a picture, pops out the widget --- */
.cob-inline-map--pin { max-width: 290px; margin: 0.4rem 0 1rem; }
.cob-inline-map--pin.cob-inline-map--float-right { float: right; margin-left: 1.5rem; clear: right; }
.cob-inline-map--pin.cob-inline-map--float-left { float: left; margin-right: 1.5rem; clear: left; }
@media (max-width: 640px) {
  .cob-inline-map--pin.cob-inline-map--float-right,
  .cob-inline-map--pin.cob-inline-map--float-left { float: none; margin: 1rem auto; }
}
.cob-inline-map__pinframe {
  position: relative; display: block; width: 100%; padding: 0; border: 1px solid #C9B998;
  border-radius: 6px; overflow: hidden; cursor: pointer; background: #C7D0DA;
  box-shadow: 0 2px 8px rgba(20,16,10,0.12); transition: box-shadow 0.15s, transform 0.15s;
  aspect-ratio: 4 / 3;
}
.cob-inline-map__pinframe:hover { box-shadow: 0 4px 14px rgba(20,16,10,0.22); transform: translateY(-1px); }
.cob-inline-map__pinframe:focus-visible { outline: 2px solid #B8860B; outline-offset: 2px; }
.cob-inline-map--pin .cob-inline-map__map, .cob-inline-map--pin .cob-inline-map__map svg { width: 100%; height: 100%; }
.cob-inline-map__pinexpand {
  position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20,32,51,0.82); color: #F8F3E9; border-radius: 4px;
  font-size: 12px; line-height: 1; pointer-events: none;
}
