/*
  Component library (PLAN-design-and-filtering §4).

  Loaded ONLY by migrated templates, always together with css/tokens.css and
  never alongside css/main.css — that pairing is the containment strategy
  (plan §2). Every selector here is a class; the only bare-element rules are
  the minimal reset and base body/heading typography the plan allows.

  The match-list block is transcribed from design/d-revised.html (the settled
  prototype) with its values mapped onto the §3 tokens. Structural things the
  plan fixes verbatim — the grid template, the 4×30px color bar, the 21px
  match number — stay literal.
*/

/* ------------------------------------------------------------------ *
 * Reset + base typography (the §2-sanctioned bare-element block)
 * ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.15;
  text-wrap: balance;
}

/* ------------------------------------------------------------------ *
 * Icons — Material Symbols, one font for every glyph on the page
 * (the heart, the ×'s, the carets) instead of ad hoc unicode/SVG.
 * ------------------------------------------------------------------ */

.icon {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 1.25rem;
  line-height: 1;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  /* Outline by default; a filled icon (the liked heart) toggles FILL to 1
     rather than swapping to a different glyph name. */
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.icon.filled,
.follow-btn[data-following="true"] .icon {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

/* ------------------------------------------------------------------ *
 * Layout container (§3.3 — replaces body{padding-inline:15%})
 * ------------------------------------------------------------------ */

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The feed is a browsing surface: it takes a maximized window's full width
   (and the header widens with it, so the logo stays over the list's edge). */
.page-wide .container,
.page-wide .site-nav-inner {
  max-width: var(--container-wide);
}


/* ------------------------------------------------------------------ *
 * Site header (§4.1) — canonical copy; html/_nav.html carries the same
 * rules inline (with fallbacks) so it renders on unmigrated pages too
 * ------------------------------------------------------------------ */

.site-nav {
  position: sticky;
  top: 0;
  background: var(--paper);
  border-bottom: var(--border);
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-1);
}

.site-nav-inner {
  max-width: var(--container-max);
  min-height: calc(var(--nav-h) - 1px);
  margin-inline: auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.site-nav .logo {
  height: 1.375rem;
  display: block;
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: var(--text-base);
}

.site-nav-links a {
  white-space: nowrap;
}

.site-nav-links a:not(.btn) {
  color: var(--ink-2);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

.site-nav-links a:not(.btn):hover {
  color: var(--ink);
}

.site-nav-links a:not(.btn)[aria-current="page"] {
  color: var(--accent);
}

.site-nav-links a:not(.btn):focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

/* School search — markup shape is fixed by assets/search.js:
   .search > img + input + .results */
.site-nav .search {
  position: relative;
  flex: 0 1 17.5rem;
  min-width: 0;
}

.site-nav .search > img {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  translate: 0 -50%;
  width: 0.9375rem;
  height: 0.9375rem;
  /* The asset is logo-cyan; neutralize it — cyan is budgeted for the primary
     action, selection and focus only (§3.2). */
  filter: grayscale(1) brightness(0);
  opacity: 0.4;
  pointer-events: none;
}

.site-nav .search input {
  width: 100%;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  transition: border-color var(--dur-fast) var(--ease);
}

.site-nav .search input::placeholder {
  color: var(--ink-3);
}

.site-nav .search input:focus-visible {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

.site-nav .search .results {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  z-index: var(--z-dropdown);
  overflow: hidden;
}

.site-nav .search .results:empty,
.site-nav .search:not(:focus-within):not(:has(.results:hover)) .results {
  display: none;
}

.site-nav .search .results a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease);
}

/* The college's colour, as a dot ahead of its name. */
.site-nav .search .results a::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--rc, var(--rule));
}

.site-nav .search .results a:hover,
.site-nav .search .results a:focus-visible,
.site-nav .search .results a.active {
  background: var(--tint);
  outline: none;
}

.site-nav .search .results a + a {
  border-top: var(--border-soft);
}

.site-nav .search .results .empty {
  margin: 0;
  padding: 10px 12px;
  color: var(--ink-3);
  font-size: var(--text-sm);
}

.site-nav .search .results span {
  width: 1.625rem;
  height: 1.625rem;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--rule);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.site-nav .search .results img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

.site-nav .search .results b {
  font-weight: 500;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile: the search collapses to its icon and expands in place (§4.1).
   The partial's small script toggles .open on .search. */
@media (max-width: 640px) {
  .site-nav-inner {
    gap: var(--space-3);
  }

  .site-nav-links {
    gap: var(--space-4);
  }

  .site-nav .search {
    flex: none;
  }

  .site-nav .search > img {
    position: static;
    translate: none;
    width: 1.125rem;
    height: 1.125rem;
    padding: 0.8125rem;
    box-sizing: content-box;
    opacity: 0.55;
    pointer-events: auto;
    cursor: pointer;
    display: block;
  }

  .site-nav .search input {
    display: none;
  }

  .site-nav .search.open {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: 50%;
    translate: 0 -50%;
    flex: 1 1 auto;
    background: var(--paper);
  }

  .site-nav .search.open > img {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    translate: 0 -50%;
    width: 0.9375rem;
    height: 0.9375rem;
    padding: 0;
    pointer-events: none;
  }

  .site-nav .search.open input {
    display: block;
  }
}

/* ------------------------------------------------------------------ *
 * Buttons (§4.2)
 * ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  position: relative;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.35;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  /* Color-only transitions; no transforms (§4.2). */
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.btn .icon {
  font-size: 1.125rem;
}

/* Pad the hit area to ≥44px tall without changing the visual box (§4). */
.btn::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -0.3125rem;
  bottom: -0.3125rem;
}

.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn:active {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn:focus-visible {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--ink-disabled);
  border-color: var(--ink-disabled);
  color: #ffffff;
  cursor: not-allowed;
}

.btn-quiet {
  background: transparent;
  border-color: var(--rule);
  color: var(--ink);
}

.btn-quiet:hover {
  background: transparent;
  border-color: var(--ink);
}

.btn-quiet:active {
  background: var(--tint);
  border-color: var(--ink);
}

.btn-quiet:disabled,
.btn-quiet[aria-disabled="true"] {
  background: transparent;
  border-color: var(--rule-2);
  color: var(--ink-disabled);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover,
.btn-danger:active {
  background: #8f3a24;
  border-color: #8f3a24;
}

.btn-block {
  display: block;
  width: 100%;
}

/* Async actions: keep the box, quiet the label (§4 "loading" state). */
.btn.loading {
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

.btn-quiet.loading::after {
  border-color: var(--rule);
  border-top-color: var(--ink-3);
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (pointer: coarse) {
  .btn {
    min-height: 2.75rem;
  }
}

/* ------------------------------------------------------------------ *
 * Forms (§4.3) — the floating-label pattern from main.css is retired
 * ------------------------------------------------------------------ */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field > label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.field input,
.field select,
.field textarea {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  min-width: 0;
  transition: border-color var(--dur-fast) var(--ease);
}

.field input::placeholder,
.field textarea::placeholder {
  /* Hints, never labels; --ink-3 is the minimum text gray (§4.3). */
  color: var(--ink-3);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: var(--tint);
  color: var(--ink-disabled);
  cursor: not-allowed;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

/* Inline validation, directly under the control (§4.3). */
.field-error {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--danger);
}

.field-hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

@media (pointer: coarse) {
  .field input,
  .field select,
  .field textarea {
    min-height: 2.75rem;
  }
}

/* ------------------------------------------------------------------ *
 * The match list — a card grid. Redesigned to sell the school, not
 * tabulate it: a school photo/logo, a big colorful match number and a
 * filled fit pill up front, one click straight to the school page.
 * ------------------------------------------------------------------ */

/* Four columns at most, however wide the window: each card gets room to
   breathe. The column minimum is the larger of the card's own minimum and
   a quarter of the row, so auto-fill can never fit a fifth. */
.list {
  --list-gap: var(--space-8);
  margin: 0 0 var(--space-2);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(var(--card-min), calc((100% - 3 * var(--list-gap)) / 4))), 1fr));
  gap: var(--list-gap) var(--list-gap);
}

.list-tail-head {
  grid-column: 1 / -1;
  margin-top: var(--space-4);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* List view (§ list format) — a dense single-column alternative to the
   card grid above, toggled client-side (html/feed.html adds .is-compact to
   #list-body and swaps to the .card-list markup rowHtml renders for it).
   Same data, same follow/not-interested/interest controls as the card —
   just laid out as one row instead of one tile, so more of the list fits
   on screen at once. */
.list.is-compact {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel);
}

/* .card.card-list, not .card-list alone: it needs to beat .card's own
   flex-direction/padding/etc at equal specificity, and .card's rule comes
   later in this file — a compound selector wins on specificity instead of
   depending on source order. */
.card.card-list {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--panel);
  border: none;
  border-radius: 0;
  box-shadow: none;
  transition: background-color var(--dur-fast) var(--ease);
}

.card-list + .card-list {
  border-top: var(--border-soft);
}

.card.card-list:hover {
  background: var(--tint);
  transform: none;
  box-shadow: none;
}

.card.card-list.dismissed {
  transform: none;
}

/* Logo tiles. The files are trimmed to the visible mark
   (modules/logo-fit.js), and each tile carries the mark's aspect ratio in
   --logo-ar. A tile sizes the mark so it covers about --logo-fill of the
   tile's inner square: a square crest stops short of the edges, a wide
   wordmark runs the full width at a lower height, and the two read at about
   the same weight. --logo-bg is the colour of the block a mark is printed
   on, which fills the tile so the block reads as a badge. Without sqrt()
   support the first width/height pair stands and the mark simply fills. */
:root {
  --logo-fill: 0.72;
}

.row-logo {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--logo-bg, var(--panel));
  border: 1px solid var(--rule);
  object-fit: contain;
  padding: 6px;
  --logo-inner: calc(42px - 2px - 12px);
  padding-inline: calc(6px + var(--logo-inner) * (1 - min(1, sqrt(0.8 * var(--logo-ar, 1)))) / 2);
  padding-block: calc(6px + var(--logo-inner) * (1 - min(1, sqrt(0.8 / var(--logo-ar, 1)))) / 2);
}

.row-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.row-main {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-width: 0;
  pointer-events: none; /* the card-link underneath carries the click */
}

.row-name {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  min-width: 0;
}

.row-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-name .card-div {
  flex: none;
}

.row-sub {
  margin: 2px 0 0;
  color: var(--ink-3);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Fit pill, sized down from the card's version rather than duplicated. */
.card-list .tag {
  flex: none;
  border: none;
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 4px 10px;
  position: relative;
  z-index: 2;
}

.card-list .t-safety   { background: var(--pop-safety); }
.card-list .t-vlikely  { background: var(--pop-vlikely); }
.card-list .t-likely   { background: var(--pop-likely); }
.card-list .t-reach    { background: var(--pop-reach); }
.card-list .t-unlikely,
.card-list .t-none     { background: var(--pop-unlikely); }
.card-list .t-target   { background: var(--pop-target); color: var(--ink); }

.card-list .card-pct {
  flex: none;
  width: 52px;
  justify-content: flex-end;
  position: relative;
  z-index: 2;
}

.card-list .card-pct b {
  font-size: var(--text-lg);
  font-weight: 800;
}

.card-list .card-pct i {
  font-size: var(--text-xs);
}

.row-interest {
  position: relative;
  z-index: 2;
  display: flex;
  gap: var(--space-2);
  flex: none;
}

/* The heart/eye buttons anchor to the card's corner on the grid card; here
   they're just two more icons in the row, so their absolute positioning
   is switched off. */
.card-list .follow-btn,
.card-list .not-interested-btn {
  position: relative;
  top: auto;
  right: auto;
  flex: none;
  width: 32px;
  height: 32px;
  background: transparent;
  box-shadow: none;
}

.card-list .follow-btn:hover,
.card-list .not-interested-btn:hover {
  background: var(--tint);
}

@media (max-width: 640px) {
  .row-sub { display: none; }
  .card-list { gap: var(--space-2); }
}

.card {
  position: relative;
  /* The card's own width decides how much fits in its rows (see the
     interest prompt below), not the window's. */
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Keeps the stretched link and follow button's z-index inside the card. */
  isolation: isolate;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-3);
  border-color: var(--sc, var(--accent-ring));
}

.card:has(.card-link:focus-visible) {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

/* The one visible confirmation that "not interested" registered — there's
   no toggled-on state to look at afterward the way a filled heart gives
   a follow, so the card itself dims instead. Stays dimmed rather than
   bouncing back, since the point is "this is being pushed down." */
.card.dismissed {
  opacity: 0.45;
  transform: scale(0.98);
  filter: grayscale(0.5);
  transition: opacity 320ms var(--ease), transform 320ms var(--ease), filter 320ms var(--ease);
}

.card.dismissed:hover {
  transform: scale(0.98);
}

/* The whole card is the click target to /school/:id/ (no accordion, no
   second click) — a transparent link stretched over everything, with the
   follow button raised above it in stacking order as the one exception. */
.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card-link:focus-visible {
  outline: none; /* the .card rule above draws the ring */
}

/* 88px: still most of the card's color and "pop", but short enough that
   a maximized window shows two full rows (eight or more schools). */
.card-top {
  position: relative;
  height: 5.5rem;
  padding: var(--space-3);
  /* The school's real brand hex rides in on --sc; it is data (§3.2). A
     sheen off the brand color itself, not a fade to black — the banner is
     half the card's area now, so it carries most of the "pop". */
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--sc, var(--ink-3)) 78%, white 22%),
    var(--sc, var(--ink-3)));
}

/* The logo banner: the school's own mark, large and centered on a soft
   tint of its color, with the full color as a stripe along the bottom.
   The tint keeps a logo drawn in the school's own color readable (a
   brown Brown "B" on a brown block would vanish). */
.card-top.has-logo {
  height: 8.5rem;
  padding: var(--space-4) var(--space-12);
  background:
    radial-gradient(ellipse at 50% 55%, rgba(255, 255, 255, 0.85), transparent 70%),
    color-mix(in srgb, var(--sc, var(--ink-3)) 16%, white);
  box-shadow: inset 0 calc(-1 * var(--space-1)) 0 var(--sc, var(--ink-3));
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-banner-logo {
  display: block;
  width: 100%;
  height: 100%;
  /* The banner is wider than tall: a square crest takes most of the
     height (clear of the rank badge in the corner), a long wordmark gives
     some back so it doesn't outweigh it. */
  height: calc(100% * min(0.84, sqrt(1.1 / var(--logo-ar, 1))));
  object-fit: contain;
  /* Multiply melts a raster logo's white box into the tint; on a
     background this light, the logo's own colors barely change. */
  mix-blend-mode: multiply;
  transition: transform var(--dur-base) var(--ease);
}

.card:hover .card-banner-logo {
  transform: scale(1.04);
}

@media (prefers-reduced-motion: reduce) {
  .card:hover .card-banner-logo {
    transform: none;
  }
}

/* With no tile hanging below the logo banner, the rank badge takes the
   banner's top-left corner and the body needs no clearance. */
.card--logo .card-rank {
  left: var(--space-3);
  top: var(--space-3);
  bottom: auto;
  max-width: calc(100% - var(--space-3) - var(--space-16) - var(--space-8));
}

.card--logo .card-body {
  padding-top: var(--space-5);
}

/* A background photo (html/admin-backgrounds.html) — the brand color
   composites on top as a translucent gradient overlay rather than
   replacing it, so the photo still reads through the color. */
.card-top.has-photo {
  background-image:
    linear-gradient(135deg,
      color-mix(in srgb, var(--sc, var(--ink-3)) 45%, transparent),
      color-mix(in srgb, var(--sc, var(--ink-3)) 78%, transparent)),
    var(--bg-photo);
  background-size: cover;
  background-position: center;
}

/* The tile hangs --space-6 below the banner; .card-body's top padding
   clears that plus a --space-3 gap. Used on photo and no-logo banners. */
.card-logo {
  position: absolute;
  left: var(--space-4);
  bottom: calc(-1 * var(--space-6));
  width: 3.75rem;
  height: 3.75rem;
  border-radius: var(--radius);
  background: var(--logo-bg, var(--panel));
  border: 3px solid var(--logo-bg, var(--panel));
  box-shadow: var(--shadow-2);
  object-fit: contain;
  padding: var(--space-1);
  --logo-inner: calc(3.75rem - 6px - 2 * var(--space-1));
  padding-inline: calc(var(--space-1) + var(--logo-inner) * (1 - min(1, sqrt(var(--logo-fill) * var(--logo-ar, 1)))) / 2);
  padding-block: calc(var(--space-1) + var(--logo-inner) * (1 - min(1, sqrt(var(--logo-fill) / var(--logo-ar, 1)))) / 2);
}

/* Academic rank, on the banner beside the logo tile. A dark wash under
   white text keeps it legible on every brand color and over a photo. */
.card-rank {
  position: absolute;
  left: calc(var(--space-4) + 3.75rem + var(--space-2));
  bottom: var(--space-1);
  max-width: calc(100% - var(--space-4) - 3.75rem - var(--space-2) - var(--space-4));
  padding: 0.125rem var(--space-2);
  border-radius: var(--radius);
  background: rgba(22, 22, 26, 0.55);
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.35;
  /* Up to two lines ("#50 U.S. News / Liberal Arts") rather than cutting
     the list name off; the banner has room below the buttons. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--ink-2);
}

.follow-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 2;
  width: var(--space-8);
  height: var(--space-8);
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-3);
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-1);
  transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.follow-btn .icon {
  font-size: 1.125rem;
}

/* A 44px touch target around the 32px circle. */
.follow-btn::before {
  content: "";
  position: absolute;
  inset: calc(-1 * (2.75rem - var(--space-8)) / 2);
}

.follow-btn:hover {
  transform: scale(1.08);
}

/* --pop-reach (the fit-band red), not --danger — a liked heart isn't a
   destructive/error state, and --danger is deliberately desaturated for
   that job, which read as dull here. */
.follow-btn[data-following="true"] {
  color: var(--pop-reach);
}

.follow-btn:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

/* The like burst (§ animations): a quick scale-pop on the heart plus a
   fading ring, played once on like — never on unlike. */
@keyframes heart-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  60%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes heart-burst {
  0%   { transform: scale(0.5); opacity: 0.65; }
  100% { transform: scale(1.9); opacity: 0; }
}

.follow-btn.pop .icon {
  animation: heart-pop 420ms var(--ease);
}

.follow-btn.pop::after {
  content: "";
  position: absolute;
  inset: -0.3125rem;
  border-radius: 50%;
  border: 2px solid var(--pop-reach);
  animation: heart-burst 420ms var(--ease) forwards;
  pointer-events: none;
}

/* "Not interested" — its own button, not tucked behind a ⋮ menu, to the
   left of the follow heart. Deliberately quieter than the heart (lower
   background opacity, dimmer icon) — it's the negative action, so it
   shouldn't compete with "like" for attention; still fully visible and a
   real target, just not the first thing the eye lands on. */
.not-interested-btn {
  position: absolute;
  top: var(--space-3);
  right: calc(var(--space-3) + var(--space-8) + var(--space-2));
  z-index: 2;
  width: var(--space-8);
  height: var(--space-8);
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-3);
  opacity: 0.8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-1);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.not-interested-btn .icon {
  font-size: 1.125rem;
}

.not-interested-btn:hover {
  opacity: 1;
  transform: scale(1.08);
}

.not-interested-btn:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
  opacity: 1;
}

.card-body {
  position: relative;
  flex: 1;
  padding: calc(var(--space-6) + var(--space-3)) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* The periodic "are you interested?" prompt (§ recommender feedback) — the
   card's own follow/⋮ signals are opt-in; this asks outright, every so
   often, on a school the athlete hasn't answered either way yet. Raised
   above the card's stretched link (z-index 2, like .follow-btn) so its
   buttons are clickable rather than triggering navigation. */
.card-interest {
  position: relative;
  z-index: 2;
  /* Pinned to the card's bottom, so every prompt in a row lines up however
     many lines the school names above them took. */
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.card-interest-q {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.card-interest-actions {
  display: flex;
  gap: var(--space-2);
  flex: none;
}

/* A narrow card keeps the question and drops the button words: the heart
   and the cross still read, and each button's aria-label names the school. */
@container (max-width: 18rem) {
  .card-interest-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .card-interest-btn {
    min-width: var(--control-h);
    justify-content: center;
  }
}

.card-fit {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.card-pct {
  display: flex;
  align-items: baseline;
  gap: 0.125rem;
}

.card-pct b {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.card-pct i {
  font-style: normal;
  font-size: var(--text-lg);
  color: var(--ink-3);
}

.card-pct.pct-na b {
  font-size: var(--text-xl);
  color: var(--ink-3);
}

/* Tint the match number by fit band — the same read as the pill beside
   it, so the number itself carries some of the "worth a look" signal.
   The --pop-* set (tokens.css), not the muted --fit-* one: a 2.75rem
   number can carry far more saturation before it stops reading as text. */
.card-pct.pct-safety b  { color: var(--pop-safety); }
.card-pct.pct-vlikely b { color: var(--pop-vlikely); }
.card-pct.pct-likely b  { color: var(--pop-likely); }
/* Amber is the one band colour too pale to read as a numeral on white
   (2.1:1); the number takes a deeper amber (3.9:1, large text). */
.card-pct.pct-target b  { color: #c26a00; }
.card-pct.pct-reach b   { color: var(--pop-reach); }

/* Fit pill scoped to the card only — filled, not the outlined .tag used
   on the map and school pages, because a feed of prospects should read
   as inviting, not as a spreadsheet. */
.card-fit .tag {
  border: none;
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
}

.card-fit .t-safety   { background: var(--pop-safety); }
.card-fit .t-vlikely  { background: var(--pop-vlikely); }
.card-fit .t-likely   { background: var(--pop-likely); }
.card-fit .t-reach    { background: var(--pop-reach); }
.card-fit .t-unlikely,
.card-fit .t-none     { background: var(--pop-unlikely); }

/* Amber is too light for white text at any usable contrast — keep the
   background vivid and switch the label to dark ink instead of dimming
   the color to something that reads as brown. */
.card-fit .t-target {
  background: var(--pop-target);
  color: var(--ink);
}

/* Division — a plain outline badge, deliberately quieter than the fit
   pill beside it, so the colorful part of the row stays the match. */
.card-div {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.125rem var(--space-2);
}

/* Whether the number behind a card's match is the program's own mark or an
   estimate. Estimates carry a "~" and the amber of the estimated chip on the
   school page, so the two read as the same thing wherever they appear. */
.card-basis {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  border-radius: 999px;
  padding: 0.125rem var(--space-2);
  background: var(--tint);
}

.card-basis.is-estimated {
  color: var(--warn-ink);
  background: var(--warn-wash);
}

.card-basis.is-published {
  color: var(--good);
  background: var(--good-wash);
}

/* Why this school leads the list: one of the few labeled picks. */
.card-pick,
.row-pick {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent, var(--ink));
}

/* The program's place in its division: same quiet badge, darker ink. */
.card-prank {
  color: var(--ink-2);
  letter-spacing: 0;
}

/* Two lines at most, so a long name can't make its whole row taller; the
   stretched link's label carries the full name. */
.card-name {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-sub {
  margin: 0;
  color: var(--ink-3);
  font-size: var(--text-base);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.src {
  font-size: var(--text-sm);
  color: var(--ink-3);
}

/* Unobtrusive links inside a source line (e.g. to /method) stay in the
   line's own gray — cyan is budgeted (§3.2), and a source line is the
   definition of a secondary affordance. */
.src a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--dur-fast) var(--ease);
}

.src a:hover {
  color: var(--ink);
}

.src a:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

/* ------------------------------------------------------------------ *
 * Tags & provenance chips (§4.7) — outlined, never solid, never cyan
 * ------------------------------------------------------------------ */

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.125rem var(--space-2);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  background: transparent;
  white-space: nowrap;
}

/* One class per engine band (LIKELIHOOD_BANDS, modules/likelihood.js).
   Ordinal cool→warm; the label text is always present — color is never
   the only channel. */
.t-safety   { color: var(--fit-safety); }
.t-vlikely  { color: var(--fit-vlikely); }
.t-likely   { color: var(--fit-likely); }
.t-target   { color: var(--fit-target); }
.t-reach    { color: var(--fit-reach); }
.t-unlikely { color: var(--fit-unlikely); }

/* Provenance chip — the imputation marking (§6.9). Class names match
   modules/provenance.js level keys; `title` carries provenance.note. */
.prov {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.125rem var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  background: var(--panel);
  white-space: nowrap;
}

.prov::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: currentColor;
}

.prov.measured {
  color: var(--good);
  border-color: rgba(47, 107, 70, 0.3);
}

.prov.imputed {
  color: var(--warn);
  border-color: rgba(138, 90, 18, 0.3);
}

.prov.stated,
.prov.coach-stated {
  color: var(--info);
  border-color: rgba(28, 91, 122, 0.3);
}

.prov.published {
  color: var(--ink-2);
  border-color: var(--rule);
}

/* ------------------------------------------------------------------ *
 * Filter components (§4.5)
 * ------------------------------------------------------------------ */

/* Sidebar facet group. Works as a plain div or as <details class="facet">
   (the mobile sheet renders facets as accordions). */
.facet {
  border-bottom: var(--border-soft);
  padding: var(--space-4) 0 var(--space-4);
}

.facet-head {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
  padding: var(--space-2) 0;
  list-style: none; /* as a <summary> */
  cursor: default;
}

details.facet > .facet-head {
  cursor: pointer;
}

details.facet > .facet-head::-webkit-details-marker {
  display: none;
}

details.facet > .facet-head::after {
  content: "expand_more";
  float: right;
  font-family: "Material Symbols Outlined";
  font-size: 1.25rem;
  line-height: 1;
  transform: rotate(-90deg);
  transition: transform var(--dur-fast) var(--ease);
}

details.facet[open] > .facet-head::after {
  transform: rotate(0deg);
}

details.facet > .facet-head:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

/* One option row: native input, custom face, right-aligned count. 32px
   rows under a mouse keep a whole facet group on screen; touch gets 44. */
.facet-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.25rem;
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--ink-2);
}

@media (pointer: coarse) {
  .facet-option {
    min-height: 2.75rem;
  }
}

.facet-option:hover {
  color: var(--ink);
}

.facet-option input[type="checkbox"],
.facet-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.facet-option input[type="radio"] {
  border-radius: 50%;
}

.facet-option input[type="checkbox"]::before {
  content: "";
  width: 0.6875rem;
  height: 0.6875rem;
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease);
  background: #ffffff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.facet-option input[type="radio"]::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease);
  background: #ffffff;
}

.facet-option input:checked {
  /* Selection is one of cyan's five sanctioned jobs (§3.2). */
  background: var(--accent);
  border-color: var(--accent);
}

.facet-option input:checked::before {
  transform: scale(1);
}

.facet-option input:focus-visible {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

.facet-option input:disabled {
  background: var(--tint);
  border-color: var(--rule-2);
  cursor: not-allowed;
}

.facet-option:has(input:disabled) {
  color: var(--ink-disabled);
  cursor: not-allowed;
}

.facet-option .facet-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facet-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

/* Bucketed ranges (§4.5): same option rows, radios instead of a slider —
   buckets are URL-stable, keyboard-friendly, honest about granularity. */
.facet-range .facet-option input[type="radio"] {
  border-radius: 50%;
}

/* Active-filter chips above the list. */
.chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-sm);
  color: var(--ink-2);
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-2);
}

.chip b {
  font-weight: 500;
  color: var(--ink);
}

/* The × is its own button with a padded ≥44px hit area (§4.5). */
.chip-x {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.chip-x::before {
  content: "";
  position: absolute;
  inset: -0.6875rem;
}

.chip-x:hover {
  background: var(--tint);
  color: var(--ink);
}

.chip-x:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

.chips-clear {
  border: none;
  background: none;
  padding: var(--space-2) 0.125rem;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.chips-clear:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.chips-clear:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

/* Count line: the list's scope readout — always states which event/mark
   the list is scored against (§4.5). */
.count-line {
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink-2);
  margin: var(--space-3) 0;
}

.count-line em {
  font-style: normal;
  color: var(--ink-3);
}

/* Mobile filter sheet (§4.5): full-screen panel over a dim backdrop,
   facets as accordions, sticky "Show N schools" footer. */
.filter-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet-backdrop);
  background: rgba(22, 22, 26, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease);
}

.filter-sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.filter-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  box-shadow: var(--shadow-3);
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease);
}

.filter-sheet.open {
  transform: translateY(0);
}

.filter-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: var(--border);
}

.filter-sheet-head h2 {
  font-size: var(--text-lg);
}

.filter-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-4);
}

.filter-sheet-foot {
  padding: var(--space-3) var(--space-4);
  border-top: var(--border);
  background: var(--paper);
}

/* ------------------------------------------------------------------ *
 * Empty & degraded states (§4.6)
 * ------------------------------------------------------------------ */

/* Zero results: never a blank area — message, best single removal
   suggestion, and Clear all. */
.empty-state {
  padding: var(--space-10) var(--space-4);
  text-align: center;
  border-bottom: 1px solid var(--rule-2);
}

.empty-state b {
  display: block;
  font-size: var(--text-md);
  font-weight: 600;
}

.empty-state p {
  margin: var(--space-2) 0 0;
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.empty-state .actions {
  margin-top: var(--space-4);
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

/* Sparse-data tail: schools a data-dependent facet had to exclude (§6.6).
   .list-tail-head is defined once, in the card grid section above. */
.list-tail {
  margin-top: var(--space-6);
}

.skeleton-bar {
  height: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--rule-2);
  animation: skeleton-pulse 1.1s var(--ease) infinite alternate;
}

.skeleton-bar.wide {
  width: 70%;
}

@keyframes skeleton-pulse {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.45;
  }
}

/* Onboard-incomplete: one inline callout; teach the interface, don't
   block it. */
.callout {
  background: var(--tint);
  border: var(--border-soft);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.callout a {
  color: var(--accent);
}

.callout a:hover {
  color: var(--accent-hover);
}

/* ------------------------------------------------------------------ *
 * Footer (§4.8) — canonical copy; html/_footer.html inlines the same
 * ------------------------------------------------------------------ */

.site-footer {
  margin-top: var(--space-16);
  padding: var(--space-8) 0 var(--space-6);
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.site-footer p {
  margin: 0;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.site-footer-links a {
  color: var(--ink-3);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

.site-footer-links a:hover {
  color: var(--ink);
}

.site-footer-links a:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

@media (max-width: 600px) {
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* The card grid's auto-fill columns reflow on their own down to a single
 * column; no breakpoint overrides needed (unlike the old fixed-column
 * table row this replaced). */

/* ------------------------------------------------------------------ *
 * Feed workbench (§6.10) — the two-column filter + list layout.
 * Additive to the Phase-1 sheet; nothing above this line changed.
 * ------------------------------------------------------------------ */

.workbench {
  padding-top: var(--space-8);
  padding-bottom: var(--space-16);
}

/* Count line as the page <h1> (§7 feed row): keep h1 semantics, count-line
   voice. */
h1.count-line {
  letter-spacing: 0;
  text-wrap: initial;
  line-height: 1.35;
}

/* Row one: the count line and the page's quiet links. Row two: the
   controls, all at --control-h so their edges line up. The list sits a
   --space-4 below; the two rows sit a --space-2 apart, one group. */
.wb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}

.wb-heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.wb-toolbar .count-line {
  margin: 0;
  min-width: 0;
}

/* The "how these numbers work" link, grouped under the count as its
   footnote instead of floating as its own full-width line (§ redesign —
   it explains the number just stated, so it reads better attached to it). */
.wb-heading .src {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.wb-heading .src .icon {
  font-size: 1rem;
}

.wb-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Grid/list layout toggle (§ list format) — a two-button segmented
   control, same visual weight as the division dropdown beside it. */
.layout-toggle {
  display: inline-flex;
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.layout-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: var(--panel);
  color: var(--ink-3);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.layout-toggle-btn + .layout-toggle-btn {
  border-left: var(--border);
}

.layout-toggle-btn .icon {
  font-size: 19px;
}

.layout-toggle-btn:hover {
  color: var(--ink);
}

.layout-toggle-btn[aria-pressed="true"] {
  background: var(--tint);
  color: var(--accent);
}

.layout-toggle-btn:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-ring);
}

@media (max-width: 640px) {
  .layout-toggle { display: none; }
}

/* Division quick-filter, next to search (§ redesign): one dropdown button
   instead of a pill per division, so it costs the toolbar a fixed amount
   of space regardless of how many divisions the data has. Empty when
   every school is D1 — divisionFilterHtml renders nothing. */
.div-dropdown {
  position: relative;
}

.div-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-2);
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-3);
  min-height: var(--control-h);
  max-width: 13.75rem;
  cursor: pointer;
  list-style: none;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.div-dropdown-btn::-webkit-details-marker {
  display: none;
}

.div-dropdown-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.div-dropdown-btn:focus-visible {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

/* The academics dropdown shows when a ranking band is on, the way a
   checked facet does. */
.acad-dropdown.is-active .div-dropdown-btn {
  background: var(--accent-wash);
  border-color: var(--accent-ring);
  color: var(--accent);
}

.div-dropdown[open] .div-dropdown-btn {
  border-color: var(--accent-ring);
  color: var(--ink);
}

.div-dropdown-btn .icon:first-child {
  font-size: 1.125rem;
  color: var(--ink-3);
}

.div-dropdown-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.div-dropdown-caret {
  font-size: 1.125rem;
  color: var(--ink-3);
  margin-left: auto;
  transition: transform var(--dur-fast) var(--ease);
}

.div-dropdown[open] .div-dropdown-caret {
  transform: rotate(180deg);
}

.div-dropdown-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: var(--z-dropdown);
  min-width: 12.5rem;
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  padding: var(--space-2);
}

.div-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.375rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}

.div-option:hover {
  background: var(--tint);
  color: var(--ink);
}

.div-option input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 1rem;
  height: 1rem;
  flex: none;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-content: center;
}

.div-option input::before {
  content: "";
  width: 0.5625rem;
  height: 0.5625rem;
  transform: scale(0);
  background: #ffffff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.div-option input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.div-option input:checked::before {
  transform: scale(1);
}

.div-option input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

/* The sort dropdown reuses .div-option (same panel/row styling as the
   division checkboxes) but is single-select — a radio, not a checkbox —
   and should look like one: a circular dot, not the checkbox's square
   corners and checkmark. */
.div-option input[type="radio"] {
  border-radius: 50%;
}

.div-option input[type="radio"]::before {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  clip-path: none;
}

/* Compact quiet button (Copy link etc.) — same states as .btn-quiet. */
.btn-compact {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* Search-within-results (§6.11). */
.wb-search {
  position: relative;
}

.wb-search input {
  min-width: 12.5rem;
  padding-left: var(--space-8);
}

.wb-search .field-icon {
  position: absolute;
  left: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  color: var(--ink-3);
  pointer-events: none;
}

@media (min-width: 1000px) {
  .workbench {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    column-gap: var(--space-12);
    align-items: start;
  }

  /* Sidebar: sticky under the header, its own scroll (§6.10). */
  .wb-side {
    position: sticky;
    top: calc(var(--nav-h) + var(--space-4));
    max-height: calc(100vh - var(--nav-h) - var(--space-8));
    overflow-y: auto;
    padding-right: var(--space-2);
    padding-bottom: var(--space-8);
  }
}

/* ---------- presets (§6.4): quiet segmented buttons ---------- */

.presets {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: 0 0 var(--space-4);
}

.preset {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
  background: var(--panel);
  border: var(--border);
  border-radius: 999px;
  padding: 0 var(--space-3);
  min-height: var(--space-8);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.preset:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Selection is one of cyan's sanctioned jobs (§3.2). */
.preset.is-active {
  background: var(--accent-wash);
  border-color: var(--accent-ring);
  color: var(--accent);
}

.preset:focus-visible {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

@media (pointer: coarse) {
  .preset {
    min-height: 2.75rem;
  }
}

/* ---------- facet internals ---------- */

.facet-group-body {
  padding-bottom: var(--space-2);
}

.facet-block + .facet-block {
  margin-top: var(--space-4);
}

/* The per-facet mini label inside a group (the group header is .facet-head). */
.facet-sub {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-2);
  padding: var(--space-2) 0 0.25rem;
}

/* Region headings line up with the option labels: checkbox + its gap. */
.facet-sub.facet-region {
  padding-left: calc(1rem + var(--space-2));
}

/* Long option lists (conference, states) scroll inside the facet. */
.facet-scroll {
  max-height: 16.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Type-ahead over a long checkbox list (§6.5 conference). */
.facet-search {
  width: 100%;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-1) var(--space-2);
  margin: var(--space-1) 0 var(--space-2);
}

.facet-search::placeholder {
  color: var(--ink-3);
}

.facet-search:focus-visible {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

/* §6.7: zero-count options dim but stay clickable. */
.facet-option.is-zero {
  color: var(--ink-disabled);
}

.facet-option.is-zero .facet-count {
  color: var(--ink-disabled);
}

/* Inline data-honesty marker on an option ("standards estimated", §6.5). */
.facet-option-note {
  font-size: var(--text-xs);
  color: var(--warn);
  margin-left: 0.25rem;
}

/* Helper text under a facet (§6.9 basis copy). */
.facet-note {
  margin: 0.25rem 0 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
  line-height: 1.45;
}

/* ---------- division notice (§6.9) — dormant until non-D1 data ---------- */

.notice {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.notice::before {
  content: "";
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
  translate: 0 -1px;
}

.notice-x {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 0.875rem;
  line-height: 1;
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.notice-x:hover {
  color: var(--ink);
  background: var(--tint);
}

.notice-x:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

/* ---------- mobile sub-header (§6.10 <1000px) ---------- */

.wb-subhead {
  display: none;
}

@media (max-width: 999px) {
  .wb-side {
    display: none;
  }

  /* When the filter sheet adopts the facet form, the sidebar's copy of it
     is gone; this keeps layout stable either way. */
  .wb-subhead {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    position: sticky;
    top: var(--nav-h); /* directly under the sticky .site-nav */
    z-index: var(--z-subhead);
    background: var(--paper);
    padding: var(--space-2) 0;
    border-bottom: var(--border);
    box-shadow: var(--shadow-1);
  }

  .wb-subhead .field {
    flex: 1;
    min-width: 0;
  }

  /* The sub-header already carries the sort; one control per job. */
  .wb-desktop-only {
    display: none;
  }

  /* Search takes whatever the dropdowns leave on the row. */
  .wb-search {
    flex: 1 1 10rem;
  }

  .wb-search input {
    min-width: 0;
    width: 100%;
  }

  .wb-toolbar .count-line {
    font-size: var(--text-sm);
  }
}

.wb-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-4);
  min-height: 2.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.wb-filters-btn .icon {
  font-size: 1.1875rem;
  color: var(--ink-3);
}

.wb-filters-btn:hover {
  border-color: var(--ink);
}

.wb-filters-btn:focus-visible {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.35);
}

/* The filter sheet exists only below the breakpoint. */
@media (min-width: 1000px) {
  .filter-sheet,
  .filter-sheet-backdrop {
    display: none;
  }
}

/* ---------- misc ---------- */

.chips:empty {
  display: none;
  margin: 0;
}

.list-sentinel {
  height: 1px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ *
 * Phase 5 additions (PLAN §7 long-tail rows). Additive only — nothing
 * above this line changed.
 * ------------------------------------------------------------------ */

/* Panel container (§7 onboard/account rows): a bordered surface — never
   the 24px-blur shadow card main.css used. */
.panel {
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

/* Stat grid (school page academics): value over label, four across, with
   full-width group headings. Restored after the list-row rules it used to
   live beside were retired. */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4) var(--space-6);
}

.detail-grid > h4 {
  grid-column: 1 / -1;
}

.stat b {
  display: block;
  font-size: var(--text-md);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stat b small {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-3);
}

.stat span {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

@media (max-width: 640px) {
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Two-up field layout that stacks on small screens. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Page heading block for simple app pages. */
.page-head {
  padding: var(--space-8) 0 var(--space-5);
}

.page-head h1 {
  font-size: var(--text-2xl);
}

.page-head p {
  margin: var(--space-2) 0 0;
  color: var(--ink-2);
}

/* Auth quartet (§7): one centered panel card, max 420px, border, no
   shadow; .field inputs; one .btn; quiet links; --danger errors inline. */
.auth-main {
  padding: var(--space-12) 1rem var(--space-16);
}

.auth-card {
  max-width: 26.25rem;
  margin-inline: auto;
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6) var(--space-6);
}

.auth-card h1 {
  font-size: var(--text-xl);
}

.auth-lede {
  margin: var(--space-2) 0 var(--space-5);
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Quiet links under the card's action. */
.auth-links {
  margin: var(--space-5) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
}

.auth-links a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--dur-fast) var(--ease);
}

.auth-links a:hover {
  color: var(--ink);
}

.auth-links a:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

/* Whole-form failures (wrong password, server error) — inline, --danger,
   never an alert(). aria-live so screen readers hear it appear. */
.form-error {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--danger);
}

.form-error:empty {
  display: none;
}

/* Prose treatment (§7 terms/privacy): readable measure, quiet heading
   scale. Applies to rendered legal/document copy only. */
.prose {
  max-width: 70ch;
  color: var(--ink-2);
}

.prose h1 {
  font-size: var(--text-2xl);
  color: var(--ink);
  margin: var(--space-10) 0 var(--space-2);
}

.prose h2 {
  font-size: var(--text-lg);
  color: var(--ink);
  margin: var(--space-8) 0 var(--space-3);
}

.prose h3 {
  font-size: var(--text-base);
  color: var(--ink);
  margin: var(--space-6) 0 var(--space-2);
}

.prose p,
.prose li {
  font-size: var(--text-base);
  line-height: 1.65;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
  margin: var(--space-3) 0;
}

.prose a {
  color: var(--accent);
}

.prose a:hover {
  color: var(--accent-hover);
}

.prose strong {
  color: var(--ink);
}

.prose .doc-meta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink-3);
}

/* ------------------------------------------------------------------ *
 * Coach recruiting tools (html/coach-dashboard, coach-athlete,
 * coach-board, coach-program). A work surface: rows over cards, the
 * feed's fit tags and provenance chips, cyan only for selection/focus.
 * ------------------------------------------------------------------ */

.cr-head {
  padding: var(--page-top) 0 var(--space-4);
}

.cr-head h1 {
  font-size: var(--text-2xl);
}

.cr-head p {
  margin: var(--space-2) 0 0;
  color: var(--ink-2);
}

/* Section tabs under the page head: Athletes / Board / Program. */
.cr-tabs {
  display: flex;
  gap: var(--space-6);
  border-bottom: var(--border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  scrollbar-width: none;
}

.cr-tabs a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: var(--space-2) 0;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.cr-tabs a:hover {
  color: var(--ink);
}

.cr-tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.cr-tabs a:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

.cr-tabs .cr-count {
  font-size: var(--text-sm);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

@media (pointer: coarse) {
  .cr-tabs a {
    min-height: 2.75rem;
  }
}

/* Mono column headers, the school page's standards-table voice. */
.cr-th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Where an athlete's PRs sit against the program's marks. Outlined like
   .tag; the word is always printed, so color is never the only channel. */
.cr-level {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.125rem var(--space-2);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  color: var(--ink-3);
}

.cr-level.lv-recruit { color: var(--good); }
.cr-level.lv-walk-on { color: var(--info); }
.cr-level.lv-below { color: var(--warn); }
.cr-level.lv-none { color: var(--ink-3); border-color: var(--rule); }

/* "Follows your program" and "On your board" markers. */
.cr-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--info);
  background: var(--panel);
  border: 1px solid rgba(28, 91, 122, 0.3);
  border-radius: 999px;
  padding: 1px var(--space-2);
  white-space: nowrap;
}

.cr-badge.is-board {
  color: var(--ink-2);
  border-color: var(--rule);
}

/* The fit percentage beside its band tag. */
.cr-fit {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  white-space: nowrap;
}

.cr-fit b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cr-fit .tag.t-none {
  color: var(--ink-3);
  border-color: var(--rule);
}

.cr-muted {
  color: var(--ink-3);
}

.cr-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Previous / page N of M / next. */
.cr-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: var(--space-6) 0 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

/* The consent line every coach page ends on. A hairline above, never a
   colored stripe. */
.cr-consent {
  margin: var(--space-10) 0 0;
  padding-top: var(--space-4);
  border-top: var(--border-soft);
  font-size: var(--text-sm);
  color: var(--ink-3);
  max-width: 80ch;
}

.cr-consent a {
  color: inherit;
}

/* Inline save state beside a control ("Saved", "Could not save"). */
.cr-status {
  font-size: var(--text-sm);
  color: var(--ink-3);
  min-height: 1.4em;
  margin: 0;
}

.cr-status.is-error {
  color: var(--danger);
}

.cr-status.is-ok {
  color: var(--good);
}

/* A quiet destructive text button (Remove from board). */
.cr-link-danger {
  border: none;
  background: none;
  padding: var(--space-2) 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--danger);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cr-link-danger:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

@media (pointer: coarse) {
  .cr-link-danger {
    min-height: 2.75rem;
  }
}

/* ------------------------------------------------------------------ *
 * Reduced motion (§3.5, verbatim)
 * ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* View on map sits in the toolbar row with the dropdowns: same height, size
   and weight, so the row reads as one set of controls. */
.wb-actions > .btn {
  min-height: var(--control-h);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------------ *
 * Public standards pages (html/standards-school.html, standards-hub.html)
 * ------------------------------------------------------------------ */

.std-page {
  padding-top: 0;
}

/* The public pages take the brand colour for their links: they are lists of
   colleges and programs, so the links are the content. */
.std-page a {
  color: var(--brand-deep);
  text-decoration-color: color-mix(in srgb, var(--brand-deep) 38%, transparent);
  text-underline-offset: 0.18em;
  transition: text-decoration-color var(--dur-fast) var(--ease);
}

.std-page a:hover {
  text-decoration-color: currentColor;
}

/* The ring follows each link's own shape (pills stay round), and a
   transparent outline keeps a visible ring in Windows high-contrast mode. */
.std-page a:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px var(--accent-ring), 0 0 0 4px rgba(42, 165, 179, 0.35);
}

.std-page ::selection {
  background: var(--brand-logo);
  color: var(--ink);
}

/* ---------- The masthead band ----------
   Every public page opens on a band: the site's deep teal, or the college's
   own colour where we have it (modules/standards-pages.js bandFor, which also
   picks white or ink for the text so it always clears 4.5:1). The lane lines
   curving off the corner are the one piece of decoration the pages carry. */
.mast,
.std-cta {
  --lanes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400' fill='none' stroke='%23fff' stroke-width='1.3'%3E%3Ccircle cx='400' cy='0' r='150'/%3E%3Ccircle cx='400' cy='0' r='180'/%3E%3Ccircle cx='400' cy='0' r='210'/%3E%3Ccircle cx='400' cy='0' r='240'/%3E%3Ccircle cx='400' cy='0' r='270'/%3E%3Ccircle cx='400' cy='0' r='300'/%3E%3Ccircle cx='400' cy='0' r='330'/%3E%3Ccircle cx='400' cy='0' r='360'/%3E%3Ccircle cx='400' cy='0' r='390'/%3E%3Cpath d='M313.9 122.9 176.1 319.4' stroke-width='2.6'/%3E%3C/svg%3E");
}

.mast {
  --mast-bg: var(--brand-deep);
  --mast-ink: #ffffff;
  --mast-soft: var(--brand-deep-soft);
  --mast-line: color-mix(in srgb, var(--brand-logo) 42%, transparent);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--mast-bg);
  color: var(--mast-ink);
}

/* On a college's own colour the text stays at full strength (the colour may
   only just clear contrast), and the lanes take the text colour. */
.mast-school {
  --mast-soft: var(--mast-ink);
  --mast-line: color-mix(in srgb, var(--mast-ink) 20%, transparent);
}

/* A track's bend from above: eight lanes and the finish line, drawn once as
   an SVG and used as a mask, so the lines take the band's own line colour.
   It sits in the top right corner and fades out before it reaches the text. */
.mast::after,
.std-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--mast-line);
  -webkit-mask-image: var(--lanes), linear-gradient(to left, #000 0%, #000 30%, transparent 70%);
  mask-image: var(--lanes), linear-gradient(to left, #000 0%, #000 30%, transparent 70%);
  -webkit-mask-size: 36rem 36rem, 100% 100%;
  mask-size: 36rem 36rem, 100% 100%;
  -webkit-mask-position: right -5rem top -7rem, 0 0;
  mask-position: right -5rem top -7rem, 0 0;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.mast-inner {
  padding-block: var(--space-5) var(--space-8);
}

.mast a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

.mast a:focus-visible {
  box-shadow: 0 0 0 2px var(--mast-bg), 0 0 0 4px var(--mast-ink);
}

.std-crumbs {
  list-style: none;
  margin: 0 0 var(--space-6);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  color: var(--mast-soft, var(--ink-3));
}

.std-crumbs li + li::before {
  content: "/";
  margin-right: var(--space-2);
  opacity: 0.5;
}

.std-crumbs a {
  text-decoration: none;
}

.std-crumbs a:hover {
  text-decoration: underline;
}

.std-crumbs [aria-current="page"] {
  font-weight: 600;
  color: var(--mast-ink, var(--ink));
}

.std-head {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.std-logo {
  flex: none;
  width: 6rem;
  height: 6rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--logo-bg, #ffffff);
  box-shadow: 0 1px 2px rgba(22, 22, 26, 0.12), 0 6px 16px rgba(22, 22, 26, 0.16);
  padding: var(--space-2);
}

.std-logo img {
  width: 100%;
  height: 100%;
  width: calc(100% * min(1, sqrt(var(--logo-fill) * var(--logo-ar, 1))));
  height: calc(100% * min(1, sqrt(var(--logo-fill) / var(--logo-ar, 1))));
  object-fit: contain;
}

.std-logo span {
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--ink-2);
}

.std-head h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.12;
  margin: 0;
  max-width: 26ch;
  text-wrap: balance;
}

.std-meta {
  margin: var(--space-2) 0 0;
  color: var(--mast-soft);
  font-size: var(--text-base);
}

.std-meta span + span::before {
  content: "·";
  margin: 0 var(--space-2);
}

/* Where the program ranks: one pill per ranked team, in the band's own two
   colours turned around, so it reads on any college colour. */
.std-ranks {
  list-style: none;
  margin: var(--space-6) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.std-ranks a {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  min-height: 2rem;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: var(--mast-ink);
  color: var(--mast-bg);
  font-size: var(--text-sm);
  line-height: 1.5;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.std-ranks a:hover {
  box-shadow: 0 2px 8px rgba(22, 22, 26, 0.24);
  transform: translateY(-1px);
}

.std-ranks a:focus-visible,
.std-ranks a:focus-visible:hover {
  box-shadow: 0 0 0 2px var(--mast-bg), 0 0 0 4px var(--mast-ink);
}

.std-ranks b {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 500;
}

.std-body {
  padding-top: var(--space-8);
}

.std-answer {
  margin: 0;
  /* Inter Tight is narrow: about 1.4 characters to the ch, so 52ch is a
     72-character line. Every measure on these pages is set on that basis. */
  max-width: 52ch;
  font-size: max(1.125rem, 15.5px);
  line-height: 1.5;
  color: var(--ink);
  text-wrap: pretty;
}

.std-sec {
  margin-top: var(--space-12);
}

.std-sec > h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0 0 var(--space-4);
}

.std-scroll {
  overflow-x: auto;
}

.std-page table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.std-page th,
.std-page td {
  text-align: left;
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid var(--rule-2);
  font-size: var(--text-base);
}

.std-page thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom-color: var(--rule);
  padding-block: var(--space-2);
}

.std-page tbody th {
  font-weight: 600;
  color: var(--ink);
}

.std-teams {
  max-width: 50rem;
}

.std-why {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

/* Whether a team exists, as a pill: the word carries it, the colour backs it. */
.std-status {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  background: var(--tint);
  color: var(--ink-2);
}

.std-status-yes {
  background: var(--good-wash);
  color: var(--good);
}

.std-status-combined,
.std-status-unknown {
  background: var(--warn-wash);
  color: var(--warn-ink);
}

.std-note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

/* ---------- The marks ---------- */

/* What the three columns mean, once, above the tables. */
.std-key {
  margin: 0 0 var(--space-6);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4) var(--space-8);
  max-width: 62rem;
}

.std-key dt {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--panel);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.std-key .is-recruit dt {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.std-key dd {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink-2);
}

/* Men / Women jump links: only where the two tables stack. */
.std-jump {
  display: none;
  margin: 0 0 var(--space-5);
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.std-jump a {
  display: inline-block;
  margin-left: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--panel);
  font-weight: 600;
  text-decoration: none;
}

/* Side by side where both tables fit whole, stacked where they don't. The
   floor is in px as well as rem because the marks have a px floor: at the
   desktop UI scale a table still needs about 360px. */
.std-sides {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(27rem, 360px)), 1fr));
  gap: var(--space-8) var(--space-10);
  align-items: start;
}

.std-side {
  scroll-margin-top: calc(var(--nav-h) + var(--space-4));
}

.std-side-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.std-side-head h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0;
}

/* Where a table's marks came from, said once in its heading. */
.std-tag {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.std-tag-est {
  background: var(--warn-wash);
  color: var(--warn-ink);
}

.std-tag-pub {
  background: var(--good-wash);
  color: var(--good);
}

.std-none {
  margin: 0;
  padding: var(--space-4);
  background: var(--tint);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius-lg);
  color: var(--ink-2);
}

/* The table itself: a framed block with a coloured head, events in their
   groups, marks set large and right-aligned so the digits line up, and the
   Recruit column (the number the page is about) carried down in a wash. */
.std-side .std-scroll {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.std-page .std-table {
  border-collapse: separate;
  border-spacing: 0;
}

.std-page .std-table th,
.std-page .std-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--rule-2);
}

.std-page .std-table th:first-child {
  padding-left: var(--space-4);
}

.std-page .std-table td:last-child,
.std-page .std-table thead th:last-child {
  padding-right: var(--space-4);
}

.std-page .std-table thead th {
  background: var(--brand-deep);
  color: #ffffff;
  border-bottom: 0;
  padding-block: var(--space-3);
  text-align: right;
  letter-spacing: 0.06em;
  white-space: normal;
  vertical-align: bottom;
}

.std-page .std-table thead th:first-child {
  text-align: left;
}

/* "Walk-on" never breaks at its hyphen; "Top recruit" may take two lines. */
.std-page .std-table thead th:nth-child(2) {
  white-space: nowrap;
}

.std-page .std-table thead th.std-recruit {
  background: var(--accent);
}

.std-page .std-table tbody th {
  font-size: var(--text-base);
  font-weight: 600;
  white-space: nowrap;
}

.std-page .std-table td {
  font-family: var(--font-mono);
  font-size: max(1rem, 15px);
  text-align: right;
  white-space: nowrap;
  color: var(--ink-2);
}

.std-page .std-table td.std-recruit {
  background: var(--accent-wash);
  font-weight: 500;
  color: var(--ink);
}

.std-page .std-table tbody:last-child tr:last-child > * {
  border-bottom: 0;
}

.std-page .std-table .std-group-row th {
  padding-block: var(--space-2);
  background: var(--tint);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--brand-deep);
}

@media (hover: hover) {
  .std-table tbody tr:not(.std-group-row):hover > th,
  .std-table tbody tr:not(.std-group-row):hover > td:not(.std-recruit) {
    background: var(--tint);
  }
}

/* An estimate next to a printed mark, in a table that has both. */
.std-approx {
  margin-right: 1px;
  color: var(--ink-3);
}

.std-dash {
  color: var(--ink-3);
}

/* An event nobody on the roster posted a mark in this season. */
.std-star {
  margin-left: 0.125rem;
  font-weight: 700;
  color: var(--warn);
  text-decoration: none;
  cursor: help;
}

.std-sheets {
  margin: 0 0 var(--space-4);
  max-width: 56ch;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.std-legend {
  margin: var(--space-4) 0 0;
  max-width: 56ch;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.std-prose {
  max-width: 54ch;
  color: var(--ink-2);
}

.std-prose p {
  margin: 0 0 var(--space-3);
}

/* No single word left alone on a paragraph's last line. */
.std-prose p,
.std-faq p,
.std-key dd,
.std-legend,
.std-note,
.std-hub-head p,
.std-cta p {
  text-wrap: pretty;
}

.std-links {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
}

.std-facts {
  margin: var(--space-5) 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--space-5) var(--space-6);
  max-width: 50rem;
}

.std-facts dt {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.std-facts dd {
  margin: var(--space-1) 0 0;
  font-weight: 700;
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  color: var(--brand-deep);
}

/* The one call to action, on the same band the page opened with. */
.std-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: var(--space-12);
  padding: var(--space-8);
  --mast-line: color-mix(in srgb, var(--brand-logo) 42%, transparent);
  background: var(--brand-deep);
  color: #ffffff;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.std-cta h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0;
}

.std-cta p {
  margin: var(--space-2) 0 0;
  max-width: 44ch;
  color: var(--brand-deep-soft);
}

.std-page .std-cta .btn {
  flex: none;
  background: #ffffff;
  border-color: #ffffff;
  color: var(--brand-deep);
  text-decoration: none;
}

.std-page .std-cta .btn:hover {
  background: var(--accent-wash);
  border-color: var(--accent-wash);
}

.std-page .std-cta .btn:focus-visible {
  box-shadow: 0 0 0 2px var(--brand-deep), 0 0 0 4px #ffffff;
}

.std-faq {
  display: grid;
  gap: var(--space-5);
  max-width: 54ch;
}

.std-faq h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0 0 var(--space-1);
}

.std-faq p {
  margin: 0;
  color: var(--ink-2);
}

.std-related,
.std-college-list,
.std-hub-links,
.std-search-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.std-related,
.std-hub-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0 var(--space-8);
}

.std-hub-links-tight {
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}

.std-related li,
.std-hub-links li,
.std-search-results li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--rule-2);
}

.std-related span,
.std-hub-links span,
.std-search-results span {
  flex: none;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

/* How many colleges sit under a hub link, as a count pill. */
.std-hub-links span {
  min-width: 2.25rem;
  padding: 0 var(--space-2);
  border-radius: 999px;
  background: var(--accent-wash);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.7;
  text-align: center;
  color: var(--brand-deep);
}

.std-page .btn {
  color: #ffffff;
  text-decoration: none;
}

.std-hub-head h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.12;
  margin: 0;
  max-width: 30ch;
  text-wrap: balance;
}

.std-hub-head p {
  margin: var(--space-3) 0 0;
  max-width: 54ch;
  color: var(--mast-soft, var(--ink-2));
}

.std-search {
  margin-top: 0;
  max-width: 34rem;
}

.std-search-results {
  margin-top: var(--space-2);
}

.std-college-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr));
  gap: 0 var(--space-10);
}

.std-group .std-college-list {
  margin-top: 0;
}

.std-group {
  margin-top: var(--space-10);
}

.std-group > h2 {
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--brand-deep);
  font-size: var(--text-lg);
  color: var(--brand-deep);
}

.std-college-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--rule-2);
}

.std-college-list li > a {
  font-weight: 600;
  flex: 1 1 100%;
}

.std-row-meta,
.std-row-teams {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.std-row-teams.is-none {
  color: var(--warn);
}

.std-sources {
  display: block;
  margin-top: var(--space-12);
}

@media (max-width: 760px) {
  .std-head {
    align-items: flex-start;
    gap: var(--space-4);
  }

  .std-logo {
    width: 4rem;
    height: 4rem;
    padding: var(--space-2);
  }

  /* The page title names the college and the subject, so it runs long. */
  .std-head h1,
  .std-hub-head h1 {
    font-size: var(--text-xl);
  }

  .mast-inner {
    padding-block: var(--space-4) var(--space-6);
  }

  /* On a phone the title runs the full width, so the bend pulls up into the
     corner and its lines go lighter: nothing strong sits behind the words. */
  .mast {
    --mast-line: color-mix(in srgb, var(--brand-logo) 24%, transparent);
  }

  .mast-school {
    --mast-line: color-mix(in srgb, var(--mast-ink) 11%, transparent);
  }

  .mast::after,
  .std-cta::after {
    -webkit-mask-size: 22rem 22rem, 100% 100%;
    mask-size: 22rem 22rem, 100% 100%;
    -webkit-mask-position: right -5rem top -9rem, 0 0;
    mask-position: right -5rem top -9rem, 0 0;
  }

  .std-crumbs {
    margin-bottom: var(--space-4);
  }

  .std-key {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
  }

  .std-page .std-table th,
  .std-page .std-table td {
    padding-inline: var(--space-2);
  }

  .std-page .std-table th:first-child {
    padding-left: var(--space-3);
  }

  .std-page .std-table td:last-child,
  .std-page .std-table thead th:last-child {
    padding-right: var(--space-3);
  }

  .std-page .std-table td,
  .std-page .std-table tbody th {
    font-size: 14px;
  }

  .std-cta {
    padding: var(--space-6);
  }

  .std-college-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* On the narrowest phones a two-word event name wraps so all four columns
   stay on screen. */
@media (max-width: 370px) {
  .std-page .std-table tbody th {
    white-space: normal;
  }

  .std-page .std-table th,
  .std-page .std-table td {
    padding-inline: 6px;
  }

  .std-page .std-table th:first-child {
    padding-left: 10px;
  }

  .std-page .std-table td:last-child,
  .std-page .std-table thead th:last-child {
    padding-right: 10px;
  }

  .std-page .std-table td,
  .std-page .std-table tbody th {
    font-size: 13px;
  }

  .std-page .std-table thead th {
    letter-spacing: 0.02em;
  }
}

/* The two tables stack below about 960px (two 27rem tables, the gap and the
   page gutters); that is where the jump links help. */
@media (max-width: 60rem) {
  .std-jump {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .std-ranks a {
    transition: none;
  }

  .std-ranks a:hover {
    transform: none;
  }
}

/* ------------------------------------------------------------------ *
 * Program rankings (html/rankings.html) — shares the .std- page frame
 * ------------------------------------------------------------------ */

.rk-division {
  margin-top: var(--space-12);
}

.rk-division:first-of-type {
  margin-top: var(--space-4);
}

.rk-division > h2 {
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--brand-deep);
  color: var(--brand-deep);
}

.rk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-8) var(--space-8);
}

.rk-card h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
}

.rk-top {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rk-top li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--rule-2);
  font-size: var(--text-base);
}

/* The rank itself: a filled numeral for the leader, the brand colour after. */
.rk-num {
  flex: none;
  min-width: 1.5rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5rem;
  color: var(--brand-deep);
  text-align: center;
}

.rk-top li:first-child .rk-num {
  background: var(--brand-deep);
  color: #ffffff;
}

.rk-all {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
}

.rk-siblings {
  margin: 0 0 var(--space-5);
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.rk-table th,
.rk-table td {
  padding-inline: var(--space-3);
}

.rk-table .rk-rank {
  width: 3.75rem;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--brand-deep);
}

.rk-table thead .rk-rank {
  font-size: var(--text-xs);
  color: var(--ink-3);
}

.rk-table tbody th a {
  font-weight: 600;
}

.rk-loc {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--ink-2);
}

.rk-table .rk-conf {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.rk-scroll {
  max-width: 52rem;
}

/* The top three rows carry the wash the Recruit column uses. */
.rk-table tbody tr:nth-child(-n + 3) > * {
  background: var(--accent-wash);
}

/* On a phone the conference gives way to the program name. */
@media (max-width: 40rem) {
  .rk-table .rk-conf {
    display: none;
  }

  .rk-table .rk-rank {
    width: 2.75rem;
  }
}

/* ---------- Glossary tooltips (assets/glossary.js) ----------
   Any element with data-term gets a dotted underline as the hint that it
   explains itself; the tooltip is one shared element the script positions. */
[data-term] {
  cursor: help;
}

[data-term][tabindex] {
  text-decoration: underline dotted var(--ink-3);
  text-underline-offset: 3px;
}

.glossary-tip {
  position: absolute;
  z-index: var(--z-tooltip, 500);
  max-width: min(20rem, calc(100vw - 1rem));
  padding: var(--space-3) var(--space-4);
  background: var(--ink);
  color: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.45;
  pointer-events: none;
}

.glossary-tip[hidden] {
  display: none;
}

.glossary-tip strong {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
}

/* ---------- Compare (feed cards + the bar at the bottom) ---------- */
.card-compare {
  position: relative;
  z-index: 2; /* above the card's full-bleed link */
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  align-self: flex-start;
  min-height: 2rem;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-3);
  cursor: pointer;
}

.card-compare input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-content: center;
}

.card-compare input::before {
  content: "";
  width: 0.625rem;
  height: 0.625rem;
  transform: scale(0);
  background: #ffffff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transition: transform var(--dur-fast) var(--ease);
}

.card-compare input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.card-compare input:checked::before {
  transform: scale(1);
}

.card-compare input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(42, 165, 179, 0.45);
}

.card-compare:hover {
  color: var(--ink);
}

.compare-bar {
  position: fixed;
  left: 50%;
  bottom: var(--space-4);
  transform: translateX(-50%);
  z-index: var(--z-toast, 400);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--ink);
  color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  max-width: calc(100vw - 2rem);
}

.compare-bar[hidden] {
  display: none;
}

.compare-bar .compare-count {
  font-size: var(--text-sm);
  white-space: nowrap;
}

.compare-bar .btn-quiet {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
  background: transparent;
}

.compare-bar .compare-note {
  margin: 0;
  font-size: var(--text-sm);
  color: #ffd9a0;
}
