/* ============================================================
   AI for Smart Mobility Lab at KFUPM
   Technical/geometric template. KFUPM green. Light and dark themes.
   ============================================================ */

/* ---------- 1. Tokens ---------- */

:root {
  color-scheme: light;

  --bg:            #ffffff;
  --bg-alt:        #f3f7f4;
  --surface:       #ffffff;
  --surface-2:     #ecf3ee;
  --border:        #dbe5df;
  --border-strong: #bccec4;

  --text:          #0b1512;
  --text-2:        #2d3d36;
  --muted:         #59695f;

  /* KFUPM green, sampled from the university mark */
  --accent:        #027e40;
  --accent-hover:  #015c2e;
  --accent-contrast: #ffffff;
  --accent-soft:   rgba(2, 126, 64, 0.08);
  --accent-line:   rgba(2, 126, 64, 0.30);

  /* fixed dark panel, identical in both themes */
  --ink:           #04231a;
  --ink-2:         #07301f;
  --on-ink:        #eaf4ee;
  --on-ink-muted:  #a8c4b5;

  --shadow-sm: 0 1px 2px rgba(6, 32, 22, 0.06);
  --shadow-md: 0 6px 20px -8px rgba(6, 32, 22, 0.18);
  --shadow-lg: 0 22px 48px -22px rgba(6, 32, 22, 0.40);

  --radius:    4px;
  --radius-lg: 6px;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --wrap: 1180px;
  --wrap-narrow: 800px;
  --header-h: 62px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #08110d;
  --bg-alt:        #0b1712;
  --surface:       #0f1c16;
  --surface-2:     #14251d;
  --border:        #1e332a;
  --border-strong: #2e4c3e;

  --text:          #e6efe9;
  --text-2:        #bfd0c6;
  --muted:         #8ea398;

  --accent:        #4ed18a;
  --accent-hover:  #7ce0ab;
  --accent-contrast: #04241a;
  --accent-soft:   rgba(78, 209, 138, 0.13);
  --accent-line:   rgba(78, 209, 138, 0.34);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 22px -8px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 22px 50px -22px rgba(0, 0, 0, 0.85);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg:            #08110d;
    --bg-alt:        #0b1712;
    --surface:       #0f1c16;
    --surface-2:     #14251d;
    --border:        #1e332a;
    --border-strong: #2e4c3e;

    --text:          #e6efe9;
    --text-2:        #bfd0c6;
    --muted:         #8ea398;

    --accent:        #4ed18a;
    --accent-hover:  #7ce0ab;
    --accent-contrast: #04241a;
    --accent-soft:   rgba(78, 209, 138, 0.13);
    --accent-line:   rgba(78, 209, 138, 0.34);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 6px 22px -8px rgba(0, 0, 0, 0.65);
    --shadow-lg: 0 22px 50px -22px rgba(0, 0, 0, 0.85);
  }
}

/* ---------- 2. Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.18;
  letter-spacing: -0.018em;
  font-weight: 600;
  margin: 0;
}

::selection { background: var(--accent-soft); color: var(--text); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 28px;
}
.wrap--narrow { max-width: var(--wrap-narrow); }

@media (max-width: 560px) { .wrap { padding-inline: 20px; } }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 18px;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* mono utility label used all over the template */
.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

/* ---------- 3. Top bar + header ---------- */

.topbar {
  background: var(--ink);
  color: var(--on-ink-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 34px;
  flex-wrap: wrap;
}
.topbar a { color: var(--on-ink); }
.topbar a:hover { color: #ffffff; }
.topbar__right { display: flex; gap: 18px; }
@media (max-width: 720px) { .topbar__right { display: none; } }

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  min-width: 0;
  color: var(--text);
}
.brand:hover { color: var(--text); text-decoration: none; }

.brand__mark {
  width: 36px;
  height: 36px;
  flex: none;
  color: var(--accent);
}
.brand__mark svg { width: 100%; height: 100%; display: block; }

.brand__text { min-width: 0; }
.brand__name {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.brand__sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  position: relative;
  padding: 10px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}
.nav a:hover { color: var(--accent); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--accent); border-color: var(--accent-line); }
.icon-btn svg { width: 17px; height: 17px; }

.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

.nav-toggle { display: none; }

@media (max-width: 1120px) {
  .nav-toggle { display: grid; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 24px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav a { padding: 14px 4px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
  .nav a:last-child { border-bottom: 0; }
  .nav a[aria-current="page"]::after { left: 0; right: auto; width: 3px; top: 8px; bottom: 8px; height: auto; }
}
@media (max-width: 480px) {
  .brand__sub { display: none; }
  .brand__name { font-size: 14.5px; }
}

/* ---------- 4. Hero (dark ink panel) ---------- */

.hero {
  position: relative;
  background: var(--ink);
  color: var(--on-ink);
  overflow: hidden;
  border-bottom: 3px solid var(--accent);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 420px at 8% 0%, rgba(2, 126, 64, 0.42), transparent 68%),
    radial-gradient(700px 380px at 95% 110%, rgba(78, 209, 138, 0.16), transparent 70%);
}
/* faint technical grid */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.038) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 92%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 92%);
}
.hero .wrap { position: relative; z-index: 1; }

.hero__grid { padding: clamp(58px, 9vw, 112px) 0; }
.hero__body { max-width: 68ch; }

.hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  color: #7fe3ab;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hero__kicker::before {
  content: "";
  width: 26px;
  height: 2px;
  background: #7fe3ab;
}

.hero h1 {
  font-size: clamp(2.3rem, 6vw, 4rem);
  color: #ffffff;
  letter-spacing: -0.028em;
  margin-bottom: 26px;
  max-width: 19ch;
}
.hero h1 em { font-style: normal; color: #7fe3ab; }

.hero__lead {
  margin: 0 0 16px;
  color: var(--on-ink-muted);
  font-size: 1.06rem;
  max-width: 58ch;
}
.hero__lead:last-of-type { margin-bottom: 32px; }

/* hero social row sits on ink */
.hero .social a {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-ink);
}
.hero .social a:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

/* ---------- 5. Buttons, chips, social ---------- */

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 15px; height: 15px; }

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

.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero .btn--primary { background: #ffffff; color: var(--ink); }
.hero .btn--primary:hover { background: #cdf3de; color: var(--ink); }
.hero .btn--ghost { color: #ffffff; border-color: rgba(255, 255, 255, 0.4); }
.hero .btn--ghost:hover { border-color: #ffffff; background: rgba(255, 255, 255, 0.1); color: #ffffff; }

.social { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.social a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.social a:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.social svg { width: 17px; height: 17px; }

/* ---------- 6. Sections ---------- */

.section { padding: clamp(56px, 7vw, 88px) 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  margin-bottom: 40px;
}
.section__label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.section__label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  max-width: 180px;
}
.section__head h2 { font-size: clamp(1.6rem, 3.2vw, 2.15rem); }
.section__head p { margin: 12px 0 0; color: var(--muted); max-width: 62ch; }

.link-more {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.link-more::after { content: "\2192"; transition: transform 0.15s ease; }
.link-more:hover { text-decoration: none; }
.link-more:hover::after { transform: translateX(3px); }

@media (max-width: 640px) {
  .section__head { grid-template-columns: 1fr; align-items: start; }
}

/* ---------- 7. Cards, pillars ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  padding: 30px 26px;
  transition: background 0.18s ease;
}
.card:hover { background: var(--surface-2); }
.card__num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}
.card h3 { font-size: 1.1rem; margin-bottom: 10px; line-height: 1.3; }
.card p { margin: 0 0 20px; color: var(--text-2); font-size: 0.93rem; }
.card .link-more { margin-top: auto; }

.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 24px;
}
.pillar {
  padding: 28px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 0 0 var(--radius) var(--radius);
}
.pillar__num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}
.pillar h3 { font-size: 1.12rem; margin-bottom: 10px; }
.pillar p { margin: 0; font-size: 0.93rem; color: var(--text-2); }

/* ---------- 8. Project rows ---------- */

.project {
  display: grid;
  grid-template-columns: 52px 240px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 34px 0;
  border-top: 1px solid var(--border);
}
.project:last-child { border-bottom: 1px solid var(--border); }

.project__index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  padding-top: 4px;
}
.project__media {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
  display: grid;
  place-items: center;
  min-height: 160px;
}
.project__media img { max-height: 180px; width: auto; object-fit: contain; }
.project__media a { display: block; position: relative; line-height: 0; }
.project__media a::after {
  content: "";
  position: absolute;
  inset: 0;
  transition: background 0.16s ease;
}
.project__media a:hover::after { background: var(--accent-soft); }

.project__body h3 { font-size: 1.18rem; margin-bottom: 12px; }
.project__body p { margin: 0 0 12px; color: var(--text-2); font-size: 0.94rem; }
.project__body p:last-child { margin-bottom: 0; }

.project__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag strong { color: var(--text-2); font-weight: 600; }
.tag--accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }

@media (max-width: 900px) {
  .project { grid-template-columns: 40px minmax(0, 1fr); gap: 18px 16px; }
  .project__media { grid-column: 2; max-width: 280px; }
  .project__body { grid-column: 2; }
}

/* ---------- 9. Team ---------- */

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.person {
  background: var(--surface);
  padding: 28px 20px;
  text-align: center;
  transition: background 0.18s ease;
}
.person:hover { background: var(--surface-2); }
.person__photo {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--surface-2);
}
.person__photo--contain { object-fit: contain; padding: 10px; }
.person h3 { font-size: 1rem; margin-bottom: 5px; }
.person p {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
}
.person .social { justify-content: center; }
.person .social a { width: 30px; height: 30px; }
.person .social svg { width: 14px; height: 14px; }

.lead {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 36px;
  align-items: center;
  padding: 32px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface);
}
.lead img { width: 100%; aspect-ratio: 9 / 11; object-fit: cover; object-position: center top; border-radius: var(--radius); }
.lead h3 { font-size: 1.55rem; margin-bottom: 8px; }
.lead__role {
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
}
.lead p { margin: 0 0 12px; color: var(--text-2); font-size: 0.94rem; }
@media (max-width: 700px) {
  .lead { grid-template-columns: 1fr; gap: 22px; padding: 24px; }
  .lead img { max-width: 180px; }
}

.vacancy {
  background: var(--surface);
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  outline: 1px dashed var(--border-strong);
  outline-offset: -10px;
}
.vacancy h3 { font-size: 1rem; }
.vacancy p {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- 10. Facilities ---------- */

.facility {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 40px;
  align-items: center;
  padding: 44px 0;
  border-top: 1px solid var(--border);
}
.facility:last-child { border-bottom: 1px solid var(--border); }
.facility:nth-child(even) .facility__media { order: 2; }
.facility__media img { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); }
.facility__num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}
.facility h3 { font-size: 1.25rem; margin-bottom: 14px; }
.facility p { margin: 0; color: var(--text-2); font-size: 0.94rem; }
@media (max-width: 820px) {
  .facility { grid-template-columns: 1fr; gap: 24px; padding: 30px 0; }
  .facility:nth-child(even) .facility__media { order: 0; }
}

/* ---------- 11. Publications ---------- */

.pub { padding: 20px 0; border-top: 1px solid var(--border); }
.pub:last-child { border-bottom: 1px solid var(--border); }
.pub__cite { margin: 0 0 10px; color: var(--text-2); font-size: 0.94rem; }
.pub__cite em { color: var(--text); font-style: normal; font-weight: 600; }
.pub__venue { color: var(--muted); font-size: 0.9rem; }

.pub__links { display: flex; flex-wrap: wrap; gap: 7px; }
.pub__links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.pub__links a:hover {
  text-decoration: none;
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.pub__links svg { width: 12px; height: 12px; }

.book-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}
.book-row:last-child { border-bottom: 1px solid var(--border); }
.book-row img { border-radius: 2px; box-shadow: var(--shadow-md); }
.book-row h3 { font-size: 1.08rem; margin-bottom: 8px; }

/* ---------- 12. Positions ---------- */

.toc {
  padding: 26px 28px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  margin-bottom: 16px;
}
.toc h2 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 16px;
}
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li {
  counter-increment: toc;
  position: relative;
  padding-left: 34px;
  margin-bottom: 10px;
  font-size: 0.94rem;
}
.toc li:last-child { margin-bottom: 0; }
.toc li::before {
  content: "0" counter(toc);
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.position {
  padding: 36px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.position:last-of-type { border-bottom: 1px solid var(--border); }
.position h2 { font-size: 1.3rem; margin: 0 0 12px; }
.position__track {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 11px;
  border-radius: 2px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.position h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 10px;
}

.callout {
  margin-top: 40px;
  padding: 30px 32px;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: var(--radius);
}
.callout h2 { color: #ffffff; font-size: 1.3rem; margin: 0 0 12px; }
.callout p { margin: 0; color: var(--on-ink-muted); }
.callout a { color: #7fe3ab; }
.callout a:hover { color: #ffffff; }

/* ---------- 13. Prose ---------- */

.prose { padding: clamp(44px, 6vw, 68px) 0 clamp(56px, 7vw, 88px); }
.prose p { margin: 0 0 1.15em; color: var(--text-2); }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text); font-weight: 600; }

.prose ul, .prose ol { margin: 0 0 1.4em; padding-left: 0; list-style: none; }
.prose li { position: relative; padding-left: 26px; margin-bottom: 0.8em; color: var(--text-2); }
.prose li:last-child { margin-bottom: 0; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.68em;
  width: 8px;
  height: 1.5px;
  background: var(--accent);
}
.prose figure { margin: 2em 0; text-align: center; }
.prose figure img {
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.prose figcaption { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }

/* the callout sits on the fixed ink panel, so it keeps its own text colors
   even when it appears inside .prose (which would otherwise win on order) */
.prose .callout p { color: var(--on-ink-muted); }
.prose .callout a { color: #7fe3ab; }
.prose .callout a:hover { color: #ffffff; }

/* ---------- 14. Page header ---------- */

.page-header {
  position: relative;
  padding: clamp(44px, 6vw, 72px) 0 clamp(30px, 4vw, 44px);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.page-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(560px 260px at 4% -20%, var(--accent-soft), transparent 70%);
}
.page-header .wrap { position: relative; }
.page-header h1 { font-size: clamp(2rem, 4.6vw, 2.9rem); }
.page-header__sub { margin: 16px 0 0; color: var(--muted); max-width: 66ch; font-size: 1.02rem; }
.page-header .section__label { margin-bottom: 16px; }

/* ---------- 15. Toolbar / filtering ---------- */

.toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  padding: 14px 0;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.toolbar__inner { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.search { position: relative; flex: 1 1 240px; min-width: 0; max-width: 340px; }
.search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 10px 14px 10px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.filter-status {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.is-hidden { display: none !important; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }

/* ---------- 16. News list ---------- */

.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li {
  position: relative;
  padding: 18px 0 18px 26px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.95rem;
}
.news-list li:last-child { border-bottom: 1px solid var(--border); }
.news-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.62em;
  width: 10px;
  height: 1.5px;
  background: var(--accent);
}

.news-entry { padding: 22px 0; border-top: 1px solid var(--border); }
.news-entry:last-of-type { border-bottom: 1px solid var(--border); }
.news-entry__body { margin-top: 10px; color: var(--text-2); font-size: 0.95rem; }
.news-entry figure { margin: 14px 0 0; max-width: 460px; }
.news-entry figure img { border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- 17. Contact ---------- */

.contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.contact__item { background: var(--surface); padding: 26px 24px; }
.contact__item h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.contact__item h3 svg { width: 15px; height: 15px; flex: none; }
.contact__item p { margin: 0; color: var(--text-2); font-size: 0.92rem; line-height: 1.65; }

/* ---------- 18. Map ---------- */

#map {
  width: 100%;
  height: 460px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 1;
}
:root[data-theme="dark"] #map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.88) saturate(0.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #map .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.88) saturate(0.7);
  }
}
.leaflet-popup-content { font-family: var(--font-sans); font-size: 13px; }

/* ---------- 19. Footer ---------- */

.site-footer {
  background: var(--ink);
  color: var(--on-ink-muted);
  border-top: 3px solid var(--accent);
  padding: 52px 0 30px;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}
.site-footer__mark { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.site-footer__mark svg { width: 38px; height: 38px; color: #7fe3ab; flex: none; }
/* The footer tile is always mint, so the foreground is always ink. Only the
   pin outline's stroke and the brain circles' fill are retargeted: the pin path
   must keep fill:none, and the .cut details already follow currentColor. */
.site-footer__mark .glyph circle { fill: var(--ink); }
.site-footer__mark .glyph path { stroke: var(--ink); }
.site-footer__mark span {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.25;
}
.site-footer h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7fe3ab;
  margin-bottom: 16px;
}
.site-footer p { color: var(--on-ink-muted); font-size: 0.9rem; margin: 0 0 20px; max-width: 44ch; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-links a { color: var(--on-ink); font-size: 0.9rem; }
.footer-links a:hover { color: #7fe3ab; text-decoration: none; }

.site-footer .social a {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-ink);
}
.site-footer .social a:hover { background: rgba(255, 255, 255, 0.14); color: #ffffff; border-color: rgba(255, 255, 255, 0.35); }

.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--on-ink-muted);
}
.site-footer__bottom a { color: #7fe3ab; }
@media (max-width: 780px) { .site-footer__grid { grid-template-columns: 1fr; gap: 30px; } }

/* ---------- 20. Back to top ---------- */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  width: 42px; height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: var(--accent); border-color: var(--accent-line); }
.to-top svg { width: 16px; height: 16px; }

/* ---------- 21. Print ---------- */

@media print {
  .site-header, .topbar, .site-footer, .to-top, .toolbar { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .hero { background: #fff; color: #000; border: 0; }
  .hero h1, .callout h2 { color: #000; }
  .callout { background: #fff; border: 1px solid #000; color: #000; }
  a { color: #000; text-decoration: underline; }
  .project, .facility, .pub, .card { break-inside: avoid; }
}
