/* Page-specific rules that sit on top of the design system (design-system/components.css),
   which is a copy of the external artifact and is not where page layout belongs. */

.ap-page { padding: var(--space-12) var(--space-4) var(--space-8); display: grid; gap: var(--space-6); max-width: 720px; margin: 0 auto; }
.ap-page > p.ap-lede { max-width: 65ch; color: var(--ink-muted); }

/* The phone list view: real 44px tap rows, since the map's own points are too small to tap. */
.ap-maplist { list-style: none; margin: 0; padding: 0; display: grid; }
.ap-maplist li { border-top: 1px solid var(--line); }
.ap-maplist a { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; padding: var(--space-2) 0; color: var(--ink); text-decoration: none; }
.ap-maplist a:hover, .ap-maplist a:focus-visible { color: var(--signal); }

.ap-map a { cursor: pointer; }

/* #52: the gauge label now carries the dimension's two ends in words too, under its name. The
   design system's 4.5em label column and all-caps mono type were sized for a short axis name
   (components.css .ap-gauge, .ap-label); this much longer label needs its own room to read. */
.ap-card-gauges .ap-gauge { grid-template-columns: minmax(11em, 16em) minmax(0, 1fr) 3em; }
.ap-card-gauges .ap-gauge > .ap-label { text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.3; }
.ap-gauge-ends { display: block; color: var(--ink-muted); font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 11px; }

.ap-related { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.ap-related a { color: var(--ink); }
.ap-related a:hover, .ap-related a:focus-visible { color: var(--signal); }

/* #50: /predictions/ needs more width than a single-column reading page for a grid of cards. */
.ap-page-wide { max-width: 1100px; }
/* A grid item's default min-width is auto (its content's intrinsic width), which let a long claim
   push the card wider than its track instead of wrapping. min-width: 0 lets it shrink to the track
   and wrap normally. components.css's .ap-h3 also sets text-wrap: balance, which (combined with an
   auto-fill grid track) measures the heading at its unbalanced max-content width instead of the
   track's width; text-wrap: wrap here is what actually constrains it. */
.ap-card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); align-items: start; }
.ap-card-list > .ap-plate { min-width: 0; }
/* components.css's .ap-card has no grid-template-columns, so its one implicit column defaults to
   auto (content's max-content width) instead of the available track width: inside an auto-fill
   grid this measures the claim's un-wrapped width and overflows the card. minmax(0, 1fr) pins it
   to the track instead. */
.ap-card-list .ap-card { grid-template-columns: minmax(0, 1fr); }
.ap-sort { display: flex; align-items: center; gap: var(--space-2); }
.ap-sort select { min-height: 44px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); padding: 0 var(--space-2); }
.ap-prediction-group { display: grid; gap: var(--space-3); }

/* The compact prediction-list card shows only the current map axes by default; all six show on
   wide screens. The card page's own appendix (#52) always shows all six, so this only scopes to
   .ap-prediction-card. */
.ap-prediction-card .ap-card-gauges { grid-template-columns: repeat(2, 1fr); gap: var(--space-2) var(--space-4); }
.ap-prediction-card .ap-gauge:not(.ap-gauge-primary) { display: none; }
@media (min-width: 720px) {
  .ap-prediction-card .ap-gauge:not(.ap-gauge-primary) { display: grid; }
}

/* #48: the axis picker is now a title button per axis that opens a popover listing every
   dimension, instead of a row of buttons for each one. */
.ap-axis { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.ap-axis-control { position: relative; }
.ap-axis-title {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px;
  padding: 0 var(--space-3); white-space: normal; text-align: left; cursor: pointer;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
}
.ap-axis-title:hover, .ap-axis-title:focus-visible, .ap-axis-title[aria-expanded="true"] {
  color: var(--signal); border-color: var(--signal);
}
.ap-chevron { width: 10px; height: 6px; flex-shrink: 0; }
.ap-axis-popover {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 10; min-width: 220px;
  margin: 0; padding: var(--space-2) 0; list-style: none;
  background: var(--raised, var(--surface)); border: 1px solid var(--line-strong);
}
.ap-axis-popover li {
  display: flex; align-items: center; gap: var(--space-2); min-height: 44px;
  padding: 0 var(--space-3); color: var(--ink); cursor: pointer;
}
.ap-axis-popover li[aria-selected="true"] { color: var(--signal); }
.ap-axis-popover li:hover, .ap-axis-popover li:focus { background: var(--surface); outline: none; color: var(--signal); }

/* The display heading is fixed at 52px for desktop; a long word like "PREDICTIONS" is wider than
   a phone viewport at that size and gets clipped rather than wrapped. Shrink it below 480px so the
   widest word always fits. */
@media (max-width: 480px) {
  .ap-display { font-size: clamp(28px, 9vw, 52px); line-height: 1.15; }
}

/* .ap-nav lays out the mark and the links in one unwrapped row; with five links that spills off a
   phone screen. Wrap both so every link stays reachable without a hidden hamburger. */
.ap-nav { flex-wrap: wrap; row-gap: var(--space-2); padding-block: var(--space-2); }
.ap-nav-links { flex-wrap: wrap; }
