/* ============================================================
   Engineering Brain Bank — Korle Archive
   Black · white · gold strike · photographic hero · density grids
   ============================================================ */

:root {
  --bg: #050505;
  --bg-elevated: #0a0a0a;
  --bg-card: #121212;
  --bg-card-hover: #1a1a1a;
  --bg-input: #0e0e0e;
  --border: rgba(255, 255, 255, 0.14);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --text: #f5f5f5;
  --text-muted: #b0b0b4;
  --text-dim: #7a7a80;
  --gold: #ffb800;
  --gold-light: #ffcc33;
  --gold-dark: #e09a00;
  --gold-ink: #000000;
  --crest-red: #c62828;
  --radius: 4px;
  --radius-sm: 3px;
  --radius-pill: 999px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Syne", "DM Sans", system-ui, sans-serif;
  --max: 1280px;
  --header-h: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--gold); text-decoration: none; transition: color 0.15s ease, opacity 0.15s ease; }
a:hover { color: var(--gold-light); }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--gold); color: var(--gold-ink); padding: 0.5rem 1rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.container {
  width: min(100% - 3rem, var(--max));
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(5, 5, 5, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  /* Keep brand + nav off the viewport edges at every width */
  padding-inline: clamp(1.25rem, 4vw, 2.75rem);
}

.site-header > .container.header-inner,
.site-header .header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.25rem, 3vw, 2.75rem);
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  box-sizing: border-box;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: 0;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  flex-shrink: 0;
}
.brand:hover { color: var(--text); opacity: 0.92; }

.brand-crest { width: 34px; height: 40px; flex-shrink: 0; }

.brand-text {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-code {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: #fff;
  white-space: nowrap;
}

.brand-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.28);
  flex-shrink: 0;
}

.brand-name {
  display: flex;
  flex-direction: column;
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.72);
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav a {
  color: rgba(255,255,255,0.78);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}
.nav a:hover { color: #fff; }
.nav a.active {
  color: var(--gold);
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.icon-btn:hover { color: var(--gold); background: rgba(255,255,255,0.05); }

.header-search {
  display: flex;
  align-items: center;
  height: 32px;
  width: 118px;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-pill);
  padding: 0 0.85rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  outline: none;
}
.header-search:focus {
  border-color: rgba(255,184,0,0.45);
  width: 160px;
  color: #fff;
}
.header-search::placeholder { color: transparent; }

.menu-toggle { display: none; }

/* ---------- Hero — Korle Archive ---------- */
.hero {
  position: relative;
  min-height: min(78vh, 720px);
  padding: 0;
  text-align: left;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  background: #000;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 42%;
  transform: scale(1.04);
  animation: heroDrift 28s ease-in-out infinite alternate;
  filter: grayscale(1) contrast(1.12) brightness(0.88);
}

@keyframes heroDrift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.2%, -0.6%, 0); }
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.42) 38%, rgba(0,0,0,0.18) 72%, rgba(0,0,0,0.4) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.08) 40%, rgba(0,0,0,0.82) 100%);
}

.hero-grain {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: grainShift 1.2s steps(2) infinite;
}

@keyframes grainShift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-1%, 1%); }
  100% { transform: translate(1%, -1%); }
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(100% - 2.5rem, var(--max));
  padding: 7rem 0 4.5rem;
  animation: heroRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes heroRise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  letter-spacing: 0.04em;
  line-height: 0.95;
  color: #fff;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: rgba(255,255,255,0.92);
  margin: 0 0 0.85rem;
  max-width: 18ch;
}

.hero-title::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 2px;
  margin-top: 0.85rem;
  background: var(--gold);
}

.hero-purpose {
  color: rgba(255,255,255,0.72);
  font-size: clamp(0.98rem, 1.4vw, 1.1rem);
  font-weight: 400;
  max-width: 34rem;
  margin: 0 0 1.75rem;
  line-height: 1.5;
}

.search-box {
  position: relative;
  z-index: 2;
  max-width: 420px;
  margin: 0 0 1.35rem;
}

.search-box form {
  display: flex;
  align-items: stretch;
  background: rgba(8, 8, 8, 0.72);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box form:focus-within {
  border-color: rgba(255,255,255,0.55);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.12);
}

.search-box input[type="search"] {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  color: #fff;
  min-width: 0;
}
.search-box input::placeholder { color: #7a7a82; }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-submit {
  flex-shrink: 0;
  width: 52px;
  background: var(--gold);
  border: none;
  color: #000;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}
.search-submit:hover { background: var(--gold-light); }

.search-results {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 6px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 50;
  text-align: left;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-subtle);
}
.search-results a:hover { background: var(--bg-card-hover); color: var(--gold); }
.search-results .sr-code { color: var(--gold); font-weight: 700; margin-right: 0.4rem; }
.search-results .sr-meta { display: block; font-size: 0.78rem; color: var(--text-dim); margin-top: 0.15rem; }
.search-results .sr-empty { padding: 1rem; color: var(--text-dim); }

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.hero-closing { display: none; }
.hero-chalk,
.hero-chalk-left,
.hero-chalk-right,
.hero-blueprint,
.hero-swoosh,
.hero-glow,
.hero-tagline { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--gold);
  color: var(--gold-ink);
  border-color: var(--gold);
}
.btn-primary:hover { background: var(--gold-light); color: var(--gold-ink); border-color: var(--gold-light); }

.btn-ghost, .btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.35);
}
.btn-ghost:hover, .btn-outline:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-color: #fff;
}

.btn-lg { padding: 0.85rem 1.7rem; font-size: 0.98rem; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: var(--radius-sm); }

/* ---------- Sections ---------- */
.main { flex: 1; }

.section {
  padding: 3.25rem 0;
}

.section-tight {
  padding-top: 2.25rem;
  padding-bottom: 1.5rem;
}

.section-title {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.35rem;
  letter-spacing: -0.02em;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}
.section-header .section-title { margin-bottom: 0; }
.section-sub { color: var(--text-dim); font-size: 0.92rem; margin-top: 0.25rem; }
.section-link { font-weight: 600; font-size: 0.9rem; }

/* ---------- Feature cards — densify with viewport ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 0.75rem;
}

@media (min-width: 1100px) {
  .feature-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.feature-card {
  background: transparent;
  border-radius: var(--radius);
  padding: 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  color: inherit;
  min-height: 148px;
}
.feature-card:hover {
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.22);
  color: inherit;
  transform: translateY(-2px);
}

.feature-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--gold);
  display: grid;
  place-items: center;
}
.feature-icon svg { width: 24px; height: 24px; }

.feature-card h3 {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.3rem;
}
.feature-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---------- Department grid ---------- */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 0.75rem;
}

@media (min-width: 1200px) {
  .dept-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.dept-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.2rem 1rem 1.35rem;
  border: 1px solid var(--border-subtle);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  color: inherit;
  min-height: 140px;
}
.dept-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.22);
  color: inherit;
  transform: translateY(-2px);
}

.dept-card h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  padding-right: 2.2rem;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.dept-card p {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.dept-badge {
  position: absolute;
  top: 0.85rem;
  right: 0.75rem;
  background: #fff;
  color: #000;
  font-weight: 800;
  font-size: 0.72rem;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.3rem;
  border-radius: 2px;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* ---------- Recently Added — filmstrip ---------- */
.recent-rail,
.recent-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 260px);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.recent-rail::-webkit-scrollbar,
.recent-list::-webkit-scrollbar { height: 4px; }
.recent-rail::-webkit-scrollbar-thumb,
.recent-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 99px;
}

.recent-item {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.1rem 1rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-radius: var(--radius);
  color: inherit;
  min-height: 110px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.recent-item:hover {
  color: inherit;
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-2px);
}
.recent-item:hover .recent-name { color: #fff; }

.recent-code {
  color: var(--gold);
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.recent-name {
  color: rgba(255,255,255,0.88);
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recent-meta { display: none; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  padding: 2.75rem 0 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 80% at 0% 0%, rgba(255,184,0,0.06), transparent 55%),
    var(--bg);
}
.page-hero .hero-blueprint { display: none !important; }
.page-hero h1 {
  font-family: var(--display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 0.4rem;
  letter-spacing: -0.03em;
}
.page-hero p { color: var(--text-muted); max-width: 36rem; }
.breadcrumb {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb span { margin: 0 0.35rem; color: var(--text-dim); }

/* ---------- Filters / toolbar — compact, not stadium-wide ---------- */
.toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(120px, 160px) minmax(180px, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1.5rem;
  max-width: 920px;
}
.toolbar select,
.toolbar input[type="search"],
.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: #fff;
  outline: none;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.form-control[type="file"] {
  padding: 0.55rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
textarea.form-control {
  resize: vertical;
  min-height: 4.5rem;
}
.toolbar select:focus,
.toolbar input:focus,
.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.12);
}
.toolbar select { cursor: pointer; }
.toolbar #course-count {
  color: var(--text-dim);
  font-size: 0.85rem;
  white-space: nowrap;
  justify-self: end;
}

/* ---------- Course cards ---------- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 0.85rem;
}

.course-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.2rem 1.1rem;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 168px;
}
.course-card:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: var(--bg-card-hover);
  color: inherit;
  transform: translateY(-2px);
}
.course-card .code {
  font-family: var(--display);
  color: var(--gold);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.course-card h3 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}
.course-card .meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
}
.course-card .desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ---------- Material tiles — densify with viewport ---------- */
.material-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .material-list {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (min-width: 1100px) {
  .material-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.material-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.05rem 1.05rem 1rem;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  min-height: 168px;
}
.material-row:hover {
  border-color: rgba(255,255,255,0.24);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.material-row__top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.material-row__label {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.material-row h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.material-row .meta {
  font-size: 0.74rem;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.material-row .mat-code {
  color: var(--gold);
  font-weight: 700;
}
.material-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.15rem;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.78);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-slides,
.badge-notes,
.badge-past-questions,
.badge-shared,
.badge-tutorials,
.badge-videos {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.78);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  grid-column: 1 / -1;
}

/* ---------- Upload form ---------- */
.upload-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: start;
}

.form-card, .info-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.75rem;
  border: 1px solid var(--border-subtle);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.form-group .hint { font-size: 0.75rem; color: var(--text-dim); }

.file-drop {
  border: 1px dashed rgba(255,255,255,0.22);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover, .file-drop.dragover {
  border-color: var(--gold);
  background: rgba(255,184,0,0.05);
  color: var(--text-muted);
}
.file-drop input { display: none; }
.file-name { color: var(--gold); font-weight: 600; margin-top: 0.5rem; }

.info-card h3 { margin-bottom: 0.75rem; }
.info-card ul { display: flex; flex-direction: column; gap: 0.65rem; }
.info-card li {
  display: flex; gap: 0.65rem; align-items: flex-start;
  font-size: 0.9rem; color: var(--text-muted);
}
.info-card li::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); margin-top: 0.4rem; flex-shrink: 0;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
}
.prose { color: var(--text-muted); }
.prose p + p { margin-top: 1rem; }
.prose h2 { color: #fff; font-size: 1.25rem; margin: 1.75rem 0 0.75rem; }
.prose h3 { color: #fff; font-size: 1.05rem; margin: 1.25rem 0 0.5rem; }
.prose ul { margin: 0.5rem 0 1rem 1.1rem; list-style: disc; }
.prose li { margin: 0.3rem 0; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 0;
}
.faq-item h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.faq-item p { color: var(--text-muted); font-size: 0.92rem; }

.org-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 1rem 0;
}
.org-chain span {
  background: var(--bg-card);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
}
.org-chain .arrow { background: transparent; color: var(--gold); padding: 0; }

/* ---------- Course detail ---------- */
.course-header-block {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: flex-start;
  justify-content: space-between;
}
.course-header-block .code {
  font-family: var(--display);
  color: var(--gold);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}
.stat-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.stat-pill strong { color: #fff; font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #141414;
  border: 1px solid rgba(255,184,0,0.35);
  color: #fff;
  padding: 0.9rem 1.35rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 200;
  transition: transform 0.3s ease;
  max-width: min(90vw, 420px);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-icon {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold); color: var(--gold-ink);
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.75rem; flex-shrink: 0;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  background: #030303;
  border-top: 1px solid var(--border-subtle);
  padding: 2.75rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.footer-brand .brand-crest { width: 36px; height: 42px; }
.footer-brand strong { display: block; margin-bottom: 0.35rem; }
.footer-brand p {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.45;
  max-width: 22rem;
}

.footer-col h4 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.footer-col a {
  display: block;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 0.25rem 0;
}
.footer-col a:hover { color: var(--gold); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-dim);
}
.footer-bottom .closing {
  color: var(--gold);
  font-style: italic;
}

.footer-admin-link {
  opacity: 0.45;
  font-size: 0.8rem !important;
}
.footer-admin-link:hover { opacity: 0.9; }

/* ---------- Contribute CTA band ---------- */
.contribute-band {
  background: #0c0c0c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.contribute-band h2 {
  font-family: var(--display);
  font-size: 1.3rem;
  margin-bottom: 0.35rem;
}
.contribute-band p { color: var(--text-muted); font-size: 0.92rem; max-width: 32rem; }

/* ---------- Media viewer ---------- */
body.modal-open { overflow: hidden; }
.media-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.media-modal[hidden] { display: none !important; }
.media-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.78);
}
.media-modal__panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--shadow);
}
.media-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.media-modal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}
.media-modal__body { margin-bottom: 1rem; }
.media-modal__video {
  width: 100%;
  max-height: 60vh;
  background: #000;
  border-radius: 4px;
}
.media-modal__img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  margin: 0 auto;
  border-radius: 4px;
}
.media-modal__hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
}
.media-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.media-modal__frame {
  width: 100%;
  min-height: min(60vh, 520px);
  border: 0;
  border-radius: 4px;
  background: #000;
}

/* ---------- Share card preview ---------- */
.share-card-preview {
  width: min(100%, 720px);
  height: auto;
  border-radius: 8px;
  margin: 0 0 1.5rem;
  box-shadow: var(--shadow);
}

/* ---------- Responsive ---------- */
html, body { overflow-x: hidden; max-width: 100%; }

@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
    max-width: none;
  }
  .toolbar input[type="search"] {
    grid-column: 1 / -1;
  }
  .toolbar #course-count {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 860px) {
  .container { width: min(100% - 2rem, var(--max)); }
  .site-header {
    padding-inline: clamp(1rem, 4vw, 1.5rem);
  }
  .site-header > .container.header-inner,
  .site-header .header-inner {
    width: 100%;
    max-width: var(--max);
  }
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: rgba(0,0,0,0.98);
    flex-direction: column;
    padding: 0.85rem clamp(1rem, 4vw, 1.5rem) 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.15rem;
  }
  .nav.open { display: flex; }
  .nav a { padding: 0.75rem 0.85rem; }
  .menu-toggle { display: inline-flex; }
  .header-search { display: none; }
  .brand-name { display: none; }
  .brand-divider { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .upload-layout, .about-grid { grid-template-columns: 1fr; }

  .hero {
    min-height: 0;
    height: auto;
    align-items: flex-end;
  }
  .hero-photo {
    animation: none;
    transform: scale(1.02);
    object-position: 50% 35%;
  }
  .hero-grain { animation: none; opacity: 0.12; }
  .hero-shade {
    background:
      linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.2) 35%, rgba(0,0,0,0.88) 100%),
      linear-gradient(90deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.25) 100%);
  }
  .hero-copy {
    padding: 4.25rem 0 2.25rem;
    text-align: left;
    animation: none;
  }
  .hero-brand {
    font-size: clamp(1.9rem, 11vw, 2.75rem);
  }
  .hero-title {
    font-size: clamp(1.05rem, 4.2vw, 1.35rem);
    max-width: none;
  }
  .hero-purpose {
    font-size: 0.92rem;
    margin-bottom: 1.25rem;
  }
  .search-box { max-width: 100%; width: 100%; margin-bottom: 1rem; }
  .hero-ctas { width: 100%; }
  .hero-ctas .btn { width: auto; }
  /* Mobile header: brand left, menu right (not centered cluster) */
  .site-header > .container.header-inner,
  .site-header .header-inner {
    justify-content: space-between;
    gap: 0.75rem;
  }
  .header-right { margin-left: auto; }
}

@media (max-width: 560px) {
  .container { width: min(100% - 1.75rem, var(--max)); }
  .site-header { padding-inline: 1rem; }
  .feature-grid,
  .dept-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn { width: 100%; }
  .hero-copy { padding: 3.25rem 0 1.75rem; }
  .hero-brand { font-size: clamp(1.75rem, 10.5vw, 2.35rem); }
  .material-row__actions .btn,
  .material-row > div:last-child .btn {
    flex: 1 1 auto;
  }
}
