/* ─────────────────────────────────────────────────────────────────────────
   Mechatronics & Automation Engineering — UBU
   Design system: dark, technical, restrained.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Background layers */
  --bg-0: #0A0E1A;          /* page */
  --bg-1: #11151F;          /* cards */
  --bg-2: #161B27;          /* raised cards / hover */
  --bg-3: #1D2331;          /* highest */

  /* Borders & dividers */
  --line:        rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --line-glow:   rgba(0, 229, 255, 0.35);

  /* Text */
  --text:       #E6E8EE;
  --text-muted: #9AA1B2;
  --text-dim:   #6B7184;

  /* Accent */
  --accent:        #00E5FF;     /* electric cyan */
  --accent-soft:   #5BC8E0;
  --accent-glow:   rgba(0, 229, 255, 0.18);

  /* Brand secondary (UBU maroon — used sparingly) */
  --ubu-maroon: #9F1A2E;

  /* State */
  --warn: #F4B740;
  --ok:   #4ADE80;

  /* Type */
  --font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-thai:  'Sarabun', 'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Consolas', 'Cascadia Mono', monospace;

  /* Layout */
  --max-w: 1200px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* Motion */
  --t-fast: 120ms cubic-bezier(.4,0,.2,1);
  --t-base: 220ms cubic-bezier(.4,0,.2,1);
}

/* ── reset / base ─────────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-thai);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Faint engineering hex grid (factory-floor wireframe) */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='48.5' viewBox='0 0 56 48.5'><g fill='none' stroke='rgba(255,255,255,0.045)' stroke-width='1'><path d='M14 0 L42 0 L56 24.25 L42 48.5 L14 48.5 L0 24.25 Z'/><path d='M42 48.5 L56 24.25 M14 48.5 L0 24.25'/></g></svg>");
  background-size: 56px 48.5px;
  background-attachment: fixed;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--accent-soft); }

h1, h2, h3, h4 {
  font-family: var(--font-thai);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  color: var(--text);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.2; }
h3 { font-size: 1.2rem; line-height: 1.3; }

p { margin: 0 0 1em; color: var(--text-muted); }

/* Mono for stats */
.mono, .stat-num {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
}

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

/* ── nav ──────────────────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.9rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand:hover { color: var(--text); }

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
  display: block;
  position: relative;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.brand:hover .brand-mark { transform: translateY(-1px); }
.brand-mark img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
}
.brand:hover .brand-mark {
  box-shadow: 0 0 14px var(--accent-glow);
}

.brand-text-en {
  font-family: var(--font-latin);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  display: block;
}

.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast);
  font-weight: 500;
  white-space: nowrap;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--bg-1);
}
.nav-links a.is-active {
  color: var(--accent);
  background: var(--bg-1);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 1.1rem;
  margin-left: auto;
}

@media (max-width: 1024px) {
  .nav-toggle { display: grid; place-items: center; }
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-1);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1rem;
    margin-left: 0;
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 0.75rem 0.5rem; border-radius: 0; }
}

/* ── layout primitives ────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: clamp(3rem, 8vw, 6rem) 0;
}

.section-header {
  margin-bottom: 2.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.eyebrow::before {
  content: '';
  width: 18px; height: 1px;
  background: var(--accent);
}

/* ── hero ─────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: clamp(440px, 72vh, 760px);
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}
@media (max-width: 600px) {
  .hero { min-height: 460px; }
  .hero h1 { word-break: break-word; }
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(0.85) brightness(0.5);
}

/* For the cyan/Industry-4.0 hero image — preserve more of the original tone */
.hero-industrial .hero-bg {
  filter: saturate(1.05) brightness(0.7) contrast(1.05) hue-rotate(-4deg);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 75% 50%, transparent 0%, rgba(10,14,26,0.85) 70%),
    linear-gradient(90deg, rgba(10,14,26,0.78) 0%, rgba(10,14,26,0.35) 50%, rgba(10,14,26,0.55) 100%),
    linear-gradient(180deg, rgba(10,14,26,0.4) 0%, var(--bg-0) 100%);
}

.hero-content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem var(--gutter);
  width: 100%;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
}
.hero-tag::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.hero h1 {
  max-width: 22ch;
  margin-bottom: 0.4rem;
}
.hero h1 .accent { color: var(--accent); }

.hero-en {
  font-family: var(--font-latin);
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  letter-spacing: 0.04em;
  font-weight: 400;
  margin-bottom: 1.6rem;
}

.hero-lede {
  max-width: 56ch;
  font-size: clamp(1rem, 1.4vw, 1.1rem);
  color: var(--text-muted);
  margin-bottom: 2.2rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

/* ── buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.4rem;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast),
              border-color var(--t-fast), color var(--t-fast);
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #66EFFF;
  color: var(--bg-0);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-arrow::after {
  content: '→';
  font-family: var(--font-mono);
  transition: transform var(--t-fast);
}
.btn-arrow:hover::after { transform: translateX(3px); }

/* ── stat strip ───────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-top: -3rem;
  position: relative;
  z-index: 5;
}

.stat {
  background: var(--bg-1);
  padding: 1.6rem 1.4rem;
  transition: background var(--t-fast);
}
.stat:hover { background: var(--bg-2); }

.stat-num {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.stat-num .unit {
  font-size: 0.55em;
  color: var(--text-dim);
  margin-left: 0.3rem;
  font-weight: 400;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── card grid ────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: 1.25rem;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.5rem;
  transition: border-color var(--t-base), background var(--t-base),
              transform var(--t-base);
  position: relative;
}
.card:hover {
  border-color: var(--line-strong);
  background: var(--bg-2);
}
.card-tight { padding: 1.1rem 1.25rem; }

.card-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.7rem;
  display: block;
}

.card h3 {
  margin-bottom: 0.45rem;
  font-size: 1.05rem;
}
.card p {
  margin-bottom: 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ── image gallery ────────────────────────────────────────────────────── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
  background: var(--bg-1);
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-base), filter var(--t-base);
  filter: saturate(0.9);
}
.gallery-item:hover img {
  transform: scale(1.04);
  filter: saturate(1);
}
.gallery-item .caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.7rem 0.9rem 0.6rem;
  background: linear-gradient(180deg, transparent, rgba(10,14,26,0.95));
  font-size: 0.8rem;
  color: var(--text);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  pointer-events: none;
}

.gallery-tall { grid-row: span 2; aspect-ratio: 3 / 4; }
.gallery-wide { grid-column: span 2; aspect-ratio: 8 / 3; }

@media (max-width: 600px) {
  .gallery-tall { grid-row: auto; aspect-ratio: 4/3; }
  .gallery-wide { grid-column: auto; aspect-ratio: 4/3; }
}

/* ── tables (curriculum / study plan) ─────────────────────────────────── */
.tbl-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow-x: auto;             /* horizontal scroll on phones */
  -webkit-overflow-scrolling: touch;
  background: var(--bg-1);
}
.tbl-wrap::-webkit-scrollbar { height: 6px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.tbl thead th {
  background: var(--bg-2);
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}
.tbl td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-2); }
.tbl .code {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
  white-space: nowrap;
}
.tbl .credits {
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}
.tbl tfoot td {
  background: var(--bg-2);
  font-weight: 600;
  color: var(--text);
}

/* ── accordion (course groups) ────────────────────────────────────────── */
details.acc {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  margin-bottom: 0.9rem;
  overflow: hidden;
}
details.acc[open] { border-color: var(--line-strong); }
details.acc summary {
  cursor: pointer;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--accent);
  transition: transform var(--t-fast);
}
details.acc[open] summary::after { content: '−'; }
details.acc .acc-body { padding: 0 1.25rem 1.25rem; }

.acc-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ── PLO / YLO blocks ─────────────────────────────────────────────────── */
.outcome {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 1.3rem 1.5rem;
  margin-bottom: 1rem;
}
.outcome .label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
  display: block;
}
.outcome p { margin: 0; color: var(--text); }

.year-block {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.year-block h3 {
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.year-block ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.year-block li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  display: flex;
  gap: 0.8rem;
}
.year-block li::before {
  content: attr(data-id);
  font-family: var(--font-mono);
  color: var(--text-dim);
  flex-shrink: 0;
  font-size: 0.85rem;
}
.year-block li:last-child { border-bottom: none; }

/* ── faculty cards ────────────────────────────────────────────────────── */
.faculty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.faculty-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color var(--t-base), transform var(--t-base);
}
.faculty-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.faculty-photo {
  aspect-ratio: 1 / 1;
  width: 100%;
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
}
.faculty-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.05);
  transition: filter var(--t-base), transform var(--t-base);
}
.faculty-card:hover .faculty-photo img {
  filter: saturate(1) contrast(1.05);
  transform: scale(1.02);
}

.faculty-body {
  padding: 1.2rem 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.faculty-card .role {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.faculty-card.is-chair .role {
  color: var(--accent);
}
.faculty-card .title {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.1rem;
}
.faculty-card .name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.faculty-card .name-en {
  color: var(--text-muted);
  font-family: var(--font-latin);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}
.faculty-card .creds {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  line-height: 1.5;
}
.faculty-card .creds .deg {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 0.15rem;
}

.faculty-card.is-chair::after {
  content: 'CHAIR';
  position: absolute;
  top: 0.9rem; right: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: var(--bg-0);
  background: var(--accent);
  padding: 0.2rem 0.55rem;
  border-radius: var(--r-sm);
  font-weight: 700;
  z-index: 2;
}

/* ── feature figure (infographic with caption) ────────────────────────── */
.figure-feature {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-1);
  padding: 0.4rem;
  transition: border-color var(--t-base);
}
.figure-feature:hover { border-color: var(--line-strong); }
.figure-feature img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: calc(var(--r-md) - 4px);
}
.figure-feature figcaption {
  padding: 0.85rem 1rem 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* Side-by-side: text + infographic */
.split-figure {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2.5rem;
  align-items: start;
}
@media (max-width: 820px) {
  .split-figure { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* Numbered concept flow */
.flow-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  counter-reset: flow;
}
.flow-list li {
  position: relative;
  padding: 0.85rem 0 0.85rem 3rem;
  border-bottom: 1px solid var(--line);
  counter-increment: flow;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.flow-list li::before {
  content: counter(flow, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 0.15rem 0.5rem;
  border-radius: var(--r-sm);
}
.flow-list li:last-child { border-bottom: none; }
.flow-list strong {
  color: var(--text);
  margin-right: 0.4rem;
}

/* ── industry partners ────────────────────────────────────────────────── */
.partners {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.partner {
  background: var(--bg-1);
  padding: 1.25rem 1.4rem;
  transition: background var(--t-fast);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 100px;
}
.partner:hover { background: var(--bg-2); }
.partner .name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.3;
}
.partner .domain {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.partner .mou {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ok);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.partner .mou.pending { color: var(--warn); }

/* ── footer ───────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
}
.footer-grid h4 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.9rem;
}
.footer-grid a { color: var(--text-muted); }
.footer-grid a:hover { color: var(--accent); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 0.5rem; }

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.brand-maroon {
  color: var(--ubu-maroon);
}

/* ── scroll reveal ────────────────────────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms cubic-bezier(.4,0,.2,1),
              transform 700ms cubic-bezier(.4,0,.2,1);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
/* Stagger for children inside revealed grids */
[data-reveal].stagger > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms cubic-bezier(.4,0,.2,1),
              transform 600ms cubic-bezier(.4,0,.2,1);
}
[data-reveal].stagger.is-visible > * { opacity: 1; transform: none; }
[data-reveal].stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
[data-reveal].stagger.is-visible > *:nth-child(2) { transition-delay: 60ms; }
[data-reveal].stagger.is-visible > *:nth-child(3) { transition-delay: 120ms; }
[data-reveal].stagger.is-visible > *:nth-child(4) { transition-delay: 180ms; }
[data-reveal].stagger.is-visible > *:nth-child(5) { transition-delay: 240ms; }
[data-reveal].stagger.is-visible > *:nth-child(6) { transition-delay: 300ms; }
[data-reveal].stagger.is-visible > *:nth-child(7) { transition-delay: 360ms; }
[data-reveal].stagger.is-visible > *:nth-child(8) { transition-delay: 420ms; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal].stagger > * {
    opacity: 1; transform: none; transition: none;
  }
}

/* ── hero cursor spotlight ────────────────────────────────────────────── */
.hero { --mx: 50%; --my: 50%; }
.hero-spotlight {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--mx) var(--my),
    rgba(0, 229, 255, 0.10),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 350ms ease;
  mix-blend-mode: screen;
}
.hero:hover .hero-spotlight { opacity: 1; }
@media (hover: none), (max-width: 768px) {
  .hero-spotlight { display: none; }
}

/* ── hero particle canvas ─────────────────────────────────────────────── */
.hero-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}
.hero-content { position: relative; z-index: 2; }

/* ── utility ──────────────────────────────────────────────────────────── */
.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.text-en { font-family: var(--font-latin); }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }

/* ── academic calendar page ─────────────────────────────────────────── */
.cal-controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-strong);
  padding: 12px 0 8px;
}
.cal-controls-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.cal-control-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.cal-label { color: var(--text-muted); font-size: 0.9rem; margin-right: 0.25rem; }
.cal-radio, .cal-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.cal-radio:hover, .cal-check:hover { border-color: var(--line-strong); }
.cal-radio input, .cal-check input { accent-color: var(--accent); }
.cal-select {
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0.35rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
}
.cal-select:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.btn-xs { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

.cal-count { padding-top: 4px; font-size: 0.85rem; }
.cal-count #cal-count { color: var(--accent); font-weight: 600; font-family: var(--font-mono); }

.cal-section {
  margin-bottom: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  overflow: hidden;
}
.cal-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.cal-section-head h3 { margin: 0; font-size: 1.05rem; }

.cal-tbl {
  table-layout: auto;
}
.cal-tbl th,
.cal-tbl td {
  font-size: 0.9rem;
}
.cal-tbl tbody td { vertical-align: top; }
.cal-check-cell { text-align: center; }
.cal-check-cell input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.cal-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: nowrap;
}
.cal-note { font-size: 0.78rem; margin-top: 0.2rem; }

.cal-term-col {
  min-width: 130px;
  transition: opacity var(--t-fast), background var(--t-fast);
}
.cal-term-col.is-dim    { opacity: 0.32; }
.cal-term-col.is-active { background: rgba(0, 229, 255, 0.06); }

@media (max-width: 640px) {
  .cal-controls-inner { flex-direction: column; align-items: stretch; }
  .cal-control-group { justify-content: flex-start; }
  .cal-section-head { flex-direction: column; align-items: flex-start; }
}

/* ── academic calendar — student view (compact) ─────────────────────── */
.cal-hero {
  padding: 1.5rem 0 0.5rem;
}
.cal-hero .container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}
.cal-banner {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin-inline: auto;
  border-radius: var(--r-md);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.cal-banner-sm { max-width: 440px; }

.cal-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-strong);
  padding: 10px 0;
}
.cal-toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}
.cal-search {
  flex: 1 1 320px;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cal-search input[type="search"] {
  flex: 1;
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
}
.cal-search input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.cal-search-count { font-size: 0.85rem; white-space: nowrap; }
.cal-toolbar-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.cal-meta-line {
  font-size: 0.85rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.cal-group {
  margin-bottom: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  overflow: hidden;
}
.cal-group[open] { background: var(--bg-1); }

.cal-group-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 0.95rem;
  background: var(--bg-2);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.cal-group-head::-webkit-details-marker { display: none; }
.cal-group-head::before {
  content: '▸';
  color: var(--accent);
  font-size: 0.8rem;
  width: 0.9rem;
  display: inline-block;
  transition: transform var(--t-fast);
}
.cal-group[open] > .cal-group-head::before { transform: rotate(90deg); }
.cal-group[open] > .cal-group-head { border-bottom-color: var(--line); }
.cal-group-head:hover { background: var(--bg-3); }

.cal-group-num {
  color: var(--accent);
  font-size: 0.82rem;
  background: rgba(0, 229, 255, 0.08);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}
.cal-group-title {
  flex: 1;
  font-weight: 600;
}
.cal-group-count {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: var(--bg-3);
  padding: 0.05rem 0.45rem;
  border-radius: 10px;
}

.cal-tbl-compact th,
.cal-tbl-compact td {
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  line-height: 1.35;
}
.cal-tbl-compact thead th {
  background: var(--bg-2);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.cal-tbl-compact tbody tr:hover td { background: var(--bg-2); }
.cal-tbl-compact .cal-evid {
  font-size: 0.72rem;
  margin-right: 0.4rem;
  opacity: 0.7;
}
.cal-tbl-compact .cal-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
}
.cal-tbl-compact .cal-date-cell {
  min-width: 110px;
  width: 17%;
}
.cal-tbl-compact .cal-term-h {
  width: 17%;
  white-space: nowrap;
}
.cal-tbl-compact .cal-note {
  cursor: help;
  margin-left: 0.25rem;
  color: var(--accent);
  font-size: 0.78rem;
}

@media (max-width: 720px) {
  .cal-toolbar-inner { flex-direction: column; align-items: stretch; }
  .cal-toolbar-actions { justify-content: flex-end; }
  .cal-tbl-compact th,
  .cal-tbl-compact td { font-size: 0.8rem; padding: 0.35rem 0.5rem; }
}
