/* Timeline presentation only: canonical event and image framing data stay intact. */
/* Use the shared card proxy while keeping the live drawer completely hidden.
   Only the photo's outer spacing changes; saved image focus/scale stays intact. */
@media (max-width: 1120px) {
  html body [data-timeline-detail].is-modal-open {
    scrollbar-width: none;
    /* The proxy owns motion. Restoring the live panel must not restart the
       legacy opacity fade and expose the rail after the proxy is removed. */
    transition: none !important;
    animation: none !important;
  }
  html body [data-timeline-detail].is-modal-open::-webkit-scrollbar {
    display: none;
  }
  html body [data-timeline-detail].is-profile-opening,
  html body [data-timeline-detail].is-profile-opening * {
    visibility: hidden !important;
    pointer-events: none !important;
  }
  html body [data-timeline-detail].is-profile-opening {
    opacity: 0 !important;
    transition: none !important;
    animation: none !important;
  }
  html[data-theme] body [data-timeline-detail].is-modal-open .timeline-detail__photo {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    width: 100% !important;
    max-width: none !important;
    border-radius: 0 0 24px 24px !important;
  }
  html[data-theme] body [data-timeline-detail].is-modal-open > .timeline-detail__share {
    left: calc(var(--space-chrome-3) + env(safe-area-inset-left, 0px)) !important;
    top: calc(var(--space-chrome-3) + env(safe-area-inset-top, 0px)) !important;
  }
  html[data-theme] body [data-timeline-detail].is-modal-open .timeline-detail__close {
    right: calc(var(--space-chrome-3) + env(safe-area-inset-right, 0px)) !important;
    top: calc(var(--space-chrome-3) + env(safe-area-inset-top, 0px)) !important;
  }
  .timeline-page .timeline-rail__button { touch-action: manipulation; }
  .archive-proxy-context .wrestler-profile-return-proxy .timeline-detail__body {
    transition: opacity 100ms ease-out;
  }
  .archive-proxy-context .wrestler-profile-return-proxy.is-returning .timeline-detail__body {
    opacity: 0;
  }
}

.timeline-page .timeline-explorer-section {
  --timeline-era-selector-height: 3.5rem;
}

/* Compact decade navigation; event images and editorial era data are independent. */
html[data-theme] .timeline-page .timeline-era-nav {
  --timeline-tab-bg: rgba(var(--text-primary-rgb), 0.04);
  --timeline-tab-border: rgba(var(--text-primary-rgb), 0.22);
  --timeline-tab-color: rgba(var(--text-primary-rgb), 0.8);
  background: transparent;
  border: 0;
}

html[data-theme="archival-dark"] .timeline-page .timeline-era-nav {
  --timeline-tab-bg: #151515;
  --timeline-tab-border: #333;
  --timeline-tab-color: #c8c4bd;
}

html[data-theme] .timeline-page .timeline-era-nav::before,
html[data-theme] .timeline-page .timeline-era-nav::after {
  display: none;
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-filter__list {
  background: transparent;
  gap: 0.65rem;
  padding: 0;
  scroll-padding-inline: 0;
  -webkit-mask-image: none;
  mask-image: none;
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button:is(button, :hover, :focus-visible, [aria-pressed]) {
  align-content: center;
  background: var(--timeline-tab-bg);
  border: 1px solid var(--timeline-tab-border);
  border-radius: var(--button-radius, 8px);
  color: var(--timeline-tab-color);
  flex: 1 0 4.5rem;
  height: 3.5rem;
  min-height: 3.5rem;
  padding: 0.65rem 1rem;
  text-align: center;
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button:first-child {
  flex-basis: 6.25rem;
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button .timeline-era-button__range {
  color: inherit;
  font-size: 1.15rem;
  line-height: 1.1;
  margin: 0;
  text-shadow: none;
  white-space: nowrap;
}

.timeline-decade-label--short {
  display: none;
}

@media (max-width: 700px) {
  html[data-theme] .timeline-page .timeline-era-nav .timeline-era-filter__list {
    padding-inline: var(--space-4);
    scroll-padding-inline: var(--space-4);
  }

  .timeline-decade-label--full {
    display: none;
  }

  .timeline-decade-label--short {
    display: inline;
  }
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button::before {
  display: none;
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button::after {
  display: none;
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button:not(:disabled):not([aria-pressed="true"]):hover {
  background: rgba(var(--text-primary-rgb), 0.06);
  border-color: rgba(var(--text-primary-rgb), 0.45);
  color: var(--text-primary);
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button[aria-pressed="true"] {
  background: rgba(var(--accent-red-rgb), 0.18);
  border-color: var(--accent-red);
  color: var(--text-primary);
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button:focus-visible {
  outline: 2px solid var(--accent-red);
  outline-offset: -5px;
}

html[data-theme] .timeline-page .timeline-era-nav .timeline-era-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.timeline-page .timeline-rail__button:focus-visible .timeline-rail__event {
  outline: 2px solid var(--text-primary);
  outline-offset: 4px;
}

/* Returning from the drawer retains focus without a temporary keyboard ring.
   The marker clears on blur or the next keypress. */
.timeline-page .timeline-rail__button.is-drawer-return-focus:focus-visible,
.timeline-page .timeline-rail__button.is-drawer-return-focus:focus-visible .timeline-rail__event {
  outline: none !important;
}

.timeline-page .timeline-rail__marker {
  color: var(--text-secondary);
}

/* Selected and hovered cards read as a 2px frame, but the second pixel is an
   outer ring rather than a thicker border. A thicker border would shrink the
   text box by 2px and re-wrap long titles (e.g. the 1990 Wrestling Summit). */
html[data-theme] .timeline-page .timeline-rail__item.is-active .timeline-rail__button .timeline-rail__event {
  border-width: 1px;
  box-shadow: 0 0 0 1px var(--accent-red);
}

html[data-theme] .timeline-page .timeline-rail__item:not(.is-active) .timeline-rail__button:hover .timeline-rail__event {
  border-width: 1px;
  box-shadow: 0 0 0 1px rgba(var(--text-primary-rgb), 0.32);
}

html[data-theme] .timeline-page .timeline-rail__item:not(.is-active) .timeline-rail__button:hover .timeline-rail__event--image-backed,
html[data-theme="archival-dark"] .timeline-page .timeline-rail__item:not(.is-active) .timeline-rail__button:hover .timeline-rail__event {
  box-shadow: 0 0 0 1px var(--accent-red);
}

/* Axis labels and row spacing are presentation; only the tile selects an event. */
.timeline-page .timeline-rail__button {
  pointer-events: none;
  cursor: default;
}

.timeline-page .timeline-rail__button .timeline-rail__event {
  pointer-events: auto;
  cursor: pointer;
}

.timeline-rail__image-preview {
  display: none;
}

/* Tablets share the desktop rail and detail presentation in either orientation. */
@media (min-width: 769px) {
  .timeline-page .timeline-rail-controls {
    display: inline-flex;
  }

  /* Reserve shared breathing room beneath both independently scrolling panes. */
  .timeline-body .timeline-page.timeline-page--collapsed .timeline-explorer-section .timeline-workspace {
    padding-bottom: max(var(--space-6), env(safe-area-inset-bottom, 0px)) !important;
  }

  .timeline-page .timeline-detail__photo {
    display: none;
  }

  .timeline-page .timeline-detail__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: var(--space-3);
    row-gap: 0.65rem;
    padding: calc(var(--space-5) + var(--space-chrome-2-5)) var(--space-5) var(--space-8);
  }

  .timeline-page .timeline-detail__meta-row {
    align-items: center;
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    min-height: 0;
    padding: 0;
  }

  .timeline-page .timeline-detail__date {
    font-family: var(--display);
    font-size: 1.8rem;
    line-height: 1;
  }

  .timeline-page .timeline-detail--precursor .timeline-detail__date::after {
    display: block;
    font-size: 0.5rem;
    letter-spacing: 0;
    margin: 0.4rem 0 0;
    padding: 0.15rem;
  }

  .timeline-page .timeline-detail__body h3 {
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 0;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(var(--text-primary-rgb), 0.18);
  }

  .timeline-page .timeline-detail__copy {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 0;
  }

  .timeline-page .timeline-detail__meta-row > .timeline-detail__share {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    color: var(--modal-icon-button-color);
    display: inline-flex;
    height: 2.75rem;
    justify-content: center;
    min-height: 2.75rem;
    min-width: 2.75rem;
    padding: 0;
    position: static;
    width: 2.75rem;
  }

  .timeline-page .timeline-detail__meta-row > .timeline-detail__share:is(:hover, :focus-visible) {
    background: var(--modal-icon-button-hover-bg);
    border-color: var(--modal-icon-button-hover-border);
    color: var(--modal-icon-button-hover-color);
  }

  .timeline-page .timeline-rail__image-preview {
    align-items: center;
    background: rgba(8, 8, 8, 0.88);
    border: 1px solid rgba(244, 241, 233, 0.4);
    border-radius: 8px;
    color: var(--color-paper);
    cursor: pointer;
    display: inline-flex;
    height: 2.75rem;
    justify-content: center;
    padding: 0;
    position: absolute;
    right: 0.65rem;
    top: 0.65rem;
    width: 2.75rem;
    z-index: var(--z-float);
  }

  .timeline-page .timeline-rail__image-preview:hover {
    background: #080808;
    border-color: var(--accent-red);
  }

  .timeline-page .timeline-rail__image-preview .material-symbols-outlined {
    font-size: 1.35rem;
    line-height: 1;
  }

  .timeline-page .timeline-rail__image-preview:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 3px;
  }

  .timeline-page .timeline-explorer {
    box-sizing: border-box;
    width: 100%;
  }

  .timeline-page .timeline-rail-shell {
    container-name: timeline-pane;
    container-type: inline-size;
    display: grid;
    width: 100%;
    box-sizing: border-box;
  }

  .timeline-body .timeline-page.timeline-page--collapsed .timeline-explorer-section .timeline-workspace {
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    overflow: hidden;
  }

  .timeline-body .timeline-page.timeline-page--collapsed .timeline-explorer,
  .timeline-body .timeline-page.timeline-page--collapsed .timeline-stage,
  .timeline-body .timeline-page.timeline-page--collapsed .timeline-rail-shell,
  .timeline-body .timeline-page.timeline-page--collapsed .timeline-detail {
    height: 100% !important;
    min-height: 0;
  }

  .timeline-body .timeline-page.timeline-page--collapsed .timeline-stage {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline-body .timeline-page .timeline-rail-scroll {
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: var(--space-6);
    scroll-padding: var(--space-6);
    scroll-snap-type: y proximity;
    overscroll-behavior: contain;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .timeline-page .timeline-rail-scroll::-webkit-scrollbar {
    display: block;
    width: 8px;
  }

  .timeline-page .timeline-rail {
    --timeline-axis-x: 6.25rem;
    --timeline-desktop-card-size: clamp(280px, 30vh, 330px);
    display: grid;
    gap: var(--space-7);
    min-width: 0;
    width: min(100%, calc(var(--timeline-desktop-card-size) + 9rem));
    margin-inline: auto;
    padding: 0;
  }

  .timeline-page .timeline-rail::before {
    background: rgba(var(--text-primary-rgb), 0.45);
    bottom: 0;
    height: auto;
    left: calc(var(--timeline-axis-x) - 1px);
    right: auto;
    top: 0;
    width: 2px;
  }

  .timeline-page .timeline-rail__item {
    width: 100%;
    min-width: 0;
    padding: 0;
    scroll-snap-align: start;
  }

  .timeline-page .timeline-rail__button {
    align-items: center;
    gap: 0;
    grid-template-columns: 5rem 2.5rem minmax(0, 1fr);
    grid-template-rows: auto;
    padding: 0;
  }

  .timeline-page .timeline-rail__button::after,
  .timeline-page .timeline-rail__item.is-active .timeline-rail__button::after {
    background: rgba(var(--text-primary-rgb), 0.45);
    height: 1px;
    left: var(--timeline-axis-x);
    opacity: 1;
    top: 50%;
    transform: none;
    width: 2.75rem;
  }

  .timeline-page .timeline-rail__item.is-active .timeline-rail__button::after {
    background: var(--accent-red);
  }

  .timeline-page .timeline-rail__marker {
    font-size: var(--font-size-8);
    left: 0;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    text-align: right;
    white-space: normal;
    width: 4.5rem;
  }

  .timeline-page .timeline-rail__dot {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .timeline-page .timeline-rail__event,
  .timeline-page .timeline-rail__item--precursor .timeline-rail__event {
    aspect-ratio: 1;
    box-sizing: border-box;
    grid-column: 3;
    grid-row: 1;
    height: auto;
    min-height: 0;
    min-width: 0;
    width: min(calc(100% - 1.5rem), var(--timeline-desktop-card-size));
    margin-left: var(--space-6);
  }

  .timeline-page .timeline-rail-shell::before,
  .timeline-page .timeline-rail-shell::after {
    display: none;
  }

  /* Reserve two comfortable card columns and a date/connector gutter. */
  @container timeline-pane (min-width: 885px) {
    .timeline-page .timeline-rail__image-preview {
      right: calc(50% + 3rem + 0.65rem);
    }

    .timeline-page .timeline-rail__item:nth-child(even) .timeline-rail__image-preview {
      right: 0.65rem;
    }

    .timeline-page .timeline-rail {
      --timeline-axis-x: 50%;
      --timeline-desktop-card-size: clamp(370.3px, 39.675vh, 436.425px);
      --timeline-desktop-card-height: clamp(322px, 34.5vh, 379.5px);
      width: min(100%, calc(2 * var(--timeline-desktop-card-size) + 6rem));
    }

    .timeline-page .timeline-rail__button {
      grid-template-columns: minmax(0, 1fr) 6rem minmax(0, 1fr);
    }

    .timeline-page .timeline-rail__event,
    .timeline-page .timeline-rail__item--precursor .timeline-rail__event {
      grid-column: 1;
      margin: 0;
      justify-self: end;
      width: min(100%, var(--timeline-desktop-card-size));
      aspect-ratio: auto;
      height: var(--timeline-desktop-card-height);
    }

    .timeline-page .timeline-rail__item:nth-child(even) .timeline-rail__event {
      grid-column: 3;
      justify-self: start;
    }

    .timeline-page .timeline-rail__button::after,
    .timeline-page .timeline-rail__item.is-active .timeline-rail__button::after {
      left: calc(50% - var(--space-12));
      width: 3rem;
    }

    .timeline-page .timeline-rail__item:nth-child(even) .timeline-rail__button::after {
      left: 50%;
    }

    .timeline-page .timeline-rail__marker {
      left: calc(50% + var(--space-5));
      text-align: left;
    }

    .timeline-page .timeline-rail__item:nth-child(even) .timeline-rail__marker {
      left: auto;
      right: calc(50% + var(--space-5));
      text-align: right;
    }
  }
}

/* Keep the phone shell aligned with the JavaScript modal cutoff, including
   narrow landscape screens formerly covered by the tablet rules. */
@media (max-width: 768px) {
  html body.timeline-body .timeline-page .timeline-explorer {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html body.timeline-body [data-timeline-detail]:not(.is-modal-open) {
    display: none !important;
  }

  html body.timeline-body [data-timeline-detail].is-modal-open {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
  }
}

/* Override the legacy portrait-tablet modal shell without changing image focus,
   crop values, event order, or the phone's proxy animation. */
@media (min-width: 769px) and (max-width: 1120px) {
  html body.timeline-body .timeline-page .timeline-explorer {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) clamp(300px, 42vw, 440px) !important;
    gap: var(--space-chrome-4);
    min-height: 0 !important;
    overflow: hidden;
  }

  html body.timeline-body .timeline-page .timeline-stage {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  html body.timeline-body .timeline-page [data-timeline-detail] {
    display: block !important;
    grid-column: 2;
    grid-row: 1;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--color-ink-700) !important;
    border-radius: var(--radius-surface, 24px) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: hidden auto !important;
    overscroll-behavior: contain;
    z-index: var(--z-raised) !important;
    scrollbar-width: thin;
  }
}

/* Rail items scroll inside .timeline-rail-scroll, so the page-level sticky
   offset (styles.css) must not apply as a snap margin there; it pushed the
   selected card up under the decade bar on phones. */
.timeline-page .timeline-rail-scroll .timeline-rail__item {
  scroll-margin-top: 0;
}

/* iPhone Safari can keep stale card heights after the rail's width changes,
   so cards touch until a scroll. timeline-rail-relayout.js adds .is-relayout
   for one synchronous layout pass (never painted) to make it re-measure. */
.timeline-rail.is-relayout .timeline-rail__event {
  aspect-ratio: auto !important;
}
