/* timeline.css — the winding history timeline on the hub landing page.
   Builds on the shared root style.css tokens + hub.css primitives
   (.chip, .medal, .avatar, .btn). */

/* ------------------------------------------------------------- controls */
.tl-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1.2rem;
}
.tl-controls .player-search {
  width: min(100%, 26rem);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--color-border-gold);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-size: 0.9rem;
}
.tl-controls .player-search:focus { outline: 1px solid var(--color-gold); }
.tl-filters { display: flex; gap: 0.45rem; flex-wrap: wrap; justify-content: center; }
.tl-filter {
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.95rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}
.tl-filter:hover { border-color: var(--color-border-gold); color: var(--color-text-primary); }
.tl-filter.is-active {
  color: #2a1e07;
  font-weight: 700;
  background: linear-gradient(180deg, var(--color-gold-light), var(--color-gold), var(--color-gold-dark));
  border-color: rgba(255, 240, 190, 0.7);
}

/* --------------------------------------------------------------- canvas */
.tl-wrap { position: relative; margin: 1rem 0 2.5rem; }
.tl-svg { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.tl-path-base {
  fill: none;
  stroke: rgba(212, 175, 55, 0.14);
  stroke-width: 2.5;
  stroke-dasharray: 1 7;
  stroke-linecap: round;
}
.tl-path-draw {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.45));
}

/* ----------------------------------------------------------------- caps */
.tl-cap {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  width: max-content;
}
.tl-cap-top { transform: translate(-50%, -100%); }
.tl-cap-text {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--color-gold);
}
.tl-cap-top .tl-cap-text { order: -1; }
.tl-cap-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-gold-light);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.8);
}
.tl-cap-dot.is-live { background: #ff5a5a; animation: liveDot 1.7s ease-out infinite; }
.tl-cap-shield {
  width: 30px;
  height: 34px;
  background: radial-gradient(circle at 50% 32%, var(--color-gold-light) 0 18%, var(--color-gold) 55%, var(--color-gold-dark));
  clip-path: polygon(50% 0, 100% 18%, 100% 62%, 50% 100%, 0 62%, 0 18%);
  opacity: 0.9;
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.4);
}

/* ------------------------------------------------------------ year chips */
.tl-year { position: absolute; z-index: 2; }
.tl-year span {
  display: inline-block;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--color-gold);
  background: linear-gradient(160deg, rgba(27, 18, 12, 0.97), rgba(12, 8, 5, 0.99));
  border: 1px solid var(--color-border-gold);
  border-radius: var(--radius-full);
  padding: 0.28rem 1.1rem;
  box-shadow: var(--shadow-md), 0 0 14px rgba(212, 175, 55, 0.1);
}

/* ---------------------------------------------------------------- nodes */
.tl-node {
  position: absolute;
  z-index: 3;
  width: 0;
  height: 0;
  text-decoration: none;
  outline: none;
}
.tl-medal {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--medal, 96px);
  height: var(--medal, 96px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 224, 130, 0.14), transparent 60%),
    linear-gradient(160deg, rgba(32, 22, 14, 0.98), rgba(11, 8, 5, 0.99));
  border: 2px solid var(--node-accent, var(--color-gold));
  box-shadow:
    0 0 0 3px rgba(10, 7, 4, 0.9),
    0 0 0 4px rgba(212, 175, 55, 0.28),
    0 8px 22px rgba(0, 0, 0, 0.65);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.3, 1.3), box-shadow 0.3s ease;
}
.tl-medal img { width: 62%; height: 62%; object-fit: contain; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6)); }
/* self-contained circular badges (EPL crest, cropped seasonal logos) fill it */
.tl-medal img.tl-ico-fill { width: 100%; height: 100%; }
/* irregular emblem (Kings of the Old World): contained, but sized up so the
   wordmark stays legible; transparent bg lets it float over the node */
.tl-medal img.tl-ico-wide { width: 92%; height: 92%; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.75)); }
.tl-pop-ico img.tl-ico-wide { width: 92%; height: 92%; }

/* season plate floated over the EPL crest */
.tl-season {
  position: absolute;
  right: 4%;
  bottom: 4%;
  min-width: 1.4em;
  padding: 0.06em 0.34em;
  font-family: var(--font-display);
  font-size: calc(var(--medal, 96px) * 0.19);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  color: #2a1e07;
  background: linear-gradient(180deg, var(--color-gold-light), var(--color-gold), var(--color-gold-dark));
  border: 1px solid rgba(255, 240, 190, 0.75);
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.tl-mono {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: calc(var(--medal, 96px) * 0.3);
  color: var(--color-gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.tl-mono small { font-size: 0.5em; color: var(--color-text-muted); letter-spacing: 0.12em; margin-top: 0.2em; }

.tl-minor { --medal: 46px; }
.tl-minor .tl-medal { border-width: 1px; border-color: rgba(212, 175, 55, 0.45); box-shadow: 0 0 0 2px rgba(10, 7, 4, 0.9), 0 5px 14px rgba(0, 0, 0, 0.6); }
.tl-minor .tl-mono { color: var(--color-text-secondary); }

.tl-node:hover .tl-medal,
.tl-node:focus-visible .tl-medal {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow:
    0 0 0 3px rgba(10, 7, 4, 0.9),
    0 0 0 5px rgba(212, 175, 55, 0.55),
    0 0 28px rgba(212, 175, 55, 0.35),
    0 10px 26px rgba(0, 0, 0, 0.7);
}
.tl-node:focus-visible .tl-medal { outline: 2px solid var(--color-gold-light); outline-offset: 4px; }

/* live node: pulsing halo */
.tl-live-ring {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 100, 100, 0.75);
  animation: tlLivePulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes tlLivePulse {
  0% { transform: scale(0.92); opacity: 0.9; }
  70% { transform: scale(1.22); opacity: 0; }
  100% { opacity: 0; }
}

/* labels */
.tl-label {
  position: absolute;
  left: 0;
  top: calc(var(--medal, 96px) / 2 + 10px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  text-align: center;
}
.tl-name {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  line-height: 1.25;
  color: var(--color-text-primary);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  transition: color 0.2s ease;
}
.tl-minor .tl-name { font-size: 0.8rem; color: var(--color-text-secondary); }
.tl-node:hover .tl-name, .tl-node:focus-visible .tl-name { color: var(--color-gold-light); }
.tl-sub {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.tl-sub .medal { width: 11px; height: 11px; }
.tl-sub-live { color: #ff8a8a; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.68rem; }

/* non-ESOC bridge events (community tournaments + showmatches that feed the
   ratings): always rendered dimmer + desaturated so the ESOC events stand out;
   they brighten to full on hover/focus. */
.tl-ne .tl-medal {
  border-style: dashed;
  border-color: rgba(170, 165, 150, 0.4);
  background: linear-gradient(160deg, rgba(26, 25, 22, 0.96), rgba(10, 9, 7, 0.99));
  box-shadow: 0 0 0 2px rgba(8, 7, 5, 0.9), 0 4px 12px rgba(0, 0, 0, 0.5);
}
.tl-ne .tl-mono { color: var(--color-text-muted); }
.tl-ne .tl-name { color: var(--color-text-muted); font-weight: 500; }
.tl-node.is-in.tl-ne { opacity: 0.6; filter: saturate(0.72); }
.tl-node.is-in.tl-ne:hover,
.tl-node.is-in.tl-ne:focus-visible { opacity: 1; filter: none; }

.chip-ne {
  background: rgba(150, 145, 130, 0.16);
  color: var(--color-text-secondary);
  border-color: rgba(170, 165, 150, 0.3);
}

/* filtered-out nodes fade; the road stays */
.tl-node.tl-dim { opacity: 0.12; filter: grayscale(1); pointer-events: none; }
.tl-node.is-in.tl-ne.tl-dim { opacity: 0.1; }

/* --------------------------------------------------- scroll-in animation */
.tl-node, .tl-year {
  opacity: 0;
  translate: 0 26px;
  transition:
    opacity 0.55s ease,
    translate 0.6s cubic-bezier(0.2, 0.8, 0.3, 1.1),
    filter 0.35s ease;
}
.tl-node.is-in, .tl-year.is-in { opacity: 1; translate: 0 0; }
.tl-node.is-in.tl-dim { opacity: 0.12; }
@media (prefers-reduced-motion: reduce) {
  .tl-node, .tl-year { opacity: 1; translate: none; transition: none; }
}

/* -------------------------------------------------------------- popover */
.tl-pop {
  position: fixed;
  z-index: 90;
  width: min(320px, 92vw);
  padding: 1rem 1.1rem 0.95rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-gold);
  background:
    linear-gradient(160deg, rgba(29, 20, 13, 0.97), rgba(12, 8, 5, 0.99)),
    url("dark_wood.webp") repeat;
  background-size: auto, 480px 480px;
  background-blend-mode: overlay;
  box-shadow: var(--shadow-lg), 0 0 26px rgba(212, 175, 55, 0.12);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.tl-pop::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(90deg, transparent, var(--node-accent, var(--color-gold)), transparent);
  opacity: 0.8;
}
.tl-pop.is-open { opacity: 1; transform: none; pointer-events: auto; }
.tl-pop-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.65rem; }
.tl-pop-ico {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border-gold);
  background: rgba(0, 0, 0, 0.35);
}
.tl-pop-ico img { width: 66%; height: 66%; object-fit: contain; }
.tl-pop-ico:has(.tl-ico-fill) { border: none; background: none; }
.tl-pop-ico img.tl-ico-fill { width: 100%; height: 100%; }
.tl-pop-ico .tl-mono { font-size: 0.85rem; }
.tl-pop-title { font-family: var(--font-heading); font-size: 0.98rem; line-height: 1.3; color: var(--color-gold-light); }
.tl-pop-dates { font-size: 0.76rem; color: var(--color-text-muted); margin-top: 0.15rem; }
.tl-pop-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.tl-pop-results { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.tl-pop-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; }
.tl-pop-player { color: var(--color-text-primary); font-weight: 600; }
.tl-pop-row:first-child .tl-pop-player { color: var(--color-gold-light); }
.tl-pop-note { color: var(--color-text-muted); font-size: 0.83rem; font-style: italic; }
.tl-pop-actions { display: flex; gap: 0.5rem; }

/* ------------------------------------------------- compact (mobile) mode
   Below 720px the serpentine collapses to a straight spine on the left,
   with labels to the right of each node. */
.tl-compact .tl-label {
  left: calc(var(--medal, 96px) / 2 + 16px);
  top: 0;
  transform: translateY(-50%);
  align-items: flex-start;
  text-align: left;
  max-width: calc(100vw - 140px);
}
.tl-compact .tl-major { --medal: 68px; }
.tl-compact .tl-minor { --medal: 40px; }
.tl-compact .tl-year span { transform: translate(-50%, -50%); font-size: 0.88rem; padding: 0.22rem 0.85rem; }
/* caps become a horizontal row anchored on the spine */
.tl-compact .tl-cap { flex-direction: row; align-items: center; gap: 0.6rem; }
.tl-compact .tl-cap-top { transform: translate(-6px, -100%); }
.tl-compact .tl-cap-top .tl-cap-text { order: 1; }
.tl-compact .tl-cap-end { transform: translate(-16px, 0); }
.tl-compact .tl-cap-text { letter-spacing: 0.18em; }
