/* ======================================================
   WCC Timeline – sjakknyheter.no
   Production CSS (Stable) — WC badge + Sticky jitter fixes
   ====================================================== */

.wcc-tl {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 16px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* =========================
   HEADER
   ========================= */

.wcc-tl__header {
  text-align: center;
  margin-bottom: 22px;
}

.wcc-tl__h1 {
  font-size: 28px;
  margin: 0 0 6px;
}

.wcc-tl__lead {
  margin: 0;
  color: #555;
}

/* =========================
   TOC (Jump to era)
   ========================= */

/* Sticky jitter fix:
   - translateZ(0) + will-change to avoid subpixel "shake" in Chrome
   - keep top as integer px
*/
.wcc-tl__toc {
  position: sticky;
  top: 14px;
  z-index: 100;
  margin: 18px auto 34px;

  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

.wcc-tl__toc.is-dismissed {
  display: none;
}

/* Sticky jitter fix:
   - keep blur, but add -webkit-backdrop-filter for Safari/Chrome consistency
   - remove transform transition (can cause tiny "jumps" while scrolling)
   - contain paint reduces repaint ripple
*/
.wcc-tl__toc-inner {
  position: relative;
  background: rgba(255,255,255,0.95);
  border: 1px solid #e3e6ea;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 14px 16px;

  transition: padding 0.2s ease, box-shadow 0.2s ease;
  contain: paint;

  transform: translateZ(0);
  will-change: transform;
}

/* Close button – robust + centered */
.wcc-tl__toc-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.15);
  background: #ffffff;
  color: #333;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);

  display: flex;
  align-items: center;
  justify-content: center;

  line-height: 1;
  padding: 0;
}

.wcc-tl__toc-close:hover {
  background: #f5f7fa;
}

.wcc-tl__toc-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  text-align: center;
}

/* Desktop list (default) */
.wcc-tl__toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.wcc-tl__toc-item {
  margin: 0;
  padding: 0;
}

.wcc-tl__toc-link {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid #d9dde3;
  background: #fff;
  text-decoration: none;
  font-size: 13px;
  color: #222;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.wcc-tl__toc-link:hover {
  border-color: rgba(0,0,0,0.18);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

/* Active era pill */
.wcc-tl__toc-link.is-active,
.wcc-tl__toc-link[aria-current="true"] {
  border-color: rgba(0,0,0,0.30);
  background: rgba(0,0,0,0.035);
  box-shadow: 0 12px 26px rgba(0,0,0,0.10);
  transform: translateY(-1px);
  font-weight: 700;
}

/* Mobile dropdown wrapper (default hidden on desktop) */
.wcc-tl__toc-selectwrap {
  display: none;
  margin-top: 10px;
}

.wcc-tl__toc-label {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.wcc-tl__toc-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d9dde3;
  background: #fff;
  font-size: 14px;
}

/* =========================
   TOC – COMPACT MODE (desktop only)
   ========================= */

.wcc-tl__toc.is-compact {
  margin-bottom: 18px;
}

.wcc-tl__toc.is-compact .wcc-tl__toc-inner {
  padding: 12px 12px 10px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.06);
}

.wcc-tl__toc.is-compact .wcc-tl__toc-title {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  opacity: 0.75;
}

.wcc-tl__toc.is-compact .wcc-tl__toc-list {
  gap: 7px;
}

.wcc-tl__toc.is-compact .wcc-tl__toc-link {
  padding: 5px 9px;
  font-size: 12px;
}

.wcc-tl__toc.is-compact .wcc-tl__toc-close {
  width: 28px;
  height: 28px;
  font-size: 17px;
  top: 8px;
  right: 10px;
}

/* =========================
   SECTION HEADINGS
   ========================= */

.wcc-tl__section {
  margin-top: 54px;
  scroll-margin-top: 190px;
}

.wcc-tl__h2 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 10px;
}

.wcc-tl__section-text {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 30px;
  color: #666;
}

/* =========================
   TIMELINE CORE
   ========================= */

.wcc-tl__timeline {
  position: relative;
}

.wcc-tl__timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #d9dde3;
  transform: translateX(-50%);
}

/* =========================
   ITEM
   ========================= */

.wcc-tl__item {
  position: relative;
  min-height: 80px;
  margin: 26px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   YEAR MARKER
   ========================= */

.wcc-tl__marker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #d9dde3;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  z-index: 3;
  font-weight: 700;
  font-size: 13px;
}

.wcc-tl__year {
  display: block;
}

/* Long years: neat pill, preserves dash/en-dash */
.wcc-tl__marker.is-long {
  width: auto;
  height: auto;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

/* =========================
   CARD
   ========================= */

.wcc-tl__card {
  width: 460px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e3e6ea;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  padding: 14px 16px;
  position: relative;
  z-index: 2;
}

.wcc-tl__card--link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.wcc-tl__card--link:hover {
  box-shadow: 0 12px 28px rgba(0,0,0,0.10);
  border-color: rgba(0,0,0,0.14);
  transform: translateY(-2px);
}

.wcc-tl__title {
  font-weight: 700;
  margin-bottom: 6px;
}

.wcc-tl__desc {
  color: #444;
  line-height: 1.35;
}

/* =========================
   WC BADGE (WC #1 etc.)
   ========================= */

/* Desktop: more air + less "ruvende" */
.wcc-tl__card.has-wc {
  padding-top: 44px; /* was 42px -> slightly more breathing room */
}

.wcc-tl__wc-badge {
  position: absolute;
  top: 8px;            /* nudge up a touch */
  left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 3px 7px;    /* slightly smaller than before */
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2px;

  background: rgba(17,17,17,0.92); /* slightly softer than pure #111 */
  color: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 4px 10px rgba(0,0,0,0.10); /* lighter shadow = less visual weight */
  pointer-events: none;
  z-index: 5;
}

/* Title should not be pulled upward toward badge */
.wcc-tl__card.has-wc .wcc-tl__title {
  margin-top: 0;
}

/* =========================
   LEFT / RIGHT POSITIONING
   ========================= */

.wcc-tl__item.is-left .wcc-tl__card {
  margin-right: 520px;
}

.wcc-tl__item.is-right .wcc-tl__card {
  margin-left: 520px;
}

/* =========================
   CONNECTOR
   ========================= */

.wcc-tl__item.is-left .wcc-tl__card::before,
.wcc-tl__item.is-right .wcc-tl__card::before {
  content: "";
  position: absolute;
  top: 50%;
  height: 2px;
  background: #d9dde3;
  transform: translateY(-50%);
  opacity: 0.95;
}

.wcc-tl__item.is-left .wcc-tl__card::before {
  right: -60px;
  width: 60px;
}

.wcc-tl__item.is-right .wcc-tl__card::before {
  left: -60px;
  width: 60px;
}

/* =========================
   FIDE / PCA TAGS
   ========================= */

.wcc-tl__card.is-fide {
  border-left: 4px solid #d9dde3;
}

.wcc-tl__card.is-pca {
  border-left: 4px solid #cfd6df;
}

.wcc-tl__card.is-fide::after,
.wcc-tl__card.is-pca::after {
  content: attr(data-org);
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #f7fafc;
  pointer-events: none;
}

.wcc-tl__card.is-pca::after {
  background: #f3f6fb;
}

/* =========================
   SPLIT PERIOD PANEL
   ========================= */

.wcc-tl__section[id^="wcc-era-the-split-of-chess-fide-vs-pca-world-champions-"] {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 26px 10px;
  margin-top: 64px;
}

.wcc-tl__section[id^="wcc-era-the-split-of-chess-fide-vs-pca-world-champions-"] .wcc-tl__timeline {
  padding-top: 6px;
  padding-bottom: 10px;
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 900px) {

  /* Don’t allow compact-mode rules to interfere on mobile */
  .wcc-tl__toc.is-compact .wcc-tl__toc-inner {
    padding: 14px 16px;
  }
  .wcc-tl__toc.is-compact .wcc-tl__toc-title {
    display: block;
    font-size: 14px;
    margin-bottom: 10px;
    opacity: 1;
  }

  .wcc-tl__toc-list {
    display: none !important;
  }

  .wcc-tl__toc-selectwrap {
    display: block !important;
  }

  .wcc-tl__timeline::before {
    left: 22px;
    transform: none;
  }

  .wcc-tl__item {
    justify-content: flex-start;
    padding-left: 56px;
  }

  .wcc-tl__marker {
    left: 22px;
  }

  .wcc-tl__marker.is-long {
    max-width: calc(100vw - 140px);
    padding: 6px 9px;
    font-size: 12px;
  }

  .wcc-tl__card {
    width: calc(100% - 12px);
    margin: 0 !important;
  }

  .wcc-tl__card::before {
    display: none !important;
  }

  /* MOBILE WC: keep generous headroom, but match the lighter badge */
  .wcc-tl__card.has-wc {
    padding-top: 50px; /* slightly more than desktop to be safe on small screens */
  }

  .wcc-tl__wc-badge {
    top: 8px;
    left: 11px;
    padding: 3px 7px;
    font-size: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.10);
  }

  .wcc-tl__card.has-wc .wcc-tl__title {
    margin-top: 6px;
    line-height: 1.25;
  }

  .wcc-tl__section[id^="wcc-era-the-split-of-chess-fide-vs-pca-world-champions-"] {
    padding: 18px 8px;
    border-radius: 12px;
  }
}