/* Kluge web — the app's Editorial system (ink on white).
   A deliberate departure from the iOS app's monochrome Editorial system, which
   suits a phone and reads stark on a large bright screen.

   Sage rather than cream on purpose: warm ivory under a serif display is the
   most over-used look going. The cooler, greener stock reads as a herbarium
   sheet instead — nearer an actual field guide, which is the idea.
   Photographs lead; one olive accent carries every interaction.

   The dark theme is designed, not inverted: the paper darkens toward forest
   floor and the accent lifts so it stays legible against it. */

:root {
  /* The app's Editorial tokens (CollegeDetailTheme.swift): one ground, white
     cards, hairlines, and ink as the only accent. */
  --paper: #FAFAFA;
  --card: #FFFFFF;
  --raised: #EEEDEB;
  --ink: #111113;
  --muted: #55555A;
  --faint: #8E8E93;
  --rule: #EAEAE7;
  --accent: #111113;
  --on-accent: #FFFFFF;
  --accent-soft: #F2F2F0;
  --gold: #111113;
  --placeholder: #EDECE8;
  --placeholder-ink: #B3B0A8;
  --bar-muted: #C9C7C3;
  --shadow: rgba(0, 0, 0, 0.05);
  --shadow-lift: rgba(0, 0, 0, 0.12);

  --radius: 13px;
  --margin: 24px;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fast: 140ms;
  --med: 220ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E0E0D; --card: #1B1B1D; --raised: #2A2A2C;
    --ink: #F2F2F2; --muted: #98989E; --faint: #7C7C82; --rule: #2C2C2E;
    --accent: #F2F2F2; --on-accent: #111113; --accent-soft: #2A2A2C; --gold: #F2F2F2;
    --placeholder: #232325; --placeholder-ink: #5A5A5E; --bar-muted: #545458;
    --shadow: rgba(0, 0, 0, 0.4); --shadow-lift: rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  --paper: #0E0E0D; --card: #1B1B1D; --raised: #2A2A2C;
  --ink: #F2F2F2; --muted: #98989E; --faint: #7C7C82; --rule: #2C2C2E;
  --accent: #F2F2F2; --on-accent: #111113; --accent-soft: #2A2A2C; --gold: #F2F2F2;
  --placeholder: #232325; --placeholder-ink: #5A5A5E; --bar-muted: #545458;
  --shadow: rgba(0, 0, 0, 0.4); --shadow-lift: rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] {
  --paper: #FAFAFA; --card: #FFFFFF; --raised: #EEEDEB;
  --ink: #111113; --muted: #55555A; --faint: #8E8E93; --rule: #EAEAE7;
  --accent: #111113; --on-accent: #FFFFFF; --accent-soft: #F2F2F0; --gold: #111113;
  --placeholder: #EDECE8; --placeholder-ink: #B3B0A8; --bar-muted: #C9C7C3;
  --shadow: rgba(0, 0, 0, 0.05); --shadow-lift: rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.58 var(--sans); -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.16; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.6vw, 2.8rem); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.08rem; font-weight: 600; }

a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--margin); }

.prose { max-width: 68ch; }
.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.5rem; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.1rem 0; font-size: .94rem; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
.prose blockquote {
  margin: 1.3rem 0; padding: 13px 17px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0;
}
.prose code { background: var(--raised); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* Header ------------------------------------------------------------------ */

header.site { border-bottom: 1px solid var(--rule); background: var(--card); position: sticky; top: 0; z-index: 20; }
header.site .wrap { display: flex; align-items: center; gap: 26px; height: 66px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
header.site nav { margin-left: auto; display: flex; align-items: center; gap: 22px; font-size: .94rem; }
header.site nav a { color: var(--muted); text-decoration: none; padding-bottom: 3px; border-bottom: 2px solid transparent; }
header.site nav a:hover { color: var(--ink); }
header.site nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* Count on the Saved tab. The tab is always present; the badge is the state. */
.navcount {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  margin-left: 6px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums;
  vertical-align: 1px;
}

.icon-btn {
  border: 1px solid var(--rule); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font: inherit; font-size: .85rem; cursor: pointer;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--accent); }

/* Landing ----------------------------------------------------------------- */

.masthead { padding: 76px 0 48px; }
.masthead .define { display: flex; flex-wrap: wrap; align-items: baseline; gap: 9px; margin: 0 0 16px; font-size: 1.06rem; color: var(--faint); }
.masthead .define b { font-family: var(--serif); font-size: 1.25rem; color: var(--ink); }
.masthead .define i { font-style: italic; }
.masthead p.lead { font-size: 1.18rem; color: var(--muted); max-width: 54ch; margin: 18px 0 28px; }
.masthead .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.features { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); padding: 4px 0 72px; }
.feature { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 3px var(--shadow); }
.feature h3 { margin-bottom: 7px; }
.feature p { color: var(--muted); margin: 0; font-size: .94rem; }

.btn {
  display: inline-block; padding: 10px 22px; line-height: 1.45; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--on-accent); text-decoration: none; font: inherit;
  font-weight: 600; cursor: pointer;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.btn:hover { opacity: .9; }
.btn:active { transform: scale(.985); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.secondary:hover { border-color: var(--accent); opacity: 1; }

/* Controls ---------------------------------------------------------------- */

.controls { padding: 26px 0 14px; display: grid; gap: 14px; }
.controls .sticky-bar {
  position: sticky; top: 66px; z-index: 10; background: var(--paper);
  padding: 12px 0 10px; display: grid; gap: 11px;
  margin: 0 calc(var(--margin) * -1); padding-left: var(--margin); padding-right: var(--margin);
}

.searchrow { display: flex; gap: 10px; }
.searchbar {
  flex: 1; display: flex; align-items: center; background: var(--card);
  border: 1px solid var(--rule); border-radius: 999px; padding: 11px 19px;
  transition: border-color var(--fast) var(--ease);
}
.searchbar:focus-within { border-color: var(--accent); }
.searchbar input { flex: 1; border: 0; background: transparent; color: var(--ink); font: inherit; outline: none; min-width: 0; }

/* The quick-filter rail stays visible; the long tail of dropdowns hides behind
   the Filters button, so the page never opens on a wall of selects. */
.rail { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--rule); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 7px 15px; font: inherit; font-size: .88rem; cursor: pointer; white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

.filters { display: none; flex-wrap: wrap; gap: 9px; align-items: center; padding-top: 2px; }
.filters.open { display: flex; }
.filters select {
  background: var(--card); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 999px; padding: 8px 13px; font: inherit; font-size: .87rem;
}
.count { color: var(--muted); font-size: 1.02rem; margin: 8px 0 4px; }
.count strong { color: var(--ink); font-weight: 700; font-family: var(--serif); font-size: 1.12rem; }

/* College cards ------------------------------------------------------------ */

.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 20px; padding: 6px 0 64px; }
.results > .btn { grid-column: 1 / -1; justify-self: center; }

.card-item {
  position: relative; background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px var(--shadow);
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease), border-color var(--fast) var(--ease);
}
.card-item:hover { transform: translateY(-3px); box-shadow: 0 10px 26px var(--shadow-lift); }
.card-link { display: block; text-decoration: none; color: inherit; }

.mono {
  height: 138px; display: grid; place-items: center; overflow: hidden;
  background: var(--placeholder);
  color: var(--placeholder-ink); font-family: var(--serif); font-size: 2rem; font-weight: 700; letter-spacing: 1px;
}
.mono img { grid-area: 1 / 1; width: 100%; height: 138px; object-fit: cover; display: block; opacity: 0; transition: opacity var(--med) var(--ease); }
.mono img.ready { opacity: 1; }

.card-body { padding: 15px 17px 17px; }
.nm { font-family: var(--serif); font-size: 1.16rem; font-weight: 600; line-height: 1.25; display: block; }
.loc { color: var(--muted); font-size: .87rem; margin-top: 3px; display: block; }

.nm { font-family: var(--serif); font-size: 1.16rem; font-weight: 600; line-height: 1.25; display: block; }
.loc { color: var(--muted); font-size: .87rem; margin-top: 3px; display: block; }

.badges { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 9px; }
.badge { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.badge.solid { color: var(--gold); }

.stat { display: flex; gap: 20px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--rule); }
.stat .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); display: block; }
.stat .v { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; font-variant-numeric: tabular-nums; display: block; }

.cmp-toggle {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  font-size: .95rem; line-height: 1; cursor: pointer; display: grid; place-items: center; z-index: 2;
  box-shadow: 0 1px 4px var(--shadow);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.cmp-toggle:hover { transform: scale(1.08); border-color: var(--accent); }
.cmp-toggle[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.empty { color: var(--muted); padding: 40px 0; grid-column: 1 / -1; }
.skeleton { height: 250px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--rule); animation: shimmer 900ms var(--ease) infinite alternate; }
@keyframes shimmer { from { opacity: .5; } to { opacity: .85; } }

@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#view[data-enter], .results[data-enter] { animation: viewIn var(--med) var(--ease) both; }

/* Detail / compare / settings ---------------------------------------------- */

.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 4px var(--shadow); margin-bottom: 18px; }
.hero {
  /* Without an explicit width the box is sized by max-height x aspect-ratio and
     ends up ~560px wide in a 1100px column, which reads as a broken image. */
  width: 100%; aspect-ratio: 2 / 1; max-height: 280px; overflow: hidden; border-radius: var(--radius);
  background: var(--placeholder); color: var(--placeholder-ink);
  display: grid; place-items: center; margin-bottom: 16px;
  font-family: var(--serif); font-weight: 700; font-size: 2.4rem; letter-spacing: 2px;
}
.hero img { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity var(--med) var(--ease); }
.hero img.ready { opacity: 1; }
.credit { font-size: .76rem; color: var(--faint); margin: -8px 0 16px; }
.credit a { color: var(--faint); }
.section-title { font-family: var(--serif); font-size: 1.24rem; font-weight: 600; margin: 0 0 14px; }

.stats { display: grid; }
.stats .r { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.stats .r:last-child { border-bottom: 0; }
.stats .k { color: var(--muted); font-size: .92rem; }
.stats .v { font-family: var(--serif); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 1.06rem; }

.bar { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* "What they look for": each Common Data Set tier as a row of chips, weighted
   the way the app weights them — filled for the factors a college calls very
   important, outlined for the ones it merely considers. */
.factors { display: grid; gap: 16px; }
.tier-label { margin: 0 0 7px; font-size: .72rem; letter-spacing: .1em;
              text-transform: uppercase; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.factor-chip { padding: 5px 11px; border-radius: 999px; font-size: .88rem; line-height: 1.3;
               border: 1px solid transparent; }
.factor-chip.strong { background: var(--accent); color: var(--paper); font-weight: 600; }
.factor-chip.medium { background: var(--raised); border-color: var(--rule); }
.factor-chip.light  { border-color: var(--rule); color: var(--muted); }
.cmp-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.cmp-table th, .cmp-table td { padding: 11px 8px; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.cmp-table th { text-align: left; font-weight: 400; color: var(--muted); font-size: .9rem; }
.cmp-table td { text-align: right; font-weight: 600; font-family: var(--serif); font-size: 1.06rem; }
.cmp-table thead th { font-family: var(--serif); color: var(--ink); font-weight: 700; text-align: right; font-size: 1.02rem; }
.cmp-table thead th:first-child { text-align: left; }
.cmp-table td.better { color: var(--ink); font-weight: 700; }
.cmp-table td.better .cmp-value::after { content: " \2713"; }

.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.slot { background: var(--card); border: 1px dashed var(--rule); border-radius: var(--radius); padding: 15px; min-height: 78px; display: grid; align-content: center; gap: 4px; }
.slot.filled { border-style: solid; cursor: pointer; }
.slot.filled:hover { border-color: var(--accent); }
.slot .nm { font-size: 1.05rem; }
.slot .loc { color: var(--muted); font-size: .85rem; }

.sources { font-size: .8rem; color: var(--faint); margin-top: 14px; }

/* Tile map ----------------------------------------------------------------- */

.leafletwrap { overflow: hidden; }
.leafletmap { height: 560px; width: 100%; }
/* OSM has no dark basemap; filter it into one rather than add a provider. */
.leafletmap.tiles-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) saturate(.7) brightness(.92); }
.leafletmap .leaflet-container { background: var(--raised); font: inherit; }
/* Logo pins. A pale plate behind each mark so light logos stay visible on the
   basemap, mirroring SchoolColor.logoPlate in the app. */
.logopin { background: none; border: 0; }
/* !important because leaflet.css styles `.leaflet-container img` at the same
   specificity and wins on width, which stretched wide wordmarks to their full
   aspect ratio — a 96x11 mark rendered 159px across. */
.logopin img {
  width: var(--marksize, 30px) !important;
  height: var(--marksize, 30px) !important;
  object-fit: contain; display: block;
  transition: width 140ms ease, height 140ms ease;
  background: var(--card); border: 1px solid var(--rule); border-radius: 9px;
  padding: 3px; box-shadow: 0 1px 4px var(--shadow-lift);
}
.logopin.saved img { border-color: var(--gold); border-width: 2px; }

/* Abbreviation pins for colleges with no mark — the same serif monogram the
   cards use, so the two surfaces name a school the same way. */
.abbrpin { background: none; border: 0; }
.abbrpin span {
  display: grid; place-items: center; width: 100%; height: 100%;
  font-family: var(--serif); font-weight: 700; font-size: .74rem; letter-spacing: .02em;
  color: var(--ink); background: var(--card); border: 1px solid var(--rule);
  border-radius: 7px; box-shadow: 0 1px 4px var(--shadow-lift);
}
.abbrpin.saved span { border-color: var(--gold); border-width: 2px; }

.markctl button {
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  border-radius: 8px; padding: 7px 12px; font: inherit; font-size: .82rem;
  cursor: pointer; box-shadow: 0 1px 4px var(--shadow);
}
.markctl button:hover { border-color: var(--accent); }

.leaflet-tooltip {
  background: var(--card); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 9px; box-shadow: 0 6px 18px var(--shadow-lift); font-size: .84rem;
}
.leaflet-tooltip strong { font-family: var(--serif); font-size: .96rem; }
.leaflet-tooltip-top::before { border-top-color: var(--rule); }
.leaflet-control-attribution { background: var(--card); color: var(--faint); font-size: .68rem; }
.leaflet-control-attribution a { color: var(--muted); }

@media (max-width: 700px) { .leafletmap { height: 420px; } }

/* Map ---------------------------------------------------------------------- */

.mapwrap { position: relative; overflow: hidden; padding: 0; }
.mapsvg { display: block; touch-action: none; user-select: none; --dotr: 2.7; --dotsw: .6; --statesw: 1; color: var(--accent); }
.mapsvg .state { fill: var(--raised); stroke: var(--rule); stroke-width: var(--statesw); stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.mapsvg .dot { r: var(--dotr); fill: currentColor; opacity: .72; stroke: var(--card); stroke-width: var(--dotsw); }
.mapsvg .dot.saved { r: calc(var(--dotr) * 1.7); opacity: 1; fill: var(--gold); }
.mapsvg .dot.on { opacity: 1; }
.mapsvg .halo { fill: none; stroke: currentColor; stroke-width: calc(var(--dotsw) * 2.4); opacity: .85; }

.maptip {
  position: absolute; pointer-events: none; max-width: 250px; background: var(--card);
  border: 1px solid var(--rule); border-radius: 10px; padding: 9px 12px;
  box-shadow: 0 8px 22px var(--shadow-lift); font-size: .86rem; line-height: 1.35;
}
.maptip strong { display: block; font-family: var(--serif); font-size: 1rem; }
.maptip span { color: var(--muted); font-size: .8rem; }

.maphint {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, .42); color: #fff; font-size: .95rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity var(--fast) var(--ease);
}
.maphint.show { opacity: 1; }

.mapctl { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 7px; }
.mapctl button {
  min-width: 34px; height: 34px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--rule);
  background: var(--card); color: var(--ink); font: inherit; font-size: .95rem; cursor: pointer; box-shadow: 0 1px 4px var(--shadow);
}
.mapctl button:hover { border-color: var(--accent); }

/* Footer ------------------------------------------------------------------- */

footer.site { border-top: 1px solid var(--rule); background: var(--card); padding: 30px 0; margin-top: 40px; color: var(--muted); font-size: .88rem; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
footer.site nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }
footer.site a { color: var(--muted); }

@media (max-width: 700px) {
  :root { --margin: 16px; }
  .slots { grid-template-columns: 1fr; }
  .results { grid-template-columns: 1fr; }

  /* Five nav links, a wordmark and a theme button do not fit across a phone.
     As flex items they refuse to shrink below their own text, so the header
     was setting a minimum width on the whole document and every page scrolled
     sideways. Let the nav scroll inside itself instead. */
  header.site nav { gap: 14px; font-size: .87rem; overflow-x: auto;
                    scrollbar-width: none; min-width: 0; }
  header.site nav::-webkit-scrollbar { display: none; }
  header.site nav > * { flex: 0 0 auto; }
  .brand { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .card-item:hover { transform: none; }
  .mono img, .hero img { opacity: 1; }
}

/* ===== College page charts ==============================================
   The colour ramp is the one addition to the Field Guide palette: a pie needs
   a sequence and the system carries a single accent. The ramp walks that
   accent from deep to pale and ends on the gold, which is already in use — so
   a chart never introduces a colour the rest of the page hasn't already had.
   ======================================================================= */

:root {
  --c1: #111113; --c2: #48484D; --c3: #7A7A80; --c4: #A5A5A8;
  --c5: #C9C7C3; --c6: #E9E8E5; --c7: #8E8E93;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c1: #F2F2F2; --c2: #C9C9CC; --c3: #A0A0A5; --c4: #78787D;
    --c5: #545458; --c6: #323234; --c7: #98989E;
  }
}
:root[data-theme="dark"] {
  --c1: #F2F2F2; --c2: #C9C9CC; --c3: #A0A0A5; --c4: #78787D;
  --c5: #545458; --c6: #323234; --c7: #98989E;
}
:root[data-theme="light"] {
  --c1: #111113; --c2: #48484D; --c3: #7A7A80; --c4: #A5A5A8;
  --c5: #C9C7C3; --c6: #E9E8E5; --c7: #8E8E93;
}

/* Headline figures — the four questions people arrive with, before scrolling. */
.keystrip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
            gap: 20px; padding: 22px 24px; background: var(--card);
            border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 18px; }
.keyfig { display: grid; gap: 3px; justify-items: start; align-content: start; }
.keyfig .n { font-family: var(--serif); font-size: 1.8rem; font-weight: 700;
             font-variant-numeric: tabular-nums; line-height: 1.05; }
.keyfig .l { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.keyfig .sub { font-size: .82rem; color: var(--faint); }

/* Chart cards sit two-up; align-items:start so a short card stops stretching
   to match a tall neighbour. */
/* Two wide columns rather than three narrow ones: at 330px the donut and its
   legend stack, which doubles that card's height and leaves a void beside it.
   At 420px they sit side by side and the rows come out close in height.
   align-items:start so a short card never stretches to match its neighbour. */
/* Cards are stacked into two real columns rather than laid out in grid rows.
   A grid row is as tall as its tallest card, so a short card leaves a hole
   beside a tall one — and these differ a lot: a demographics donut with seven
   shares runs three times the height of a three-row academics list. Each card
   is dropped into whichever column is currently shorter (see explore.js), so
   a column is a simple stack with nothing to leave a gap.

   CSS multi-column was the obvious tool and is the wrong one here: a
   `column-span` element switches off balancing for everything before it, which
   piles the earlier cards into column one. */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 18px;
               align-items: start; }
@media (min-width: 761px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-col { display: grid; gap: 18px; align-content: start; }
.detail-col > .panel { margin-bottom: 0; }
/* A card pulled out of the columns to run the full width beneath them. */
.detail-grid > .panel.wide { grid-column: 1 / -1; margin-bottom: 0; }

details.figures { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 10px; }
details.figures summary { cursor: pointer; font-size: .86rem; color: var(--muted); list-style: none; }
details.figures summary::-webkit-details-marker { display: none; }
details.figures summary::before { content: "▸ "; color: var(--faint); }
details.figures[open] summary::before { content: "▾ "; }
details.figures[open] summary { margin-bottom: 6px; }
details.figures summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.chart-lead { margin: 0 0 14px; font-size: .9rem; color: var(--muted); line-height: 1.5; }

.donut { width: 176px; height: 176px; flex: 0 0 auto; }
.donut-figure { font-family: var(--serif); font-size: 30px; font-weight: 700; fill: var(--ink); }
.donut-caption { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; fill: var(--muted); }
.donut-block { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }

.legend { list-style: none; margin: 0; padding: 0; flex: 1 1 200px; min-width: 190px; }
.legend li { display: flex; align-items: center; gap: 10px; padding: 6px 0;
             border-bottom: 1px solid var(--rule); }
.legend li:last-child { border-bottom: 0; }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.legend-label { flex: 1; font-size: .92rem; color: var(--muted); }
.legend-value { font-family: var(--serif); font-weight: 600; font-variant-numeric: tabular-nums; }

.ring { width: 132px; height: 132px; flex: 0 0 auto; }
.ring-figure { font-family: var(--serif); font-size: 27px; font-weight: 700; fill: var(--ink); }
.ring-caption { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; fill: var(--muted); }

.funnel { display: grid; gap: 12px; }
.funnel-row { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 12px; }
.funnel-label { font-size: .9rem; color: var(--muted); }
.funnel-track { height: 24px; background: var(--raised); border-radius: 4px; overflow: hidden; }
.funnel-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.funnel-value { font-family: var(--serif); font-weight: 600; font-variant-numeric: tabular-nums;
                font-size: 1.02rem; min-width: 62px; text-align: right; }

/* Flex-end rather than grid rows: each value label has to sit on top of its
   own bar, and the smallest bar here can be $41 against $36,094. */
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px;
        align-items: end; height: 200px; margin-top: 4px; }
.col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 6px; }
.col-bar { background: var(--accent); border-radius: 4px 4px 0 0; width: 100%; min-height: 3px; }
.cols:has(.is-emphasis) .col-bar:not(.is-emphasis) { background: var(--bar-muted); }
.col-bar.is-emphasis { background: var(--accent); }
.col-value { font-family: var(--serif); font-weight: 600; font-size: .92rem;
             font-variant-numeric: tabular-nums; text-align: center; }
.col-label { font-size: .76rem; color: var(--muted); text-align: center; line-height: 1.3; }

.range { margin-top: 18px; }
.range-caption { margin: 0; font-size: .78rem; letter-spacing: .08em;
                 text-transform: uppercase; color: var(--muted); }
.range-figure { margin: 2px 0 10px; font-family: var(--serif); font-size: 1.4rem;
                font-weight: 700; font-variant-numeric: tabular-nums; }
.range-track { position: relative; height: 10px; background: var(--raised); border-radius: 5px; }
.range-band { position: absolute; top: 0; height: 100%; background: var(--accent); border-radius: 5px; }
.range-scale { display: flex; justify-content: space-between; margin-top: 5px;
               font-size: .76rem; color: var(--faint); font-variant-numeric: tabular-nums; }

.hbars { display: grid; gap: 11px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 1.3fr) 2fr auto; gap: 14px; align-items: center; }
.hbar-label { font-size: .89rem; color: var(--muted); }
.hbar-track { height: 9px; background: var(--raised); border-radius: 5px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.hbar-value { font-family: var(--serif); font-weight: 600; font-variant-numeric: tabular-nums;
              min-width: 78px; text-align: right; }

@media (max-width: 640px) {
  .cols { height: 160px; gap: 7px; }
  .col-value { font-size: .8rem; }
  .col-label { font-size: .7rem; }
  .hbar { grid-template-columns: 1fr auto; }
  .hbar-track { display: none; }
}

/* ===== Your stats, and the matches built from them ====================== */

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
          gap: 14px; }
.field { display: grid; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field-label { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
               color: var(--muted); margin: 0; }
.field input, .field select {
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 10px; padding: 11px 13px; font: inherit; width: 100%;
}
.field input:focus-visible, .field select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent);
}
.chipfield { margin-top: 16px; display: grid; gap: 7px; }

/* Tier keys. Selectivity runs deep-to-pale so the four read as a scale rather
   than four unrelated labels, and none of them uses red — a reach is a
   long shot, not an error. */
.tier { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .74rem;
        font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.tier-highReach { background: var(--accent); color: var(--on-accent); }
.tier-reach { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.tier-match { background: var(--raised); color: var(--ink); border: 1px solid var(--rule); }
.tier-safety { background: transparent; color: var(--muted); border: 1px solid var(--rule); }

.matchline { display: flex; align-items: baseline; gap: 8px; margin-top: 9px; }
.matchscore { font-family: var(--serif); font-weight: 700; font-size: 1.1rem;
              font-variant-numeric: tabular-nums; margin-left: auto; }
.matchunit { color: var(--faint); font-size: .8rem; }

.matchhead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.matchbig { font-family: var(--serif); font-weight: 700; font-size: 2.4rem; line-height: 1;
            font-variant-numeric: tabular-nums; }
.matchhead .tier { margin-left: auto; }

.recommended { margin-bottom: 26px; }
.rec-head { margin-bottom: 12px; }
.rec-head .section-title { margin-bottom: 4px; }
.rec-head .sources { margin: 0; }

/* The two Explore feeds — Recommended and All. A pair of tabs rather than
   chips: these are exclusive views of the list, not another filter stacked on
   the ones below. */
.feedtabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--rule); }
.feedtab {
  appearance: none; background: none; border: 0; font: inherit; cursor: pointer;
  color: var(--muted); padding: 9px 3px; margin-right: 18px;
  border-bottom: 2px solid transparent; transition: color var(--fast) var(--ease);
}
.feedtab:hover { color: var(--ink); }
.feedtab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.feedtab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* An empty list inside the card grid: one element spanning every column, so
   the message and its button stay together instead of landing in two cells. */
.emptystate { grid-column: 1 / -1; display: grid; justify-items: start; gap: 14px; }
.emptystate .empty { margin: 0; }

}

/* ===== Essay prompts ==================================================== */

.essaylist { display: grid; gap: 4px; }
.essay { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.essay:last-child { border-bottom: 0; }
.essay:first-child { padding-top: 4px; }
.essaytext { margin: 0 0 9px; line-height: 1.55; }
.essaymeta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.essaychip { font-size: .72rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.essaychip.required { background: var(--accent-soft); color: var(--accent); }
.essaychip.optional { background: var(--raised); color: var(--muted); }
.essaychip.kind { background: var(--raised); color: var(--ink); border: 1px solid var(--rule); }
.essaylimit { font-size: .78rem; color: var(--muted); }

.essay details.figures { margin-top: 12px; }
.essaymatch {
  display: block; margin-top: 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--raised); text-decoration: none; color: inherit;
  border: 1px solid transparent; transition: border-color var(--fast) var(--ease);
}
a.essaymatch:hover { border-color: var(--accent); }
a.essaymatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.essaymatchhead { margin: 0 0 3px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.essaymatchname { font-weight: 600; font-size: .88rem; color: var(--accent); }
.essaymatchtext { margin: 0; font-size: .87rem; color: var(--muted); line-height: 1.5;
                  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== California high schools ==========================================
   The entry card at the top of Explore, and the pages behind it. The app
   gives this card a fixed blue identity because it marks a different source
   of data — the University of California's, not a college's. Here it takes
   the accent instead: one saturated block on a page of paper reads as the
   same "this is something else" signal without introducing a colour the
   site never otherwise uses.
   ======================================================================= */

.hscard {
  display: flex; align-items: center; gap: 13px; padding: 14px;
  background: #1B4F8A; color: #FFFFFF; border-radius: 18px;
  text-decoration: none; margin-bottom: 16px;
  box-shadow: 0 6px 18px var(--shadow);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.hscard:hover { transform: translateY(-1px); box-shadow: 0 10px 24px var(--shadow-lift); }
.hscard:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.hsicon {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 13px;
  background: rgba(255, 255, 255, .15); display: grid; place-items: center; font-size: 20px;
}
.hscardtext { display: grid; gap: 2px; flex: 1; min-width: 0; }
.hseyebrow { font-size: .62rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
             opacity: .72; }
.hstitle { font-weight: 600; font-size: .95rem; }
.hssub { font-size: .78rem; opacity: .8; }
.hschev { font-size: 1.4rem; opacity: .85; }

.hslist { display: grid; gap: 8px; margin-top: 16px; padding-bottom: 48px; }
.hsrow {
  display: flex; align-items: center; gap: 14px; padding: 13px 15px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 13px;
  text-decoration: none; color: inherit;
  transition: border-color var(--fast) var(--ease);
}
.hsrow:hover { border-color: var(--faint); }
.hsrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hstext { display: grid; gap: 2px; flex: 1; min-width: 0; }
.hsname { font-family: var(--serif); font-weight: 600; font-size: 1rem; }
.hsloc { font-size: .8rem; color: var(--muted); }
.hsfigure { display: grid; justify-items: end; gap: 1px; flex: 0 0 auto; }
.hsfigure .fig { font-family: var(--serif); font-weight: 600; font-variant-numeric: tabular-nums; }
.hsfigure .figlabel { font-size: .68rem; color: var(--muted); }

.hstable th.left, .hstable td:first-child { text-align: left; }
.hstable tbody th.left { font-weight: 600; font-family: var(--serif); font-size: 1rem; }
.hstable tbody th.left a { color: inherit; }

/* The empty compare slot is a search box, so a college can be picked here
   rather than only from an Explore card. */
.slot:has(.slotsearch) { align-content: center; padding: 12px; overflow: visible; }
.slotsearch { position: relative; }
.slotinput {
  width: 100%; background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; font: inherit;
}
.slotinput::placeholder { color: var(--muted); }
.slotinput:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

.slotresults {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  margin: 0; padding: 5px; list-style: none; max-height: 300px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 12px 30px var(--shadow-lift);
}
.slotresult { display: grid; gap: 1px; padding: 9px 11px; border-radius: 8px; cursor: pointer; }
.slotresult:hover, .slotresult.is-active { background: var(--raised); }
.slotresult-name { font-family: var(--serif); font-weight: 600; font-size: .95rem; line-height: 1.3; }
.slotresult-loc { font-size: .78rem; color: var(--muted); }

/* Compare: a picture in each filled slot, a mark beside each search result,
   and a proportional bar under any figure that is a quantity. */
.slot.filled { display: flex; align-items: center; gap: 12px; }
.slotshot {
  width: 62px; height: 62px; flex: 0 0 62px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; background: var(--raised); color: var(--faint);
  font-family: var(--serif); font-weight: 700; font-size: 1.05rem;
}
.slotshot img { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: cover;
                opacity: 0; transition: opacity var(--med) var(--ease); }
.slotshot img.ready { opacity: 1; }
.slottext { display: grid; gap: 2px; min-width: 0; }

.slotresult { grid-template-columns: 34px 1fr; align-items: center; gap: 10px; }
.slotmark {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  background: var(--raised); color: var(--muted); font-size: .68rem; font-weight: 700;
  overflow: hidden;
}
.slotmark.has-logo { background: var(--card); border: 1px solid var(--rule); }
.slotmark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.slotresult-text { display: grid; gap: 1px; min-width: 0; }

.cmp-label { display: block; }
.cmp-detail { display: block; font-size: .74rem; color: var(--faint); margin-top: 1px; }
.cmp-value { display: block; }
.cmp-bar { display: block; height: 4px; border-radius: 2px; background: var(--raised);
           overflow: hidden; margin: 5px 0 0 auto; width: 76px; }
.cmp-bar > span { display: block; height: 100%; background: var(--accent); opacity: .5; }
.cmp-table td.better .cmp-bar > span { opacity: 1; }

/* The map's own filter bar. Its own, not Explore's: on the map you are asking
   what is near somewhere, which needs different controls than narrowing a list. */
.mapfilters { display: grid; gap: 10px; margin: 0 0 12px; }
.mapsearch { max-width: 420px; }
.mapfilterrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mapfilterrow select {
  background: var(--card); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 999px; padding: 8px 13px; font: inherit; font-size: .87rem;
}
.mapfilterrow select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
