/* 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. */

/* #28 (EV-PAGE-60): components.css sets .ap's line-height to 26px (1.625); reading text sits
   easier at 1.375 (22px on 16px). Overriding here rather than hand-editing the copied artifact. */
.ap { line-height: 22px; }
/* The card-page source quote is reading prose, not a label, so it meets the 16px floor too;
   components.css sets it at 14px/21px. */
.ap-quote { font-size: 16px; line-height: 22px; }
/* The map's own caption explaining how to read it is reading prose, not a data readout, so it
   gets its own class instead of reusing .ap-readout-s (13px, correct for the scores, dates, and
   source counts that do use it elsewhere). */
.ap-caption { display: block; font-family: var(--font-sans); font-size: 16px; line-height: 22px; color: var(--ink-muted); }

.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-count { margin: 0 0 var(--space-2); }
.ap-maplist { list-style: none; margin: 0; padding: 0; display: grid; }
.ap-maplist li { border-top: 1px solid var(--line); padding-bottom: var(--space-2); }
.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-maplist-n { display: inline-block; min-width: 1.5em; color: var(--ink-muted); font-family: var(--font-mono); }
/* #30: the spread (the map's leader lines) and the cluster (the map's colour and shape) named in
   words, so neither depends on the map's own graphics to be understood (EV-PAGE-122, EV-PAGE-123). */
.ap-maplist-detail { margin: 0; }

.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); }
/* #55: the "Hide possibilities only" checkbox hides a considered-only card wherever it currently
   sits (grouped or the flat sorted view share the same data-hollow marker), rather than needing
   to re-query elements each time the sort control swaps which container is visible. */
.ap-hide-hollow-cards [data-hollow="true"] { display: none; }
.ap-hollow-marker { color: var(--ink-muted); }

/* 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); }

/* #85: the X and Y pickers sit on the plot itself, as the axis titles, rather than in a row above
   it that pushed the map below the fold on a phone. Y reads above the plot (its text stays
   horizontal; a sideways label would need more room than a phone has) and X reads under it. */
.ap-axis-on-plot { display: flex; }
.ap-axis-on-plot-x { justify-content: flex-end; margin-top: var(--space-2); }
.ap-axis-on-plot-y { margin-bottom: var(--space-2); }
/* design-system/components.css's .ap-map svg stretches every svg inside the map to the container's
   width, meant for the plot itself; now that the axis title buttons (and their small chevron icon)
   sit inside the map too, that rule would blow the 10x6 chevron up to the full plot width. */
.ap-map .ap-chevron { width: 10px; height: 6px; max-width: 10px; }

/* #55: a card placed only by sources that consider it possible draws hollow — outline only, in
   its cluster's own colour and shape. design-system/components.css's .c1/.c2/.c3 rules fill
   solid; this layers on top rather than editing that copied artifact. */
.ap-map .hollow { fill: none; }

/* 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; }
