/* =========================================================
   Department of Electronics Engineering, KMITL
   Clean / white / minimal academic theme
   ========================================================= */

/* ---------- Theme tokens (adjust here) ---------- */
:root {
  color-scheme: light;  /* light by default; html.dark switches to dark (see "Dark mode" at the end) */
  --accent: #7b2a33;          /* maroon, taken from the department logo */
  --accent-soft: #f7ecee;
  --ink: #16181d;             /* headings */
  --text: #3d4350;            /* body */
  --muted: #6b7280;
  --line: #e6e8ec;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --surface: #ffffff;          /* cards, panels */
  --header-bg: rgba(255,255,255,.95);
  --on-ink: #ffffff;           /* text on --ink backgrounds */
  --on-accent: #ffffff;        /* text on --accent backgrounds */
  --tag-bg: #eef0f3;
  --line-strong: #c9ccd2;
  --sep: #c4c8cf;
  --faint: #a3a8b1;
  --row-hover: #fcfbfb;
  --note-bg: #fff7e6; --note-line: #f1d9a6; --note-ink: #7a5a12;

  --font-sans: "IBM Plex Sans Thai", "IBM Plex Sans", system-ui, sans-serif;
  --font-serif: "Noto Serif Thai", "Source Serif 4", Georgia, serif;

  --container: 1160px;
  --radius: 6px;
  --gutter: 24px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 .5em;
}
p { margin: 0 0 1em; }

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

/* ---------- Top utility bar ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 36px;
  gap: 16px;
}
.topbar a:hover { color: var(--accent); }
.topbar .links { display: flex; gap: 20px; }

/* ---------- Header / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}
.brand { display: flex; align-items: center; gap: 14px; }
/* chip icon cropped from images/logo.jpg; the filter turns its grey backdrop white */
.brand-mark {
  width: 46px; height: 42px;
  flex-shrink: 0;
  background: url("../../images/site/logo.jpg") no-repeat;
  background-size: 74px 74px;
  background-position: -14px -4px;
  filter: brightness(1.12) contrast(1.25);
  /* no mix-blend-mode: multiply here - it turned the logo black in browser dark modes */
}
.footer-logo {
  width: 150px;
  margin-bottom: 18px;
  filter: brightness(1.12) contrast(1.25);
  /* no mix-blend-mode: multiply here - it turned the logo black in browser dark modes */
}
.brand-text strong {
  display: block;
  font-family: var(--font-serif);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}
.brand-text span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .02em;
}

.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.nav a {
  display: block;
  padding: 8px 14px;
  font-size: 15px;
  color: var(--text);
  border-radius: var(--radius);
  position: relative;
}
.nav a:hover { color: var(--accent); }
.nav a.active { color: var(--ink); font-weight: 500; }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: -19px;
  height: 2px;
  background: var(--accent);
}
.nav-extra { display: none; }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 40px; height: 40px;
  cursor: pointer;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--ink);
  margin: 0 auto;
  position: relative;
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 56px; }
/* top-down: title → image → motto */
.hero-title { margin-bottom: 36px; }
.hero-title h1 { white-space: nowrap; }
.hero-title .sub { margin-bottom: 0; }
/* banner image (images/site/head.png) used as the page title */
.hero-banner { margin: 0; line-height: 0; }
.hero-banner img {
  width: 100%;
  height: auto;
  background: #fff;   /* white backdrop instead of multiply: multiply turned the image black in browser dark modes */
}
.hero:has(.hero-banner) { padding-top: 24px; }
.hero-banner img { max-width: 620px; }   /* smaller department banner so the hero fits one screen */
.hero-title:has(.hero-banner) { margin-bottom: 20px; }
.hero-motto {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 48px;
  margin-top: 36px;
}
.hero-motto .lead {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.7;
  color: var(--ink);
  max-width: 40em;
  margin: 0;
  padding-left: 20px;
  border-left: 3px solid var(--accent);
}
.hero-motto .btn-row { margin-top: 0; flex-shrink: 0; }
.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(30px, 4.2vw, 56px);
  letter-spacing: -.01em;
  margin-bottom: 8px;
}
.hero .sub {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--muted);
  margin-bottom: 24px;
}
.hero p.lead { font-size: 17px; max-width: 34em; }
.hero-media { position: relative; margin: 0; }
.hero-media img {
  width: 100%;
  /* wide crop of images/site/banner.png (1774x887): trims the top edge and the
     decorative wave at the bottom, keeps all three programme names */
  height: auto;
  aspect-ratio: 1774 / 580;
  object-fit: cover;
  object-position: 50% 56%;
  border-radius: var(--radius);
}
.hero-media figcaption {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  transition: background .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-ghost { color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Announcements strip ---------- */
.notice {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}
.notice .container {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding-top: 28px;
  padding-bottom: 28px;
}
.notice h2 { font-size: 18px; margin: 4px 0 0; }
.notice ul { list-style: none; margin: 0; padding: 0; }
.notice li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.notice li:last-child { border-bottom: 0; }
.notice a:hover { color: var(--accent); }
.tag {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 99px;
}
.tag.neutral { color: var(--muted); background: var(--tag-bg); }

/* ---------- Sections ---------- */
.section { padding: 88px 0; }
.section.alt { background: var(--bg-alt); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { font-size: clamp(26px, 3vw, 34px); margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.more-link {
  font-size: 15px;
  color: var(--accent);
  white-space: nowrap;
  font-weight: 500;
}
.more-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Programs ---------- */
.programs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.program {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow .2s, transform .2s;
}
.program:hover { box-shadow: 0 10px 30px rgba(20,24,32,.07); transform: translateY(-2px); }
.program img { aspect-ratio: 16 / 10; object-fit: cover; object-position: left center; width: 100%; border-bottom: 1px solid var(--line); }
.program .body { padding: 24px 24px 28px; display: flex; flex-direction: column; flex: 1; }
.program .meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.program h3 { font-size: 20px; margin-bottom: 12px; }
.program p {
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.program .more-link { margin-top: auto; }

/* ---------- Video / intro ---------- */
.intro {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 56px;
  align-items: center;
}
.intro h2 { font-size: clamp(26px, 3vw, 34px); }
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.fact { border-left: 2px solid var(--accent); padding-left: 14px; }
.fact strong { display: block; font-family: var(--font-serif); font-size: 26px; color: var(--ink); line-height: 1.2; }
.fact span { font-size: 13.5px; color: var(--muted); }

/* ---------- Courses ---------- */
.courses {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px 40px;
}
.course {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.course img {
  width: 140px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}
.course h3 { font-size: 17px; margin-bottom: 6px; }
.course h3 a:hover { color: var(--accent); }
.course p {
  font-size: 14.5px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course .credit { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- News / activities ---------- */
.news {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px 28px;
}
.news-item { display: flex; flex-direction: column; }
.news-item .thumb {
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.news-item img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform .4s;
}
.news-item:hover img { transform: scale(1.04); }
.news-item time { font-size: 13px; color: var(--muted); }
.news-item h3 { font-size: 16.5px; margin: 4px 0 8px; }
.news-item:hover h3 { color: var(--accent); }
.news-item p {
  font-size: 14px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* first item featured */
.news-item.featured { grid-column: span 2; grid-row: span 2; }
.news-item.featured img { aspect-ratio: 16 / 10; }
.news-item.featured h3 { font-size: 22px; }
.news-item.featured p { -webkit-line-clamp: 5; font-size: 15px; }

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.about figure { margin: 0; }
.about img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.about figcaption { font-family: var(--font-serif); color: var(--ink); font-size: 17px; margin-top: 12px; }

/* ---------- Student life ---------- */
.life {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}
.life-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.life-item h3 { font-size: 17px; margin-bottom: 4px; }
.life-item p { font-size: 14.5px; margin: 0; }

/* ---------- CTA ---------- */
.cta {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  background: var(--surface);
}
.cta h2 { font-size: 28px; margin-bottom: 6px; }
.cta p { margin: 0; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 64px 0 32px;
  font-size: 14.5px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 48px;
}
.site-footer h4 {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a:hover { color: var(--accent); }
.site-footer .brand { margin-bottom: 16px; }
.footer-bottom {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .news { grid-template-columns: repeat(2, 1fr); }
  .life { grid-template-columns: repeat(2, 1fr); }
  .programs { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav.open { display: block; box-shadow: 0 12px 24px rgba(20,24,32,.08); }
  .nav-extra { display: block; }
  .nav-extra a { color: var(--muted); font-size: 14px; }
  .nav li:last-child a { border-bottom: 0; }
  section[id], footer[id] { scroll-margin-top: 72px; }
  .nav ul { flex-direction: column; padding: 8px var(--gutter) 16px; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav a.active::after { display: none; }
  .nav a.active { color: var(--accent); }

  .hero { padding: 40px 0; }
  .hero-title { margin-bottom: 24px; }
  .hero-title h1 { white-space: normal; }
  .hero-motto { flex-direction: column; align-items: flex-start; gap: 24px; margin-top: 24px; }
  .hero-motto .lead { font-size: 17px; }
  .hero-text,
  .intro,
  .courses,
  .footer-grid { grid-template-columns: 1fr; gap: 36px; }
  .notice .container { grid-template-columns: 1fr; gap: 8px; }
  .section { padding: 64px 0; }
  .cta { flex-direction: column; align-items: flex-start; padding: 32px; }
}

@media (max-width: 600px) {
  :root { --gutter: 16px; }
  body { font-size: 15.5px; }
  .topbar { display: none; }
  .site-header .container { height: 64px; }
  .brand { gap: 10px; }
  .brand-text strong { font-size: 15.5px; }
  .brand-text span { display: none; }
  .nav a.active::after { bottom: auto; }

  .section { padding: 52px 0; }
  .section-head { margin-bottom: 28px; padding-bottom: 14px; }
  .section-head .more-link { font-size: 14px; }

  .programs, .news, .about { grid-template-columns: 1fr; }
  .programs { gap: 20px; }
  .program img { aspect-ratio: 16 / 10; }   /* program covers carry text — keep the full image */
  .program .body { padding: 18px 18px 20px; }
  .program h3 { font-size: 18px; }
  .program p { -webkit-line-clamp: 3; }

  /* news becomes a compact list: thumbnail + date + title */
  .news { gap: 0; }
  .news-item {
    display: grid;
    grid-template-columns: 104px 1fr;
    grid-template-rows: auto 1fr;
    column-gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }
  .news-item .thumb { grid-row: span 2; margin: 0; }
  .news-item img { aspect-ratio: 1; }
  .news-item h3 { font-size: 15px; margin: 2px 0 0; }
  .news-item p { display: none; }
  .news-item.featured {
    grid-column: auto; grid-row: auto;
    display: flex;
    padding-top: 0;
  }
  .news-item.featured .thumb { margin-bottom: 12px; }
  .news-item.featured img { aspect-ratio: 16 / 10; }
  .news-item.featured h3 { font-size: 19px; margin-bottom: 6px; }
  .news-item.featured p { display: -webkit-box; -webkit-line-clamp: 3; font-size: 14.5px; }

  .about { gap: 20px; }
  .life { gap: 20px 14px; }
  .life-item h3 { font-size: 15.5px; }
  .life-item p { font-size: 13.5px; }
  .cta { padding: 24px; }
  .cta h2 { font-size: 24px; }
  .cta .btn { width: 100%; justify-content: center; }
  .hero-motto .btn-row { width: 100%; }
  .hero-motto .btn { flex: 1; justify-content: center; }
  .site-footer { padding-top: 44px; }
  .course { grid-template-columns: 96px 1fr; gap: 14px; }
  .course img { width: 96px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .footer-bottom { flex-direction: column; }
  .facts { grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
  .fact strong { font-size: 22px; }
}

/* =========================================================
   Inner pages
   ========================================================= */
.container.narrow { max-width: 880px; }
.stack > * + .section-head { margin-top: 64px; }

/* ---------- Page header ---------- */
.page-head {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
}
.page-head h1 { font-size: clamp(28px, 3.6vw, 44px); margin: 0; }
/* department banner (images/site/head.png) on inner pages — change max-width to resize */
.page-banner { max-width: 640px; margin: -24px 0 20px -12px; line-height: 0; }
.page-banner img { width: 100%; height: auto; background: #fff; }
.page-head .lead { margin: 10px 0 0; color: var(--muted); font-size: 17px; max-width: 46em; }
.page-head .eyebrow { margin-bottom: 10px; }
.breadcrumb {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 8px; color: var(--sep); }
.breadcrumb [aria-current] { color: var(--ink); }

/* ---------- Prose ---------- */
.prose { max-width: 46em; }
.prose h2 { font-size: 24px; margin: 40px 0 16px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 19px; margin: 28px 0 10px; }
.prose p { margin-bottom: 1.1em; }
.prose a, .bio-body a:not(.more-link), .meta-list a, .note a, .years a, .sublinks a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(123, 42, 51, .3);
  text-underline-offset: 3px;
}
.prose a:hover { text-decoration-color: var(--accent); }
.note { color: var(--muted); font-size: 15px; }
.back { margin-top: 48px; }

/* lists */
.ticks, .plain, .sublinks { list-style: none; margin: 0 0 1.2em; padding: 0; }
.ticks li {
  position: relative;
  padding: 0 0 12px 28px;
}
.ticks li::before {
  content: "";
  position: absolute;
  left: 2px; top: .62em;
  width: 12px; height: 7px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border-bottom: 0; }
.sublinks { margin: 10px 0 0; }
.sublinks li { padding: 2px 0 2px 18px; position: relative; font-size: 15px; }
.sublinks li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 8px; height: 8px; border-left: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); }

.years { list-style: none; margin: 0 0 1.4em; padding: 0; border-left: 2px solid var(--line); }
.years > li { position: relative; padding: 0 0 22px 24px; }
.years > li::before {
  content: "";
  position: absolute;
  left: -7px; top: .45em;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}
.years strong { display: block; font-family: var(--font-serif); color: var(--ink); font-weight: 600; }
.years span { display: block; }

/* figures */
.figure { margin: 0 0 24px; }
.figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}
.figure figcaption { font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.plan h2 { font-size: 24px; margin: 48px 0 20px; }
.plan h2:first-child { margin-top: 0; }
.plan .note { margin: -8px 0 16px; }
.plan .sublinks { margin-bottom: 24px; }
a.zoom { display: block; cursor: zoom-in; }

/* program page */
.program-intro {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 56px;
  align-items: start;
}
.program-aside { display: grid; gap: 16px; position: sticky; top: 100px; }
.program-aside img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }

/* meta definition list */
.meta-list {
  margin: 0 0 40px;
  border-top: 1px solid var(--line);
}
.meta-list > div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.meta-list dt { color: var(--muted); font-size: 14.5px; }
.meta-list dd { margin: 0; color: var(--ink); }

/* downloads */
.file-link { display: inline-flex; align-items: center; gap: 10px; text-decoration: none !important; color: var(--ink) !important; }
.file-link:hover { color: var(--accent) !important; }
.ftype {
  flex-shrink: 0;
  min-width: 44px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}
.ftype.docx, .ftype.doc { background: #e8eef8; color: #2b5797; }
.doc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.doc-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 12px;
  background: var(--surface);
}
.doc-card h3 { font-size: 19px; margin-bottom: 12px; }
.doc-card ul { list-style: none; margin: 0; padding: 0; }
.doc-card li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }

/* ---------- People ---------- */
.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 36px 28px;
}
.person { display: block; }
.person .photo {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  margin-bottom: 14px;
}
.person img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transition: transform .4s; }
a.person:hover img { transform: scale(1.04); }
a.person:hover h3 { color: var(--accent); }
.person h3 { font-size: 16.5px; margin: 0 0 2px; }
.person .en { font-size: 13px; color: var(--muted); margin: 0 0 6px; line-height: 1.5; }
.person .roles { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.person .roles span {
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--text);
}
.section.alt .person .roles span { background: var(--surface); }

/* ---------- Study plan tables (programs/*.html, generated by tools/plan_*.py) ---------- */
.container.plan:has(.plan-intro) { max-width: var(--container); }
.plan-intro h2 { margin-bottom: 6px; }
.plan-intro .note { margin: 0 0 18px; }
.ph-key { font-family: ui-monospace, monospace; color: var(--muted); }
.plan-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.plan-jump a {
  font-size: 14px; padding: 5px 14px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.plan-jump a:hover { border-color: var(--accent); color: var(--accent); }

.plan-year { margin-top: 48px; scroll-margin-top: 90px; }
.plan-year > h3 {
  font-size: 24px; display: flex; align-items: baseline; gap: 14px;
  padding-bottom: 12px; margin-bottom: 20px; border-bottom: 2px solid var(--ink);
}
.plan-year > h3 span, .electives h2 span {
  font-family: var(--font-sans); font-size: 14px; font-weight: 400; color: var(--muted);
}
.sems { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.sem {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.sem > h4 {
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; color: var(--ink);
  margin: 0; padding: 12px 16px; background: var(--bg-alt); border-bottom: 1px solid var(--line);
}
.sem > h4 small { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 13px; }

.plan-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.plan-table th {
  text-align: left; font-size: 12px; font-weight: 500; letter-spacing: .03em; color: var(--muted);
  padding: 8px 16px; border-bottom: 1px solid var(--line);
}
.plan-table td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.plan-table tbody tr:last-child td { border-bottom: 0; }
.plan-table tbody tr:hover { background: var(--row-hover); }
.plan-table .code { width: 92px; white-space: nowrap; }
.plan-table td.code {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--text);
}
.plan-table td.ph { color: var(--faint); }
.plan-table .name .th { display: block; color: var(--ink); line-height: 1.5; }
.plan-table .name .en { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 1px; }
.plan-table .cr { width: 84px; text-align: right; white-space: nowrap; }
.plan-table td.cr strong { display: block; font-size: 15px; color: var(--ink); }
.plan-table td.cr span { display: block; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-table tfoot td {
  background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 0;
  font-weight: 600; color: var(--ink); padding: 10px 16px;
}
.plan-table tfoot td.cr strong { font-size: 16px; color: var(--accent); }

.route { margin-bottom: 28px; }
.route-title {
  font-family: var(--font-sans); font-size: 16px; font-weight: 600; color: var(--ink);
  margin: 0 0 12px; display: flex; align-items: center; gap: 10px;
}
.route-title span {
  font-size: 12px; font-weight: 600; color: var(--on-accent); background: var(--accent);
  padding: 2px 10px; border-radius: 99px;
}
.choose { list-style: none; margin: 0; padding: 0; }
.choose li {
  display: grid; grid-template-columns: 1fr auto; column-gap: 12px;
  padding: 12px 16px; border-bottom: 1px dashed var(--line); font-size: 14.5px;
}
.choose li::before { display: none; }
.choose .th { color: var(--ink); }
.choose .en { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.choose strong { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--ink); }
.sem .sum { margin: 0; padding: 10px 16px; background: var(--bg-alt); text-align: right; font-weight: 600; color: var(--ink); font-size: 14.5px; }
.sem .sum strong { color: var(--accent); font-size: 16px; margin-left: 12px; }

.plan-total {
  margin: 36px 0 0; padding: 18px 22px; border-radius: var(--radius);
  background: var(--ink); color: var(--on-ink); font-size: 17px; text-align: center;
}
.plan-total strong { font-family: var(--font-serif); font-size: 26px; margin: 0 6px; color: var(--on-ink); }

.electives { margin-top: 72px; scroll-margin-top: 90px; }
.electives > h2 { display: flex; align-items: baseline; gap: 14px; }
.electives > p { max-width: 50em; color: var(--text); }
.egroup {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-top: 12px; overflow: hidden;
}
.egroup summary {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none;
}
.egroup summary::-webkit-details-marker { display: none; }
.egroup summary::after { content: "+"; margin-left: 8px; font-size: 22px; color: var(--muted); line-height: 1; }
.egroup[open] summary::after { content: "–"; }
.egroup[open] summary { border-bottom: 1px solid var(--line); }
.egroup summary .t { flex: 1; }
.egroup summary .t strong { display: block; color: var(--ink); font-family: var(--font-serif); font-weight: 600; font-size: 17px; }
.egroup summary .t .en { font-size: 13px; color: var(--muted); }
.egroup summary .cnt { font-size: 13px; color: var(--muted); white-space: nowrap; }
.g {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 99px; font-size: 12.5px; font-weight: 600; color: #fff;
}
.egroup summary .g { min-width: 34px; height: 34px; font-size: 15px; }
.g1 .g.g1, .g.g1 { background: #7b2a33; }
.g.g2 { background: #2f5d8a; }
.g.g3 { background: #2f7a5b; }
.g.g4 { background: #b0662a; }
.elective-table .grp { width: 96px; text-align: right; white-space: nowrap; }
.elective-table td.grp .g { margin-left: 4px; }
.elective-table .name a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(123,42,51,.3); }

@media (max-width: 960px) {
  .sems { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .plan-year > h3 { font-size: 21px; flex-wrap: wrap; gap: 4px 12px; }
  .plan-table { font-size: 14px; }
  .plan-table th, .plan-table td, .plan-table tfoot td { padding-left: 12px; padding-right: 12px; }
  .plan-table .code { width: 74px; }
  .plan-table td.code { font-size: 12px; }
  .plan-table .cr { width: 62px; }
  .elective-table .grp { width: 64px; }
  .elective-table td.grp .g { margin: 0 0 3px 3px; }
  .egroup summary { padding: 12px 14px; gap: 10px; }
  .egroup summary .cnt { display: none; }
  .plan-total { font-size: 15px; }
}

/* tabs (semiconductor tracks) */
.plan-tracks { margin-top: 48px; scroll-margin-top: 90px; }
.tracks-title { font-size: 24px; display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.tracks-title span { font-family: var(--font-sans); font-size: 14px; font-weight: 400; color: var(--muted); }
.tab-list { display: none; }
.tabs.ready .tab-list {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px;
}
.tab-list button {
  display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.tab-list button:hover { border-color: var(--line-strong); }
.tab-list button[aria-selected="true"] { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.tab-list button .g { min-width: 32px; height: 32px; font-size: 15px; flex-shrink: 0; }
.tab-list button .t strong { display: block; color: var(--ink); font-weight: 600; line-height: 1.4; }
.tab-list button .t .en { font-size: 12.5px; color: var(--muted); }
.tab-panel { scroll-margin-top: 90px; }
.panel-title { display: flex; align-items: center; gap: 10px; font-size: 21px; margin: 40px 0 0; }
.tabs.ready .panel-title { display: none; }
.tabs.ready .tab-panel > .plan-year:first-of-type { margin-top: 28px; }
.tab-panel .egroup { margin-top: 28px; }
.g.g1, .tab-list .g.g1 { background: #7b2a33; }

/* credit structure (communication) */
.plan-structure { margin-top: 40px; scroll-margin-top: 90px; }
.plan-structure h3 { max-width: 640px; font-size: 24px; display: flex; justify-content: space-between; align-items: baseline; }
.plan-structure h3 span { font-family: var(--font-sans); font-size: 13px; font-weight: 400; color: var(--muted); }
.struct { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-width: 640px; }
.struct li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 18px; border-top: 1px solid var(--line); font-size: 15px; }
.struct li::before { display: none; }
.struct li:first-child { border-top: 0; }
.struct li.top { background: var(--bg-alt); font-weight: 600; color: var(--ink); }
.struct li.sub { padding-left: 34px; }
.struct li.sub2 { padding-left: 52px; color: var(--muted); font-size: 14px; }
.struct strong { font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.plan-table .name .fn { display: block; font-size: 12px; color: var(--accent); margin-top: 2px; }
.electives > .sem { margin-top: 12px; }

@media (max-width: 860px) {
  .tabs.ready .tab-list { grid-template-columns: 1fr; gap: 6px; }
  .tab-list button { padding: 10px 14px; }
}
@media (max-width: 600px) {
  .struct li { padding: 8px 12px; font-size: 14px; }
  .struct li.sub { padding-left: 24px; }
  .struct li.sub2 { padding-left: 36px; }
}

/* group photo at the top of staff.html (images/site/staff-banner.jpg) */
.staff-banner { padding-top: 40px; }
.staff-banner figure { margin: 0; }
.staff-banner img { width: 100%; height: auto; aspect-ratio: 1477 / 520; object-fit: cover; border-radius: var(--radius); }
.staff-banner figcaption { font-size: 13.5px; color: var(--muted); margin-top: 10px; }
.staff-banner + .section { padding-top: 56px; }
@media (max-width: 600px) {
  .staff-banner { padding-top: 0; }
  .staff-banner .container { padding: 0; }
  .staff-banner img { border-radius: 0; }
  .staff-banner figcaption { padding: 0 var(--gutter); }
  .staff-banner + .section { padding-top: 40px; }
}

/* bio */
.bio {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: start;
}
.bio-card { position: sticky; top: 100px; }
.bio-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; border-radius: var(--radius); margin-bottom: 16px; }
.bio-card .role { margin: 0 0 4px; color: var(--ink); font-size: 15px; }
.bio-card .contact { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14.5px; overflow-wrap: anywhere; }
.bio-card .contact a { color: var(--accent); }
.bio-section { margin-bottom: 44px; }
.bio-section h2 { font-size: 22px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.bio-section h3 { font-size: 16px; font-family: var(--font-sans); font-weight: 600; color: var(--muted); letter-spacing: .02em; margin: 22px 0 8px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-size: 14px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg-alt);
}
.pubs { margin: 0; padding-left: 1.6em; font-size: 15px; }
.pubs li { padding: 5px 0 5px 4px; }
.pubs li::marker { color: var(--muted); font-size: 13px; }

/* ---------- Gallery + lightbox ---------- */
.gallery-title { font-size: 22px; margin: 48px 0 18px; }
.gallery-title span { font-family: var(--font-sans); font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.g-item { display: block; overflow: hidden; border-radius: 4px; cursor: zoom-in; background: var(--bg-alt); }
.g-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s, opacity .2s; }
.g-item:hover img { transform: scale(1.05); }

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12, 13, 16, .94);
  display: none;
  align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 4px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.lightbox button {
  position: absolute;
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 0;
  width: 48px; height: 48px;
  border-radius: 50%;
  font-size: 30px; line-height: 1;
  cursor: pointer;
}
.lightbox button:hover { background: rgba(255,255,255,.18); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }
.lb-count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.7); font-size: 13px; }

/* ---------- Activity page (new design) ---------- */
.activity .lead-photo { margin: 0 0 40px; }
.lead-photo a { display: block; cursor: zoom-in; border-radius: var(--radius); overflow: hidden; }
.lead-photo img { width: 100%; height: auto; max-height: 620px; object-fit: cover; transition: transform .5s; }
.lead-photo a:hover img { transform: scale(1.015); }
.lead-photo figcaption { font-size: 13.5px; color: var(--muted); margin-top: 10px; }

.activity-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 56px;
  align-items: start;
  margin-bottom: 64px;
}
.activity-body .first { font-size: 18px; line-height: 1.85; color: var(--ink); }
.fact-box {
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 8px 22px;
  background: var(--bg-alt);
}
.fact-box dl { margin: 0; }
.fact-box dl > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.fact-box dl > div:last-child { border-bottom: 0; }
.fact-box dt { font-size: 12.5px; letter-spacing: .04em; color: var(--muted); }
.fact-box dd { margin: 2px 0 0; font-size: 15px; color: var(--ink); line-height: 1.6; }

.gallery-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line);
}
.gallery-head h2 { font-size: 24px; margin: 0; }
.gallery-head span { font-size: 14px; color: var(--muted); }

/* mosaic: every photo keeps its own shape; rows fill the width (justified layout) */
.gallery.mosaic { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery.mosaic::after { content: ""; flex-grow: 999; }
.gallery.mosaic .g-item {
  flex: var(--r) 1 calc(var(--r) * 240px);
  aspect-ratio: var(--r);
  border-radius: 4px;
}
.gallery.mosaic .g-item img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }

.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line);
}
.post-nav-item {
  display: block; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.post-nav-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.post-nav-item span { display: block; font-size: 13px; color: var(--muted); }
.post-nav-item strong { display: block; font-family: var(--font-serif); color: var(--ink); font-weight: 600; margin-top: 2px; }
.post-nav-item.next { text-align: right; }

/* lightbox v2: caption + thumbnail strip */
.lightbox { flex-direction: column; padding: 56px 72px 0; }
.lightbox .lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }
.lightbox .lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; animation: lb-in .25s ease; }
@keyframes lb-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.lb-caption { color: rgba(255,255,255,.88); font-size: 14.5px; text-align: center; padding: 14px 16px 4px; min-height: 1em; max-width: 60em; }
.lb-count { position: static; padding-bottom: 8px; }
.lb-thumbs {
  display: flex; gap: 6px; overflow-x: auto; max-width: 100%;
  padding: 6px 4px 16px; scrollbar-width: thin;
}
.lb-thumbs button {
  position: static; flex: 0 0 auto; width: 72px; height: 50px; border-radius: 3px;
  padding: 0; overflow: hidden; opacity: .45; background: none;
  border: 2px solid transparent; transform: none;
}
.lb-thumbs button.on { opacity: 1; border-color: #fff; }
.lb-thumbs button:hover { opacity: .85; background: none; }
.lb-thumbs img { width: 100%; height: 100%; object-fit: cover; animation: none; }
.lightbox.single .lb-thumbs { display: none; }

@media (max-width: 860px) {
  .activity-body { grid-template-columns: 1fr; gap: 28px; margin-bottom: 48px; }
}
@media (max-width: 600px) {
  .activity .lead-photo { margin: 0 calc(var(--gutter) * -1) 28px; }
  .lead-photo a { border-radius: 0; }
  .lead-photo figcaption { padding: 0 var(--gutter); }
  .activity-body .first { font-size: 16.5px; }
  .gallery.mosaic { gap: 4px; }
  .gallery.mosaic .g-item { flex-basis: calc(var(--r) * 110px); border-radius: 2px; }
  .gallery-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .gallery-head h2 { white-space: nowrap; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-item.next { text-align: left; }
  .lightbox { padding: 52px 0 0; }
  .lb-thumbs button { width: 56px; height: 40px; }
}

/* ---------- About ---------- */
.about-intro { display: grid; grid-template-columns: 1fr 380px; gap: 56px; align-items: start; }
.values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.value {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
}
.value h3 { font-size: 19px; margin-bottom: 8px; }
.value p { margin: 0; }
.value.wide { grid-column: span 3; }
.value ol { margin: 0; padding-left: 1.3em; }
.value ol li { padding: 4px 0; }
.contact-block { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.contact-block h2 { font-size: 28px; }
.contact-block .meta-list { margin: 20px 0 28px; }
.contact-block .meta-list > div { grid-template-columns: 110px 1fr; }
.contact-media { display: grid; gap: 16px; }
.contact-media img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }

@media (max-width: 860px) {
  .program-intro, .bio, .about-intro, .contact-block { grid-template-columns: 1fr; gap: 32px; }
  .program-aside, .bio-card { position: static; }
  .program-aside { grid-template-columns: 1fr 1fr; }
  .bio-card { display: grid; grid-template-columns: 140px 1fr; gap: 0 20px; align-items: start; }
  .bio-card img { grid-row: span 4; margin: 0; }
  .bio-card .contact { margin-top: 8px; }
  .values { grid-template-columns: 1fr; }
  .value.wide { grid-column: auto; }
  .doc-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .page-head { padding: 28px 0 24px; }
  .page-banner { max-width: none; margin: -16px -4px 12px; }
  .page-head .lead { font-size: 15.5px; }
  .breadcrumb { margin-bottom: 12px; font-size: 13px; }
  .people { grid-template-columns: 1fr 1fr; gap: 24px 14px; }
  .person h3 { font-size: 15px; }
  .person .en { font-size: 12px; }
  .bio-card { grid-template-columns: 110px 1fr; }
  .meta-list > div { grid-template-columns: 1fr; gap: 2px; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .g-item { border-radius: 2px; }
  .lightbox button { width: 40px; height: 40px; font-size: 26px; }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
  .prose h2, .plan h2 { font-size: 21px; }
  .back { margin-top: 32px; }
}

.electives h2.mt { margin-top: 48px; }
@media (max-width: 600px) { .electives > h2 { flex-wrap: wrap; gap: 2px 10px; } .electives > h2 span { white-space: nowrap; } }

/* link between curriculum editions (programs/electronics*.html) */
.version-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.version-note a { color: var(--accent); }
.version-note.old {
  display: inline-block; padding: 6px 12px; border-radius: var(--radius);
  background: var(--note-bg); border: 1px solid var(--note-line); color: var(--note-ink);
}

/* header text mark (replaces the small logo + name; the banner already shows both) */
.wordmark {
  font-family: var(--font-serif); font-weight: 700; font-size: 22px; letter-spacing: .01em;
  color: var(--ink); line-height: 1; white-space: nowrap;
}
.wordmark b { color: var(--accent); font-weight: 700; }
.brand:hover .wordmark { opacity: .85; }
@media (max-width: 600px) { .wordmark { font-size: 20px; } }

/* painted student photo at the top of activities.html (whole image, no crop) */
.activities-banner img { aspect-ratio: 1942 / 809; }


/* ---------- Dark mode ----------
   The site is light by default. The dark theme is switched on only by the
   small script in each page's <head> (adds class="dark" to <html>), which
   does so for Mi Browser in dark mode - that browser otherwise forces its
   own dark mode and leaves dark text on a dark background. */
html.dark {
  color-scheme: dark;
  --accent: #e8939c;
  --accent-soft: #3a2328;
  --ink: #eceef1;
  --text: #c5cad3;
  --muted: #9aa0ab;
  --line: #30343c;
  --bg: #14161a;
  --bg-alt: #1a1d22;
  --surface: #1f2228;
  --header-bg: rgba(20,22,26,.95);
  --on-ink: #14161a;
  --on-accent: #14161a;
  --tag-bg: #2a2e35;
  --line-strong: #4a505a;
  --sep: #5a606b;
  --faint: #6f7580;
  --row-hover: #24272e;
  --note-bg: #3a2f17; --note-line: #6b5422; --note-ink: #f0d79a;
}
/* head.png and logo.jpg: dark version.
   invert(1) makes the white background black and dark text light;
   hue-rotate(180deg) turns the colours back (maroon stays maroon, not teal);
   mix-blend-mode: screen lets the black background melt into the page. */
html.dark .hero-banner img,
html.dark .page-banner img {
  background: none;
  filter: invert(1) hue-rotate(180deg);
  mix-blend-mode: screen;
}
html.dark .footer-logo,
html.dark .brand-mark {
  filter: brightness(1.12) contrast(1.25) invert(1) hue-rotate(180deg);
  mix-blend-mode: screen;
}
