:root {
  --paper: #f7f7f2;
  --surface: #ffffff;
  --ink: #19201d;
  --muted: #69726d;
  --line: #dde2dc;
  --line-soft: #ecefe9;
  --forest: #194f3d;
  --forest-dark: #103b2d;
  --mint: #dff0e7;
  --amber: #f3e7c4;
  --blue: #e1eaf5;
  --rose: #f3e3df;
  --shadow: 0 18px 48px rgba(24, 49, 38, .08);
  --sidebar-width: 318px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

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

.skip-link {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: -60px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus { top: 16px; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 18px 18px;
  border-right: 1px solid var(--line);
  background: #f1f2ec;
}

.brand-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--forest);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  letter-spacing: -.03em;
}
.brand strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.15; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
}
.icon-button:hover { background: var(--surface); }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.sidebar-close { display: none; font-size: 25px; line-height: 1; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 13px;
  width: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  outline: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.search-box input:focus {
  border-color: #84a998;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(25,79,61,.09);
}
.sidebar-search { margin-top: 24px; }
.sidebar-search input { height: 43px; padding: 0 13px 0 40px; border-radius: 11px; font-size: 13px; }

.tier-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.42); }
.tier-tab { padding: 6px 3px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.tier-tab:hover { background: rgba(255,255,255,.75); color: var(--ink); }
.tier-tab.active { background: var(--surface); color: var(--forest-dark); box-shadow: 0 2px 8px rgba(28,51,42,.08); }
.tier-tab.top.active { background: var(--forest); color: #fff; }
.tier-tab.mid.active { background: #315e83; color: #fff; }
.tier-tab.low.active { background: #78652f; color: #fff; }

.sidebar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 5px 9px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.compact-toggle { display: flex; align-items: center; gap: 5px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.compact-toggle input { accent-color: var(--forest); }

.university-nav { min-height: 0; flex: 1; overflow: auto; scrollbar-width: thin; scrollbar-color: #c8cec8 transparent; }
.university-nav ul { display: grid; gap: 3px; margin: 0; padding: 0 3px 20px 0; list-style: none; }
.tier-group-heading { display: flex; align-items: center; justify-content: space-between; padding: 13px 9px 5px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.tier-group-heading:first-child { padding-top: 5px; }
.tier-group-heading span:last-child { font-weight: 600; letter-spacing: 0; text-transform: none; }
.university-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #4f5954;
  text-align: left;
  font-size: 12px;
  line-height: 1.35;
}
.university-button:hover { background: rgba(255,255,255,.72); color: var(--ink); }
.university-button.active { background: var(--surface); color: var(--forest-dark); box-shadow: 0 4px 15px rgba(28,51,42,.06); font-weight: 650; }
.university-button .uni-count { flex: 0 0 auto; min-width: 24px; padding: 2px 6px; border-radius: 99px; background: #e2e5df; color: var(--muted); text-align: center; font-size: 10px; }
.university-button.active .uni-count { background: var(--mint); color: var(--forest-dark); }
.nav-empty { padding: 24px 10px; color: var(--muted); text-align: center; font-size: 13px; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #49a271; box-shadow: 0 0 0 4px rgba(73,162,113,.12); }

.sidebar-backdrop { display: none; }
.main-content { margin-left: var(--sidebar-width); min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 66px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 4vw, 58px);
  border-bottom: 1px solid rgba(221,226,220,.82);
  background: rgba(247,247,242,.88);
  backdrop-filter: blur(14px);
}
.topbar-label { color: var(--forest); font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.freshness { color: var(--muted); font-size: 11px; }
.menu-button { display: none; }

.content-wrap { width: min(1300px, 100%); margin: 0 auto; padding: 0 clamp(22px, 4vw, 58px); }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(380px, .75fr);
  gap: 54px;
  align-items: end;
  padding: 70px 0 52px;
  border-bottom: 1px solid var(--line);
}
.eyebrow { margin: 0 0 13px; color: var(--forest); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.hero h1 {
  max-width: 710px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5.2vw, 76px);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .98;
}
.hero-copy { max-width: 620px; margin: 22px 0 0; color: var(--muted); font-size: 16px; }
.dataset-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0; }
.dataset-stats div { padding: 0 18px; border-left: 1px solid var(--line); }
.dataset-stats dt { font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px, 3vw, 40px); line-height: 1; }
.dataset-stats dd { margin: 8px 0 0; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.directory { padding: 48px 0 70px; }
.university-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.breadcrumb { display: flex; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.breadcrumb span:last-child { color: var(--forest); }
.university-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(29px, 3.2vw, 45px); font-weight: 500; letter-spacing: -.025em; line-height: 1.1; }
.university-subline { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 11px; color: var(--muted); font-size: 12px; }
.department-link { color: var(--forest); font-weight: 650; text-decoration: none; }
.department-link:hover { text-decoration: underline; }
.university-ranking { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.ranking-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 7px; background: #ecefe9; color: #505a55; font-size: 10px; font-weight: 700; }
.ranking-pill.top { background: var(--forest); color: #fff; }
.ranking-pill.mid { background: var(--blue); color: #31506d; }
.ranking-pill.low { background: var(--amber); color: #68541f; }
.ranking-pill.rank { background: #ecefe9; color: #4f5954; }
.ranking-pill.competition { background: transparent; border: 1px solid var(--line); color: var(--muted); }

.toolbar { display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: 12px; margin-top: 30px; }
.professor-search input { height: 49px; padding: 0 45px 0 43px; border-radius: 12px; }
.professor-search kbd { position: absolute; right: 13px; padding: 2px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: #f6f7f3; color: var(--muted); font-size: 10px; }
.select-wrap select, .sort-control select {
  height: 49px;
  outline: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 38px 0 14px;
}
.select-wrap select:focus, .sort-control select:focus { border-color: #84a998; box-shadow: 0 0 0 3px rgba(25,79,61,.09); }

.category-bar { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.category-chip {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.category-chip:hover { border-color: #aeb9b2; color: var(--ink); }
.category-chip.active { border-color: var(--forest); background: var(--forest); color: #fff; }
.category-chip span { margin-left: 5px; opacity: .72; }

.results-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 28px 0 13px; }
.results-row p { margin: 0; color: var(--muted); font-size: 12px; }
.sort-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.sort-control select { width: auto; height: 34px; padding: 0 28px 0 9px; border-radius: 8px; background: transparent; font-size: 11px; }

.professor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.professor-card {
  position: relative;
  display: flex;
  min-height: 292px;
  flex-direction: column;
  padding: 21px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(32,54,45,.035);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.professor-card:hover { transform: translateY(-2px); border-color: #d0d8d1; box-shadow: var(--shadow); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; }
.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--mint);
  color: var(--forest-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
}
.profile-arrow {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--forest);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.profile-arrow:hover { background: var(--forest); color: #fff; }
.card-name { margin: 15px 0 2px; font-family: Georgia, "Times New Roman", serif; font-size: 21px; font-weight: 550; line-height: 1.2; overflow-wrap: anywhere; }
.card-title { min-height: 19px; margin: 0; color: var(--muted); font-size: 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 13px 0 0; }
.badge { padding: 3px 7px; border-radius: 5px; background: var(--mint); color: var(--forest-dark); font-size: 9px; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
.badge.cyber { background: var(--blue); color: #314d6a; }
.badge.blockchain { background: var(--amber); color: #68541f; }
.badge.reverse { background: var(--rose); color: #71483f; }
.badge.supervisor { background: #ecebe6; color: #555b57; }
.badge.tier-top { background: var(--forest); color: #fff; }
.badge.tier-mid { background: #315e83; color: #fff; }
.badge.tier-low { background: #78652f; color: #fff; }
.research-label { margin: 17px 0 5px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.research-text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #3d4742;
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.card-foot { display: flex; flex-wrap: wrap; gap: 7px 12px; align-items: center; margin-top: auto; padding-top: 17px; }
.email-link { max-width: 100%; overflow: hidden; color: var(--forest); font-size: 11px; font-weight: 650; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.email-link:hover { text-decoration: underline; }
.publication-details { width: 100%; border-top: 1px solid var(--line-soft); padding-top: 11px; }
.publication-details summary { color: var(--forest); cursor: pointer; font-size: 10px; font-weight: 650; }
.publication-details ol { max-height: 220px; margin: 10px 0 0; padding-left: 18px; overflow: auto; color: var(--muted); font-size: 10px; }
.publication-details li + li { margin-top: 7px; }

.empty-state { padding: 65px 20px; border: 1px dashed #cbd2cc; border-radius: 15px; text-align: center; }
.empty-icon { color: var(--forest); font-family: Georgia, serif; font-size: 45px; }
.empty-state h3 { margin: 5px 0 4px; font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.secondary-button, .load-more {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--forest);
  font-size: 12px;
  font-weight: 650;
}
.secondary-button:hover, .load-more:hover { border-color: var(--forest); }
.load-more-wrap { display: flex; justify-content: center; padding-top: 22px; }

footer { display: flex; justify-content: space-between; gap: 24px; padding: 22px 0 35px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
footer p { max-width: 580px; margin: 0; }
footer a { color: var(--forest); font-weight: 650; text-decoration: none; }
footer a:hover { text-decoration: underline; }

.toast {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 15px;
  transform: translateY(20px);
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { transform: none; opacity: 1; }

@media (max-width: 1120px) {
  .professor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; gap: 38px; }
  .dataset-stats { max-width: 560px; }
}

@media (max-width: 820px) {
  :root { --sidebar-width: min(88vw, 340px); }
  body.nav-open { overflow: hidden; }
  .sidebar { transform: translateX(-102%); box-shadow: 24px 0 70px rgba(21,39,31,.18); transition: transform .22s ease; }
  body.nav-open .sidebar { transform: none; }
  .sidebar-close { display: grid; }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    visibility: hidden;
    border: 0;
    background: rgba(17,30,24,.32);
    opacity: 0;
    transition: opacity .22s ease, visibility .22s ease;
  }
  body.nav-open .sidebar-backdrop { visibility: visible; opacity: 1; }
  .main-content { margin-left: 0; }
  .menu-button { display: grid; }
  .topbar-label { display: none; }
  .hero { padding-top: 48px; }
  .professor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 590px) {
  .content-wrap, .topbar { padding-left: 16px; padding-right: 16px; }
  .topbar { height: 60px; }
  .freshness { font-size: 10px; }
  .hero { padding: 41px 0 36px; }
  .hero h1 { font-size: 43px; }
  .hero-copy { font-size: 14px; }
  .dataset-stats div { padding: 0 10px; }
  .dataset-stats div:first-child { padding-left: 0; border-left: 0; }
  .dataset-stats dt { font-size: 27px; }
  .dataset-stats dd { font-size: 8px; }
  .directory { padding-top: 37px; }
  .toolbar { grid-template-columns: 1fr; }
  .select-wrap select { width: 100%; }
  .professor-grid { grid-template-columns: 1fr; }
  .professor-card { min-height: 275px; }
  .results-row { align-items: end; }
  footer { flex-direction: column; }
}

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