/* ============================================================
   UniAtlas — design system
   Modern, responsive, accessible. No build step, no framework.
   ============================================================ */

/* Country flags on Windows. Windows has no flag emoji (🇺🇸 shows as the
   letters "US"), so when the check in index.html finds that, html gets the
   class "flag-font" and flags are drawn from Twemoji Country Flags
   (Twemoji graphics © Twitter, CC BY 4.0; font packaged by
   country-flag-emoji-polyfill, MIT). The unicode-range limits the font to
   flag letters, and it is fetched only on pages that show a flag. */
@font-face {
  font-family: "Twemoji Country Flags";
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067,
    U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  src: url("https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1.8/dist/TwemojiCountryFlags.woff2")
    format("woff2");
  font-display: swap;
}
html.flag-font {
  --font:
    "Twemoji Country Flags", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display:
    "Twemoji Country Flags", "Iowan Old Style", "Palatino Linotype", Palatino,
    Georgia, "Times New Roman", serif;
}

:root {
  /* Brand */
  --brand-900: #0b1b3a;
  --brand-800: #122a56;
  --brand-700: #1b3d78;
  --brand-600: #2453a0;
  --brand-500: #3b6fc4;
  --brand-100: #e5edfa;
  --brand-050: #f2f6fd;

  --accent-600: #c2410c;
  --accent-500: #ea580c;
  --accent-100: #ffedd5;

  --ok-600: #047857;
  --ok-100: #d1fae5;
  --warn-700: #92400e;
  --warn-100: #fef3c7;
  --danger-600: #b91c1c;
  --danger-100: #fee2e2;

  /* Neutrals */
  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --bg: #f6f8fb;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --shadow-sm:
    0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md:
    0 4px 12px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:
    0 18px 40px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.05);

  /* Type */
  --font:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display:
    "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Solid fills that carry white text — identical in both themes */
  --solid-primary: #1b3d78;
  --solid-primary-hover: #122a56;
  --solid-accent: #c2410c;
  --solid-accent-hover: #9a3412;
  --hero-ink: #0b1b3a;

  /* Semantic surfaces/lines */
  --header-bg: rgba(255, 255, 255, 0.88);
  --glass: rgba(255, 255, 255, 0.94);
  --line-hover: #cfdcf0;
  --info-line: #c7d9f5;
  --warn-line: #fcd34d;
  --footer-bg: #0b1b3a;

  --maxw: 1180px;
  --nav-h: 66px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-900);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--brand-600);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.02em;
}
h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem);
}
h2 {
  font-size: clamp(1.4rem, 1.15rem + 1.1vw, 2rem);
}
h3 {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
}
p {
  margin: 0 0 1em;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}
.stack > * + * {
  margin-top: 1rem;
}
.muted {
  color: var(--ink-500);
}
.small {
  font-size: 0.875rem;
}
.tiny {
  font-size: 0.8rem;
}
.center {
  text-align: center;
}
.nowrap {
  white-space: nowrap;
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--solid-primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus {
  left: 0;
  outline: 3px solid var(--accent-500, #f59e0b);
  outline-offset: 2px;
  text-decoration: underline;
}
/* Focus lands on the content after "Skip to content"; no ring around the
   whole page, the scroll position shows where the reader is. */
main:focus {
  outline: none;
}
main {
  scroll-margin-top: var(--nav-h);
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--nav-h);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.15rem;
  color: var(--ink-900);
}
.logo:hover {
  text-decoration: none;
}
.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: none;
  background: linear-gradient(140deg, #2453a0, #122a56);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 800;
}
.logo-mark span {
  transform: translateY(-0.5px);
}

/* Loading screen shown until the app has read the data files and rendered the first page */
.boot {
  min-height: 70vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 40px 16px;
  text-align: center;
}
.boot-mark {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(18, 42, 86, 0.25);
  animation: boot-pulse 1.6s ease-in-out infinite;
}
.boot-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink-900);
}
.boot-bar {
  position: relative;
  width: 180px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.boot-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-600), var(--accent-500));
  animation: boot-slide 1.2s ease-in-out infinite;
}
.boot-text {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.95rem;
}
@keyframes boot-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}
@keyframes boot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .boot-mark, .boot-bar span { animation: none; }
  .boot-bar span { width: 100%; opacity: 0.6; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-links > a {
  color: var(--ink-700);
  font-weight: 550;
  font-size: 0.94rem;
  padding: 8px 12px;
  border-radius: var(--r-sm);
}
.nav-links > a:hover {
  background: var(--brand-050);
  color: var(--brand-700);
  text-decoration: none;
}
.nav-links > a[aria-current="page"] {
  color: var(--brand-700);
  background: var(--brand-100);
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  width: 42px;
  height: 38px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink-700);
  position: relative;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--ink-700);
}
.nav-toggle span::before {
  top: -6px;
}
.nav-toggle span::after {
  top: 6px;
}

@media (max-width: 1180px) {
  .nav-toggle {
    display: flex;
  }
  .nav-links {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--nav-h);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 8px 14px 16px;
    box-shadow: var(--shadow-md);
    margin-left: 0;
  }
  .nav-links[hidden] {
    display: none;
  }
  .nav-links > a {
    padding: 12px 10px;
    font-size: 1rem;
  }
  .nav-tools {
    margin: 10px 0 0;
  }
  .nav-tools .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary {
  background: var(--solid-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--solid-primary-hover);
}
.btn-accent {
  background: var(--solid-accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--solid-accent-hover);
}
.btn-ghost {
  background: var(--surface);
  color: var(--ink-700);
  border-color: var(--line);
}
.btn-ghost:hover {
  border-color: var(--brand-500);
  color: var(--brand-700);
  background: var(--brand-050);
}
.btn-quiet {
  background: transparent;
  color: var(--ink-700);
  border-color: transparent;
  padding-inline: 10px;
}
.btn-quiet:hover {
  background: var(--surface-2);
}
.btn-sm {
  padding: 7px 14px;
  font-size: 0.84rem;
}
.btn-lg {
  padding: 14px 26px;
  font-size: 1rem;
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
.btn-block {
  width: 100%;
}

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-700);
  border: 1px solid var(--line);
  white-space: nowrap;
  max-width: 100%;
}
.badge-ok {
  background: var(--ok-100);
  color: var(--ok-600);
  border-color: transparent;
}
.badge-warn {
  background: var(--warn-100);
  color: var(--warn-700);
  border-color: transparent;
}
.badge-info {
  background: var(--brand-100);
  color: var(--brand-700);
  border-color: transparent;
}
.badge-accent {
  background: var(--accent-100);
  color: var(--accent-600);
  border-color: transparent;
}
.badge-flat {
  background: var(--surface);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}
.card-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-hover);
}
.card-body {
  padding: 20px;
}
.card-pad-sm .card-body {
  padding: 16px;
}

.grid {
  display: grid;
  gap: 20px;
}
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}
.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}
.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
/* Country cards: three across on wide screens (5 countries = 3 + 2),
   two on tablets, one on phones */
.grid-countries {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1020px) {
  .grid-countries {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .grid-countries {
    grid-template-columns: 1fr;
  }
}

/* ---------- Media placeholder (no fake photos) ---------- */
.media {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: linear-gradient(135deg, var(--c1, #1b3d78), var(--c2, #0b1b3a));
  display: grid;
  place-items: center;
  overflow: hidden;
}
.media::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(
      circle at 18% 22%,
      rgba(255, 255, 255, 0.16),
      transparent 45%
    ),
    repeating-linear-gradient(
      115deg,
      rgba(255, 255, 255, 0.05) 0 2px,
      transparent 2px 16px
    );
}
.media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-mono {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  color: #fff;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.04em;
  opacity: 0.95;
}
.media-note {
  position: absolute;
  z-index: 2;
  left: 10px;
  bottom: 10px;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(15, 23, 42, 0.35);
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.media-sm {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(
      1000px 420px at 12% -10%,
      rgba(59, 111, 196, 0.25),
      transparent 60%
    ),
    radial-gradient(
      800px 400px at 92% 0%,
      rgba(234, 88, 12, 0.16),
      transparent 55%
    ),
    linear-gradient(170deg, var(--hero-ink), #142a52 60%, #16305c);
  color: #fff;
  padding: clamp(52px, 8vw, 96px) 0 clamp(60px, 8vw, 104px);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.035) 0 1px,
    transparent 1px 22px
  );
}
.hero .wrap {
  position: relative;
  z-index: 1;
}
.hero h1 {
  color: #fff;
  max-width: 15ch;
  margin-bottom: 0.3em;
}
.hero-eyebrow {
  display: inline-block;
  line-height: 1.5;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cfe0ff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.hero-sub {
  color: #d7e3f8;
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.2rem);
  max-width: 60ch;
  margin-bottom: 30px;
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 34px;
}
.hero-stat b {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero-stat span {
  color: #b9cdee;
  font-size: 0.85rem;
}

.page-head {
  background: linear-gradient(170deg, var(--hero-ink), #17305d);
  color: #fff;
  padding: clamp(34px, 5vw, 56px) 0;
}
.page-head h1 {
  color: #fff;
  margin-bottom: 0.25em;
}
.page-head p {
  color: #cddcf5;
  max-width: 70ch;
  margin: 0;
}

/* ---------- Search ---------- */
.searchbox {
  position: relative;
  /* The reveal animation gives the box and the chips below it their own
     layers; this keeps the suggestion list above the later siblings. */
  z-index: 30;
  max-width: 660px;
}
.searchbox input {
  width: 100%;
  font: inherit;
  font-size: 1.02rem;
  padding: 16px 130px 16px 50px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--ink-900);
  box-shadow: var(--shadow-lg);
}
.searchbox input::placeholder {
  color: var(--ink-400);
}
.searchbox .search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  font-size: 1.05rem;
  pointer-events: none;
}
.searchbox .btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
}
.searchbox-flat input {
  box-shadow: var(--shadow-sm);
  border-color: var(--line);
}

.suggest {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 380px;
  overflow-y: auto;
  text-align: left;
}
.suggest[hidden] {
  display: none;
}
.suggest a {
  display: block;
  padding: 11px 16px;
  color: var(--ink-900);
  border-bottom: 1px solid var(--line-soft);
}
.suggest a:last-child {
  border-bottom: 0;
}
.suggest a:hover,
.suggest a.is-active {
  background: var(--brand-050);
  text-decoration: none;
}
.suggest .s-title {
  font-weight: 620;
  font-size: 0.95rem;
}
.suggest .s-meta {
  font-size: 0.8rem;
  color: var(--ink-500);
}
.suggest-empty {
  padding: 16px;
  color: var(--ink-500);
  font-size: 0.9rem;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
}
.quick-links span {
  color: #b9cdee;
  font-size: 0.84rem;
}
.chip {
  font-size: 0.82rem;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #e8f0ff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.chip:hover {
  background: rgba(255, 255, 255, 0.22);
  text-decoration: none;
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(44px, 6vw, 76px) 0;
}
.section-alt {
  background: var(--surface);
  border-block: 1px solid var(--line);
}
.section-head {
  margin-bottom: 30px;
  max-width: 70ch;
}
.section-head .eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-600);
  display: block;
  margin-bottom: 8px;
}
.section-head p {
  color: var(--ink-500);
  margin: 0;
}
.section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* ---------- Country card ---------- */
.country-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  cursor: pointer;
}
/* The card's main link stretches over the whole card, so any click opens it. */
.card-cover-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
}
/* A transform would make the link the containing block and shrink the
   overlay back to the button, so the button itself never moves; the
   whole card lifts instead. The selectors are deliberately stronger than
   the later .btn:hover / .btn:active press effect (scale 0.97): with that
   effect, mousedown hit the overlay but mouseup hit the text under the
   shrunken button, so clicks on the card body did nothing. */
.card .btn.card-cover-link,
.card .btn.card-cover-link:hover,
.card .btn.card-cover-link:active {
  transform: none;
}
.country-card:hover .card-cover-link {
  background: var(--solid-primary-hover);
}
.country-card .flag {
  font-size: 2.6rem;
  line-height: 1;
}
.country-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.country-card h3 {
  margin: 0;
}
.country-card .desc {
  color: var(--ink-500);
  font-size: 0.93rem;
  margin: 0;
  flex: 1;
}
.country-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.country-meta div b {
  display: block;
  font-size: 1.15rem;
  font-weight: 750;
}
.country-meta div span {
  font-size: 0.76rem;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- University card ---------- */
.uni-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}
.uni-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.uni-card h3 {
  margin: 0;
  font-size: 1.08rem;
}
.uni-card h3 a {
  color: inherit;
}
.uni-card .loc {
  font-size: 0.86rem;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  gap: 6px;
}
.uni-card .blurb {
  font-size: 0.89rem;
  color: var(--ink-700);
  margin: 0;
}
.uni-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  margin-top: auto;
}
.uni-facts dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-400);
  margin: 0;
}
.uni-facts dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.uni-card-actions {
  display: flex;
  gap: 8px;
  padding: 0 20px 18px;
}
.uni-card-actions .btn {
  flex: 1;
}

.compare-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--ink-700);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.compare-toggle:hover {
  border-color: var(--brand-500);
  color: var(--brand-700);
}
.compare-toggle[aria-pressed="true"] {
  background: var(--solid-primary);
  color: #fff;
  border-color: var(--solid-primary);
}

/* ---------- Filters ---------- */
.browse-layout {
  display: grid;
  grid-template-columns: 276px 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .browse-layout {
    grid-template-columns: 1fr;
  }
}

.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow-y: auto;
}
@media (max-width: 900px) {
  .filters {
    position: static;
    max-height: none;
  }
}
.filters h2 {
  font-size: 1rem;
  margin: 0;
}
.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.filter-group {
  border-top: 1px solid var(--line-soft);
  padding: 14px 0 4px;
}
.filter-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.filter-group h3 {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-400);
  margin: 0 0 10px;
}
.filter-opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 0;
  font-size: 0.9rem;
  cursor: pointer;
}
.filter-opt input {
  margin: 3px 0 0;
  accent-color: var(--brand-600);
  width: 16px;
  height: 16px;
  flex: none;
}
.filter-opt:hover {
  color: var(--brand-700);
}
.filter-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ink-400);
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.results-bar .count {
  font-weight: 650;
}
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.active-filters button {
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  background: var(--brand-100);
  color: var(--brand-700);
  border: 0;
  padding: 5px 10px 5px 12px;
  border-radius: 999px;
}
.active-filters button::after {
  content: " ✕";
  font-size: 0.7rem;
  opacity: 0.7;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-500);
}
.empty-state h3 {
  color: var(--ink-900);
}

/* ---------- University profile ---------- */
.uni-hero {
  background: linear-gradient(170deg, var(--hero-ink), #17305d);
  color: #fff;
  padding: 34px 0 30px;
}
.uni-hero .crumbs {
  font-size: 0.84rem;
  color: #a9c2ea;
  margin-bottom: 16px;
}
.uni-hero .crumbs a {
  color: #cfe0ff;
}
.uni-hero-grid {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.uni-logo {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  flex: none;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.06)
  );
}
.uni-hero h1 {
  color: #fff;
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.5rem);
  margin-bottom: 0.2em;
}
.uni-hero .sub {
  color: #cddcf5;
  margin: 0 0 14px;
}
.uni-hero .pill-row .badge {
  background: rgba(255, 255, 255, 0.12);
  color: #e8f0ff;
  border-color: rgba(255, 255, 255, 0.2);
}

.profile-nav {
  position: sticky;
  top: var(--nav-h);
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.profile-nav ul {
  display: flex;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.profile-nav a {
  display: block;
  padding: 14px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-500);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.profile-nav a:hover {
  color: var(--brand-700);
  text-decoration: none;
}
.profile-nav a.is-active {
  color: var(--brand-700);
  border-bottom-color: var(--brand-600);
}

.profile-section {
  scroll-margin-top: calc(var(--nav-h) + 56px);
  padding: 34px 0;
  border-top: 1px solid var(--line);
}
.profile-section:first-of-type {
  border-top: 0;
}
.profile-section > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-section > h2::before {
  content: "";
  width: 4px;
  height: 1.1em;
  border-radius: 3px;
  background: var(--brand-600);
  flex: none;
}

.deflist {
  display: grid;
  gap: 0;
  margin: 0;
}
.deflist > div {
  display: grid;
  grid-template-columns: minmax(150px, 230px) 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.deflist > div:last-child {
  border-bottom: 0;
}
.deflist dt {
  color: var(--ink-500);
  font-size: 0.88rem;
  margin: 0;
}
.deflist dd {
  margin: 0;
  font-size: 0.95rem;
}
@media (max-width: 620px) {
  .deflist > div {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 10px 0;
  }
  .deflist dt {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-400);
  }
}

.unknown {
  color: var(--ink-400);
  font-style: italic;
}

.cost-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
.cost-table th,
.cost-table td,
.data-table th,
.data-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.cost-table th,
.data-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  background: var(--surface-2);
}
.cost-table td:last-child,
.cost-table th:last-child {
  text-align: right;
}
.cost-table tfoot td {
  font-weight: 750;
  border-top: 2px solid var(--line);
  border-bottom: 0;
  background: var(--brand-050);
}
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.covers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cover-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.cover-yes {
  background: var(--ok-100);
  border-color: transparent;
  color: var(--ok-600);
  font-weight: 600;
}
.cover-no {
  background: var(--surface-2);
  color: var(--ink-400);
  text-decoration: line-through;
}
.cover-unk {
  color: var(--ink-400);
  font-style: italic;
}

.scholarship-card {
  border-left: 4px solid var(--accent-500);
}
.fullride-card {
  border-left: 4px solid var(--ok-600);
}
.fullride-card.is-conflict {
  border-left-color: var(--warn-700);
}
.need-card {
  border-left: 4px solid var(--brand-600);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.link-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-900);
  font-weight: 600;
  font-size: 0.92rem;
  transition:
    border-color 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
}
.link-tile:hover {
  text-decoration: none;
  border-color: var(--brand-500);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.link-tile .ico {
  font-size: 1.1rem;
}
.link-tile .arw {
  margin-left: auto;
  color: var(--ink-400);
}
.link-tile.is-missing {
  opacity: 0.5;
  pointer-events: none;
}

.prog-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.prog-group {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 14px 16px;
}
.prog-group h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.prog-group p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-500);
}

/* ---------- Notices ---------- */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 0.89rem;
  line-height: 1.55;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.notice .ico {
  font-size: 1.1rem;
  flex: none;
  line-height: 1.3;
}
.notice-warn {
  background: var(--warn-100);
  border-color: var(--warn-line);
  color: var(--warn-700);
}
.notice-info {
  background: var(--brand-050);
  border-color: var(--info-line);
  color: var(--brand-800);
}
.notice strong {
  font-weight: 700;
}

.verify-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 0.86rem;
  color: var(--ink-500);
}
.verify-bar b {
  color: var(--ink-900);
}

.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.source-list li {
  font-size: 0.87rem;
}
.source-list a {
  word-break: break-word;
}

/* ---------- Compare ---------- */
.compare-tray {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.1);
  padding: 12px 0;
  transform: translateY(110%);
  transition: transform 0.25s ease;
}
.compare-tray.is-open {
  transform: translateY(0);
}
body.tray-open {
  padding-bottom: 96px;
}
@media (max-width: 640px) {
  body.tray-open {
    padding-bottom: 150px;
  }
}
.compare-tray .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.tray-items {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.tray-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
}
.tray-chip button {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ink-400);
  font-size: 0.95rem;
  line-height: 1;
  padding: 2px 4px;
}
.tray-chip button:hover {
  color: var(--danger-600);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
}
.compare-table th,
.compare-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  text-align: left;
}
.compare-table thead th {
  background: var(--hero-ink);
  color: #fff;
  font-size: 0.9rem;
  position: sticky;
  top: 0;
}
.compare-table tbody th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  background: var(--surface-2);
  font-weight: 650;
  width: 200px;
  position: sticky;
  left: 0;
}
.compare-table .row-group th {
  background: var(--brand-050);
  color: var(--brand-800);
  letter-spacing: 0.07em;
}
.compare-table td {
  min-width: 200px;
}


/* Keep every selected university beside the same criterion on phones.
   A sticky 200px criterion plus 200px data cells leaves no readable pair. */
.compare-remove {
  float: right;
  margin: -4px -4px 4px 4px;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 4px 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
@media (max-width: 640px) {
  .compare-table { display: block; }
  .compare-table thead, .compare-table tbody { display: block; }
  .compare-table tr {
    display: grid;
    grid-template-columns: repeat(var(--compare-count), minmax(0, 1fr));
  }
  .compare-table th, .compare-table td {
    display: block;
    min-width: 0;
    width: auto;
    padding: 10px 8px;
    overflow-wrap: anywhere;
  }
  .compare-table thead th { position: static; font-size: .8rem; }
  .compare-table thead th:first-child { display: none; }
  .compare-table tbody th {
    position: static;
    grid-column: 1 / -1;
    width: auto;
    font-size: .75rem;
  }
  .compare-table td { font-size: .8rem; border-right: 1px solid var(--line-soft); }
  .compare-table td:last-child { border-right: 0; }
  .compare-remove { float: none; display: block; margin: 0 0 8px auto; min-width: 44px; min-height: 44px; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--footer-bg);
  color: #b9cdee;
  padding: 52px 0 28px;
  margin-top: 60px;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 800px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
.site-footer h4 {
  color: #fff;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}
.site-footer a {
  color: #cfe0ff;
}
.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}
.site-footer .logo {
  color: #fff;
  margin-bottom: 12px;
}
.footer-bottom {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: #93aed6;
}
.footer-disclaimer {
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d7e3f8;
  font-size: 0.84rem;
  line-height: 1.6;
}

/* ---------- Animation ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.reveal {
  animation: rise 0.5s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}
.reveal-1 {
  animation-delay: 0.05s;
}
.reveal-2 {
  animation-delay: 0.12s;
}
.reveal-3 {
  animation-delay: 0.19s;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .card-link:hover,
  .btn:hover {
    transform: none;
  }
}

@media print {
  .site-header,
  .site-footer,
  .compare-tray,
  .profile-nav,
  .filters {
    display: none !important;
  }
}

/* ---------- Admission target band ---------- */
.target-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--warn-100);
  border: 1px solid var(--warn-line);
}
.target-box h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.target-grid > div {
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.target-grid span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
}
.target-grid b {
  font-size: 0.92rem;
}

/* ---------- Bot check (Turnstile) ---------- */
.gate-hidden-holder {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.gate-visible-holder {
  position: fixed;
  z-index: 1001;
  left: 50%;
  top: calc(50% + 58px);
  transform: translate(-50%, -50%);
}
html.is-gated body > *:not(#human-gate):not(#gate-widget) {
  visibility: hidden;
}
html.is-gated body {
  overflow: hidden;
}
#human-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(170deg, var(--hero-ink), #17305d);
  transition: opacity 0.35s ease;
}
#human-gate.is-done {
  opacity: 0;
  pointer-events: none;
}
.gate-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 32px 26px;
  box-shadow: var(--shadow-lg);
}
.gate-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 18px;
}
.gate-card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.4em;
}
.gate-card p {
  color: var(--ink-500);
  font-size: 0.92rem;
}
.gate-widget {
  min-height: 96px;
  display: flex;
  justify-content: center;
  margin: 18px 0 6px;
}
.gate-status {
  min-height: 1.4em;
  margin: 0;
  font-size: 0.85rem;
}

/* ---------- Campus photos ---------- */
.hero-photo {
  margin: 18px 0 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.hero-photo img {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
}
.hero-photo figcaption {
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--ink-500);
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.photo {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.photo a:hover img {
  transform: scale(1.03);
}
.photo figcaption {
  padding: 10px 12px;
  font-size: 0.82rem;
  display: grid;
  gap: 4px;
}
.credit {
  color: var(--ink-500);
  font-size: 0.74rem;
  word-break: break-word;
}

/* ============================================================
   Night theme
   Follows the device setting unless the visitor picked a theme
   with the toggle (stored as data-theme on <html>).
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-900: #0b1b3a;
    --brand-800: #d2e2fb;
    --brand-700: #b3cdf6;
    --brand-600: #8fb4f0;
    --brand-500: #6d9be0;
    --brand-100: #1b2f52;
    --brand-050: #111f38;

    --accent-600: #fb923c;
    --accent-500: #f97316;
    --accent-100: #3b1f0e;

    --ok-600: #34d399;
    --ok-100: #0f3528;
    --warn-700: #fcd34d;
    --warn-100: #33270b;
    --danger-600: #f87171;
    --danger-100: #3b1414;

    --ink-900: #e6edf7;
    --ink-700: #c3cfdf;
    --ink-500: #95a3b8;
    --ink-400: #7a889d;
    --line: #243149;
    --line-soft: #1b263a;
    --surface: #121b2d;
    --surface-2: #0e1626;
    --bg: #0a111e;

    --solid-primary: #2a5bb0;
    --solid-primary-hover: #3569c4;
    --hero-ink: #07101f;

    --header-bg: rgba(10, 17, 30, 0.86);
    --glass: rgba(18, 27, 45, 0.92);
    --line-hover: #34507c;
    --info-line: #2a4470;
    --warn-line: #6b5314;
    --footer-bg: #060c18;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-900: #0b1b3a;
  --brand-800: #d2e2fb;
  --brand-700: #b3cdf6;
  --brand-600: #8fb4f0;
  --brand-500: #6d9be0;
  --brand-100: #1b2f52;
  --brand-050: #111f38;

  --accent-600: #fb923c;
  --accent-500: #f97316;
  --accent-100: #3b1f0e;

  --ok-600: #34d399;
  --ok-100: #0f3528;
  --warn-700: #fcd34d;
  --warn-100: #33270b;
  --danger-600: #f87171;
  --danger-100: #3b1414;

  --ink-900: #e6edf7;
  --ink-700: #c3cfdf;
  --ink-500: #95a3b8;
  --ink-400: #7a889d;
  --line: #243149;
  --line-soft: #1b263a;
  --surface: #121b2d;
  --surface-2: #0e1626;
  --bg: #0a111e;

  --solid-primary: #2a5bb0;
  --solid-primary-hover: #3569c4;
  --hero-ink: #07101f;

  --header-bg: rgba(10, 17, 30, 0.86);
  --glass: rgba(18, 27, 45, 0.92);
  --line-hover: #34507c;
  --info-line: #2a4470;
  --warn-line: #6b5314;
  --footer-bg: #060c18;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] {
  color-scheme: light;
}

/* Photos and white UI tiles are slightly dimmed at night */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img {
    filter: brightness(0.92);
  }
}
:root[data-theme="dark"] img {
  filter: brightness(0.92);
}

/* Theme toggle */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-700);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.theme-toggle:hover {
  border-color: var(--brand-500);
  transform: rotate(-12deg);
}
.theme-toggle .when-dark {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .when-dark {
  display: inline;
}
:root[data-theme="dark"] .theme-toggle .when-light {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .when-dark {
    display: inline;
  }
  :root:not([data-theme="light"]) .theme-toggle .when-light {
    display: none;
  }
}
.nav-bar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
}
@media (max-width: 1180px) {
  .nav-bar-tools {
    margin-left: auto;
  }
  .nav-toggle {
    margin-left: 0;
  }
}
/* Russian labels are longer: with the default spacing the row was wider than
   the header and, between the menu breakpoint and about 1290 px, pushed the
   page sideways. Tighter spacing keeps it inside the header at desktop widths. */
@media (min-width: 1181px) {
  html[lang="ru"] .nav-links {
    gap: 2px;
  }
  html[lang="ru"] .nav-links > a {
    padding: 8px;
  }
}

/* Language toggle */
.lang-toggle {
  height: 38px;
  min-width: 42px;
  padding: 0 10px;
  border-radius: 999px;
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-700);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.lang-toggle:hover {
  border-color: var(--brand-500);
  color: var(--brand-700);
}

/* ---------- Find my match ---------- */
.match-form {
  margin-top: 18px;
}
.match-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 18px;
}
@media (max-width: 900px) {
  .match-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .match-grid {
    grid-template-columns: 1fr;
  }
}
.match-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}
.match-field input,
.match-field select {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-900);
  min-width: 0;
  width: 100%;
}
.match-field small {
  font-weight: 400;
}
.route-list {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}
.route-card.route-closed {
  opacity: 0.86;
  border-style: dashed;
}
.match-conflict {
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: var(--r-sm);
  background: var(--warn-100);
  color: var(--warn-700);
}
.match-conflict a {
  color: inherit;
  text-decoration: underline;
}
.conflict-figures {
  margin: 6px 0;
  padding-left: 18px;
}
.kind-date + .kind-date {
  margin-top: 10px;
}
.cost-subtotal td {
  font-weight: 650;
  border-top: 1px solid var(--line);
}
.match-field .field-error {
  color: var(--danger-600);
  font-weight: 600;
}
.match-field input[aria-invalid="true"] {
  border-color: var(--danger-600);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}
.match-budget {
  display: flex;
  gap: 8px;
}
.match-budget input {
  flex: 1 1 auto;
}
.match-budget select {
  flex: 0 0 auto;
  width: auto;
}
.match-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.95rem;
}
.match-group {
  margin-top: 30px;
}
.match-group h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  margin-bottom: 4px;
}
.match-count {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-500);
}
.match-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.match-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.match-head h3 {
  margin: 2px 0 0;
  font-size: 1.08rem;
}
.match-checks {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 6px;
  font-size: 0.93rem;
}
.match-checks li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.match-checks .ico {
  flex: 0 0 1.3em;
  text-align: center;
  font-weight: 700;
}
.match-checks .lvl-ok .ico {
  color: var(--ok-600);
}
.match-checks .lvl-soft .ico {
  color: var(--warn-700);
}
.match-checks .lvl-hard .ico {
  color: var(--danger-600);
}
.match-checks .lvl-info .ico {
  color: var(--ink-500);
}

/* ---------- v47: country accordions, cost summary, paging ---------- */
.acc-list {
  display: grid;
  gap: 10px;
}
.acc {
  border: 1px solid var(--line);
  border-radius: var(--r-md, 14px);
  background: var(--surface);
  overflow: hidden;
}
.acc > summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 650;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.acc > summary::-webkit-details-marker {
  display: none;
}
.acc > summary::after {
  content: "+";
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
}
.acc[open] > summary::after {
  content: "–";
}
.acc > summary:hover {
  background: var(--surface-2, rgba(127, 127, 127, 0.06));
}
.acc-body {
  padding: 0 18px 16px;
}
.acc-body > p:first-child {
  margin-top: 0;
}
.results-more {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}
.results-more .btn {
  min-height: 44px;
}
.cost-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 4px 0 0;
}
.cost-figure {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
}
.cost-figure dt {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.cost-figure dd {
  margin: 0;
  font-size: 1.05rem;
}
.cost-figure dd .small {
  margin-left: 4px;
}
.hero-photo img,
.photo img {
  /* Let the responsive aspect ratio override the HTML fallback height. */
  height: auto;
  background: var(--surface-2, rgba(127, 127, 127, 0.08));
}
.media {
  aspect-ratio: 16 / 10;
}
.photo img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}
.hero-photo img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
}
@media (max-width: 640px) {
  .cost-summary {
    grid-template-columns: 1fr;
  }
  .acc > summary {
    padding: 13px 14px;
  }
  .acc-body {
    padding: 0 14px 14px;
  }
}
.news-card.is-past {
  opacity: 0.72;
}
.badge.is-on {
  background: var(--brand, #1b3d78);
  color: #fff;
  border-color: transparent;
}
button.badge {
  cursor: pointer;
  font: inherit;
}

/* On a phone the country page must reach the universities quickly, so the
   stats sit two to a row instead of one under another. */
@media (max-width: 640px) {
  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-top: 22px;
  }
  .hero-stat b {
    font-size: 1.3rem;
  }
  .hero-stat span {
    font-size: 0.78rem;
    line-height: 1.25;
    display: block;
  }
  .page-head {
    padding: 24px 0 26px;
  }
}
.filters-box > summary {
  display: none;
}
.filters-summary::-webkit-details-marker {
  display: none;
}
@media (max-width: 900px) {
  .filters-box > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    padding: 12px 16px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font-weight: 650;
  }
  .filters-box > summary::after {
    content: "▾";
    color: var(--muted);
  }
  .filters-box[open] > summary::after {
    content: "▴";
  }
  .filters-box[open] > summary {
    margin-bottom: 10px;
  }
  .filters-box .filter-head h2 {
    font-size: 1rem;
  }
}

/* The initials and the "no photo" label sit under the photograph; when a
   photo loads it covers them, and if it fails to load it removes itself and
   they show through again. */
.media img {
  z-index: 3;
}

/* ---------- application rounds ---------- */
.rounds {
  margin-top: 8px;
}
.rounds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}
.rounds-table th,
.rounds-table td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.rounds-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.rounds-table tr.round-previous-cycle td,
.rounds-table tr.round-not-confirmed td {
  background: var(--surface-2);
}
.warn-text {
  color: var(--warn, #b45309);
}
@media (max-width: 760px) {
  .rounds-table,
  .rounds-table tbody,
  .rounds-table tr,
  .rounds-table td {
    display: block;
    width: 100%;
  }
  .rounds-table thead {
    display: none;
  }
  .rounds-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 6px 2px;
    margin-bottom: 12px;
    background: var(--surface);
  }
  .rounds-table td {
    border: 0;
    padding: 7px 14px;
  }
  .rounds-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 2px;
  }
}

/* English requirements that differ by programme, language profile or band */
.req-varies {
  display: block;
  font-size: 1.12rem;
  line-height: 1.3;
  margin-bottom: 6px;
}
.req-profiles {
  list-style: none;
  margin: 8px 0 6px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.req-profiles li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  min-width: 0;
}
.req-name {
  font-weight: 600;
  color: var(--ink-900);
}
.req-kv {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  overflow-wrap: anywhere;
}
.req-kv > .muted {
  min-width: 6.5em;
}
.req-meta {
  margin-top: 2px;
  color: var(--ink-500);
}

/* A long badge (often a translated one) wraps instead of widening the page. */
@media (max-width: 620px) {
  .badge { white-space: normal; }
}

/* Confirmation status of a round (kept apart from whether the date has passed) */
.round-status { font-weight: 600; font-size: 0.85rem; }
.round-status-confirmed { color: var(--ok-600); }
.round-status-previous-cycle,
.round-status-not-confirmed { color: var(--warn-700); }

/* Official test statistics — kept apart from requirements */
.stat-group { margin: 6px 0 14px; }
.stat-group h4 { margin: 0 0 6px; font-size: 1rem; }
.stat-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
}
.stat-line > .muted { min-width: 12em; }
.stat-meta { margin: 6px 0 0; overflow-wrap: anywhere; }

.cost-group-title { margin: 16px 0 6px; font-size: 1rem; }

/* ---------- v70: intake choice, reference blocks, saved list, match basis, report form ---------- */
.intake-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}
.intake-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}
.intake-pick select {
  font: inherit;
  font-weight: 500;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  max-width: 100%;
}
.results-level {
  flex: 1 1 100%;
}
.ref-block {
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
}
.ref-block > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.93rem;
}
.ref-block .rounds {
  margin-top: 10px;
}
.save-toggle[aria-pressed="true"] {
  border-color: var(--warn-line);
  background: var(--warn-100);
  color: var(--warn-700);
}
.saved-table tr.is-past td {
  opacity: 0.6;
}
.basis-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
  vertical-align: 1px;
}
.basis-minimum {
  border-color: var(--ok-600);
  color: var(--ok-600);
}
.basis-statistic {
  border-color: var(--warn-line);
  color: var(--warn-700);
}
.match-unchecked {
  margin-top: 10px;
  font-size: 0.88rem;
}
.match-unchecked > summary {
  cursor: pointer;
  color: var(--warn-700);
  font-weight: 600;
}
.match-unchecked ul {
  margin: 6px 0 0;
  padding-left: 1.2em;
  color: var(--ink-500);
}
.report-text {
  display: block;
  width: 100%;
  max-width: 720px;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: inherit;
  resize: vertical;
}
.intake-pick select:focus-visible,
.report-text:focus-visible,
.ref-block > summary:focus-visible,
.match-unchecked > summary:focus-visible {
  outline: 2px solid var(--brand-500, #2563eb);
  outline-offset: 2px;
}

/* v72 — field tags checked against degrees conferred */
.field-check { font-size: .82rem; color: var(--ink-500); margin: 2px 0 6px; line-height: 1.4; }
.field-check.field-ok { color: var(--ok-600); }
.field-check strong { font-weight: 600; white-space: nowrap; }
/* A named programme can be long ("Painting — Bachelor of Fine Arts (Herron
   School of Art and Design)"): it wraps inside its tile. */
.field-check .field-named { font-weight: 600; overflow-wrap: anywhere; }
.degrees-table { margin-top: 10px; }
.degrees-table td:last-child, .degrees-table th:last-child { text-align: right; }
.degrees-table td:last-child { white-space: nowrap; }
.plain-list { margin: 8px 0 0; padding-left: 18px; }
.plain-list li { margin-bottom: 6px; }

/* v89 — motion: one timing scale for the whole site. Everything here is
   decoration: with reduced motion requested, or with scripts off, the page
   looks and works the same without it. */
:root {
  --ease: cubic-bezier(0.22, 0.8, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.16s;
  --t: 0.26s;
  --t-slow: 0.5s;
  interpolate-size: allow-keywords;
}

/* Hover, focus and pressed states ease instead of snapping. */
a,
button,
summary,
.btn,
.chip,
.badge,
.card,
.link-tile,
.prog-group,
.compare-toggle,
.save-toggle,
.nav-links > a,
.lang-toggle,
.theme-toggle,
input,
select,
textarea {
  transition:
    color var(--t-fast) var(--ease-soft),
    background-color var(--t-fast) var(--ease-soft),
    border-color var(--t-fast) var(--ease-soft),
    box-shadow var(--t) var(--ease),
    transform var(--t) var(--ease),
    opacity var(--t-fast) var(--ease-soft),
    outline-offset var(--t-fast) var(--ease-soft);
}
.btn:active,
.chip:active,
.compare-toggle:active,
.save-toggle:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.08s;
}
.prog-group:hover,
.link-tile:hover {
  transform: translateY(-2px);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--solid-primary) 18%, transparent);
}

/* A new page fades in; moving inside one profile only scrolls. */
@keyframes route-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
#main.route-enter > * {
  animation: route-in 0.34s var(--ease) both;
}

/* Blocks rise into place as they enter the viewport. The script adds .rv only
   when it can also add .is-in, so nothing is ever left hidden. */
.rv {
  opacity: 0;
  transform: translateY(16px);
}
.rv.is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--t-slow) var(--ease),
    transform var(--t-slow) var(--ease);
  transition-delay: var(--rv-delay, 0ms);
}

/* Photos fade in when they finish loading (the placeholder shows until then). */
img.img-fade {
  opacity: 0;
  transition: opacity 0.45s var(--ease-soft);
}
img.img-fade.is-loaded {
  opacity: 1;
}
.uni-card .media img,
.hero-photo img {
  transition:
    opacity 0.45s var(--ease-soft),
    transform 0.6s var(--ease);
}
.uni-card:hover .media img {
  transform: scale(1.035);
}

/* Disclosure blocks open and close smoothly where the browser can animate
   them; elsewhere the content simply fades in. */
details::details-content {
  block-size: 0;
  overflow: clip;
  opacity: 0;
  transition:
    block-size 0.32s var(--ease),
    opacity 0.24s var(--ease-soft),
    content-visibility 0.32s allow-discrete;
}
details[open]::details-content {
  block-size: auto;
  opacity: 1;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@supports not selector(::details-content) {
  details[open] > *:not(summary) {
    animation: fade-in 0.28s var(--ease-soft) both;
  }
}
summary {
  cursor: pointer;
}

/* The mobile menu slides down instead of appearing at once. */
@media (max-width: 1180px) {
  .nav-links {
    transition:
      opacity 0.22s var(--ease-soft),
      transform 0.26s var(--ease),
      display 0.26s allow-discrete;
    transform-origin: top;
  }
  .nav-links[hidden] {
    opacity: 0;
    transform: translateY(-8px);
  }
  @starting-style {
    .nav-links:not([hidden]) {
      opacity: 0;
      transform: translateY(-8px);
    }
  }
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  transition:
    transform 0.26s var(--ease),
    background-color var(--t-fast) var(--ease-soft),
    top 0.26s var(--ease);
}

/* Saving or adding to compare gives a small confirmation. */
@keyframes pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}
.save-toggle[aria-pressed="true"],
.compare-toggle[aria-pressed="true"] {
  animation: pop 0.32s var(--ease) 1;
}

/* Results that are redrawn after a filter change fade in rather than blink. */
.match-group,
.results-level,
.empty-state,
.news-list > *,
.saved-table {
  animation: fade-in 0.3s var(--ease-soft) both;
}

/* ---------- University card: one tap target, compact controls ---------- */
/* The title link covers the whole card, so a tap anywhere opens the
   profile; the other controls sit above it. */
.uni-card {
  cursor: pointer;
}
.uni-card .card-stretch::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--r-lg);
}
/* The photo keeps its own layers to itself, so the corner buttons and the
   card-wide link stay above it. */
.uni-card .media {
  isolation: isolate;
}
.uni-card-actions {
  position: relative;
  z-index: 2;
  align-items: stretch;
  flex-wrap: nowrap;
}
.uni-card-actions .btn {
  min-height: 44px;
  min-width: 0;
  white-space: nowrap;
}
.uni-card-actions .card-go {
  flex: none;
  width: 52px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}
.card-go > span {
  display: inline-block;
  transition: transform var(--t) var(--ease);
}
.uni-card:hover .card-go > span {
  transform: translateX(3px);
}
.save-icon {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink-700);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.save-icon:hover {
  border-color: var(--brand-500);
  color: var(--brand-700);
}
.save-icon[aria-pressed="true"] {
  border-color: var(--warn-line);
  background: var(--warn-100);
  color: var(--warn-700);
}

/* ---------- Profile header buttons ---------- */
.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .hero-actions .btn {
    min-height: 46px;
    padding-left: 12px;
    padding-right: 12px;
    text-align: center;
  }
  .hero-actions .hero-main {
    grid-column: 1 / -1;
    min-height: 50px;
    font-size: 1rem;
  }
  .hero-actions > :last-child:nth-child(even) {
    grid-column: 1 / -1;
  }
}

/* Light/dark switch. Where the browser can, the new theme spreads over the
   page as a growing circle (the script animates the clip); the old page
   stays still underneath. */
html.theme-reveal::view-transition-old(root),
html.theme-reveal::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
html.theme-reveal::view-transition-old(root) {
  z-index: 1;
}
html.theme-reveal::view-transition-new(root) {
  z-index: 2;
}
html.theme-reveal *,
html.theme-reveal *::before,
html.theme-reveal *::after {
  transition: none !important;
}
.theme-toggle > span {
  animation: theme-icon 0.5s var(--ease) both;
}
@keyframes theme-icon {
  from {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Elsewhere the colours cross-fade for a moment, then normal timings return. */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition:
    background-color 0.45s var(--ease-soft),
    color 0.45s var(--ease-soft),
    border-color 0.45s var(--ease-soft),
    box-shadow 0.45s var(--ease-soft),
    fill 0.45s var(--ease-soft) !important;
}

/* The highlight of the current menu item slides to the next one. The
   marker is added by the script; without it each item keeps its own. */
.profile-nav ul {
  position: relative;
}
@media (min-width: 1181px) {
  .nav-links {
    position: relative;
  }
}
.slide-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--mw, 0);
  height: var(--mh, 0);
  transform: translate(var(--mx, 0), var(--my, 0));
  border-radius: var(--r-sm);
  background: var(--brand-100);
  opacity: 0;
  pointer-events: none;
  list-style: none;
  transition:
    transform 0.34s var(--ease),
    width 0.34s var(--ease),
    height 0.34s var(--ease),
    opacity var(--t-fast) var(--ease-soft),
    background-color var(--t-fast) var(--ease-soft);
}
.has-marker > .slide-marker {
  opacity: 1;
}
.nav-links > a {
  position: relative;
  z-index: 1;
}
.nav-links.has-marker > a[aria-current="page"],
.nav-links.has-marker > a[aria-current="page"]:hover {
  background: transparent;
}
.profile-nav .slide-marker {
  top: auto;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand-600);
  transform: translateX(var(--mx, 0));
}
.profile-nav ul.has-marker a.is-active {
  border-bottom-color: transparent;
}
@media (max-width: 1180px) {
  .nav-links[hidden] > .slide-marker {
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv,
  .rv.is-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
  img.img-fade {
    opacity: 1;
  }
  .slide-marker {
    transition: none;
  }
  .theme-toggle > span {
    animation: none;
  }
  #main.route-enter > *,
  .save-toggle[aria-pressed="true"],
  .compare-toggle[aria-pressed="true"] {
    animation: none;
  }
  details::details-content {
    transition: none;
  }
}
@media print {
  .rv,
  img.img-fade {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Dropdowns of the match form (assets/js/match.js): a button and a list in
   the site's style over the hidden native select. */
.match-form {
  overflow: visible;
}
.fs {
  position: relative;
  min-width: 0;
}
.match-budget .fs {
  flex: 0 0 auto;
}
.match-field .fs-native,
.fs-native {
  position: absolute;
  inset: auto auto 0 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.fs-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 7px 12px 7px 8px;
  font: inherit;
  font-weight: 500;
  color: var(--ink-900);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition:
    border-color var(--t-fast) var(--ease-soft),
    box-shadow var(--t) var(--ease);
}
.fs-btn:hover {
  border-color: var(--line-hover);
}
.fs-btn:focus-visible,
.fs.is-open .fs-btn {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--solid-primary) 18%, transparent);
}
.fs-cur {
  display: contents;
}
.fs-text {
  flex: 1 1 auto;
  min-width: 0;
}
.fs-btn .fs-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fs-chev {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink-500);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t) var(--ease);
}
.fs.is-open .fs-chev {
  transform: rotate(180deg);
}
.fs-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: hsl(var(--h, 220) 85% 95%);
  color: hsl(var(--h, 220) 62% 38%);
  font-size: 17px;
  line-height: 1;
}
.fs-ico svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fs-ico.is-flag {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}
.fs-list {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(340px, 62vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: fs-in 0.14s var(--ease);
}
.fs-list[hidden] {
  display: none;
}
.fs.fs-up .fs-list {
  top: auto;
  bottom: calc(100% + 6px);
}
.fs-list:focus {
  outline: none;
}
@keyframes fs-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }
}
.fs-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 10px;
  font-weight: 500;
  color: var(--ink-900);
  cursor: pointer;
  user-select: none;
}
.fs-opt + .fs-opt {
  margin-top: 2px;
}
.fs-opt.is-active {
  background: var(--brand-050);
}
.fs-opt[aria-selected="true"] {
  background: var(--brand-100);
  color: var(--brand-800);
  font-weight: 650;
}
.fs-check {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--brand-600);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}
.fs-opt[aria-selected="true"] .fs-check {
  opacity: 1;
}
.fs-sep {
  height: 1px;
  margin: 5px 6px;
  background: var(--line);
}
.fs-compact .fs-btn {
  gap: 6px;
  padding: 7px 10px 7px 12px;
}
.fs-compact .fs-list {
  left: auto;
  min-width: 112px;
}
.fs-compact .fs-opt {
  padding: 8px 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fs-ico:not(.is-flag) {
    background: hsl(var(--h, 220) 32% 21%);
    color: hsl(var(--h, 220) 78% 78%);
  }
}
:root[data-theme="dark"] .fs-ico:not(.is-flag) {
  background: hsl(var(--h, 220) 32% 21%);
  color: hsl(var(--h, 220) 78% 78%);
}
@media (prefers-reduced-motion: reduce) {
  .fs-list {
    animation: none;
  }
  .fs-chev {
    transition: none;
  }
}

/* ---------- Phones: shorter country cards, larger touch targets ---------- */
@media (max-width: 560px) {
  /* Flag beside the name instead of above it: six cards take a screen less. */
  .country-card .card-body {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
  }
  .country-card .card-body > :not(.flag):not(h3) {
    grid-column: 1 / -1;
  }
  .country-card .flag {
    font-size: 2rem;
  }
  .compare-toggle {
    min-height: 34px;
    padding: 6px 12px;
  }
  .quick-links .chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
  }
}
