/**
 * Local-only overrides for plans/global GEO pages (injected by serve.py).
 * Keeps geo-index-en.html unchanged while matching live index-en behaviour.
 */
.wp-page nav.wp-segment,
.wp-page .wp-segment {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  box-shadow: none !important;
  background: transparent !important;
}

.wp-page {
  --wp-geo-table-head-offset: 56px;
}

/* Fixed clone bar — worldplan-geo-sticky-liverow.js (CMS overflow breaks pure CSS sticky) */
.wp-liverow-sticky-shell {
  position: fixed;
  z-index: 45;
  overflow: hidden;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(26, 16, 51, 0.18);
}

.wp-liverow-sticky-shell.is-active {
  pointer-events: auto;
}

.wp-liverow-sticky-shell[hidden] {
  display: none !important;
}

.wp-liverow-sticky-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.wp-liverow-sticky-scroll::-webkit-scrollbar {
  display: none;
}

.wp-liverow-sticky-clone {
  margin: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.wp-liverow-sticky-clone thead th {
  background: #774fda;
  color: #fff;
  border: 2px solid #fff;
  font-weight: bold;
  vertical-align: middle;
  text-align: center;
}

@media (min-width: 769px) {
  .wp-liverow-sticky-clone thead th {
    padding: 10px 4px;
    font-size: 16px;
    line-height: 120%;
  }
}

.wp-liverow-sticky-clone thead th,
.wp-liverow-sticky-clone thead th * {
  color: #fff;
}

/* Mobile liverow sticky header + float nav (worldplan-geo-sticky-liverow.js) */
@media (max-width: 768px) {
  .wp-page {
    --wp-geo-table-head-offset: 85px;
  }

  .wp-liverow-sticky-shell--mobile {
    z-index: 41;
    pointer-events: none;
    box-sizing: border-box;
  }

  .wp-liverow-sticky-shell--mobile .wp-liverow-sticky-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    pointer-events: none;
    width: 100%;
  }

  .wp-liverow-sticky-shell--mobile .wp-liverow-sticky-clone {
    border-collapse: collapse;
    margin: 0;
    table-layout: fixed;
  }

  /* Clone lives on body (outside .wp-page) — mirror in-table mobile thead typography */
  .wp-liverow-sticky-clone.wp-liverow thead th,
  .wp-liverow-sticky-shell--mobile .wp-liverow-sticky-clone thead th {
    font-size: 16px;
    padding: 10px 4px;
    line-height: 120%;
    vertical-align: middle;
  }

  .wp-liverow-sticky-clone .wp-liverow__chooseone {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: normal;
    line-height: 130%;
  }

  .wp-liverow-sticky-shell--mobile .wp-liverow-sticky-clone thead th:first-child {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: #774fda;
  }

  .wp-table-wrap.is-liverow-head-fixed .wp-table.wp-liverow thead th {
    visibility: hidden;
    pointer-events: none;
  }

  /* Liverow mobile: 3 columns in view (see worldplan-geo-liverow.css) */
  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table.wp-liverow {
    width: 333.333%;
    table-layout: fixed;
  }

  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-liverow th,
  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-liverow td {
    width: 10%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .wp-page .wp-table-wrap:has(.wp-liverow--mobile-sticky-col) .wp-table-scroll {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  .wp-page .wp-table.wp-liverow.wp-liverow--mobile-sticky-col {
    border-collapse: separate;
    border-spacing: 0;
  }

  .wp-page
    .wp-table-wrap:not(.is-liverow-head-fixed)
    .wp-table.wp-liverow.wp-liverow--mobile-sticky-col
    thead
    th:first-child {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 24;
    background-color: #774fda;
  }

  .wp-table-wrap.is-liverow-head-fixed .wp-table.wp-liverow thead th:first-child {
    position: static;
    left: auto;
  }

  .wp-page .wp-table.wp-liverow.wp-liverow--mobile-sticky-col tbody th.wp-liverow__plan {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 20;
    background: #f8f0ff !important;
  }

  .wp-page
    .wp-table-wrap:has(.wp-liverow--mobile-sticky-col).is-scrolled-x
    .wp-table.wp-liverow
    thead
    th:first-child,
  .wp-page
    .wp-table-wrap:has(.wp-liverow--mobile-sticky-col).is-scrolled-x
    .wp-table.wp-liverow
    tbody
    th.wp-liverow__plan {
    box-shadow: 4px 0 8px rgba(26, 16, 51, 0.12);
  }

  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table-stage {
    position: relative;
  }

  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    z-index: 42;
    width: clamp(28px, 8vw, 36px);
    height: clamp(28px, 8vw, 36px);
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
    font-size: clamp(20px, 6vw, 28px);
  }

  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table-nav--prev {
    left: 4px;
  }

  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table-nav--next {
    right: 4px;
  }

  /* Float overlay (JS place()) — mirror lacks this in plancss/worldplan-geo-liverow.css */
  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table-nav.wp-table-nav--float {
    position: fixed !important;
    top: auto;
    bottom: auto;
    margin: 0;
    z-index: 43;
    transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
    backface-visibility: hidden;
    display: flex !important;
  }

  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table-nav.wp-table-nav--float.wp-table-nav--prev {
    right: auto;
  }

  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table-nav.wp-table-nav--float.wp-table-nav--next {
    right: auto;
  }

  .wp-table-nav.wp-table-nav--float:not(.is-offscreen) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .wp-table-nav.wp-table-nav--float.is-offscreen {
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
  }
}

/* Desktop fallback if JS disabled: free sticky from overflow scrollport */
@media (min-width: 769px) {
  .wp-page .wp-table-wrap:has(.wp-liverow) .wp-table-scroll {
    overflow: visible !important;
  }

  .wp-page .wp-table.wp-liverow {
    border-collapse: separate;
    border-spacing: 0;
  }

  .wp-page .wp-table.wp-liverow thead th {
    position: -webkit-sticky;
    position: sticky;
    top: var(--wp-geo-table-head-offset);
    z-index: 25;
    background-color: #774fda;
    box-shadow: 0 2px 6px rgba(26, 16, 51, 0.12);
  }
}
