/* ===== Fonts, hosted on this site (SIL Open Font License, see fonts/LICENSE-*.txt) =====
   Not loaded from Google Fonts, so visitors' browsers don't contact Google (privacy by design).
   Inter: all text. Source Serif 4: big titles only (the "European academic" touch). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-ext-600.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* =====================================================================
   1. DESIGN TOKENS
   The whole look of the site is defined here, once. Documented in docs/design-system.md.
   Brand: Navy = structure and trust · Blue = interaction · Terracotta = personality, used sparingly
   (main calls to action, active underline, map highlights, selected chips) · Warm ivory surfaces.
   Pages use the semantic names (--color-…, --text-…, --surface-…); the raw brand values
   (--navy-900 …) are only referenced here and in a few brand moments.
   ===================================================================== */

/* ----- Scales (same in light and dark) ----- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-heading: var(--font-serif);

  /* Type scale (fluid between phone and desktop) */
  --fs-display: clamp(2.5rem, 1.6rem + 3.6vw, 4rem);
  --fs-h1: clamp(2rem, 1.45rem + 2.2vw, 3rem);
  --fs-h2: clamp(1.6rem, 1.3rem + 1.2vw, 2.25rem);
  --fs-h3: clamp(1.15rem, 1.08rem + 0.35vw, 1.4rem);
  --fs-body-lg: 1.125rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-meta: 0.8rem;
  --fs-eyebrow: 0.72rem;
  --tracking-eyebrow: 0.12em;

  /* Spacing scale: 4 8 12 16 20 24 32 40 48 64 80 96 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space-11: 80px;
  --space-12: 96px;
  --section-y: clamp(48px, 6vw, 88px);

  /* Layout widths */
  --width-content: 1240px;
  --width-wide: 1320px;
  --width-reading: 820px;
  --gutter: clamp(16px, 3vw, 32px);

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Shadows: restrained (European / academic, not floating SaaS) */
  --shadow-xs: 0 1px 2px var(--color-shadow);
  --shadow-sm: 0 1px 2px var(--color-shadow), 0 1px 3px var(--color-shadow);
  --shadow-md: 0 6px 18px var(--color-shadow), 0 1px 3px var(--color-shadow);
  --shadow-lg: 0 16px 40px var(--color-shadow-strong);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 160ms;
  --dur: 220ms;
  --dur-slow: 300ms;

  --header-height: 72px;
}

/* ----- Brand palette (raw values) ----- */
:root {
  --navy-900: #0f2b5b;
  --navy-800: #163a63;
  --blue-600: #1f5fae;
  --blue-100: #eaf2fb;
  --terracotta-600: #c75b3a;
  --terracotta-700: #a9472d;
  --terracotta-100: #f8e9e2;
  --ivory-page: #f7f5f1;
  --ivory-white: #fffdf9;
  --white: #ffffff;

  /* Kept for older rules that still name the old brand colours */
  --brand-terracotta: var(--terracotta-600);
  --brand-ink: #20242a;
  --brand-paper: var(--ivory-page);
  --brand-white: var(--white);
  --brand-muted: #667085;
  --brand-ochre: var(--terracotta-600);
}

/* ----- Semantic colours: light ----- */
:root {
  color-scheme: light;

  /* Surfaces */
  --surface-page: var(--ivory-page);
  --surface-card: var(--white);
  --surface-warm: var(--ivory-white);
  --surface-subtle: #fbfaf8;
  --surface-elevated: var(--white);
  --surface-navy: var(--navy-900);

  /* Text */
  --text-primary: #20242a;
  --text-secondary: #5d6679; /* AA (4.5:1) on white, ivory and tinted surfaces */
  --text-muted: #636d80; /* AA (4.5:1) on white, ivory and tinted surfaces */
  --text-heading: var(--navy-900);
  --text-on-navy: #ffffff;
  --text-on-navy-muted: rgba(255, 255, 255, 0.72);

  /* Borders */
  --border-default: #e4e7ec;
  --border-subtle: #eeeae4;
  --border-input: #d0d5dd;

  /* Brand roles */
  --color-navy: var(--navy-900);
  --action-navy: var(--navy-900);
  --action-navy-hover: var(--navy-800);
  --color-link: var(--blue-600);
  --color-focus: #1f5fae;
  --color-brand: var(--terracotta-600);        /* active underline, accents, map highlights */
  --color-brand-action: #c0562f;               /* filled CTA buttons: #C75B3A darkened a touch for AA with white text */
  --color-brand-hover: var(--terracotta-700);
  --color-brand-soft: var(--terracotta-100);
  --color-on-brand: #ffffff; /* text on terracotta fills */
  --color-brand-text: var(--terracotta-700);   /* terracotta as text (AA on white) */
  --color-info-soft: var(--blue-100);

  /* Semantic states (terracotta is never used for errors) */
  --success: #2b7556; /* #2E7D5B in the brief, darkened slightly for AA on its background */
  --success-bg: #e9f5ef;
  --warning: #9a6416; /* #B7791F in the brief, darkened for AA text contrast */
  --warning-bg: #fff4db;
  --danger: #b42318;
  --danger-bg: #fdecec;
  --info: #2f6daa;
  --info-bg: #ebf3fb;

  /* Canonical track colours (one system for the whole site; also in content/tracks.json) */
  --track-eeh: #2f6daa;
  --track-eeh-soft: #eaf2fa;
  --track-ep: #6b5aa6;
  --track-ep-soft: #f0edf8;
  --track-mhi: #c75b3a;
  --track-mhi-soft: #f8e9e2;
  --track-phm: #3d7d6a;
  --track-phm-soft: #e9f3ef;
  /* Track colour as small text on its soft background (AA) */
  --track-eeh-text: var(--track-eeh);
  --track-ep-text: var(--track-ep);
  --track-mhi-text: #a9472d;
  --track-phm-text: #336a5a;

  /* City accents (secondary only) */
  --city-bologna: #c75b3a;
  --city-oslo: #3b6e8f;
  --city-innsbruck: #497560;
  --city-rotterdam: #426983;

  /* Community map scale */
  --map-0: #e7e9ee;
  --map-1: #f3d8cc;
  --map-2: #e9a98e;
  --map-3: #d97957;
  --map-4: #b94a2c;
  --map-selected: #8f321d;
  --map-sea: #f4f6f9;

  /* ----- Names used across the existing pages (mapped onto the system above) ----- */
  --color-primary: var(--blue-600);            /* interactive: links, selected controls, focus */
  --color-primary-light: var(--blue-100);
  --color-primary-border: #c9dbf0;
  --color-on-primary: #ffffff;
  --color-header-bg: var(--ivory-white);
  --color-header-text: var(--navy-900);
  --color-text: var(--text-primary);
  --color-heading: var(--text-heading);
  --color-muted: var(--text-secondary);
  --color-faint: var(--text-muted);
  --color-background: var(--surface-page);
  --color-card: var(--surface-card);
  --color-surface-alt: var(--surface-warm);
  --color-surface-zebra: var(--surface-subtle);
  --color-surface-muted: #f3f1ed;
  --color-border: var(--border-default);
  --color-divider: var(--border-subtle);
  --color-input-border: var(--border-input);
  --color-shadow: rgba(15, 43, 91, 0.06);
  --color-shadow-strong: rgba(15, 43, 91, 0.14);
  --color-accent: #b7791f; /* notices, demo labels, highlights (warning amber; terracotta stays for brand emphasis) */
  --color-warning-bg: var(--warning-bg);
  --color-success-bg: var(--success-bg);
  --color-success-text: var(--success);
  --color-danger-bg: var(--danger-bg);
  --color-danger-text: var(--danger);
  --color-urgent: var(--danger);
  --pill-blue-bg: var(--info-bg);
  --pill-blue-text: #1d4f8c;
  --pill-purple-bg: #f0edf8;
  --pill-purple-text: #4f3f8a;
  --pill-amber-bg: var(--warning-bg);
  --pill-amber-text: #8a5a0b;
  --pill-orange-bg: var(--terracotta-100);
  --pill-orange-text: var(--terracotta-700);
  --pill-pink-bg: #f6e6f0;
  --pill-pink-text: #8a2f63;
}

/* ----- Semantic colours: dark (a parallel brand palette, not an inversion) -----
   They apply when the device is set to dark mode (unless the visitor chose light with the theme
   button), or when the visitor chose dark. theme.js sets data-theme on <html>.
   The two blocks below must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-page: #111827;
    --surface-card: #182230;
    --surface-warm: #151f2c;
    --surface-subtle: #1b2532;
    --surface-elevated: #202b3a;
    --surface-navy: #091d3a;
    --text-primary: #f2f4f7;
    --text-secondary: #cbd5e1;
    --text-muted: #98a2b3;
    --text-heading: #f2f4f7;
    --text-on-navy: #f2f4f7;
    --text-on-navy-muted: rgba(242, 244, 247, 0.72);
    --border-default: #344054;
    --border-subtle: #2a3546;
    --border-input: #475467;
    --color-navy: #a9c3e6;
    --action-navy: #2c5c96;
    --action-navy-hover: #3669a8;
    --color-link: #74a7df;
    --color-focus: #74a7df;
    --color-brand: #e78562;
    --color-brand-action: #e78562;
    --color-brand-hover: #f09a7b;
    --color-brand-soft: #3a2621;
    --color-brand-text: #f0a184;
    --color-on-brand: #1d1512;
    --color-info-soft: #1c2f47;
    --success: #6fc29b;
    --success-bg: #15302a;
    --warning: #f0c169;
    --warning-bg: #33290f;
    --danger: #f59a92;
    --danger-bg: #3b1d1d;
    --info: #74a7df;
    --info-bg: #1c2f47;
    --track-eeh: #74a7df;
    --track-eeh-soft: #1c2f47;
    --track-ep: #a79add;
    --track-ep-soft: #2a2442;
    --track-mhi: #e78562;
    --track-mhi-soft: #3a2621;
    --track-phm: #6fc29b;
    --track-phm-soft: #15302a;
    --track-mhi-text: #e78562;
    --track-phm-text: #6fc29b;
    --city-bologna: #e78562;
    --city-oslo: #7fb0cf;
    --city-innsbruck: #8cc0a4;
    --city-rotterdam: #86aed0;
    --map-0: #2a3546;
    --map-1: #5a3428;
    --map-2: #8c4630;
    --map-3: #c2603d;
    --map-4: #e78562;
    --map-selected: #ffffff;
    --map-sea: #142030;
    --color-primary: #74a7df;
    --color-primary-light: #1c2f47;
    --color-primary-border: #2d4a6e;
    --color-on-primary: #0b1626;
    --color-header-bg: #0d1a2e;
    --color-header-text: #f2f4f7;
    --color-surface-muted: #1f2a38;
    --color-shadow: rgba(0, 0, 0, 0.35);
    --color-shadow-strong: rgba(0, 0, 0, 0.55);
    --color-accent: #e0a64f;
    --pill-blue-text: #9cc6f2;
    --pill-purple-bg: #2a2442;
    --pill-purple-text: #c6b4f2;
    --pill-amber-text: #f0c169;
    --pill-orange-bg: #3a2621;
    --pill-orange-text: #f0a184;
    --pill-pink-bg: #3a2031;
    --pill-pink-text: #eda5d1;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-page: #111827;
  --surface-card: #182230;
  --surface-warm: #151f2c;
  --surface-subtle: #1b2532;
  --surface-elevated: #202b3a;
  --surface-navy: #091d3a;
  --text-primary: #f2f4f7;
  --text-secondary: #cbd5e1;
  --text-muted: #98a2b3;
  --text-heading: #f2f4f7;
  --text-on-navy: #f2f4f7;
  --text-on-navy-muted: rgba(242, 244, 247, 0.72);
  --border-default: #344054;
  --border-subtle: #2a3546;
  --border-input: #475467;
  --color-navy: #a9c3e6;
  --action-navy: #2c5c96;
  --action-navy-hover: #3669a8;
  --color-link: #74a7df;
  --color-focus: #74a7df;
  --color-brand: #e78562;
  --color-brand-action: #e78562;
  --color-brand-hover: #f09a7b;
  --color-brand-soft: #3a2621;
  --color-brand-text: #f0a184;
  --color-on-brand: #1d1512;
  --color-info-soft: #1c2f47;
  --success: #6fc29b;
  --success-bg: #15302a;
  --warning: #f0c169;
  --warning-bg: #33290f;
  --danger: #f59a92;
  --danger-bg: #3b1d1d;
  --info: #74a7df;
  --info-bg: #1c2f47;
  --track-eeh: #74a7df;
  --track-eeh-soft: #1c2f47;
  --track-ep: #a79add;
  --track-ep-soft: #2a2442;
  --track-mhi: #e78562;
  --track-mhi-soft: #3a2621;
  --track-phm: #6fc29b;
  --track-phm-soft: #15302a;
  --track-mhi-text: #e78562;
  --track-phm-text: #6fc29b;
  --city-bologna: #e78562;
  --city-oslo: #7fb0cf;
  --city-innsbruck: #8cc0a4;
  --city-rotterdam: #86aed0;
  --map-0: #2a3546;
  --map-1: #5a3428;
  --map-2: #8c4630;
  --map-3: #c2603d;
  --map-4: #e78562;
  --map-selected: #ffffff;
  --map-sea: #142030;
  --color-primary: #74a7df;
  --color-primary-light: #1c2f47;
  --color-primary-border: #2d4a6e;
  --color-on-primary: #0b1626;
  --color-header-bg: #0d1a2e;
  --color-header-text: #f2f4f7;
  --color-surface-muted: #1f2a38;
  --color-shadow: rgba(0, 0, 0, 0.35);
  --color-shadow-strong: rgba(0, 0, 0, 0.55);
  --color-accent: #e0a64f;
  --pill-blue-text: #9cc6f2;
  --pill-purple-bg: #2a2442;
  --pill-purple-text: #c6b4f2;
  --pill-amber-text: #f0c169;
  --pill-orange-bg: #3a2621;
  --pill-orange-text: #f0a184;
  --pill-pink-bg: #3a2031;
  --pill-pink-text: #eda5d1;
}

/* =====================================================================
   2. BASE, TYPOGRAPHY AND LAYOUT
   ===================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header-height) + 16px); /* anchors land below the sticky header */
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--color-heading);
}

/* Big titles use the serif heading font on every page */
h1 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.012em;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.2em;
}

a {
  color: var(--color-link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Form fields follow the theme */
input,
select,
textarea {
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-sm);
}

/* Containers: general content, data-heavy pages, long reading */
.container {
  width: 100%;
  max-width: var(--width-content);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container-wide {
  max-width: var(--width-wide);
}

.container-reading {
  max-width: var(--width-reading);
}

main {
  padding-top: var(--space-7);
  padding-bottom: var(--space-9);
}

/* Section pattern: optional eyebrow, serif title, description, action on the right */
.section {
  padding: var(--section-y) 0;
}

.section-warm {
  background: var(--surface-warm);
}

.section-white {
  background: var(--surface-card);
}

.section-eyebrow,
.eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-brand-text);
}

.section-description {
  margin: var(--space-2) 0 0;
  max-width: 62ch;
  color: var(--color-muted);
  font-size: var(--fs-body-lg);
}

/* A thin terracotta rule: the one editorial accent of the brand */
.brand-rule {
  display: block;
  width: 40px;
  height: 3px;
  margin: 0 0 var(--space-4);
  border-radius: 2px;
  background: var(--color-brand);
}

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

/* One focus ring for the whole site (keyboard only), in both themes */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* "Skip to content": invisible until reached with the keyboard */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-link);
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  transition: top var(--dur-fast) var(--ease);
}

.skip-link:focus {
  top: 12px;
}

/* =====================================================================
   3. GLOBAL SHELL: HEADER, NAVIGATION, MOBILE DRAWER (built by site-nav.js)
   ===================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  color: var(--color-header-text);
  border-bottom: 1px solid var(--border-subtle);
  transition: box-shadow var(--dur) var(--ease);
}

/* The frosted background is a separate layer: a backdrop-filter on the header itself would trap the
   phone drawer (position: fixed) inside the header box */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--color-header-bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
}

.site-header .container {
  max-width: var(--width-wide);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.site-header.is-compact {
  box-shadow: 0 4px 18px var(--color-shadow);
}

.header-bar {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: var(--header-height);
  transition: min-height var(--dur) var(--ease);
}

.site-header.is-compact .header-bar {
  min-height: 58px;
}

/* Brand lockup: a small monogram, "EU-HEM" and "Student Hub" (clearly unofficial, no official logos) */
.brand {
  flex: none;
  min-width: 0;
}

.site-title {
  margin: 0;
  font-size: 1rem;
}

.site-title a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-header-text);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--navy-900);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

:root[data-theme="dark"] .brand-mark {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  }
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--terracotta-600);
}

.brand-words {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--color-header-text);
}

.brand-product {
  font-family: var(--font-heading);
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-header-text);
}

.site-tagline {
  display: none; /* replaced by the lockup; the descriptor below is shown on wide screens */
}

.brand-descriptor {
  margin-left: var(--space-3);
  padding-left: var(--space-3);
  border-left: 1px solid var(--border-default);
  font-size: var(--fs-meta);
  line-height: 1.3;
  color: var(--color-muted);
  max-width: 11em;
}

.header-bar .site-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.menu {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-item {
  position: relative;
}

.menu-group,
.menu > .menu-item > .menu-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-header-text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.menu-group .icon-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  transition: transform var(--dur-fast) var(--ease);
}

.menu-group[aria-expanded="true"] .icon-chevron {
  transform: rotate(180deg);
}

.menu-group:hover,
.menu > .menu-item > .menu-link:hover,
.menu-group[aria-expanded="true"] {
  background: var(--color-surface-muted);
}

/* Current page: navy text with a thin terracotta underline */
.menu-group.is-current::after,
.menu > .menu-item > .menu-link.is-current::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-brand);
}

.menu > .menu-item > .menu-link .icon {
  display: none;
}

/* Dropdowns: white surface, icon + label + one line of description */
.menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 50;
  width: 300px;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  background: var(--surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
}

.menu-group[aria-expanded="true"] + .menu-dropdown {
  display: block;
  animation: menu-in var(--dur-fast) var(--ease);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translate(-50%, -4px);
  }
}

.menu-dropdown .menu-link {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  column-gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.93rem;
}

.menu-dropdown .menu-link .icon {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-link);
}

.menu-link-text {
  display: flex;
  flex-direction: column;
}

.menu-link-desc {
  font-size: var(--fs-meta);
  font-weight: 400;
  color: var(--color-muted);
  line-height: 1.35;
}

.menu-dropdown .menu-link:hover {
  background: var(--color-primary-light);
}

.menu-dropdown .menu-link.is-current {
  background: var(--color-surface-muted);
  box-shadow: inset 3px 0 0 var(--color-brand);
}

/* Header actions: search, theme, Join, menu */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.header-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-card);
  color: var(--color-header-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.header-button:hover {
  border-color: var(--color-primary-border);
  background: var(--color-primary-light);
}

.header-button kbd {
  font-family: inherit;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--color-surface-muted);
  color: var(--color-muted);
}

.search-button {
  min-width: 180px;
  justify-content: flex-start;
  color: var(--color-muted);
  font-weight: 500;
}

.search-button kbd {
  margin-left: auto;
}

.header-actions .theme-toggle {
  width: 40px;
  padding: 0;
}

.menu-toggle,
.drawer-head,
.drawer-search,
.drawer-extras {
  display: none;
}

/* Narrower desktops: no descriptor below 1320px, then a shorter search button */
@media (max-width: 1320px) {
  .brand-descriptor {
    display: none;
  }
}

@media (max-width: 1240px) {

  .search-button {
    min-width: 0;
  }

  .search-button kbd {
    display: none;
  }
}

@media (max-width: 1080px) {
  .header-cta {
    display: none;
  }

  .search-button .search-label {
    display: none;
  }
}

/* ----- Phones and tablets: a drawer from the right ----- */
@media (max-width: 900px) {
  :root {
    --header-height: 62px;
  }

  .header-bar {
    gap: var(--space-2);
  }

  .header-actions .menu-toggle {
    display: inline-flex;
  }

  .header-actions .search-button {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-product {
    font-size: 1.1rem;
  }

  .header-bar .site-nav {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 60;
    width: min(380px, 88vw);
    flex: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--space-4) var(--space-5) var(--space-7);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface-elevated);
    box-shadow: var(--shadow-lg);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform var(--dur-slow) var(--ease), visibility 0s linear var(--dur-slow);
  }

  .header-bar .site-nav.is-open {
    transform: none;
    visibility: visible;
    transition: transform var(--dur-slow) var(--ease), visibility 0s;
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(9, 29, 58, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-slow) var(--ease);
  }

  .drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-divider);
  }

  .drawer-search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: 48px;
    margin-bottom: var(--space-3);
    padding: 0 var(--space-4);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    background: var(--color-card);
    color: var(--color-muted);
    font: inherit;
    cursor: pointer;
  }

  .menu {
    display: block;
  }

  .menu-item + .menu-item {
    margin-top: var(--space-2);
  }

  /* Groups become headings with their links below */
  .menu-group {
    display: block;
    width: 100%;
    min-height: 0;
    padding: var(--space-3) 0 var(--space-1);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: var(--tracking-eyebrow);
    font-size: var(--fs-eyebrow);
    color: var(--color-muted);
    cursor: default;
    pointer-events: none;
  }

  .menu-group .icon-chevron,
  .menu-group.is-current::after {
    display: none;
  }

  .menu-group:hover,
  .menu-group[aria-expanded="true"] {
    background: transparent;
  }

  .menu-dropdown,
  .menu-group[aria-expanded="true"] + .menu-dropdown {
    display: block;
    position: static;
    width: auto;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    transform: none;
    animation: none;
  }

  .menu-dropdown .menu-link,
  .menu > .menu-item > .menu-link {
    min-height: 48px;
    padding: var(--space-2) var(--space-2);
  }

  .menu > .menu-item > .menu-link {
    display: flex;
    width: 100%;
    font-weight: 600;
  }

  .menu > .menu-item > .menu-link .icon {
    display: inline;
  }

  .menu > .menu-item > .menu-link.is-current::after {
    left: 0;
    right: auto;
    top: 10px;
    bottom: 10px;
    width: 3px;
    height: auto;
  }

  .menu-link-desc {
    display: none;
  }

  .drawer-extras {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-divider);
  }

  .drawer-extras a,
  .drawer-extras button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-2);
    border: none;
    background: none;
    color: var(--color-text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
  }

  body.drawer-open {
    overflow: hidden;
  }
}

@media (max-width: 420px) {
  .brand-name {
    font-size: 0.7rem;
  }

  .brand-product {
    font-size: 1rem;
  }

  .header-actions .header-button:not(.menu-toggle) {
    width: 38px;
    min-width: 38px;
  }

  .menu-toggle-label {
    display: none;
  }
}

/* =====================================================================
   4. FOOTER (built by site-nav.js): one slim deep-navy band
   ===================================================================== */
.site-footer {
  margin-top: 0;
  padding: clamp(40px, 5vw, 64px) 0 var(--space-5);
  background: var(--surface-navy);
  color: var(--text-on-navy-muted);
  font-size: var(--fs-small);
}

/* Brand / programme identity at left; navigation groups breathe in a 3 × 2 rhythm at right. */
.footer-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(0, 2.2fr);
  align-items: start;
  gap: var(--space-8) clamp(40px, 5vw, 72px);
}

.footer-brand {
  min-width: 0;
}

.footer-brand-link {
  color: var(--white);
  text-decoration: none;
}

.footer-brand .brand-name,
.footer-brand .brand-product,
.footer-brand .brand-mark {
  color: var(--white);
}

.footer-brand p {
  max-width: 34ch;
  margin: var(--space-4) 0 0;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.86);
}

.footer-brand .footer-about {
  margin-top: var(--space-2);
  font-size: var(--fs-meta);
  color: var(--text-on-navy-muted);
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: clamp(24px, 3vw, 48px);
  row-gap: var(--space-7);
}

.footer-column {
  min-width: 0;
}

.footer-heading {
  margin: 0 0 14px;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 650;
  letter-spacing: 0;
  color: var(--white);
}

.footer-links ul,
.footer-brand-links {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-brand-links {
  margin-top: var(--space-4);
}

.footer-programme {
  max-width: 320px;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.footer-programme-label {
  margin: 0;
  color: var(--white);
  font-size: var(--fs-small);
  font-weight: 650;
}

.footer-programme-note {
  margin: 3px 0 0 !important;
  max-width: none !important;
  color: var(--text-on-navy-muted) !important;
  font-size: var(--fs-meta) !important;
}

/* The official channels read as one compact visual group instead of four unrelated buttons. */
.footer-socials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.footer-social-link:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.11);
  color: var(--white);
  text-decoration: none;
}

.footer-social-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.footer-social-text {
  min-width: 0;
  overflow: hidden;
  font-size: var(--fs-meta);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer-links a,
.footer-brand-links a,
.footer-links button.footer-link {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.footer-links a:hover,
.footer-brand-links a:hover,
.footer-links button.footer-link:hover {
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer :focus-visible {
  outline-color: #9cc6f2;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  margin: var(--space-8) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: var(--fs-meta);
  color: var(--text-on-navy-muted);
}

.footer-bottom p {
  margin: 0;
  max-width: 70ch;
}

/* Release stage and version (site-nav.js, from content/roadmap.json) */
.footer-bottom .footer-version {
  padding: 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-pill);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.footer-bottom .footer-version:hover {
  color: var(--white);
  border-color: var(--white);
}

.footer-bottom .footer-signature {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.86);
}

@media (max-width: 1100px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .footer-programme {
    max-width: 360px;
  }
}

@media (max-width: 700px) {
  .site-footer {
    padding-top: var(--space-8);
  }

  .footer-grid {
    gap: var(--space-7);
  }

  .footer-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-6);
    row-gap: var(--space-7);
  }

  .footer-bottom {
    margin-top: var(--space-7);
  }
}

@media (max-width: 420px) {
  .footer-links {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .footer-programme {
    max-width: none;
  }

  .footer-socials {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =====================================================================
   5. BUTTONS
   .button (navy action) · .button-primary (terracotta, the main call to action in a region)
   · .button-secondary / .button-quiet (outline) · .button-ghost · .button-danger (semantic red)
   ===================================================================== */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--action-navy);
  color: var(--white);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.button:hover {
  background: var(--action-navy-hover);
  box-shadow: var(--shadow-sm);
}

.button:active {
  transform: translateY(1px);
}

.button[disabled],
.button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.button-primary {
  background: var(--color-brand-action);
  color: var(--color-on-brand);
}

.button-primary:hover {
  background: var(--color-brand-hover);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .button-primary {
    color: #1d1512;
  }
}

.button-secondary,
.button-quiet {
  background: transparent;
  color: var(--color-navy);
  border-color: var(--color-input-border);
}

.button-secondary:hover,
.button-quiet:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-border);
}

.button-ghost {
  background: transparent;
  color: var(--color-link);
  padding-inline: var(--space-2);
}

.button-ghost:hover {
  background: var(--color-primary-light);
  box-shadow: none;
}

.button-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: var(--fs-small);
}

/* A small arrow that moves 3px on hover: <span class="arrow" aria-hidden="true">→</span> */
.arrow {
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease);
}

a:hover .arrow,
button:hover .arrow,
.card-interactive:hover .arrow {
  transform: translateX(3px);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--color-link);
  text-decoration: none;
}

.link-arrow:hover {
  text-decoration: underline;
}

/* =====================================================================
   6. CARDS
   .card (default) · .card-interactive (lifts 1–2px) · .card-muted · .card-feature
   ===================================================================== */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.card h2 {
  margin-top: 0;
  color: var(--color-heading);
  font-size: var(--fs-h3);
  font-weight: 700;
}

.card-interactive {
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.card-interactive:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-md);
}

.card-muted {
  background: var(--surface-subtle);
  box-shadow: none;
}

.card-feature {
  border-top: 3px solid var(--color-brand);
}

.note {
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-2) var(--space-3);
}

.placeholder {
  color: var(--color-muted);
  font-style: italic;
}

/* =====================================================================
   7. PILLS AND BADGES
   ===================================================================== */
.pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-size: var(--fs-meta);
  font-weight: 600;
  line-height: 1.6;
}

.pill-info { background: var(--info-bg); color: var(--pill-blue-text); }
.pill-brand { background: var(--color-brand-soft); color: var(--color-brand-text); }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.demo-pill { background: var(--warning-bg); color: var(--warning); border: 1px dashed currentColor; }

/* Track pills: one colour system for the whole site (EEH blue, E&P purple, MHI terracotta, PHM green) */
.track-color-0,
.track-pill-eeh { background: var(--track-eeh-soft); color: var(--track-eeh-text); }
.track-color-1,
.track-pill-ep { background: var(--track-ep-soft); color: var(--track-ep-text); }
.track-color-2,
.track-pill-mhi { background: var(--track-mhi-soft); color: var(--track-mhi-text); }
.track-color-3,
.track-pill-phm { background: var(--track-phm-soft); color: var(--track-phm-text); }

/* =====================================================================
   8. FILTERS AND CHIPS (shared look for Students, Thesis, Notes)
   ===================================================================== */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 14px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-pill);
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
  font-size: var(--fs-small);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.filter-chip:hover {
  border-color: var(--color-primary-border);
}

.filter-chip[aria-pressed="true"],
.filter-chip.is-active {
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
  color: var(--color-brand-text);
  font-weight: 600;
}

/* =====================================================================
   9. FEEDBACK: EMPTY, ERROR, LOCKED STATES
   ===================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-5);
  text-align: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  color: var(--color-muted);
}

.empty-state .icon {
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-link);
}

.empty-state strong {
  color: var(--color-heading);
  font-size: var(--fs-body-lg);
}

.feedback {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.feedback-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.feedback-success { background: var(--success-bg); color: var(--success); }
.feedback-info { background: var(--info-bg); color: var(--info); }
.feedback-warning { background: var(--warning-bg); color: var(--warning); }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Schedule ===== */
.schedule-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  margin-bottom: 12px;
}

/* min-width: 0 lets the label shrink, so long course names can't push the dropdown off-screen */
.schedule-filters label {
  min-width: 0;
  max-width: 100%;
}

.schedule-filters select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px;
  font-size: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Limits the list height so the page doesn't become endless; it scrolls inside */
#schedule-list {
  max-height: 600px;
  overflow-y: auto;
}

.schedule-day h3 {
  margin: 16px 0 8px;
  font-size: 1rem;
  color: var(--color-primary);
  border-bottom: 1px solid var(--color-primary-light);
  padding-bottom: 4px;
}

.schedule-day.is-today h3 {
  background: var(--color-primary-light);
  padding: 4px 8px;
}

.schedule-item {
  display: flex;
  gap: 16px;
  padding: 8px 0;
}

.schedule-time {
  flex: 0 0 110px;
  font-weight: 600;
}

.schedule-course {
  font-weight: 600;
}

.schedule-meta {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: var(--radius-sm);
}

/* ===== Exams ===== */
#exam-list {
  max-height: 600px;
  overflow-y: auto;
}

.exam-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-primary-light);
}

.exam-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--color-primary);
  font-weight: 600;
}

.exam-course {
  font-weight: 600;
  margin-top: 2px;
}

.exam-registration {
  font-size: 0.9rem;
  margin-top: 4px;
  color: var(--color-muted);
}

/* Registration currently open: make it stand out */
.exam-registration.is-open {
  color: var(--color-success-text);
  font-weight: 600;
}

/* ===== Calendar subscription ===== */
.copy-row {
  display: flex;
  gap: 8px;
}

/* The link box takes the remaining space; min-width: 0 lets it shrink on phones */
.copy-row input {
  flex: 1;
  min-width: 0;
  padding: 6px;
  font-size: 0.9rem;
}

/* ===== City guide ===== */
.guide h1 {
  margin-top: 0;
  font-size: var(--fs-h1);
  line-height: 1.15;
  color: var(--color-heading);
}

.guide h2 {
  margin-top: 28px;
  scroll-margin-top: 12px;
}

.guide h3 {
  margin-bottom: 4px;
}

/* Long web addresses (e.g. in Sources) wrap instead of making the page wider */
.guide a {
  overflow-wrap: anywhere;
}

.guide hr {
  border: none;
  border-top: 1px solid var(--color-primary-light);
  margin: 24px 0 0;
}

/* "Last checked" + disclaimer box under the title */
.guide-notice {
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--color-warning-bg);
  border-left: 4px solid var(--color-accent);
  border-radius: 4px;
}

.guide-notice p {
  margin: 0;
}

/* Quote boxes inside the guide (e.g. Student tips) */
.guide blockquote.note {
  margin: 12px 0;
}

.guide blockquote.note p {
  margin: 0;
}

/* Table of contents */
.guide-toc {
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.guide-toc h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.guide-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-toc li {
  padding: 3px 0;
  break-inside: avoid;
}

/* Two columns on wider screens */
@media (min-width: 640px) {
  .guide-toc ul {
    columns: 2;
    column-gap: 24px;
  }
}

.guide-back {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
}

/* Tables scroll sideways inside this box on small screens */
.table-wrapper {
  overflow-x: auto;
  margin: 12px 0;
}

.guide table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

.guide th,
.guide td {
  border: 1px solid var(--color-border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.guide th {
  background: var(--color-primary-light);
}

.guide caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 6px;
  font-size: 0.88rem;
  color: var(--color-muted);
}

/* ----- City guides: index, notices, "My track" ----- */
.guide-breadcrumb {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.guide-notice .guide-checked {
  font-weight: 700;
}

.guide-notice p + p {
  margin-top: 6px;
}

.guide-report {
  font-size: 0.9rem;
}

.guide-disclaimer {
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.guide-my-track {
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--color-success-bg);
  border-left: 4px solid var(--color-primary);
  border-radius: 4px;
}

.guide-my-track p {
  margin: 0;
}

.guide-my-track p + p {
  margin-top: 4px;
}

.guide-my-track-next {
  font-size: 1.05rem;
}

.guide-my-track-next a {
  font-weight: 700;
}

.guide-my-track-note {
  font-size: 0.88rem;
}

.guide-city-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  margin: var(--space-6) 0;
  padding: 0;
  list-style: none;
}

/* First thing in the card (the title is in the page header above): no extra gap */
.guide > .guide-city-cards:first-child { margin-top: 0; }

.guide-city-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--city-accent, var(--color-brand));
  border-radius: var(--radius-lg);
  background: var(--color-card);
  color: var(--color-text);
  text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.guide-city-card[href*="bologna"] { --city-accent: var(--city-bologna); }
.guide-city-card[href*="oslo"] { --city-accent: var(--city-oslo); }
.guide-city-card[href*="rotterdam"] { --city-accent: var(--city-rotterdam); }
.guide-city-card[href*="innsbruck"] { --city-accent: var(--city-innsbruck); }

.guide-city-card:hover,
.guide-city-card:focus-visible {
  border-color: var(--color-primary-border);
  border-top-color: var(--city-accent, var(--color-brand));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.guide-city-card strong {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--color-heading);
}

.guide-city-card .city-country,
.guide-city-university,
.guide-city-presence {
  font-size: 0.88rem;
  color: var(--color-muted);
}

.guide-city-card .city-country {
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  color: var(--color-muted);
}

.guide-city-card .city-status {
  margin-top: auto;
  padding-top: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.guide-city-card .city-status.is-ready {
  color: var(--color-primary);
}

/* Comparison: choose cities with buttons; topics grouped; the saved track's cities highlighted */
.guide-compare-intro {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--color-muted);
}

.compare-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.compare-chip {
  min-height: 40px;
  padding: 6px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.compare-chip[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.compare-chip[aria-pressed="true"]::before {
  content: "✓ ";
}

.compare-chip.compare-mine {
  border-style: dashed;
}

.compare-chip:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.compare-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.guide .compare-table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.guide .compare-table th,
.guide .compare-table td {
  border: none;
  border-bottom: 1px solid var(--color-divider);
  min-width: 150px;
}

.guide .compare-table thead th {
  background: var(--color-surface-alt);
  vertical-align: bottom;
}

.compare-table thead th a {
  font-family: var(--font-heading);
  font-size: 1.1rem;
}

.compare-who {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-muted);
}

/* The topic column stays visible while the table scrolls sideways */
.guide .compare-table th[scope="row"],
.guide .compare-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 120px;
  max-width: 160px;
  background: var(--color-card);
  font-weight: 600;
  font-size: 0.85rem;
}

.guide .compare-table thead th:first-child {
  background: var(--color-surface-alt);
}

.guide .compare-table .compare-group th {
  position: static;
  max-width: none;
  padding-top: 14px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guide .compare-table .is-mine {
  background: var(--color-success-bg);
}

.guide .compare-table thead th.is-mine {
  box-shadow: inset 0 3px 0 var(--color-primary);
}

/* Grey text is too faint on the highlight colour, so it uses the normal text colour there */
.compare-table .is-mine .source-tag,
.compare-table .is-mine .compare-who {
  color: var(--color-text);
}

/* Topic lines are only for phones; wider screens use the topic column */
.compare-table .compare-topic {
  display: none;
}

@media (max-width: 600px) {
  .compare-table .compare-topic {
    display: table-row;
  }

  .guide .compare-table .compare-topic th {
    position: static;
    max-width: none;
    padding: 10px 10px 0;
    border-bottom: none;
    background: var(--color-card);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-muted);
  }

  .guide .compare-table th[scope="row"],
  .guide .compare-table thead th:first-child {
    display: none;
  }

  .guide .compare-table td,
  .guide .compare-table thead th {
    min-width: 140px;
  }
}

.guide-compare-note {
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* ----- City guide page: "At a glance", contents menu, folding sections, sources ----- */
.guide-glance {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 12px;
}

.guide-glance dt {
  font-weight: 600;
}

.guide-glance dd {
  margin: 0;
}

/* The contents menu sticks under the site header while scrolling */
.guide-jump {
  position: sticky;
  top: calc(var(--guide-sticky-top, var(--header-height)) + 4px);
  z-index: 5;
  margin: 0 0 8px;
  padding: 8px 14px;
  background: var(--color-primary-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.guide-jump summary {
  cursor: pointer;
  font-weight: 700;
}

.guide-jump ol {
  max-height: 65vh;
  overflow-y: auto;
  margin: 8px 0;
  padding-left: 1.6em;
}

.guide-jump li {
  padding: 3px 0;
}

@media (min-width: 640px) {
  .guide-jump ol {
    columns: 2;
    column-gap: 28px;
  }

  .guide-jump li {
    break-inside: avoid;
  }
}

.guide-section h2 {
  scroll-margin-top: calc(var(--guide-sticky-top, var(--header-height)) + 64px);
  margin-bottom: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--color-primary-light);
}

.guide-section li[id] {
  scroll-margin-top: calc(var(--guide-sticky-top, var(--header-height)) + 64px);
}

/* The heading of a folding section is one big button */
.guide-fold {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 4px 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.guide-fold::after {
  content: "+";
  flex: none;
  width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.6em;
  text-align: center;
}

.guide-fold[aria-expanded="true"]::after {
  content: "−";
}

.guide-fold:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.source-tag {
  font-size: 0.75em;
  white-space: nowrap;
  text-decoration: none;
  color: var(--color-muted);
}

.source-tag:hover,
.source-tag:focus-visible {
  text-decoration: underline;
  color: var(--color-primary);
}

.guide-section li[id]:target {
  background: var(--color-warning-bg);
}

/* City photos: a mosaic (one large photo, five smaller) on wide screens, a row to swipe through
   on phones. The caption and credit sit on a dark fade at the bottom of each photo. */
.guide-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 190px;
  gap: 10px;
  margin: 4px 0 22px;
}

.guide-photos figure {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.guide-photos figure:first-child {
  grid-column: span 2;
  grid-row: span 2;
}

.guide-photos img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.guide-photos figure:hover img {
  transform: scale(1.04);
}

.guide-photos figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 30px 10px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.55) 60%, rgba(0, 0, 0, 0));
  color: var(--white);
  font-size: 0.72rem;
  line-height: 1.35;
}

.guide-photos figure:first-child figcaption {
  font-size: 0.8rem;
}

.guide-photos figcaption a {
  color: var(--white);
}

/* AI-generated pictures carry a visible badge (and say so in the caption and alt text) */
.guide-photos figure.is-ai::before {
  content: "AI illustration";
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.68);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
}

@media (max-width: 860px) {
  .guide-photos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 170px;
  }
}

@media (max-width: 600px) {
  .guide-photos {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }

  .guide-photos figure {
    flex: 0 0 86%;
    height: 230px;
    scroll-snap-align: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .guide-photos figure:hover img {
    transform: none;
  }
}

/* The photo at the top of a city card (City Guide index and homepage), with a small credit */
.city-card-photo {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--color-surface-muted);
}

.city-card-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.city-card .city-card-credit,
.guide-city-card .city-card-credit {
  position: absolute;
  right: 6px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.guide-city-card .city-card-photo {
  margin: -14px -16px 8px;
  border-radius: calc(var(--radius-md) - 2px) calc(var(--radius-md) - 2px) 0 0;
}

.city-card .city-card-photo {
  margin: -18px -18px 10px;
  border-radius: 12px 12px 0 0;
}

/* On phones, tables become one card per row, each value labelled with its column */
@media (max-width: 600px) {
  .guide-cards-on-phone thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .guide-cards-on-phone,
  .guide-cards-on-phone tbody,
  .guide-cards-on-phone tr,
  .guide-cards-on-phone th,
  .guide-cards-on-phone td {
    display: block;
    width: 100%;
  }

  .guide-cards-on-phone tr {
    margin-bottom: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
  }

  .guide-cards-on-phone th,
  .guide-cards-on-phone td {
    border: none;
    border-bottom: 1px solid var(--color-divider);
  }

  .guide-cards-on-phone caption {
    display: block;
  }

  .guide-cards-on-phone td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-muted);
  }

  .guide-glance {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .guide-glance dd {
    margin-bottom: 8px;
  }
}

/* ===== Students directory ===== */
.demo-banner {
  margin: 24px 0 16px;
  padding: 12px 16px;
  background: var(--color-warning-bg);
  border-left: 4px solid var(--color-accent);
  border-radius: 4px;
}

/* Header card: icon + title + count pill on one side, track tabs on the other */
.directory-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  background: var(--color-card);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: 0 1px 3px var(--color-shadow);
}

.directory-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.directory-title h2 {
  margin: 0;
  font-size: 1.4rem;
}

.directory-icon {
  width: 30px;
  height: 30px;
  fill: var(--color-primary);
}

.count-pill {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-pill);
  padding: 2px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Segmented tabs; they wrap onto more lines on narrow screens */
.track-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  max-width: 100%;
}

.track-tab {
  border: none;
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
}

.track-tab:hover {
  color: var(--color-primary);
}

.track-tab[aria-selected="true"] {
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: 600;
}

/* Toolbar: rounded search box, country filter, Join button */
.directory-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 20px 0 8px;
}

.search-pill {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-card);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
}

.search-pill:focus-within {
  border-color: var(--color-primary);
}

.search-pill svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.search-pill input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
}

.select-pill {
  flex: 0 1 220px;
  min-width: 0;
  background: var(--color-card);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-pill);
  padding: 9px 14px;
  font: inherit;
}

.join-button {
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.button.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.student-totals {
  font-weight: 600;
  color: var(--color-muted);
  margin: 8px 0 12px;
}

/* The table */
.directory-table-wrapper {
  background: var(--color-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 1px 3px var(--color-shadow);
  margin-bottom: 24px;
}

.directory-table {
  width: 100%;
  border-collapse: collapse;
}

.directory-table th {
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
}

.directory-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}

.directory-table tbody tr:nth-child(even) {
  background: var(--color-surface-zebra);
}

.directory-table tbody tr:hover {
  background: var(--color-primary-light);
}

.col-number {
  width: 40px;
  color: var(--color-muted);
  font-weight: 600;
}

.name-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-name {
  font-weight: 600;
}

.empty-value {
  color: var(--color-faint);
}

/* Track pills: one soft colour per track */
.track-pill {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.track-color-0 { background: var(--color-success-bg); color: var(--color-success-text); }
.track-color-1 { background: var(--pill-blue-bg); color: var(--pill-blue-text); }
.track-color-2 { background: var(--pill-amber-bg); color: var(--pill-amber-text); }
.track-color-3 { background: var(--pill-pink-bg); color: var(--pill-pink-text); }

.track-none {
  background: var(--color-surface-muted);
  color: var(--color-muted);
  font-style: italic;
  font-weight: 400;
}

.empty-row td {
  text-align: center;
  color: var(--color-muted);
  padding: 32px 14px;
}

/* On phones: each row becomes a small stacked card with labels */
@media (max-width: 640px) {
  .directory-table thead {
    display: none;
  }

  .directory-table,
  .directory-table tbody,
  .directory-table tr,
  .directory-table td {
    display: block;
    width: 100%;
  }

  .directory-table tbody tr {
    position: relative;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-divider);
  }

  .directory-table td {
    border: none;
    padding: 3px 0;
  }

  /* The number moves to the top-right corner */
  .directory-table td.col-number {
    position: absolute;
    top: 12px;
    right: 14px;
    width: auto;
    padding: 0;
    font-size: 0.8rem;
  }

  .directory-table td.col-name {
    padding: 0 30px 6px 0;
  }

  .select-pill {
    flex: 1 1 100%;
  }

  /* The column name ("Country", ...) appears before each value */
  .directory-table td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    width: 92px;
    color: var(--color-muted);
    font-size: 0.8rem;
  }

  .empty-row td {
    padding: 24px 0;
  }
}

/* ===== Announcements ===== */

/* Red bar at the top of every page when there is an active Urgent announcement */
.urgent-banner {
  background: var(--color-urgent);
  color: var(--white);
  padding: 10px 0;
  font-size: 0.95rem;
}

.urgent-banner a {
  color: var(--white);
  font-weight: 600;
}

.demo-note {
  background: var(--color-warning-bg);
  border-left: 4px solid var(--color-accent);
  padding: 8px 12px;
  border-radius: 4px;
}

.announcement-filters {
  margin-bottom: 8px;
}

.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.announcement {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  scroll-margin-top: 12px;
}

.announcement.is-pinned {
  border-left: 4px solid var(--color-primary);
}

/* The announcement someone arrived at from a link */
.announcement.is-highlighted {
  box-shadow: 0 0 0 3px var(--color-accent);
}

.announcement-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 0.8rem;
}

.announcement-date {
  color: var(--color-muted);
}

.announcement-title {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.1rem;
  font-weight: 600;
}

.announcement-message {
  margin: 4px 0 8px;
  white-space: pre-line; /* keeps the line breaks typed in the sheet */
}

.announcement-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  font-size: 0.9rem;
}

.read-more {
  font-weight: 600;
}

.posted-by {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* Home page: shorter cards */
.announcement.compact {
  padding: 10px 14px;
}

.announcement.compact .announcement-title {
  margin: 6px 0 0;
  font-size: 1rem;
}

.see-all {
  display: inline-block;
  margin-top: 12px;
  font-weight: 600;
}

/* Category badges, one colour each */
.category-badge,
.pinned-badge,
.new-badge {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-weight: 600;
  white-space: nowrap;
}

.category-university { background: var(--pill-blue-bg); color: var(--pill-blue-text); }
.category-academic { background: var(--pill-purple-bg); color: var(--pill-purple-text); }
.category-student { background: var(--color-success-bg); color: var(--color-success-text); }
.category-social { background: var(--pill-orange-bg); color: var(--pill-orange-text); }
.category-urgent { background: var(--color-urgent); color: var(--white); }
.category-other { background: var(--color-surface-muted); color: var(--color-muted); }

.pinned-badge {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.new-badge {
  background: var(--color-brand-action);
  color: var(--color-on-brand);
}

/* ===== Notes & Resources ===== */

/* Title on one side, buttons on the other; they stack on narrow screens */
.notes-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.notes-heading h2,
.notes-heading h3,
.notes-heading h4 {
  margin: 0;
}

.notes-search {
  margin-top: 12px;
}

.page-tabs {
  margin: 0 0 16px;
}

/* Course tabs are links (so the address changes); make them look like the other tabs */
a.track-tab {
  text-decoration: none;
}

.back-link {
  display: inline-block;
  margin: 16px 0 8px;
  font-weight: 600;
}

/* Small grey "Sample" tag on sample content */
.sample-tag {
  display: inline-block;
  margin: 0 6px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}

.save-button {
  border: 1px solid var(--color-input-border);
  background: var(--color-card);
  color: var(--color-primary);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.save-button[aria-pressed="true"] {
  background: var(--color-primary-light);
  font-weight: 600;
}

.button-light {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.inline-link {
  font-weight: 600;
}

.inline-link.is-disabled {
  color: var(--color-muted);
  font-weight: 400;
}

/* An item someone arrived at from a link (search, study list) */
.is-highlighted {
  box-shadow: 0 0 0 3px var(--color-accent);
  border-radius: var(--radius-sm);
}

/* Landing: course cards */
.course-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.course-card {
  display: block;
  background: var(--color-card);
  border-radius: var(--radius-sm);
  border-top: 4px solid var(--course-color, var(--color-primary));
  padding: 14px 16px;
  color: var(--color-text);
  text-decoration: none;
  box-shadow: 0 1px 3px var(--color-shadow);
}

.course-card:hover {
  box-shadow: 0 2px 8px var(--color-shadow-strong);
}

.course-card.is-overview-only {
  border-top-color: var(--color-input-border);
}

.course-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.course-card-title {
  font-weight: 700;
  color: var(--color-text);
}

.course-card-counts {
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.course-card-counts.is-empty {
  font-weight: 400;
  font-style: italic;
  color: var(--color-muted);
}

/* Course page */
.course-header {
  margin-bottom: 16px;
  border-top: 4px solid var(--course-color, var(--color-primary));
}

.course-header .page-tabs {
  margin: 12px 0 0;
}

.course-code {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-muted);
}

.course-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.course-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 12px 0;
}

.course-facts dt {
  font-weight: 600;
  color: var(--color-muted);
}

.course-facts dd {
  margin: 0;
}

.plain-list,
.topic-preview {
  margin-top: 4px;
}

/* Topics list */
.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-divider);
}

.topic-row-main {
  display: flex;
  flex-direction: column;
}

.topic-title {
  font-weight: 600;
}

.topic-row.is-empty .topic-title {
  font-weight: 400;
  color: var(--color-muted);
}

/* A topic's notes */
.notes-disclaimer {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--color-warning-bg);
  border-left: 4px solid var(--color-accent);
  border-radius: 4px;
}

.notes-meta {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.review-box {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
}

.review-box h4 {
  margin: 0 0 4px;
  color: var(--color-primary);
}

.markdown table {
  border-collapse: collapse;
  width: 100%;
}

.markdown th,
.markdown td {
  border: 1px solid var(--color-border);
  padding: 6px 10px;
  text-align: left;
}

.markdown th {
  background: var(--color-primary-light);
}

.markdown blockquote {
  margin: 12px 0;
  padding: 6px 12px;
  border-left: 4px solid var(--color-primary);
  background: var(--color-surface-alt);
}

.plain-markdown {
  white-space: pre-line;
}

.topic-extras {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--color-divider);
}

.topic-extras h4 {
  margin: 0 0 8px;
}

.chip {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-light);
  text-decoration: none;
  font-size: 0.85rem;
}

/* Concepts and resources */
.concept-list,
.resource-list,
.question-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.concept-card,
.resource-card,
.question-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  scroll-margin-top: 12px;
}

.concept-card p,
.resource-card p {
  margin: 6px 0 0;
}

.resource-type {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 10px;
  border-radius: var(--radius-pill);
  background: var(--pill-purple-bg);
  color: var(--pill-purple-text);
  font-size: 0.75rem;
  font-weight: 600;
}

.resource-title {
  font-weight: 600;
}

/* Practice: flashcards */
.practice-section + .practice-section {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--color-divider);
}

.flashcard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.flashcard-counter {
  font-weight: 600;
  color: var(--color-muted);
}

.flashcard {
  margin: 8px 0;
  padding: 20px;
  min-height: 140px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-primary-border);
  background: linear-gradient(180deg, var(--color-card), var(--color-primary-light));
}

.flashcard-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.flashcard-front {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 4px 0 16px;
}

.flashcard-back {
  margin: 4px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--color-primary-border);
}

/* Practice: questions */
.difficulty {
  text-transform: capitalize;
}

.question-type,
.difficulty {
  display: inline-block;
  padding: 1px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}

.question-type { background: var(--color-primary-light); color: var(--color-primary); }
.difficulty-easy { background: var(--color-success-bg); color: var(--color-success-text); }
.difficulty-medium { background: var(--pill-amber-bg); color: var(--pill-amber-text); }
.difficulty-hard { background: var(--color-danger-bg); color: var(--color-danger-text); }

.meta-spacer {
  flex: 1;
}

.question-text {
  font-weight: 600;
  margin: 10px 0;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.choice-row {
  flex-direction: row;
  flex-wrap: wrap;
}

.choice {
  text-align: left;
  border: 1px solid var(--color-input-border);
  background: var(--color-card);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.choice:hover:not(:disabled) {
  border-color: var(--color-primary);
}

.choice:disabled {
  cursor: default;
  color: var(--color-text);
}

.choice.is-correct {
  background: var(--color-success-bg);
  border-color: var(--color-success-text);
}

.choice.is-wrong {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-text);
}

.answer-feedback {
  margin: 8px 0 0;
  font-weight: 600;
}

.answer-feedback.is-right { color: var(--color-success-text); }
.answer-feedback.is-wrong { color: var(--color-danger-text); }

.short-answer {
  width: 100%;
  font: inherit;
  padding: 8px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-sm);
}

.question-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.explanation {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--color-surface-alt);
  border-left: 4px solid var(--color-primary);
  border-radius: 4px;
}

.explanation p {
  margin: 4px 0;
}

/* My Study List and search */
.study-list,
.search-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.study-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-divider);
}

.study-type {
  display: inline-block;
  margin-right: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-muted);
}

.study-title,
.search-title {
  font-weight: 600;
}

.study-item .schedule-meta {
  display: block;
}

.search-group {
  margin: 16px 0 4px;
  color: var(--color-primary);
}

.search-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-divider);
}

.search-snippet {
  margin: 2px 0 0;
  font-size: 0.9rem;
  color: var(--color-muted);
}

@media (max-width: 640px) {
  .course-facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .course-facts dd {
    margin-bottom: 8px;
  }

  .flashcard {
    padding: 14px;
  }
}

/* ===== Notes & Resources: upgrade ===== */

/* The course page is wider, to fit the topic sidebar next to the notes */
/* Data-heavy pages (Study Plan, Timetable, Exams, course pages) use the wide layout width.
   Only the page content: the header and footer keep their own widths. */
.wide-page main.container {
  max-width: var(--width-wide);
}

/* Landing hero */
.notes-hero {
  margin: 24px 0 16px;
  padding: 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-card));
  border: 1px solid var(--color-primary-border);
}

.notes-hero h2 {
  font-family: var(--font-heading);
  margin: 0 0 4px;
  font-size: 1.8rem;
  color: var(--color-heading);
}

.notes-hero-text {
  margin: 0;
  max-width: 640px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 18px 0 14px;
}

.hero-stat,
.progress-tile {
  display: flex;
  flex-direction: column;
}

.hero-stat-number {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-heading);
}

.hero-stat-label {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.search-key {
  border: 1px solid var(--color-input-border);
  border-radius: 4px;
  padding: 0 6px;
  font-size: 0.8rem;
  color: var(--color-muted);
}

mark {
  background: #ffe58a;
  color: #222222;
  border-radius: 2px;
  padding: 0 1px;
}

/* Filter chips (search results, flashcard modes) */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
}

.filter-chip {
  border: 1px solid var(--color-input-border);
  background: var(--color-card);
  color: var(--color-text);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.filter-chip[aria-pressed="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: 600;
}

.filter-course {
  flex: 0 1 260px;
  padding: 5px 12px;
}

/* Course cards: icon, status, progress */
.course-group-title {
  margin: 20px 0 10px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.course-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.course-card-titles {
  display: flex;
  flex-direction: column;
}

.course-icon {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: color-mix(in srgb, var(--course-color, var(--color-primary)) 16%, transparent);
}

.course-icon.small {
  flex-basis: 30px;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  border-radius: var(--radius-sm);
}

.course-card-badges,
.course-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 10px;
}

.status-badge {
  display: inline-block;
  padding: 1px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-now { background: var(--color-success-bg); color: var(--color-success-text); }
.status-upcoming { background: var(--pill-blue-bg); color: var(--pill-blue-text); }
.status-finished { background: var(--color-surface-muted); color: var(--color-muted); }

.course-card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.course-card-progress .progress-bar {
  flex: 1;
}

.progress-bar {
  height: 8px;
  min-width: 80px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--course-color, var(--color-primary));
  transition: width 0.3s ease;
}

/* Course page header */
.course-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.course-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 260px;
}

.course-progress .progress-bar {
  flex: 0 1 200px;
}

/* My progress */
.progress-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.progress-tile {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
}

.progress-table {
  display: flex;
  flex-direction: column;
}

.progress-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  text-decoration: none;
}

.progress-row:hover .course-card-title {
  text-decoration: underline;
}

.progress-row-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-row-cell .progress-bar {
  margin-bottom: 4px;
}

.progress-tools {
  margin-top: 16px;
}

.button-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

/* Topic list: status */
.topic-row-side {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topic-status {
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--color-muted);
}

.topic-status.status-read { color: var(--pill-amber-text); }
.topic-status.status-understood { color: var(--color-success-text); font-weight: 600; }

/* Reader: sidebar + notes */
.reader-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
}

.topic-sidebar {
  position: sticky;
  top: 12px;
  align-self: start;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding-right: 8px;
  border-right: 1px solid var(--color-divider);
}

.topic-sidebar h4 {
  margin: 0 0 8px;
}

.topic-sidebar ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic-sidebar li a,
.topic-sidebar li .is-empty {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
  line-height: 1.35;
  text-decoration: none;
}

.topic-sidebar li a:hover {
  background: var(--color-surface-alt);
}

.topic-sidebar li a.is-current {
  background: var(--color-primary-light);
  font-weight: 600;
}

.topic-sidebar .is-empty {
  color: var(--color-faint);
}

.topic-status-icon {
  flex: 0 0 14px;
  color: var(--color-muted);
}

.topic-status-icon.status-read { color: var(--pill-amber-text); }
.topic-status-icon.status-understood { color: var(--color-success-text); }

.topic-jump-label {
  display: none;
}

.reader-title {
  font-size: 1.5rem;
}

.reader-meta {
  margin: 2px 0 0;
}

.on-this-page {
  margin: 12px 0;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.on-this-page ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.on-this-page a.is-sub {
  font-size: 0.85rem;
}

.notes-body h2,
.notes-body h3 {
  scroll-margin-top: 12px;
}

/* Images in notes */
.notes-figure {
  margin: 16px 0;
  text-align: center;
}

.zoom-button {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px;
  background: var(--white); /* diagrams are drawn for a white background */
  cursor: zoom-in;
  /* A real width (not "shrink to fit"), so the image inside has something to size against */
  display: block;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.zoom-button img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
}

.notes-figure figcaption {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.image-zoom {
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  max-width: 95vw;
  max-height: 95vh;
  background: var(--white);
  color: #222222;
}

.image-zoom::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.image-zoom img {
  display: block;
  max-width: 90vw;
  max-height: 80vh;
  margin: 0 auto;
}

.image-zoom-caption {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.image-zoom-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #eceff3;
  font-size: 1rem;
  cursor: pointer;
}

/* Topic progress buttons */
.topic-progress-box {
  margin-top: 24px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
}

.topic-progress-box h4 {
  margin: 0 0 8px;
}

.status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-button {
  border: 1px solid var(--color-input-border);
  background: var(--color-card);
  color: var(--color-text);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font: inherit;
  cursor: pointer;
}

.status-button[aria-pressed="true"].status-none { background: var(--color-surface-muted); font-weight: 600; }
.status-button[aria-pressed="true"].status-read { background: var(--pill-amber-bg); color: var(--pill-amber-text); border-color: var(--pill-amber-text); font-weight: 600; }
.status-button[aria-pressed="true"].status-understood { background: var(--color-success-bg); color: var(--color-success-text); border-color: var(--color-success-text); font-weight: 600; }

/* Previous / Next topic */
.topic-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--color-divider);
}

.pager-link {
  font-weight: 600;
  max-width: 48%;
}

.pager-link.is-next {
  text-align: right;
  margin-left: auto;
}

/* Smart flashcards */
.flashcard-done {
  text-align: center;
  padding: 24px 12px;
  border: 1px dashed var(--color-primary-border);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.flashcard-done-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.grade-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 82px;
  line-height: 1.2;
}

.grade-when {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.85;
}

.grade-again { background: var(--color-danger-bg); color: var(--color-danger-text); }
.grade-hard { background: var(--pill-amber-bg); color: var(--pill-amber-text); }
.grade-good { background: var(--color-success-bg); color: var(--color-success-text); }
.grade-easy { background: var(--pill-blue-bg); color: var(--pill-blue-text); }

/* Quiz */
.quiz-box {
  margin-top: 8px;
}

.quiz-setup {
  margin-bottom: 12px;
}

.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.quiz-clock {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.quiz-clock.is-low {
  color: var(--color-danger-text);
}

.quiz-question {
  margin-top: 12px;
}

.quiz-after {
  margin-top: 10px;
}

.quiz-quit {
  margin-top: 12px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-muted);
  text-decoration: underline;
  cursor: pointer;
}

.quiz-result {
  text-align: center;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  margin-bottom: 16px;
}

.quiz-score {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--color-primary);
}

.quiz-result .progress-bar {
  max-width: 320px;
  margin: 8px auto 0;
}

.quiz-review {
  margin-bottom: 10px;
}

/* "Create an item" helper */
#contribute-slot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.create-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.create-side {
  position: sticky;
  top: 12px;
}

.create-form h3 {
  margin: 18px 0 8px;
  font-size: 1.05rem;
}

.create-form h3:first-child {
  margin-top: 0;
}

.create-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-weight: 600;
}

.create-field input,
.create-field select,
.create-field textarea,
.create-option input[type="text"] {
  font: inherit;
  font-weight: 400;
  padding: 8px;
  width: 100%;
}

.create-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-muted);
}

.create-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.create-row .create-field {
  flex: 1 1 160px;
}

.create-topics,
.create-options {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px 12px;
  margin: 0 0 12px;
}

.create-topics legend,
.create-options legend {
  font-weight: 600;
  padding: 0 4px;
}

.create-topics .checkbox-label {
  padding: 3px 0;
}

.create-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.create-letter {
  font-weight: 700;
  width: 1.2em;
}

.create-problems {
  color: var(--color-danger-text);
  margin-top: 0;
}

.create-steps {
  padding-left: 20px;
  font-size: 0.9rem;
}

.create-json {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 0.85rem;
  white-space: pre;
}

@media (max-width: 860px) {
  .create-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .create-side {
    position: static;
  }
}

/* ===== Study Plan ===== */
.plan-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 24px 0 16px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-accent);
  background: var(--color-warning-bg);
}

.plan-notice p {
  margin: 0;
}

.plan-notice-title {
  font-weight: 700;
  font-size: 1.05rem;
}

/* Study plan: a course group without student advice yet (empty state) */
.plan-advice-empty {
  color: var(--text-secondary);
}

#plan-views {
  margin: 4px 0 12px;
}

.plan-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.plan-summary-row .progress-bar {
  flex: 1 1 240px;
  height: 12px;
}

.plan-cfu {
  font-size: 1.05rem;
}

.plan-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.plan-check.is-done {
  color: var(--color-success-text);
  font-weight: 600;
}

.plan-complete {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-success-bg);
  color: var(--color-success-text);
  font-weight: 700;
}

.plan-group h3 {
  margin: 0;
}

.plan-course {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.plan-course.is-selected {
  border-left-color: var(--course-color, var(--color-primary));
  background: var(--color-surface-alt);
}

.plan-course > input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 6px;
  accent-color: var(--color-primary);
}

.plan-lock {
  flex: 0 0 20px;
  margin-top: 4px;
}

.plan-course-body {
  flex: 1;
  min-width: 0;
}

.plan-course-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
}

.plan-course-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 6px;
}

.plan-badge {
  display: inline-block;
  padding: 1px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.plan-badge-required { background: var(--pill-blue-bg); color: var(--pill-blue-text); }
.plan-badge-choose-one { background: var(--pill-purple-bg); color: var(--pill-purple-text); }
.plan-badge-optional { background: var(--color-surface-muted); color: var(--color-muted); }
.plan-badge-mine { background: var(--color-success-bg); color: var(--color-success-text); }

.plan-modules {
  margin: 8px 0 6px;
  padding-left: 18px;
  font-size: 0.9rem;
}

.plan-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.9rem;
}

.plan-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.plan-status select {
  padding: 4px 8px;
  font: inherit;
}

.plan-advice {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
}

.plan-advice summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-primary);
}

.plan-calendar-url {
  width: 100%;
  margin-top: 10px;
  padding: 6px;
  font-size: 0.85rem;
}

/* Timeline */
.timeline-chart {
  position: relative;
  margin-top: 12px;
  --label-width: 210px;
}

.timeline-row {
  display: grid;
  grid-template-columns: var(--label-width) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.timeline-label {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-track {
  position: relative;
  height: 22px;
  border-left: 1px solid var(--color-divider);
}

.timeline-months .timeline-track {
  border: none;
}

.timeline-month {
  position: absolute;
  top: 2px;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.timeline-cycle,
.timeline-bar {
  position: absolute;
  top: 3px;
  height: 16px;
  border-radius: var(--radius-pill);
}

.timeline-cycle {
  background: var(--color-surface-muted);
  font-size: 0.7rem;
  line-height: 16px;
  text-align: center;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
}

.timeline-bar {
  background: var(--course-color, var(--color-primary));
}

/* "You are here": a line over all rows, at today's position */
.timeline-today {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--label-width) + 10px + (100% - var(--label-width) - 10px) * var(--today) / 100);
  border-left: 2px dashed var(--color-danger-text);
  pointer-events: none;
}

.timeline-today-label {
  position: absolute;
  top: -20px;
  left: -2px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.plan-timeline .timeline-chart {
  margin-top: 28px;
}

/* Course page: modules, plan status */
.module-box {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--color-divider);
}

.module-box h4 {
  margin: 0 0 6px;
}

.module-box h5 {
  margin: 12px 0 4px;
  font-size: 0.95rem;
}

.module-heading {
  margin: 18px 0 4px;
  color: var(--color-primary);
}

.plan-status-box {
  margin: 8px 0 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
}

.course-status-select {
  padding: 3px 8px;
  font: inherit;
}

.course-card-modules {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.sidebar-module {
  margin: 10px 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.reader-module {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.my-courses-switch {
  font-weight: 600;
}

@media (max-width: 640px) {
  .timeline-chart {
    --label-width: 110px;
  }
}

/* KaTeX formulas follow the text colour (also in dark mode) */
.katex {
  font-size: 1.05em;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

/* Phones and small tablets */
@media (max-width: 860px) {
  .reader-layout {
    grid-template-columns: minmax(0, 1fr); /* minmax(0, ...) lets the column shrink to the screen */
    gap: 0;
  }

  .topic-sidebar {
    display: none;
  }

  .topic-jump-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
  }

  .topic-jump {
    flex: 1;
    min-width: 0;
    padding: 6px;
    font-size: 0.95rem;
  }

  .progress-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* On narrow phone screens, put the time above the details */
@media (max-width: 500px) {
  .schedule-item {
    flex-direction: column;
    gap: 2px;
  }

  .schedule-time {
    flex-basis: auto;
  }
}


/* ===== Toasts, skeletons, icon buttons, back to top ===== */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--navy-900);
  color: var(--white);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.25s var(--ease);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast-action {
  border: none;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  background: var(--white);
  color: var(--navy-900);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.skeleton-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 0;
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-muted) 25%, var(--color-surface-alt) 50%, var(--color-surface-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-line { height: 14px; }
.skeleton-card { height: 84px; border-radius: var(--radius-md); }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-card);
  color: var(--color-primary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.icon-button:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-border);
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-card);
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Gentle movement: cards lift on hover, new content fades in */
.course-card,
.dash-card,
.tile,
.exam-card {
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.course-card:hover,
.tile:hover,
.exam-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.fade-in {
  animation: fade-in 0.25s var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

details > summary {
  cursor: pointer;
}

/* The device asks for less motion: switch animations off */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Page intro (title at the top of a page) ===== */
.page-intro {
  margin: var(--space-4) 0 var(--space-6);
}

.page-intro h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 6px;
  font-size: var(--fs-h1);
  font-weight: 600;
  color: var(--color-heading);
}

.page-intro h1 .icon {
  color: var(--color-primary);
}

.page-intro p {
  margin: 0;
  max-width: 760px;
  color: var(--color-muted);
}

/* ===== Toolbar, segmented switch ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  margin-bottom: 12px;
}

.toolbar-filters {
  margin: 0 0 0 auto;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
}

.segmented .segment {
  border: none;
  background: transparent;
  color: var(--color-muted);
}

.segmented .segment[aria-pressed="true"] {
  background: var(--color-card);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.week-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.week-label {
  min-width: 170px;
  text-align: center;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ===== Now / Next ===== */
.now-next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.now-next-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  border-left: 5px solid var(--course-color, var(--color-primary));
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.now-next-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.now-next-item.is-now .now-next-label {
  color: var(--color-danger-text);
}

.now-next-item.is-now .now-next-label::before {
  content: "\25CF  ";
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  50% { opacity: 0.3; }
}

/* ===== Week grid ===== */
.week-scroller {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px 4px;
}

.week-grid {
  display: grid;
  grid-template-columns: 56px repeat(5, minmax(130px, 1fr));
  min-width: 720px;
  --hour-height: 52px;
}

.week-day-head {
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border);
}

.week-day.is-today .week-day-head {
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.week-body {
  position: relative;
  height: calc(var(--hours) * var(--hour-height));
  border-left: 1px solid var(--color-divider);
  background-image: linear-gradient(var(--color-divider) 1px, transparent 1px);
  background-size: 100% var(--hour-height);
}

.week-times .week-body {
  border-left: none;
  background-image: none;
}

.week-hour {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  font-size: 0.72rem;
  color: var(--color-muted);
}

.week-hour:first-child {
  transform: none;
}

.week-block {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  padding: 6px 8px;
  border: none;
  border-left: 4px solid var(--course-color, var(--color-primary));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--course-color, var(--color-primary)) 14%, var(--color-card));
  color: var(--color-text);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--course-color, var(--color-primary)) 25%, transparent);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.week-block:hover {
  z-index: 2;
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.week-block strong {
  font-size: 0.8rem;
}

.week-room {
  color: var(--color-muted);
}

.week-now {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  border-top: 2px solid var(--color-danger-text);
  pointer-events: none;
}

.week-now::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-danger-text);
}

/* Dialogs (class details) */
.session-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  background: var(--color-card);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
}

.session-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.session-dialog h2 {
  margin: 0 32px 6px 0;
  font-size: 1.2rem;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px;
}

/* ===== Exam cards ===== */
.month-heading {
  margin: 22px 0 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
}

.exam-card {
  display: flex;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--color-border);
  border-left: 5px solid var(--course-color, var(--color-primary));
  border-radius: var(--radius-lg);
  background: var(--color-card);
}

.exam-date-block {
  flex: 0 0 58px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.exam-day {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.exam-weekday {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.exam-card-body {
  flex: 1;
  min-width: 0;
}

.exam-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.exam-card-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.exam-card p {
  margin: 4px 0;
}

.reg-chip {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.reg-chip.is-open {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.open-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-success-text);
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.open-alert > div {
  flex: 1 1 260px;
}

.open-alert p {
  margin: 2px 0 0;
  font-size: 0.9rem;
}

.open-alert .icon {
  width: 26px;
  height: 26px;
}

.help-step {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-divider);
}

.help-step summary {
  font-weight: 600;
}

@media (max-width: 640px) {
  .toolbar-filters {
    margin-left: 0;
  }

  .exam-card {
    gap: 12px;
  }
}

/* Anything marked hidden stays hidden, even if a style gives it display: flex */
[hidden] {
  display: none !important;
}

/* ===== Home dashboard ===== */
.dash-date {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.dash-sub {
  margin: 0;
  color: var(--color-muted);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.dash-card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.dash-card h2,
.dash-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 750;
  color: var(--color-text);
}

.dash-card h2 .icon,
.dash-card h3 .icon {
  color: var(--color-primary);
}

.dash-mine {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-success-bg);
  color: var(--color-success-text);
  font-size: 0.7rem;
  font-weight: 700;
}

.dash-body {
  flex: 1;
}

.dash-more {
  margin-top: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.dash-more:hover {
  text-decoration: underline;
}

.dash-wide {
  grid-column: 1 / -1;
}

.dash-empty {
  margin: 0 0 10px;
  color: var(--color-muted);
}

.dash-class {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--course-color, var(--color-primary));
  background: var(--color-surface-alt);
}

.dash-class.is-now {
  background: color-mix(in srgb, var(--course-color, var(--color-primary)) 14%, var(--color-card));
}

.dash-class.is-done {
  opacity: 0.55;
}

.dash-class-time {
  flex: 0 0 46px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dash-class-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dash-class-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-dot {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--color-urgent);
  color: var(--white);
  font-size: 0.68rem;
  vertical-align: 2px;
}

.dash-countdown {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.dash-countdown-number {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary);
}

.dash-countdown-label {
  color: var(--color-muted);
  font-weight: 600;
}

.dash-exam-title {
  display: block;
  margin-top: 8px;
}

.dash-plan-cfu {
  margin: 8px 0;
  font-weight: 700;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.dash-stat {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  font-size: 0.75rem;
  color: var(--color-muted);
}

.dash-stat strong {
  font-size: 1.2rem;
  color: var(--color-text);
}

.dash-due {
  display: inline-block;
  margin-top: 10px;
  font-weight: 600;
}

/* Explore tiles */
.section-title {
  margin: 0 0 12px;
  font-size: 1.2rem;
  font-weight: 750;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  color: var(--color-text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.tile .icon {
  width: 26px;
  height: 26px;
  margin-bottom: 6px;
  padding: 7px;
  box-sizing: content-box;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.tile span {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.dash-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.link-list {
  margin: 0;
  padding-left: 18px;
}

.link-list li {
  padding: 3px 0;
}

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

  .dash-today {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .dash-grid,
  .dash-footer-grid {
    grid-template-columns: 1fr;
  }

  .tiles {
    grid-template-columns: 1fr 1fr;
  }

  .tile span {
    display: none;
  }
}

/* ===== Site-wide search (search.js) ===== */
.search-dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: min(70vh, 640px);
  margin: 10vh auto auto;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: fade-in 0.15s var(--ease);
}

.search-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-divider);
}

.search-bar .icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--color-muted);
}

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 1.05rem;
  padding: 6px 0;
}

.search-esc,
.search-hint {
  color: var(--color-muted);
  font-size: 0.78rem;
}

.search-esc {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.search-status {
  margin: 0;
  padding: 10px 16px 4px;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 4px 8px 8px;
  overflow-y: auto;
  flex: 1;
}

.search-group-label {
  padding: 10px 8px 4px;
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-result {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
}

.search-result[aria-selected="true"] {
  background: var(--color-primary-light);
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.search-result-title {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-meta {
  display: block;
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-hint {
  margin: 0;
  padding: 8px 16px;
  border-top: 1px solid var(--color-divider);
}

@media (max-width: 600px) {
  .search-dialog {
    margin-top: 12px;
    max-height: calc(100vh - 24px);
  }
  .search-hint {
    display: none;
  }
}

/* Text for screen readers only (not shown on screen) */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ===== Welcome & setup checklist (onboarding.js) ===== */
/* ===== Welcome & setup guide (onboarding.js, home page) =====
   A navy panel (title, progress ring, next step) beside a grid of step cards. */
.welcome-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) 2fr;
  gap: 0;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--color-border);
  animation: fade-in 0.25s var(--ease);
}

.welcome-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: radial-gradient(circle at 100% 0%, rgba(199, 91, 58, 0.28), transparent 55%), var(--surface-navy);
  color: var(--text-on-navy-muted);
}

.welcome-eyebrow {
  margin: 0;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: #f6b79d;
}

.welcome-panel h2 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--white);
}

.welcome-sub {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.welcome-status {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-2);
}

/* Progress ring */
.welcome-ring {
  position: relative;
  flex: none;
  width: 104px;
  height: 104px;
}

.welcome-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.welcome-ring circle {
  fill: none;
  stroke-width: 10;
}

.welcome-ring-track { stroke: rgba(255, 255, 255, 0.16); }

.welcome-ring-fill {
  stroke: #e7845f;
  stroke-linecap: round;
  transition: stroke-dasharray 600ms var(--ease);
}

.welcome-card.is-complete .welcome-ring-fill { stroke: #6fcf97; }

.welcome-ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.1;
}

.welcome-ring-label strong {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--white);
}

.welcome-ring-label span {
  font-size: var(--fs-meta);
  color: rgba(255, 255, 255, 0.75);
}

/* Next step (or where to explore when everything is done) */
.welcome-next {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
}

.welcome-next-label {
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.welcome-next strong {
  color: var(--white);
  line-height: 1.3;
}

.welcome-next-button {
  background: var(--color-brand-action) !important;
  border-color: transparent !important;
  color: var(--color-on-brand) !important;
}

.welcome-explore {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.welcome-explore a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
}

.welcome-explore a:hover { text-decoration: underline; }

.welcome-privacy {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: auto 0 0;
  padding-top: var(--space-3);
  font-size: var(--fs-meta);
  color: rgba(255, 255, 255, 0.72);
}

.welcome-panel :focus-visible { outline-color: var(--white); }

.welcome-hide {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}

/* Step cards */
.setup-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: calc(var(--space-6) + 28px) var(--space-5) var(--space-5);
  list-style: none;
  align-content: start;
}

.setup-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.setup-step:hover { border-color: var(--color-primary-border, #9baec3); }

.setup-step.is-next {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-brand-soft);
}

.setup-step-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.setup-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--info-bg);
  color: var(--pill-blue-text);
}

.setup-icon .icon { width: 20px; height: 20px; }

.setup-number {
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-muted);
}

.setup-time {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}

.setup-title {
  color: var(--color-heading);
  line-height: 1.3;
}

.setup-sub {
  margin: 0;
  flex: 1;
  font-size: var(--fs-small);
  color: var(--color-muted);
}

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

/* Done (or skipped) steps: quieter, with a green tick */
.setup-step.is-done {
  background: var(--color-surface-alt, var(--color-card));
  border-style: dashed;
}

.setup-step.is-done .setup-icon {
  background: var(--success-bg);
  color: var(--success);
}

.setup-step.is-done .setup-time {
  background: var(--success-bg);
  color: var(--success);
}

.setup-step.is-skipped .setup-icon,
.setup-step.is-skipped .setup-time {
  background: var(--color-surface-muted);
  color: var(--color-muted);
}

.setup-step.is-done .setup-title { color: var(--color-muted); }

@media (max-width: 900px) {
  .welcome-card { grid-template-columns: 1fr; }
  .setup-list { padding-top: var(--space-5); }
  .welcome-hide {
    border-color: rgba(255, 255, 255, 0.4) !important;
    background: transparent !important;
    color: var(--white) !important;
  }
}

@media (max-width: 420px) {
  .welcome-panel { padding: var(--space-5); }
  .welcome-ring { width: 88px; height: 88px; }
  .welcome-status { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-ring-fill { transition: none; }
}

/* City labels: readable grey text, with a dot in the city's own colour (the colour is too light for small text) */
.city-card .city-country::before,
.guide-city-card .city-country::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--city-accent, var(--color-brand));
  vertical-align: 1px;
}

/* ===== Offline banner (pwa.js) ===== */
.offline-banner {
  padding: 8px 16px;
  background: var(--navy-800);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

/* Tablets / small laptops: search button shows only its icon, menu labels stay on one line */
@media (max-width: 1000px) {
  .header-button .search-label,
  .header-button kbd {
    display: none;
  }
}

.menu-group,
.menu-link {
  white-space: nowrap;
}

/* Keep the footer below the screen while the page content loads, so nothing jumps */
main.container {
  min-height: calc(100vh - 160px);
}

/* Narrow phones: the Menu button shows only its icon, so the header stays on one row */
@media (max-width: 400px) {
  .header-actions .menu-toggle {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .menu-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

/* =====================================================================
   13. HOMEPAGE (index.html)
   Order: full-width hero → stats strip → Explore the Hub → global community → Your Week → cities → links/about
   ===================================================================== */

/* Section heads (also used by the Tracks and Thesis pages): eyebrow, serif title, description, action */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  margin-bottom: var(--space-7);
}

.section-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--color-heading);
}

.section-sub {
  margin: var(--space-2) 0 0;
  color: var(--color-muted);
}

/* A short italic line with a terracotta stroke under it (the editorial accent) */
.section-signature,
.hero-signature {
  margin: 0;
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--color-muted);
}

.section-signature {
  position: relative;
  padding-bottom: 8px;
  font-size: var(--fs-body-lg);
}

.section-signature::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 56px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-brand);
  transform: rotate(-3deg);
}

main.home {
  padding-top: 0;
  padding-bottom: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html:has(main.home) {
    scroll-behavior: smooth;
  }
}

/* ----- 1. Hero: full width, navy text panel on the left, cohort photo on the right ----- */
.home-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--navy-900);
  color: var(--white);
}

.home-hero-media {
  position: absolute;
  inset: 0 0 0 30%;
  z-index: -2;
}

.home-hero-media picture,
.home-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
}

.home-hero-media img {
  object-fit: cover;
  object-position: 55% 45%; /* keeps the faces of the group in frame */
}

/* Navy panel that fades into the photo, so the text is readable and the faces stay clear */
.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, var(--navy-900) 0%, var(--navy-900) 30%, rgba(15, 43, 91, 0.82) 40%,
    rgba(15, 43, 91, 0.25) 56%, rgba(15, 43, 91, 0) 70%);
}

.home-hero-inner {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  min-height: clamp(440px, 56vh, 540px);
  padding-top: var(--space-10);
  padding-bottom: var(--space-12);
}

.home-hero-text {
  max-width: 540px;
}

.hero-eyebrow {
  margin: 0 0 var(--space-4);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

.home-hero h1 {
  margin: 0;
  font-size: var(--fs-display);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--white);
}

.hero-accent {
  color: #e7845f; /* terracotta, lightened for contrast on navy (5.0:1) */
}

.hero-sentence {
  margin: var(--space-5) 0 0;
  max-width: 46ch;
  font-size: var(--fs-body-lg);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-7);
}

.hero-actions .button {
  min-height: 48px;
  padding-inline: 22px;
}

.home-hero .button-primary {
  color: var(--white);
}

.hero-button-secondary {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.75);
}

.hero-button-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--white);
}

.hero-note {
  margin: var(--space-5) 0 0;
  font-size: var(--fs-meta);
  color: rgba(255, 255, 255, 0.7);
}

.hero-signature {
  align-self: flex-start;
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(9, 29, 58, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--white);
  text-align: right;
  transform: rotate(-4deg);
}

.hero-signature::after {
  content: "";
  display: block;
  width: 60px;
  height: 2px;
  margin: 8px 0 0 auto;
  border-radius: 2px;
  background: var(--terracotta-600);
}

.home-hero :focus-visible {
  outline-color: var(--white);
}

/* Returning students (a study plan is saved): a shorter hero */
.home-compact .home-hero-inner {
  min-height: 380px;
  padding-top: var(--space-8);
}

.home-compact .hero-sentence {
  display: none;
}

/* ----- 2. Cohort statistics: a white strip overlapping the bottom of the hero ----- */
.home-stats-wrap {
  position: relative;
  z-index: 1;
  margin-top: calc(-1 * var(--space-10));
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  padding: var(--space-5) 0;
  list-style: none;
  background: var(--surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.home-stats[hidden] {
  display: none;
}

.home-stat {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-2) var(--space-6);
}

.home-stat + .home-stat {
  border-left: 1px solid var(--color-divider);
}

.home-stat-icon {
  flex: none;
  width: 64px;
  height: 64px;
  padding: 18px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-link);
}

.home-stat-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-stat-number {
  min-width: calc(var(--digits, 2) * 0.62em);
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.5rem);
  font-weight: 600;
  line-height: 1;
  color: var(--color-heading);
  font-variant-numeric: tabular-nums;
}

.home-stat-label {
  margin-top: 4px;
  font-weight: 600;
  color: var(--color-heading);
}

.home-stat-caption {
  font-size: var(--fs-meta);
  color: var(--color-muted);
}

/* ----- 3. Explore the Hub: five feature cards ----- */
.home-explore {
  padding-top: var(--space-9);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  height: 100%;
  padding: var(--space-6) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
}

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

.feature-head strong {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-heading);
}

.feature-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-link);
}

.feature-icon.is-brand {
  background: var(--color-brand-soft);
  color: var(--color-brand-text);
}

.feature-icon .icon {
  width: 26px;
  height: 26px;
}

.feature-text {
  flex: 1;
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--color-muted);
}

.feature-card .link-arrow {
  font-size: var(--fs-small);
}

.more-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-divider);
}

.more-tools-label {
  margin: 0;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-muted);
}

.more-tools ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.more-tools a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  font-weight: 600;
  color: var(--color-navy);
  text-decoration: none;
}

.more-tools a:hover {
  color: var(--color-link);
  text-decoration: underline;
}

.more-tools .icon {
  color: var(--color-link);
}

/* ----- 4. A global community: text · map · people ----- */
.community-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1.35fr;
  align-items: center;
  gap: var(--space-7);
}

.community-values {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
  margin: var(--space-6) 0;
  padding: 0;
  list-style: none;
}

.community-values li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 9.5em;
  font-size: var(--fs-small);
  line-height: 1.3;
  color: var(--color-muted);
}

.community-values .icon {
  width: 30px;
  height: 30px;
  color: var(--color-navy);
}

.community-map {
  margin: 0;
}

.community-map-svg {
  aspect-ratio: 960 / 400;
}

.community-map-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.community-map-svg .map-country {
  fill: #d7e3f1;
  stroke: var(--color-card);
  stroke-width: 0.4;
  vector-effect: non-scaling-stroke;
}

.community-map-svg .city-dot {
  fill: var(--terracotta-600);
  stroke: var(--white);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.community-map-svg .city-halo {
  fill: var(--terracotta-600);
  opacity: 0.18;
}

.community-map figcaption {
  margin-top: var(--space-3);
  font-size: var(--fs-meta);
  color: var(--color-muted);
  text-align: center;
}

.community-map-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--terracotta-600);
  vertical-align: 0;
}

.community-people-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.community-people-head .section-eyebrow {
  margin: 0;
  color: var(--color-heading);
}

.people-nav {
  display: flex;
  gap: var(--space-2);
}

.people-nav button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-card);
  color: var(--color-navy);
  cursor: pointer;
}

.people-nav button:hover {
  border-color: var(--color-primary-border);
  background: var(--color-primary-light);
}

.people-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-5) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-xs);
  text-align: center;
  animation: person-in var(--dur) var(--ease);
}

@keyframes person-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.person-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-2);
  border-radius: 50%;
  background: var(--color-primary-light);
  border: 2px solid var(--color-card);
  box-shadow: 0 0 0 2px var(--color-primary-border);
  color: var(--color-heading);
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

.person-name {
  font-weight: 700;
  font-size: var(--fs-small);
  color: var(--color-heading);
  text-decoration: none;
}

.person-name:hover {
  text-decoration: underline;
}

.person-meta {
  font-size: var(--fs-meta);
  color: var(--color-muted);
  line-height: 1.35;
}

.person-bio {
  margin-top: var(--space-2);
  font-family: var(--font-heading);
  font-style: italic;
  font-size: var(--fs-meta);
  line-height: 1.45;
  color: var(--color-text);
}

.people-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: var(--space-3) 0 0;
  font-size: var(--fs-meta);
  color: var(--color-muted);
}

/* ----- 5. Your Week ----- */
.week-greeting {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--fs-small);
}

.home .dash-grid {
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-7);
}

.home .dash-card {
  padding: var(--space-6);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.home .dash-today {
  border-top: 3px solid var(--color-brand);
}

.home .dash-card h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: var(--space-4);
}

.dash-icon {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-link) !important;
}

.home .dash-today .dash-icon {
  background: var(--color-brand-soft);
  color: var(--color-brand-text) !important;
}

.home .dash-more {
  display: inline-flex;
  gap: 6px;
  margin-top: var(--space-4);
  color: var(--color-link);
}

.dash-countdown-number {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-heading);
}

.home #welcome-slot:not(:empty) {
  margin-top: var(--space-2);
}

/* ----- 6. City cards ----- */
.city-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

.city-card {
  --city-accent: var(--color-brand);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  padding: 0 0 var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text);
  text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.city-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-md);
}

.city-card[href*="bologna"] { --city-accent: var(--city-bologna); }
.city-card[href*="oslo"] { --city-accent: var(--city-oslo); }
.city-card[href*="rotterdam"] { --city-accent: var(--city-rotterdam); }
.city-card[href*="innsbruck"] { --city-accent: var(--city-innsbruck); }

.city-card > :not(.city-card-photo) {
  padding-inline: var(--space-5);
}

.city-card .city-card-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: var(--space-4);
  border-bottom: 3px solid var(--city-accent);
}

.city-card .city-country {
  margin-top: var(--space-4);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-muted);
}

.city-card .city-card-photo + .city-country {
  margin-top: 0;
}

.city-card strong {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-heading);
}

.city-card span {
  font-size: var(--fs-small);
  color: var(--color-muted);
}

.city-card .city-status {
  margin-top: var(--space-3);
  font-weight: 600;
}

.city-card .city-status.is-ready {
  color: var(--color-link);
}

/* City guide "coming soon" (guide.js) */
.coming-soon-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: var(--fs-meta);
  font-weight: 700;
}

/* ----- 7. Useful links + about ----- */
.home-links-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-9);
  align-items: start;
}

.link-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-top: var(--space-6);
}

.link-groups h3 {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-muted);
}

.compact-links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.compact-links li {
  display: flex;
  flex-direction: column;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}

.compact-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--color-navy);
  text-decoration: none;
}

.compact-links a:hover {
  color: var(--color-link);
  text-decoration: underline;
}

.compact-links a .icon {
  width: 14px;
  height: 14px;
  color: var(--color-muted);
}

.compact-links span {
  font-size: var(--fs-small);
  color: var(--color-muted);
}

.about-card {
  padding: var(--space-7);
  border-radius: var(--radius-md);
  background: var(--color-card);
  border: 1px solid var(--color-border);
}

.about-card .section-title {
  font-size: var(--fs-h3);
}

.about-points {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  padding: 0;
  list-style: none;
}

.about-points li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.about-points .icon {
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-link);
}

.about-links {
  margin: 0;
  font-weight: 600;
}

.photo-credit {
  margin-top: var(--space-6);
  font-size: var(--fs-meta);
  color: var(--color-muted);
}

/* ----- Dark mode details ----- */
:root[data-theme="dark"] .community-map-svg .map-country {
  fill: #2a3a52;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .community-map-svg .map-country {
    fill: #2a3a52;
  }
}

/* ----- Below 1360px: the community section in two rows (text + map, then the people) ----- */
@media (max-width: 1360px) {
  .community-grid {
    grid-template-columns: 1fr 1.3fr;
    row-gap: var(--space-8);
  }

  .community-people {
    grid-column: 1 / -1;
  }
}

/* ----- Wide tablets ----- */
@media (max-width: 1180px) {
  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-signature {
    display: none;
  }
}

/* ----- Tablets ----- */
@media (max-width: 1000px) {
  .home .dash-grid {
    grid-template-columns: 1fr 1fr;
  }

  .home .dash-today {
    grid-column: 1 / -1;
  }

  .city-cards {
    grid-template-columns: 1fr 1fr;
  }

  .home-links-grid,
  .community-grid {
    grid-template-columns: 1fr;
    gap: var(--space-7);
  }

  .home-stats {
    grid-template-columns: 1fr 1fr;
    row-gap: var(--space-4);
  }

  .home-stat:nth-child(3) {
    border-left: none;
  }

  .home-hero-media {
    inset: 0 0 0 20%;
  }
}

/* ----- Phones: photo on top, text on navy below ----- */
@media (max-width: 680px) {
  .home-hero-media {
    inset: 0 0 auto 0;
    height: 260px;
  }

  .home-hero::after {
    background: linear-gradient(180deg, rgba(15, 43, 91, 0) 0, rgba(15, 43, 91, 0.2) 150px, var(--navy-900) 260px, var(--navy-900) 100%);
  }

  .home-hero-inner {
    min-height: 0;
    padding-top: 220px;
    padding-bottom: var(--space-11);
  }

  .home-hero-media img {
    object-position: 50% 30%;
  }

  .hero-actions .button {
    flex: 1 1 auto;
  }

  .home-stats-wrap {
    margin-top: calc(-1 * var(--space-9));
  }

  .home-stats {
    padding: var(--space-3) 0;
  }

  .home-stat {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
  }

  .home-stat-icon {
    width: 40px;
    height: 40px;
    padding: 10px;
  }

  .feature-grid,
  .home .dash-grid,
  .link-groups {
    grid-template-columns: 1fr;
  }

  .feature-card {
    padding: var(--space-5);
  }

  .people-cards {
    grid-template-columns: 1fr 1fr;
  }

  .people-cards li:nth-child(3) {
    display: none;
  }

  /* Cities: a horizontal row you can swipe */
  .city-cards {
    display: flex;
    gap: var(--space-4);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: calc(-1 * var(--gutter));
    padding: 0 var(--gutter) var(--space-3);
  }

  .city-card {
    flex: 0 0 78%;
    scroll-snap-align: start;
  }

  .about-card {
    padding: var(--space-6);
  }

  .section-signature {
    display: none;
  }
}

/* ===== Simple text pages (privacy.html, contact.html) ===== */
.text-page {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.65;
}

.text-page h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
}

.text-page h2 {
  margin: 28px 0 6px;
  font-size: 1.15rem;
}

.text-page-lead {
  font-size: 1.08rem;
  color: var(--color-muted);
}

.text-page-updated {
  margin-top: 28px;
  color: var(--color-muted);
  font-size: 0.88rem;
}

.draft-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-warning-bg);
  color: var(--pill-amber-text);
  font-size: 0.8rem;
  font-weight: 700;
}

.placeholder-box {
  margin: 20px 0;
  padding: 16px 18px;
  border: 2px dashed var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}

.placeholder-box p {
  margin: 4px 0 0;
  color: var(--color-muted);
}

/* =====================================================================
   Tracks page (tracks.html, tracks.js)
   Each track has an accent colour (--track-accent, from content/tracks.json),
   used only for small accents: the name or abbreviation is always shown too.
   ===================================================================== */
.tracks {
  padding-bottom: 48px;
}

.tracks [id] {
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.tracks-section {
  margin-top: 56px;
}

/* ----- Hero ----- */
.tracks-hero {
  padding: 36px 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0%, var(--color-primary-light), transparent 55%),
    var(--color-card);
  box-shadow: var(--shadow-sm);
}

.tracks-hero .hero-badge {
  border-color: var(--color-primary-border);
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-shadow: none;
}

.tracks-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.1;
}

.tracks-tagline {
  margin: 10px 0 0;
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  color: var(--color-heading);
}

.tracks-hero-text {
  max-width: 640px;
  margin: 12px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.tracks-hero .hero-actions {
  margin-top: 20px;
}

.tracks-hero-note {
  margin: 18px 0 0;
  color: var(--color-muted);
  font-size: 0.88rem;
}

.student-label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--color-warning-bg);
  font-size: 0.88rem;
  line-height: 1.5;
}

.student-label .icon {
  margin-top: 2px;
  color: var(--pill-amber-text);
}

/* ----- Track badge: "A · EEH" ----- */
.track-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-card);
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.track-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--track-accent, var(--color-primary));
}

/* ----- Journey ----- */
.journey {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  gap: 0 28px;
  align-items: center;
}

.journey-start {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-navy);
  color: var(--white);
}

.journey-start strong {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
}

.journey-start span:last-child {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
}

.journey-start .journey-step-label {
  color: #f3dccf;
}

.journey-step-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.journey-paths {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 0 0 22px;
  list-style: none;
  border-left: 2px solid var(--color-border);
}

.journey-path {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr);
  gap: 10px 16px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--track-accent);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

/* The branch line from Bologna to each track */
.journey-path::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 50%;
  width: 22px;
  border-top: 2px solid var(--color-border);
}

.journey-track {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.journey-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.journey-step {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.journey-step strong {
  font-size: 0.98rem;
}

.journey-path.is-mine,
.track-card.is-mine,
.track-detail.is-mine {
  box-shadow: 0 0 0 2px var(--track-accent), var(--shadow-sm);
}

.tracks-callout {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 18px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-text);
  font-weight: 600;
}

.tracks-callout .icon {
  color: var(--color-primary);
}

/* ----- Four track cards ----- */
.track-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.track-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--track-accent);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.track-card h3 {
  margin: 4px 0 0;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
}

/* Readable heading text; the track keeps its colour as a bar on the left */
.track-question {
  margin: 0;
  padding-left: 10px;
  border-left: 3px solid var(--track-accent, var(--color-link));
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--color-heading);
}

.tracks-callout-warning {
  background: var(--warning-bg) !important;
  color: var(--warning) !important;
}

.track-route {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  color: var(--color-muted);
  font-weight: 600;
}

.track-description {
  margin: 0;
  line-height: 1.55;
}

.track-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 6px;
  padding: 0;
  list-style: none;
}

.track-tags li {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  font-size: 0.8rem;
}

.track-card .button {
  margin-top: auto;
}

/* ----- Detailed explorer ----- */
.track-detail {
  margin-bottom: 12px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--track-accent);
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.track-detail > summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
}

.track-detail > summary::-webkit-details-marker {
  display: none;
}

.track-detail > summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--color-muted);
}

.track-detail[open] > summary::after {
  content: "–";
}

.track-detail-title {
  display: flex;
  flex-direction: column;
}

.track-detail-title strong {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
}

.track-detail-title span {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.track-detail-body {
  padding: 0 20px 20px;
}

.explorer-tabs .track-tabs {
  margin-bottom: 16px;
}

.explorer-panel:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: var(--radius-xs);
}

.explorer-panel-body h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.explorer-panel-body > :first-child {
  margin-top: 0;
}

.track-central {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--color-primary);
}

.typical-problem {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
}

.typical-problem h3 {
  margin-top: 0;
}

.typical-problem p {
  margin: 0;
  line-height: 1.55;
}

.typical-problem-note,
.course-note,
.course-source,
.course-context {
  margin: 8px 0 0;
  color: var(--color-muted);
  font-size: 0.86rem;
}

.course-semester {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-divider);
}

.course-group-label {
  margin: 12px 0 4px;
  font-weight: 700;
  font-size: 0.9rem;
}

.course-rule {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.82rem;
}

.course-rule.is-unknown {
  background: var(--color-warning-bg);
  color: var(--pill-amber-text);
}

.track-course-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.55;
}

.course-options {
  list-style: circle;
}

.course-extra {
  color: var(--color-muted);
  font-size: 0.88rem;
}

.course-plus {
  font-weight: 700;
  color: var(--color-primary);
}

.sector-list,
.fit-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sector-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--color-divider);
}

.fit-list li {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  line-height: 1.5;
}

.fit-list .icon {
  margin-top: 3px;
  color: var(--color-primary);
}

.student-written {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--color-warning-bg);
  color: var(--pill-amber-text);
  font-size: 0.75rem;
  font-weight: 700;
}

.second-year blockquote {
  margin: 8px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--color-primary-border);
}

.second-year cite {
  display: block;
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.track-city-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.track-city {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}

.track-city strong {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
}

.track-city a {
  margin-top: 6px;
  font-weight: 600;
}

/* Phones: each section of a track is its own fold */
.explorer-fold {
  border-top: 1px solid var(--color-divider);
}

.explorer-fold > summary {
  padding: 12px 0;
  font-weight: 700;
  cursor: pointer;
}

.explorer-fold > .explorer-panel-body {
  padding-bottom: 14px;
}

/* ----- Careers across tracks ----- */
.careers-text {
  max-width: 760px;
  line-height: 1.6;
}

.sector-overlap {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.sector-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 16px;
}

.sector-row + .sector-row {
  border-top: 1px solid var(--color-divider);
}

.sector-name {
  display: flex;
  flex-direction: column;
}

.sector-name span {
  color: var(--color-muted);
  font-size: 0.82rem;
}

.sector-tracks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sector-chip {
  min-width: 3.4em;
  padding: 3px 8px;
  border: 1px dashed var(--color-input-border);
  border-radius: var(--radius-pill);
  color: var(--color-muted); /* readable; "not listed" is shown by the dashed outline and the missing tick */
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.sector-chip.is-listed::before {
  content: "✓ ";
}

.sector-chip.is-listed {
  border: 1px solid var(--track-accent);
  background: var(--color-card);
  color: var(--color-text);
  box-shadow: inset 4px 0 0 var(--track-accent);
}

/* ----- Cities ----- */
.tracks-city-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.tracks-city-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.tracks-city-card h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
}

.tracks-city-card .city-country {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.tracks-city-uni {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.88rem;
}

.city-presence {
  margin: 8px 0;
  padding-left: 18px;
  line-height: 1.6;
}

.tracks-city-card a {
  margin-top: auto;
  font-weight: 600;
}

/* ----- FAQ ----- */
.faq-item {
  border-bottom: 1px solid var(--color-divider);
}

.faq-item > summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 14px 0;
  font-weight: 700;
  cursor: pointer;
}

.faq-item > p {
  margin: 0 0 16px;
  line-height: 1.6;
  max-width: 760px;
}

.faq-audience {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ----- Sources ----- */
.sources-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

/* ----- Tablets and phones ----- */
@media (max-width: 1000px) {
  .tracks-city-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journey {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .journey-paths {
    margin-left: 18px;
  }
}

@media (max-width: 640px) {
  .tracks-hero {
    padding: 24px 18px;
  }

  .tracks-section {
    margin-top: 40px;
  }

  .track-card-grid,
  .track-city-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .journey-path {
    grid-template-columns: minmax(0, 1fr);
  }

  .journey-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journey-thesis {
    grid-column: 1 / -1;
  }

  .track-detail > summary,
  .track-detail-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .sector-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 400px) {
  .tracks-city-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Section titles on the Tracks page use the same serif style as the homepage */
.tracks .section-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tracks .section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 18px;
}

/* ----- Tracks: My track ----- */
.mine-label {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-ink);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.track-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.track-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--track-accent);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.track-pick:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.track-pick[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--track-accent), var(--shadow-sm);
}

.track-pick strong {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
}

.track-pick span:last-child {
  color: var(--color-muted);
  font-size: 0.86rem;
}

.my-track-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 10px;
}

.my-track-foot .course-note {
  margin: 0 auto 0 0;
}

.my-track-card {
  padding: 22px;
  border: 1px solid var(--color-border);
  border-left: 5px solid var(--track-accent);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.my-track-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 14px;
}

.my-track-head h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 600;
}

.my-track-head .button {
  margin-left: auto;
}

.my-track-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.my-track-semester {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
}

.my-track-semester strong {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
}

.my-track-semester .track-course-list {
  margin-top: 8px;
  font-size: 0.92rem;
}

.my-track-guides {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  line-height: 1.8;
}

.my-track-guides a {
  font-weight: 600;
}

/* ----- Tracks: Compare ----- */
.compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.compare-mark {
  display: inline-block;
  width: 1.1em;
  text-align: center;
}

.is-required .compare-mark,
.compare-cell.is-required .compare-status {
  color: var(--color-primary);
}

.is-none .compare-mark,
.compare-cell.is-none .compare-status {
  color: var(--color-muted);
}

.compare-table-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.9rem;
}

.compare-table th,
.compare-table td {
  padding: 12px;
  border-bottom: 1px solid var(--color-divider);
  text-align: left;
  vertical-align: top;
}

.compare-table thead th {
  background: var(--color-surface-alt);
}

.compare-table thead th:first-child {
  width: 19%;
}

.compare-table tbody th {
  font-weight: 700;
}

.compare-track-name {
  display: block;
  margin-top: 6px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

.compare-table tr:last-child th,
.compare-table tr:last-child td {
  border-bottom: none;
}

.compare-table .compare-fact th,
.compare-table .compare-fact td {
  background: var(--color-surface-alt);
}

/* My track's column */
.compare-table th.is-mine,
.compare-table td.is-mine {
  background: var(--color-primary-light);
}

.compare-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.compare-status {
  font-weight: 700;
}

.compare-courses {
  display: block;
  color: var(--color-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.compare-cards {
  display: grid;
  gap: 12px;
}

.compare-card {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.compare-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.compare-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.compare-card li {
  display: grid;
  grid-template-columns: 5.4em minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  border-top: 1px solid var(--color-divider);
}

.compare-card li.is-mine {
  margin: 0 -8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
}

.compare-card .track-badge {
  justify-content: center;
  padding: 3px 6px;
}

/* Compare two tracks */
.compare-two,
.track-overlaps {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.compare-two h3,
.track-overlaps h3 {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
}

.compare-two-pickers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.compare-two-pickers label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 0.88rem;
}

.compare-two-pickers select {
  padding: 8px;
  font: inherit;
}

.compare-two-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr) minmax(0, 1fr);
  font-size: 0.9rem;
}

.compare-two-grid > * {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-divider);
}

.compare-two-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border-bottom: 2px solid var(--track-accent);
}

.compare-two-head strong {
  font-family: var(--font-heading);
  font-weight: 600;
}

.compare-two-label {
  font-weight: 700;
}

.compare-two-shared {
  margin: 14px 0 0;
  line-height: 1.55;
}

/* What tracks share */
.track-overlaps > ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.overlap-item {
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}

.overlap-head {
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 700;
}

.overlap-facts {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.9rem;
  line-height: 1.55;
}

@media (prefers-reduced-motion: reduce) {
  .track-pick:hover {
    transform: none;
  }
}

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

  .my-track-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .track-picker,
  .my-track-grid,
  .track-overlaps > ul {
    grid-template-columns: minmax(0, 1fr);
  }

  .track-pick {
    min-height: 0;
  }

  .compare-two,
  .track-overlaps,
  .my-track-card {
    padding: 16px;
  }

  /* Compare two: label on its own line, the two tracks side by side under it */
  .compare-two-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .compare-two-corner {
    display: none;
  }

  .compare-two-label {
    grid-column: 1 / -1;
    padding-bottom: 2px;
    border-bottom: none;
    background: var(--color-surface-alt);
  }
}

/* ----- Tracks: quiz ----- */
.quiz-box {
  margin-top: 16px;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.quiz-intro {
  margin: 0 0 14px;
  font-size: 1.02rem;
}

.quiz-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.quiz-count {
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.quiz-question {
  margin: 0 0 16px;
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 2.6vw, 1.55rem);
  font-weight: 600;
}

/* The question gets focus only so screen readers read it out; no outline needed */
.quiz-question:focus,
.quiz-question:focus-visible {
  outline: none;
}

.quiz-answers {
  display: grid;
  gap: 10px;
}

.quiz-answer {
  min-height: 56px;
  padding: 14px 18px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-text);
  font: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.quiz-answer:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.quiz-answer[aria-pressed="true"] {
  border-color: var(--color-primary);
  box-shadow: inset 4px 0 0 var(--color-primary);
}

.quiz-back {
  margin-top: 14px;
}

.quiz-bars {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.quiz-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.6fr) auto;
  gap: 8px 14px;
  align-items: center;
}

.quiz-bar-label {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px 8px;
  align-items: center;
  font-weight: 600;
}

.quiz-bar {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.quiz-bar span {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--track-accent);
  transition: width 0.6s var(--ease);
}

.quiz-bar-score {
  color: var(--color-muted);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.quiz-close {
  margin: 0 0 16px;
}

.quiz-top {
  display: grid;
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quiz-top-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--track-accent);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}

.quiz-top-card p {
  margin: 0;
  line-height: 1.55;
}

.quiz-top-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.quiz-top-head strong {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.quiz-advice {
  margin: 14px 0 0;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .quiz-bar span,
  .quiz-answer {
    transition: none;
  }
}

@media (max-width: 640px) {
  .quiz-box {
    padding: 16px;
  }

  .quiz-bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .quiz-bar-label {
    grid-column: 1 / -1;
  }

  .quiz-top {
    grid-template-columns: minmax(0, 1fr);
  }

  .quiz-actions .button {
    flex: 1 1 100%;
  }
}

/* =====================================================================
   Past Thesis Explorer (thesis.html, thesis.js)
   ===================================================================== */
.thesis {
  padding-bottom: 48px;
}

.thesis [id] {
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.thesis-section {
  margin-top: 44px;
}

.thesis .section-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 600;
}

.thesis .section-head {
  margin-bottom: 16px;
}

.thesis-subhead {
  margin-top: 36px !important;
}

/* ----- Intro ----- */
.thesis-intro h1 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  line-height: 1.1;
}

.thesis-tagline {
  margin: 10px 0 0;
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  color: var(--color-heading);
}

.thesis-intro-text {
  max-width: 720px;
  margin: 10px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.thesis-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 22px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.thesis-notice > .icon {
  margin-top: 3px;
  color: var(--color-accent);
}

.thesis-notice p {
  margin: 0 0 6px;
  line-height: 1.55;
}

.thesis-notice-small {
  color: var(--color-muted);
  font-size: 0.92rem;
}

.thesis-notice a {
  font-weight: 600;
}

.thesis-stats-label {
  margin: 22px 0 8px;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.thesis-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.thesis-stat {
  display: flex;
  flex-direction: column-reverse;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.thesis-stat dd {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.1;
}

.thesis-stat dt {
  color: var(--color-muted);
  font-size: 0.86rem;
}

/* ----- Search and filters ----- */
.thesis-search-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.thesis-search-box {
  position: relative;
}

.thesis-search-box .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: var(--color-muted);
  pointer-events: none;
}

.thesis-search-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px 14px 46px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  font: inherit;
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
}

.thesis-search-box input:focus-visible {
  outline: 3px solid var(--color-primary-border);
  border-color: var(--color-primary);
}

.thesis-filters {
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.thesis-filters > summary {
  font-weight: 700;
  cursor: pointer;
}

.thesis-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.thesis-filter-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--color-muted);
}

.thesis-filter-grid select {
  min-width: 0;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.92rem;
  color: var(--color-text);
}

.thesis-active {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.thesis-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thesis-chips:empty {
  display: none;
}

.thesis-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px 6px 12px;
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-pill);
  background: var(--color-primary-light);
  color: var(--color-text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.thesis-chip-x {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--color-primary);
}

.thesis-count {
  margin: 16px 0 10px;
  font-weight: 700;
}

/* ----- Result cards ----- */
.thesis-results {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.thesis-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.thesis-card:hover {
  border-color: var(--color-primary-border);
}

.thesis-card.is-open {
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-md);
}

.thesis-card-title {
  margin: 0;
}

.thesis-card-toggle {
  display: block;
  width: 100%;
  padding: 16px 18px 6px;
  border: none;
  background: none;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere; /* long titles wrap fully, never cut off */
  cursor: pointer;
}

.thesis-card-toggle mark {
  padding: 0 2px;
  border-radius: 3px;
  background: #f6dfa0;
  color: #20242a;
}

.thesis-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 18px 10px;
}

.thesis-badge {
  padding: 2px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-alt);
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.thesis-card-details {
  margin: 0 18px;
  padding: 12px 0 16px;
  border-top: 1px solid var(--color-divider);
}

.thesis-card-details h4 {
  margin: 14px 0 4px;
  font-size: 0.95rem;
}

.thesis-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thesis-find {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

.thesis-small {
  margin: 6px 0 10px;
  color: var(--color-muted);
  font-size: 0.86rem;
}

.thesis-card-note {
  margin-top: 12px;
}

.thesis-empty {
  padding: 24px;
  border: 1px dashed var(--color-input-border);
  border-radius: var(--radius-md);
  text-align: center;
}

.thesis-more {
  display: block;
  margin: 16px auto 0;
}

/* ----- Browse: one panel with tabs ----- */
.thesis-browse-head {
  margin-bottom: 12px;
}

.thesis-mytrack {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.thesis-link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.thesis-browse-panel {
  margin-top: 12px;
}

.thesis-browse-intro {
  margin: 0 0 4px;
}

.thesis-class-note {
  margin: 0 0 12px;
  color: var(--color-muted);
  font-size: 0.86rem;
}

.thesis-pills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.thesis-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.thesis-pill:hover {
  border-color: var(--color-primary-border);
}

/* Selected: a check mark in the text plus a thicker border (never colour alone) */
.thesis-pill[aria-pressed="true"] {
  padding: 9px 13px;
  border: 2px solid var(--color-primary);
}

.thesis-pill strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.thesis-pill-code {
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.thesis-pill-count {
  color: var(--color-muted);
  font-size: 0.84rem;
}

.thesis-matrix-box {
  margin-top: 20px;
}

.thesis-matrix-box h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

/* ----- Student Hub classification (filters, cards, details) ----- */
.thesis-filter-hint {
  display: block;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.thesis-filter-note {
  margin: 10px 0 0;
  color: var(--color-muted);
  font-size: 0.84rem;
}

.thesis-suggest {
  margin: 14px 0 0;
  font-size: 0.92rem;
}

.thesis-count-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 16px 0 10px;
}

.thesis-count-row .thesis-count {
  margin: 0;
}

/* The draft note sits next to the count; Inspire me stays on the right */
.thesis-count-row .thesis-draft {
  margin-right: auto;
}

.thesis-draft {
  display: inline-block;
  padding: 0 7px;
  border: 1px dashed var(--color-input-border);
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.thesis-classification {
  margin: 0 18px 14px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-divider);
}

.thesis-class-label {
  margin-right: 6px;
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.thesis-class-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.thesis-theme {
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-light);
  color: var(--color-text);
  font-size: 0.78rem;
}

.thesis-theme.is-none,
.thesis-theme.is-more {
  background: var(--color-surface-alt);
  color: var(--color-muted);
}

.thesis-rel {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.thesis-rel-track {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
}

.thesis-detail-class {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--color-input-border);
  border-radius: var(--radius-md);
}

.thesis-card-details .thesis-detail-class h4 {
  margin-top: 0;
}

.thesis-detail-list {
  margin: 0;
}

.thesis-detail-list dt {
  margin-top: 8px;
  font-size: 0.84rem;
  font-weight: 700;
}

.thesis-detail-list dd {
  margin: 2px 0 0;
}

.thesis-relevance {
  margin: 0;
  padding-left: 18px;
}

.thesis-relevance .thesis-small {
  display: block;
  margin: 2px 0 6px;
}

.thesis-related-list {
  display: grid;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.thesis-related-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
}

.thesis-related-item:hover {
  border-color: var(--color-primary-border);
}

.thesis-related-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.thesis-related-meta {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.thesis-matrix-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  overflow: hidden;
}

.thesis-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.thesis-matrix th,
.thesis-matrix td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-divider);
  text-align: left;
}

.thesis-matrix thead th {
  background: var(--color-surface-alt);
}

.thesis-matrix td {
  text-align: center;
}

.thesis-matrix tr:last-child th,
.thesis-matrix tr:last-child td {
  border-bottom: none;
}

.thesis-matrix-link {
  display: inline-block;
  min-width: 2.2em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-light);
  font-weight: 700;
}

.thesis-matrix-zero {
  color: var(--color-muted);
}

.thesis-matrix-stacked {
  display: none;
}

/* ----- Examples ----- */
.thesis-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.thesis-example {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text);
  text-decoration: none;
}

.thesis-example:hover {
  border-color: var(--color-primary-border);
}

.thesis-example-title {
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
}

.thesis-example-meta {
  color: var(--color-muted);
  font-size: 0.82rem;
}

/* ----- Notes ----- */
.thesis-callout,
.thesis-own,
.thesis-source {
  margin-top: 14px;
  padding: 18px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.thesis-callout {
  border-left: 4px solid var(--color-primary);
}

.thesis-callout h2,
.thesis-own h2,
.thesis-source h2 {
  margin: 0 0 6px;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
}

.thesis-callout p,
.thesis-own p,
.thesis-source p {
  margin: 6px 0 0;
  line-height: 1.6;
}

.thesis-source {
  background: var(--color-surface-alt);
  font-size: 0.92rem;
}

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

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

  .thesis-filter-grid,
  .thesis-examples {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The table becomes one small card per legacy track */
  .thesis-matrix-wrap {
    display: none;
  }

  .thesis-matrix-stacked {
    display: grid;
    gap: 10px;
  }

  .thesis-matrix-card {
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card);
  }

  .thesis-matrix-card ul {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
  }

  .thesis-matrix-card li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid var(--color-divider);
  }

  .thesis-card-toggle {
    padding: 14px 14px 6px;
    font-size: 1.02rem;
  }

  .thesis-badges {
    padding: 0 14px 10px;
  }

  .thesis-classification {
    margin: 0 14px 12px;
  }

  .thesis-pills {
    grid-template-columns: minmax(0, 1fr);
  }

  .thesis-browse-tabs .track-tab {
    padding: 6px 10px;
  }

  .thesis-card-details {
    margin: 0 14px;
  }
}



/* =====================================================================
   Shared header: Student Hub lockup, direct links, filled Join button, white bar
   ===================================================================== */
:root {
  --color-header-bg: #ffffff;
}

:root[data-theme="dark"] {
  --color-header-bg: #0d1a2e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-header-bg: #0d1a2e;
  }
}

.brand-mark,
:root[data-theme="dark"] .brand-mark {
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--color-header-text);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark {
    box-shadow: none;
  }
}

.brand-mark::after {
  content: none;
}

.brand-mark .icon {
  width: 44px;
  height: 44px;
  stroke-width: 1.75;
}

/* Pulse to Growth: navy, white and terracotta, reversed on dark surfaces. */
.hub-brand-icon {
  --hub-badge: var(--navy-900);
  --hub-pulse: var(--white);
  --hub-accent: var(--terracotta-600);
}

:root[data-theme="dark"] .hub-brand-icon,
.site-footer .hub-brand-icon {
  --hub-badge: var(--ivory-page);
  --hub-pulse: var(--navy-900);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hub-brand-icon {
    --hub-badge: var(--ivory-page);
    --hub-pulse: var(--navy-900);
  }
}

.brand-lockup {
  gap: 10px;
}

.brand-name {
  font-family: var(--font-sans);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-product {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
}

.brand-descriptor {
  display: flex;
  flex-direction: column;
  max-width: none;
  margin-left: var(--space-5);
  padding-left: var(--space-5);
  font-size: var(--fs-meta);
  line-height: 1.35;
}

.header-bar {
  min-height: 76px;
}

.menu > .menu-item > .menu-link,
.menu-group {
  font-weight: 500;
  font-size: 0.95rem;
  padding-inline: 10px;
}

.menu > .menu-item > .menu-link.is-current,
.menu-group.is-current {
  font-weight: 700;
}

.menu > .menu-item > .menu-link:hover,
.menu-group:hover {
  background: transparent;
  color: var(--color-link);
}

/* Search is an icon on the header bar (the dialog itself is unchanged) */
.header-actions .search-button {
  min-width: 40px;
  width: 40px;
  padding: 0;
  justify-content: center;
}

.header-actions .search-button .search-label,
.header-actions .search-button kbd {
  display: none;
}

.header-actions .header-cta {
  min-height: 44px;
  padding: 10px 18px;
  white-space: nowrap;
}

@media (max-width: 1500px) {
  .brand-descriptor {
    display: none;
  }
}

@media (max-width: 1160px) {
  .header-actions .header-cta {
    display: none;
  }
}

@media (max-width: 900px) {
  .brand-mark .icon {
    width: 36px;
    height: 36px;
  }

  .brand-name {
    font-size: 1.3rem;
  }

  .brand-product {
    font-size: 0.82rem;
  }

  .header-bar {
    min-height: 62px;
  }

  .menu > .menu-item > .menu-link {
    font-weight: 600;
  }
}

/* =====================================================================
   PAGE HEADER BAND (every inner page)
   One look for the top of each page: a full-width warm band under the navigation with an eyebrow,
   a serif title, a short lead and a faint dot grid on the right. Used by .page-intro (Timetable,
   Exams, Calendar, Study Plan, Announcements, Contact, Privacy) and by the heroes that pages build
   in JavaScript (Tracks, Thesis, Notes, Students). The band reaches the screen edges with a
   pseudo-element, so the page structure does not change.
   ===================================================================== */
body {
  overflow-x: clip; /* the full-width band must never cause sideways scrolling */
}

:is(.page-intro, .notes-hero, .tracks-hero, .thesis-intro, .sx-hero) {
  position: relative;
  isolation: isolate;
  margin: 0 0 var(--space-8);
  padding: var(--space-9) 0 var(--space-8);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* At the top of the page the band touches the navigation */
main > :is(.page-intro, .notes-hero, .tracks-hero, .thesis-intro, .sx-hero):first-child {
  margin-top: calc(-1 * var(--space-7));
}

:is(.page-intro, .notes-hero, .tracks-hero, .thesis-intro, .sx-hero)::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -2;
  background: linear-gradient(180deg, var(--surface-warm) 0%, var(--surface-page) 100%);
  border-bottom: 1px solid var(--border-subtle);
}

/* The dot grid, fading out towards the text */
:is(.page-intro, .notes-hero, .tracks-hero, .thesis-intro, .sx-hero)::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(50% - 50vw);
  z-index: -1;
  width: min(48vw, 680px);
  background-image: radial-gradient(color-mix(in srgb, var(--color-navy) 22%, transparent) 1.2px, transparent 1.6px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(to left, #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
  mask-image: linear-gradient(to left, #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
  pointer-events: none;
}

:is(.page-intro, .notes-hero, .tracks-hero, .thesis-intro, .sx-hero) :is(h1, .notes-heading h2) {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--fs-h1);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--color-heading);
}

.page-intro h1 {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.page-intro h1 .icon {
  flex: none;
  width: 52px;
  height: 52px;
  padding: 13px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-link);
}

.page-intro > div > p:not(.section-eyebrow),
.page-intro .page-lead {
  margin: var(--space-4) 0 0;
  max-width: 64ch;
  font-size: var(--fs-body-lg);
  line-height: 1.6;
  color: var(--color-muted);
}

.page-intro .section-eyebrow,
.notes-hero .section-eyebrow {
  margin-bottom: var(--space-3);
}

/* Notes: the totals and search sit inside the band */
.notes-hero .hero-stats {
  margin-top: var(--space-6);
}

.notes-hero .notes-search,
.notes-hero input[type="search"] {
  background: var(--color-card);
}

/* ----- Loading placeholders: the text stays for screen readers, with soft bars under it ----- */
:is(#tracks-status, #thesis-status, #guide-status):not(:empty) {
  display: block;
  padding: var(--space-9) 0 var(--space-6);
  font-style: normal;
  color: var(--color-muted);
}

:is(#tracks-status, #thesis-status, #guide-status):not(:empty)::after {
  content: "";
  display: block;
  height: 120px;
  max-width: 720px;
  margin-top: var(--space-5);
  border-radius: var(--radius-md);
  background:
    linear-gradient(var(--color-card) 0 0) 0 0 / 60% 28px,
    linear-gradient(var(--color-card) 0 0) 0 46px / 92% 14px,
    linear-gradient(var(--color-card) 0 0) 0 72px / 84% 14px,
    linear-gradient(var(--color-card) 0 0) 0 98px / 40% 14px;
  background-repeat: no-repeat;
  animation: loading-pulse 1.6s ease-in-out infinite;
}

@keyframes loading-pulse {
  50% {
    opacity: 0.55;
  }
}

/* ----- Sections fade in gently as they scroll into view (ui.js adds .reveal; reduced motion: off) ----- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ----- Phones ----- */
@media (max-width: 680px) {
  :is(.page-intro, .notes-hero, .tracks-hero, .thesis-intro, .sx-hero) {
    padding: var(--space-7) 0 var(--space-6);
    margin-bottom: var(--space-6);
  }

  :is(.page-intro, .notes-hero, .tracks-hero, .thesis-intro, .sx-hero)::after {
    width: 70vw;
    opacity: 0.6;
  }

  .page-intro h1 .icon {
    width: 42px;
    height: 42px;
    padding: 10px;
  }
}

/* Page header band: details for pages that build their own hero */
.tracks-hero .hero-badge {
  display: block;
  width: auto;
  margin: 0 0 var(--space-3);
  padding: 0;
  border: none;
  background: none;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-brand-text);
}

.notes-hero .notes-hero-text {
  margin-top: var(--space-3);
  font-size: var(--fs-body-lg);
  color: var(--color-muted);
}

.thesis-intro .section-eyebrow {
  margin-bottom: var(--space-3);
}

/* Course icons: outline icon in the course colour (utils.js → courseIcon) */
.course-icon {
  color: color-mix(in srgb, var(--course-color, var(--color-primary)) 80%, var(--color-text));
}

.course-icon .icon {
  width: 22px;
  height: 22px;
}

.course-icon.small .icon {
  width: 17px;
  height: 17px;
}

/* ----- Homepage: Roadmap & Updates preview (home.js) ----- */
.roadmap-preview {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--space-5);
}

.roadmap-preview-now {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-7);
  border-radius: var(--radius-md);
  background: var(--surface-navy);
  color: var(--text-on-navy-muted);
  text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.roadmap-preview-now:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.roadmap-preview-now strong {
  font-family: var(--font-heading);
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--white);
}

.roadmap-preview-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: #f6b79d;
}

.roadmap-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.roadmap-preview-more {
  margin-top: auto;
  padding-top: var(--space-3);
  font-weight: 600;
  color: var(--white);
}

.roadmap-preview-now:focus-visible {
  outline-color: var(--color-focus);
}

.roadmap-preview-latest {
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

.roadmap-preview-latest h3 {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-muted);
}

.roadmap-preview-latest ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.roadmap-preview-latest li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px var(--space-3);
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}

.roadmap-preview-latest li:last-child {
  border-bottom: none;
}

.roadmap-preview-latest time {
  grid-column: 1 / -1;
  font-size: var(--fs-meta);
  color: var(--color-muted);
}

.roadmap-preview-latest a {
  font-weight: 600;
  color: var(--color-heading);
  text-decoration: none;
}

.roadmap-preview-latest a:hover {
  color: var(--color-link);
  text-decoration: underline;
}

.roadmap-preview-type {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-meta);
  font-weight: 700;
}

.roadmap-preview-type.is-new { background: var(--success-bg); color: var(--success); }
.roadmap-preview-type.is-improved { background: var(--info-bg); color: var(--pill-blue-text); }

@media (max-width: 800px) {
  .roadmap-preview {
    grid-template-columns: 1fr;
  }

  .roadmap-preview-now {
    padding: var(--space-6);
  }
}

.roadmap-preview-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-3);
  font-size: var(--fs-small);
  color: var(--white);
}



/* ----- Source labels (utils.js → sourceLabel): Official vs Student tip, always written out ----- */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-meta);
  font-weight: 600;
  line-height: 1.6;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.source-badge::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.source-badge.is-official {
  background: var(--info-bg);
  color: var(--pill-blue-text);
}

.source-badge.is-tip {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ----- Key dates (calendar.html, from "keyDates" in content/programme.json) ----- */
.key-dates {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.key-date {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) 1fr;
  gap: 0.25rem 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.key-date.is-exams { border-left-color: var(--brand-terracotta); }
.key-date.is-deadline { border-left-color: var(--warning); }
.key-date.is-classes { border-left-color: var(--action-navy); }
.key-date.is-past { opacity: 0.6; }

.key-date-when {
  margin: 0;
  font-weight: 700;
  color: var(--text-heading);
}

.key-date-body p { margin: 0 0 0.25rem; }
.key-date-title { font-weight: 600; }

.key-date-kind {
  display: inline-block;
  margin-right: 0.5rem;
  font-size: var(--fs-meta);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .key-date { grid-template-columns: 1fr; }
}

/* Homepage: exam period line (Next exam card) and the official study plan reminder (My plan card) */
.dash-period {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--pill-orange-bg);
  color: var(--pill-orange-text);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
}

.dash-period:hover { text-decoration: underline; }

.dash-reminder {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}
/* A link inside a sentence is underlined, so it doesn't rely on colour alone */
.dash-reminder a { text-decoration: underline; text-underline-offset: 2px; }
.key-date.is-now { background: var(--surface-subtle); box-shadow: var(--shadow-xs); }

/* ===== Academic Rules (academic-rules.html, content/academic-rules.json) ===== */
.rules-contents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 12px 16px;
  font-size: var(--fs-small);
  font-weight: 600;
}

.rules-section { scroll-margin-top: calc(var(--header-height, 64px) + 12px); }
.rules-section h2 { margin-top: 0; }

.rules-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 8px;
}

.rules-item .source-badge { vertical-align: middle; }

.rules-note {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--info-bg);
  color: var(--text-primary);
}

.rules-links {
  margin: 14px 0 0;
  font-size: var(--fs-small);
}

.rules-links-label { font-weight: 600; color: var(--text-secondary); }

/* Each university: one card per university, two columns on wide screens */
.rules-unis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
}

.rules-uni {
  margin: 0;
  border-top: 4px solid var(--city-accent, var(--color-border));
}

.rules-uni h3 {
  margin: 0 0 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.rules-uni-city {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text-muted);
}

.rules-uni h4,
.resit-result h4 {
  margin: 16px 0 6px;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--text-secondary);
}

/* Grading table: a table on wide screens, one card per university on phones */
.rules-grades {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.rules-grades th,
.rules-grades td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}

.rules-grades thead th {
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

@media (max-width: 680px) {
  .rules-grades thead { display: none; }
  .rules-grades,
  .rules-grades tbody,
  .rules-grades tr,
  .rules-grades th,
  .rules-grades td { display: block; }
  .rules-grades tr {
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
  }
  .rules-grades tbody th { background: var(--surface-subtle); }
  .rules-grades td::before {
    content: attr(data-label);
    display: block;
    font-size: var(--fs-meta);
    font-weight: 600;
    color: var(--text-muted);
  }
}

/* Re-sit guide */
.resit-question {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.resit-question legend {
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text-heading);
}

.choice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  cursor: pointer;
}

.choice-option:hover { border-color: var(--action-navy); }

.choice-option:has(input:checked) {
  border-color: var(--action-navy);
  background: var(--info-bg);
  font-weight: 600;
}

.choice-option:has(input:focus-visible) {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.choice-option input { accent-color: var(--action-navy); margin: 0; }

.resit-result {
  margin-top: 8px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--action-navy);
  background: var(--surface-subtle);
}

.resit-result h3 { margin-top: 0; }
.resit-reset { margin-top: 14px; }

/* Plagiarism and AI: one block per university */
.rules-integrity-unis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin-top: 16px;
}

.rules-integrity-uni {
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.rules-integrity-uni h3,
.rules-more-topic h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.rules-more {
  display: grid;
  gap: 18px;
}

.rules-disclaimer { margin-top: 24px; }

/* ===== Programme Journey (journey.html, content/programme-events.json) ===== */
.journey-track-picker {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.journey-track-picker legend {
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text-heading);
}

.journey-track-note { margin: 8px 0 0; }

/* Vertical timeline: a line with a dot per stage */
.journey-page .journey-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 28px;
  position: relative;
}

.journey-page .journey-timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-default);
}

.journey-stop {
  position: relative;
  padding: 0 0 24px;
}

.journey-stop::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--action-navy);
  background: var(--surface-card);
}

.journey-stop.is-done::before { background: var(--action-navy); }
.journey-stop.is-done { opacity: 0.75; }

.journey-stop.is-current::before {
  background: var(--brand-terracotta);
  border-color: var(--brand-terracotta);
  box-shadow: 0 0 0 4px var(--pill-orange-bg);
}

.journey-stop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.journey-stop-head h3 { margin: 0; font-size: 1.05rem; }
.journey-stop-meta { margin: 0; font-size: var(--fs-small); color: var(--text-muted); }

.journey-here,
.journey-done,
.journey-mine {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-meta);
  font-weight: 700;
}

.journey-here { background: var(--pill-orange-bg); color: var(--pill-orange-text); }
.journey-done { background: var(--success-bg); color: var(--success); }
.journey-mine { margin-left: 8px; background: var(--info-bg); color: var(--pill-blue-text); }

.journey-place { margin: 6px 0 8px; }
.journey-place.is-unknown { color: var(--text-muted); font-style: italic; }

/* Joint degree: the four titles */
.journey-titles {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 10px;
}

.journey-titles li {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.journey-titles span { font-size: var(--fs-small); color: var(--text-muted); }
.journey-titles + .source-badge { margin-bottom: 12px; }

/* Numbers and fees: big figures */
.journey-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 16px;
  align-items: start;
}

.journey-pair > .card { margin: 0; }

.journey-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.journey-figure {
  display: flex;
  flex-direction: column-reverse;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.journey-figure dd {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-heading);
}

.journey-figure dt { font-size: var(--fs-small); color: var(--text-secondary); }

.journey-history {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.journey-history li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 8px;
}

.journey-year { color: var(--color-brand-text); }

.journey-erasmus-table {
  width: 100%;
  border-collapse: collapse;
}

.journey-erasmus-table th,
.journey-erasmus-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}

.journey-erasmus-table tr.is-mine { background: var(--info-bg); }
#numbers .journey-figures,
.journey-fees .journey-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ===== Support & Contacts (support.html, content/people.json) ===== */
.support-emergency {
  margin: 0 0 16px;
  padding: 14px 18px;
  border: 1px solid var(--danger);
  border-left-width: 5px;
  border-radius: var(--radius-lg);
  background: var(--danger-bg);
}

.support-emergency h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--danger);
}

.support-emergency-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 4px 16px;
}

.support-coordinator {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.support-mail {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.support-official::after { content: " ↗"; }

.support-page-link {
  display: inline-block;
  margin-top: 12px;
  font-weight: 600;
}

.support-emergency-note {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--danger-bg);
}

#leave h3 { margin: 16px 0 8px; font-size: 1rem; }
#leave h3:first-of-type { margin-top: 0; }

/* ===== Interaction polish (shared by every page) ===== */
/* Smooth scrolling to anchors, only once the user has clicked or tabbed into the page (:focus-within).
   A link that opens a page at a section (page.html#section) still lands there at once.
   Off for anyone who asks for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  html:focus-within { scroll-behavior: smooth; }
}

/* Switching light/dark: colours fade briefly instead of jumping */
body,
.site-header,
.site-footer {
  transition: background-color 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}

/* A small press effect on buttons and chips */
.button:active,
.filter-chip:active,
.header-button:active,
.choice-option:active,
.track-tab:active {
  transform: translateY(1px);
}

/* Touch targets: at least 44px on phones and touch screens */
@media (pointer: coarse), (max-width: 600px) {
  .header-actions .header-button,
  .header-actions .header-button:not(.menu-toggle),
  .header-actions .theme-toggle {
    min-width: 44px;
    width: 44px;
    height: 44px;
  }

  .sx-link-button,
  .ex-link-button {
    min-width: 44px;
  }

  .filter-chip,
  .track-tab,
  .sx-link-button,
  .ex-link-button,
  .button-quiet,
  .button-light,
  .button-secondary {
    min-height: 44px;
  }

  label:has(> input[type="checkbox"]),
  label:has(> input[type="radio"]) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* Saved students: the star and the word turn terracotta */
.sx-save.is-saved {
  color: var(--color-brand-text);
  font-weight: 700;
}

.sx-save .icon {
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.15em;
}

/* Study Plan: lock and check icons (instead of emoji) */
.plan-lock .icon { width: 18px; height: 18px; color: var(--color-muted); }
.plan-check .icon,
.plan-complete .icon { width: 1em; height: 1em; vertical-align: -0.12em; color: var(--success); }
.plan-check-dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border: 2px solid var(--color-muted);
  border-radius: 50%;
  vertical-align: -0.05em;
}

/* ===== Readable line length: text blocks stop at about 75 characters ===== */
/* Only text (paragraphs and text list items), never cards or grids */
.rules-item,
.rules-links,
.rules-note,
.rules-disclaimer,
.announcement-message,
.key-date-body p,
.journey-erasmus-intro,
.roadmap-note,
.roadmap-card-summary,
.plan-group-note,
.thesis-notice-main,
.course-note,
.sx-hint,
.uni-section-intro,
.uni-visual-note,
.page-intro p,
#guide p,
#guide li,
.thesis-page main p,
.universities-page main p,
.universities-page main li {
  max-width: 75ch;
}

/* Error and empty states: a control row that was never filled (data failed to load) stays out of sight */
.segmented:empty { display: none; }
