/* ==========================================================================
   Corner-radius system (Nov 2026)
   Loaded LAST on every page so these rules settle every corner on the site.
   Selectors carry :not(#radius-system) (ID weight) so they win over the older
   page rules without !important; delete those older rules over time.
   Dark themes only (archival-dark, dark); the light theme is being retired.

   Rule: rounded = a thing you look at or pick up; square = page structure.
     0                 structure: header, footer, full-width/edge-to-edge
                       bands, list rows, dividers, blocks with a coloured
                       accent bar (About rows, Start Here chapter boxes).
     edge-attached     a panel fixed to a screen edge rounds only the corners
                       that float (bottom sheets: top two; side panels and
                       the phone/tablet menu drawer: the inner two).
     --radius-surface  24px  every floating surface: cards, detail panes,
                       filter rails, toolbars, sheets, modals, feature panels.
     --radius-inset    16px  a container inside a surface, or a compact tile.
     --radius-control  8px   every button, input, chip, tab, toggle.
     50%               dots, avatars, round icon buttons.
   An image that touches its panel's edge takes the panel's corners.
   A floating toolbar goes square when it runs edge to edge (<=768px).
   ========================================================================== */

/* The three values are defined in css/tokens.css. */

/* ---------- Surfaces (24) ---------- */

/* Archive search toolbar (Wrestlers, Venues, Masks, Voices, Vault): floats
   beside the grid from 769px up; edge to edge (square) below. */
@media (min-width: 769px) {
  html[data-theme]:not(#radius-system) .archive-toolbar {
    border-radius: var(--radius-surface);
  }

  /* Desktop/tablet split-view detail pane (was 32 at >=1121, 24 below). */
  html[data-theme]:not(#radius-system) .archive-detail {
    border-radius: var(--radius-surface);
  }

  /* Timeline: event rail + detail panel side by side. */
  html[data-theme]:not(#radius-system) .timeline-rail-shell,
  html[data-theme]:not(#radius-system) .timeline-detail {
    border-radius: var(--radius-surface);
  }
}

/* Archive filter rail (Wrestlers, Venues, Voices) on desktop. Below 1366px
   the same element becomes the bottom sheet (24 on its top corners). */
@media (min-width: 1366px) {
  html[data-theme]:not(#radius-system) .archive-rail {
    border-radius: var(--radius-surface);
  }
}

/* Traditions: the three main panels. */
html[data-theme]:not(#radius-system) .styles-experimental__panel,
html[data-theme]:not(#radius-system) .styles-documented-preview .styles-experimental__feature-card {
  border-radius: var(--radius-surface);
}

/* Promotions: every dossier tile, the leader tiles and the big photo. */
html[data-theme]:not(#radius-system) .promotions-grid > *,
html[data-theme]:not(#radius-system) .promotions-leader {
  border-radius: var(--radius-surface);
}

html[data-theme]:not(#radius-system) .promotions-hero__media,
html[data-theme]:not(#radius-system) .promotions-leader__media {
  clip-path: inset(0 round var(--radius-surface));
}

/* Home "Trails" feature card: rounded on phones; on desktop the top-right
   stays square where the trail tabs meet it. */
html[data-theme]:not(#radius-system) .home-trails__feature {
  border-radius: var(--radius-surface);
}

@media (min-width: 761px) {
  html[data-theme]:not(#radius-system) .home-trails__feature {
    border-top-right-radius: 0;
  }
}

/* Mask image lightbox: a floating modal; its bottom control bar sits flush. */
html[data-theme]:not(#radius-system) .mask-lightbox {
  border-radius: var(--radius-surface);
  overflow: hidden;
}

html[data-theme]:not(#radius-system) .mask-detail-lightbox__controls {
  border-radius: 0;
}

/* Support page cards. */
html[data-theme]:not(#radius-system) .support-action-card,
html[data-theme]:not(#radius-system) .support-help-card {
  border-radius: var(--radius-surface);
}

/* Lineage side panel: fixed to the right edge, so only its inner corners. */
@media (min-width: 701px) {
  html[data-theme]:not(#radius-system) .lineage-detail {
    border-radius: var(--radius-surface) 0 0 var(--radius-surface);
  }
}

/* Menu drawer (<=1120px): fixed to the right edge, inner corners only. */
@media (max-width: 1120px) {
  html[data-theme]:not(#radius-system) .site-nav {
    border-radius: var(--radius-surface) 0 0 var(--radius-surface);
  }
}

/* ---------- Insets and compact tiles (16) ---------- */

html[data-theme]:not(#radius-system) .era-filter-control,
html[data-theme]:not(#radius-system) .venue-filter-stack,
html[data-theme]:not(#radius-system) .styles-experimental__quick-facts,
html[data-theme]:not(#radius-system) .vault-info-rail__item,
html[data-theme]:not(#radius-system) .styles-experimental__style-card,
html[data-theme]:not(#radius-system) .styles-documented-preview .styles-experimental__feature-image {
  border-radius: var(--radius-inset);
}

/* Home stats strip floats over the hero; it clips its own cells. */
html[data-theme]:not(#radius-system) .hero-kpi-strip {
  border-radius: var(--radius-inset);
}

html[data-theme]:not(#radius-system) .hero-kpi-strip > * {
  border-radius: 0;
}

/* Outline and texture layers drawn with ::before/::after follow their
   element's corners (otherwise an active outline is cut off at the corners). */
html[data-theme]:not(#radius-system) :is(
  .archive-toolbar,
  .styles-experimental__panel,
  .styles-experimental__style-card,
  .styles-experimental__feature-image,
  .support-action-card,
  .support-help-card,
  .home-trails__feature
)::before,
html[data-theme]:not(#radius-system) :is(
  .archive-toolbar,
  .styles-experimental__panel,
  .styles-experimental__style-card,
  .styles-experimental__feature-image,
  .support-action-card,
  .support-help-card,
  .home-trails__feature
)::after {
  border-radius: inherit;
}

/* ---------- Controls (8) ---------- */

html[data-theme]:not(#radius-system) :is(
  .lineage-filter-trigger,
  .ds-button.ds-filter-control,
  .promotions-titles__page-button,
  .lineage-graph-nav button,
  .about-contact-submit
) {
  border-radius: var(--radius-control);
}

/* ---------- Controls, round 2 (button audit, 6 Nov 2026) ---------- */

/* Icon buttons squared off by an older styles.css rule ("border-radius: 0
   !important" on .site-nav-toggle, .filter-sheet__close, .detail-modal-close
   ...). They are controls, so 8px: the phone/tablet menu button (it turns into
   the menu's close X), every close X, the Voices rail arrows, the footer
   social icons, the Lineage graph zoom buttons. !important is needed only to
   beat that rule; delete both together when styles.css is cleaned up.
   The Video Games ones are in the Video Games section at the end. */
html[data-theme]:not(#radius-system) :is(
  .site-nav-toggle,
  .preferences-menu__button,
  .filter-sheet__close,
  .detail-modal-close,
  .venue-detail__close,
  .timeline-photo-lightbox__close,
  .mask-lightbox__close,
  .voice-mobile-modal__close,
  .lineage-filter-panel__header button,
  .lineage-detail__close,
  .lineage-mobile-sheet__close,
  .lineage-graph-nav__icon-button,
  .jp-tokyo-modal__close,
  .voices-rail__arrow,
  .footer-social-link,
  .vault-room-sheet-close,
  .vault-room-detail-modal-close
) {
  border-radius: var(--radius-control) !important;
}

html[data-theme]:not(#radius-system) .lineage-mobile-intro-modal__button {
  border-radius: var(--radius-control);
}

/* Traditions path dots are short bars: round their ends. */
html[data-theme]:not(#radius-system) .styles-documented-preview__path-dots > button {
  border-radius: 999px;
}

/* ---------- Tap and click size ----------
   Touch screens: every control is at least 44 x 44px (Apple and Google's
   minimum). Mouse screens: small icons get at least a 32px click area.
   Where growing the visible button would shift the layout, an invisible
   ::after hit area is added instead, so nothing moves. */

@media (pointer: coarse) {
  html[data-theme]:not(#radius-system) :is(
    .promotions-titles__page-button,
    .lineage-filter-trigger,
    .mask-detail-expand,
    .lineage-graph-nav__icon-button,
    .lineage-graph-nav > button,
    .mask-detail-photo-controls > button,
    .video-games-panel__toggle,
    .video-games-detail__screenshots-button,
    .video-games-detail__immersive-button,
    .video-games-inline-button
  ) {
    min-height: 44px;
  }

  /* Icon-only buttons also need the width. (Text buttons keep their own
     min-width, e.g. Lineage's "All lines: On/Off" stays one fixed width.) */
  html[data-theme]:not(#radius-system) :is(
    .promotions-titles__page-button,
    .mask-detail-expand,
    .lineage-graph-nav__icon-button,
    .mask-detail-photo-controls > button,
    .lineage-graph-nav > [data-lineage-fit],
    .video-games-panel__toggle
  ) {
    min-width: 44px;
  }
}

/* Invisible hit areas for small controls that sit in tight rows. */
/* (The Video Games poster eyes are already absolutely positioned.) */
html[data-theme]:not(#radius-system) :is(
  .styles-documented-preview__path-dots > button,
  .video-games-selector__groups > button
) {
  position: relative;
}

html[data-theme]:not(#radius-system) :is(
  .styles-documented-preview__path-dots > button,
  .video-games-selector__groups > button,
  .video-games-poster-eye
)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 32px);
  height: max(100%, 32px);
  transform: translate(-50%, -50%);
}

@media (pointer: coarse) {
  html[data-theme]:not(#radius-system) :is(
    .styles-documented-preview__path-dots > button,
    .video-games-selector__groups > button,
    .video-games-poster-eye
  )::after {
    width: max(100%, 44px);
    height: max(100%, 44px);
  }
}


/* Phone/tablet menu drawer: the current-page highlight and the pressed/hover
   state of each row sit inset inside the rounded drawer, so they get the
   control radius too (the X is covered above). */
@media (max-width: 1120px) {
  html[data-theme]:not(#radius-system) .site-nav :is(a, button):not(.site-nav-toggle) {
    border-radius: var(--radius-control);
  }
}

/* The Vault's filter panel becomes a side panel on the right edge from
   1366px: like the other edge-attached side panels, round its inner corners. */
@media (min-width: 1366px) {
  html[data-theme]:not(#radius-system) .vault-filter-sheet {
    border-radius: var(--radius-surface) 0 0 var(--radius-surface);
  }
}

/* ---------- Video Games page (6 Nov 2026) ----------
   Brought onto the system (the page was square throughout). The TV-room
   scene stays square: it is background, not a surface. */

/* Controls (8): filter options, shelf tabs, Clear all / Random, Screenshots /
   Immersive, panel edge toggles, shelf arrows, poster-card and screenshot
   viewer buttons (those last ones also sit in the old !important square rule). */
html[data-theme]:not(#radius-system) :is(
  .video-games-filter-group__options > button,
  .video-games-selector__groups > button,
  .video-games-inline-button,
  .video-games-detail__screenshots-button,
  .video-games-detail__immersive-button,
  .video-games-panel__toggle,
  .video-games-selector__arrow,
  .video-games-hotspot-card__close,
  .video-games-screenshot-lightbox__head button,
  .video-games-screenshot-lightbox__controls button
) {
  border-radius: var(--radius-control) !important;
}

/* Game cards are compact cards in a dense shelf (16); the cover sits 10px
   inside the card, so it takes 8. */
html[data-theme]:not(#radius-system) .video-games-game-card {
  border-radius: var(--radius-inset);
}

html[data-theme]:not(#radius-system) .video-games-game-card__cover {
  border-radius: var(--radius-control);
}

/* Boxes inside the details panel and the screenshot viewer (16). */
html[data-theme]:not(#radius-system) :is(
  .video-games-detail__screens,
  .video-games-detail__screen-frame,
  .video-games-detail__facts,
  .video-games-screenshot-lightbox__frame
) {
  border-radius: var(--radius-inset);
}

/* Floating surfaces (24): the poster card and the screenshot viewer. */
html[data-theme]:not(#radius-system) :is(
  .video-games-hotspot-card,
  .video-games-screenshot-lightbox__dialog
) {
  border-radius: var(--radius-surface);
}

/* Side panels are attached to the screen edges: round only their inner
   corners (filters on the left edge, details on the right). */
html[data-theme]:not(#radius-system) .video-games-panel--filters {
  border-radius: 0 var(--radius-surface) var(--radius-surface) 0;
}

html[data-theme]:not(#radius-system) .video-games-panel--details {
  border-radius: var(--radius-surface) 0 0 var(--radius-surface);
}

/* From 1181px the game shelf floats between the two panels on the bottom
   edge: round its top corners. Below that it runs edge to edge (square). */
@media (min-width: 1181px) {
  html[data-theme]:not(#radius-system) .video-games-selector {
    border-radius: var(--radius-surface) var(--radius-surface) 0 0;
  }
}
