/* ==========================================================================
   PSU Trang Personnel & Expert Directory — Design System (v4 Reference)
   Replicated faithfully from Main.dc.html artboard specifications
   ========================================================================== */

:root {
  --bg: #FFFFFF;
  --bg-soft: #F5F8FF;
  --bg-tint: #EAF1FF;
  --ink: #0B1733;
  --ink-navy: #0A2A66;
  --ink-dark: #061B44;
  --ink-body: #3A4870;
  --ink-muted: #55648A;
  --primary: #1F4FD8;
  --primary-mid: #1A44C2;
  --primary-glow: #3C78FF;
  --accent: #F07A2E;
  --teal: #12B39A;
  --teal-soft: #E3F6F2;
  --teal-ink: #0B7A69;
  --sky: #7FB2FF;
  --sky-soft: #EEF5FF;
  --sky-ink: #1D5FA8;
  --border: #D6E2F7;
  --border-soft: #E6EDF9;
  --border-field: #C9D5EE;
  --border-hover: #B9CCF2;
  --font-heading: "Google Sans", -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", "Adwaita Sans", Cantarell, Ubuntu, Roboto, Noto, Helvetica, Arial, sans-serif;
  --font-body: var(--font-heading);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: inherit;
}

h1, h2, h3, h4 {
  text-wrap: balance;
}

button, input, select, textarea {
  font-family: inherit;
}

input, select, textarea {
  font-size: 16px !important;
}

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

.wrap {
  max-width: 1248px;
  margin: 0 auto;
  padding: 0 24px;
}

.icon {
  flex: none;
  vertical-align: middle;
}

/* 56px wide: the same height as the two-line name beside it; footer the same. */
.site-logo {
  display: block;
  flex: none;
  width: 56px;
  height: auto;
}

.section-heading {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px 48px;
  align-items: end;
  margin-bottom: 40px;
}

/* ========== Transitions & Micro-interactions ========== */
.navlink {
  transition: color .2s;
}
.navlink:hover, .navlink.active {
  color: var(--primary);
}

.btn {
  transition: transform .2s cubic-bezier(.2,.8,.2,1), filter .2s, background-color .2s, border-color .2s;
  cursor: pointer;
}
.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.card {
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .35s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px -28px rgba(10,42,102,.45);
  border-color: var(--border-hover) !important;
}

.field {
  transition: border-color .2s, box-shadow .2s;
}
.field:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(31,79,216,.15);
}

.flink {
  display: inline-block;
  padding: 6px 0;
  transition: color .2s;
}
.flink:hover {
  color: var(--primary);
}

/* ========== Footer ==========
   Navy like the page header, so the page is bookended; the faded wordmark closes it. */
.site-footer {
  position: relative;
  overflow: hidden;
  padding: 72px 0 0;
  background-color: #061B44;
  background-image: radial-gradient(60% 90% at 12% 0%, rgba(60, 120, 255, .22) 0%, rgba(60, 120, 255, 0) 65%);
  font-size: 14.5px;
  color: #9DB0D8;
}

.site-footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) repeat(3, minmax(0, 1fr));
  gap: 40px 48px;
}

.site-footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .04em;
  color: #FFFFFF;
}

.site-footer-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  line-height: 1.2;
}

.site-footer-subtitle {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .12em;
  color: #B8C9E8;
}

/* The navy logo is shown in white on the dark footer. */
.site-footer .site-logo-footer {
  filter: brightness(0) invert(1);
}

.site-footer-brand p {
  margin: 16px 0 0;
  line-height: 1.7;
}

.site-footer-title {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .04em;
  color: #FFFFFF;
}

.site-footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer .flink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  color: #C9D7F5;
}

.site-footer .flink:hover {
  color: #FFFFFF;
}

.flink-ext {
  flex: none;
  opacity: .5;
  transition: opacity .2s, transform .2s;
}

.flink:hover .flink-ext {
  opacity: 1;
  transform: translate(1px, -1px);
}

.site-footer-contact li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.6;
}

.site-footer-contact li > span {
  padding: 4px 0;
}

.site-footer-contact svg {
  flex: none;
  margin-top: 7px;
  color: #7FB2FF;
}

.site-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 56px;
  padding-top: 20px;
  padding-bottom: 20px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: 13px;
  color: #8197C4;
}

.site-footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.site-footer-bottom .flink {
  font-size: 13px;
}

.site-footer-wordmark {
  margin-bottom: -.2em;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(72px, 16vw, 240px);
  line-height: .9;
  letter-spacing: -.04em;
  text-align: center;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(180deg, rgba(127, 178, 255, .2) 0%, rgba(127, 178, 255, 0) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
  user-select: none;
}

@media (max-width: 960px) {
  .site-footer-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .site-footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .site-footer {
    padding-top: 56px;
  }
  .site-footer-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
  .site-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flink:hover .flink-ext {
    transform: none;
  }
}

/* ========== Sticky Pill Header ========== */
.sticky-nav-shell {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 0;
}

.sticky-nav-wrap {
  max-width: 1248px;
  margin: 0 auto;
  padding: 14px 24px 0;
}

.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 10px 30px -12px rgba(6,27,68,.28);
}

.mtabs {
  display: none;
}

/* Phones: bottom tab bar (src/components/MobileTabBar.astro), like a phone app's:
   icon over label; the current tab's icon sits in a tinted pill. */
.mtabs {
  position: sticky;
  bottom: 0;
  z-index: 40;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid #E6EDF9;
  box-shadow: 0 -8px 24px -18px rgba(10, 42, 102, .35);
}

.mtab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 56px;
  padding: 2px 2px 4px;
  color: var(--ink-muted);
  -webkit-tap-highlight-color: transparent;
}

.mtab-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 30px;
  border-radius: 999px;
  transition: background .2s, color .2s;
}

.mtab-label {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.mtab[aria-current="page"] {
  color: var(--primary);
}

.mtab[aria-current="page"] .mtab-icon {
  background: var(--bg-tint);
}

.mtab[aria-current="page"] .mtab-label {
  font-weight: 700;
}

.mtab:active .mtab-icon {
  background: var(--bg-tint);
}

.mtab:focus-visible {
  outline: none;
}

.mtab:focus-visible .mtab-icon {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ========== Hero Section ========== */
.hero {
  position: relative;
  overflow: hidden;
  color: #FFFFFF;
  background-color: #1F4FD8;
  background-image:
    radial-gradient(80% 70% at 80% 15%, #3C78FF 0%, rgba(60,120,255,0) 60%),
    linear-gradient(180deg, #1F4FD8 0%, #1A44C2 62%, #0A2A66 100%);
  padding: 144px 0 112px;
}

.hero-watermark {
  position: absolute;
  left: 50%;
  bottom: -0.16em;
  transform: translateX(-50%);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(96px, 17vw, 250px);
  line-height: .9;
  letter-spacing: -0.04em;
  color: rgba(255,255,255,.07);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* Compact hero: the site is a lookup tool, so the hero is a title and a search box. */
.hero-compact {
  padding: 120px 0 56px;
}

.hero-compact-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  align-items: center;
  gap: 32px 56px;
}

.hero-compact-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

/* Browse panel beside the search: same row pattern as the department list. */
.hero-browse {
  padding: 18px;
  border-radius: 24px;
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 30px 60px -30px rgba(3,10,40,.6);
}

.hero-browse-title {
  margin: 0 0 8px 6px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-muted);
}

.hero-browse ul {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Text rows with rules between them, like the unit tiles below; no icons. */
.hero-browse li + li {
  border-top: 1px solid var(--border-soft);
}

.hero-browse-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
  transition: background .2s;
}

.hero-browse-row:hover {
  background: var(--bg-soft);
}

.hero-browse-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.45;
}

.hero-browse-text b {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-navy);
}

.hero-browse-text small {
  font-size: 13px;
  color: var(--ink-muted);
}

.hero-browse-arrow {
  flex: none;
  color: var(--primary);
}

@media (max-width: 960px) {
  .hero-compact-inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hero-badge {
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  font-size: 14px;
  color: #DCE7FF;
}

.hero-compact-title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.hero-compact-lead {
  margin: 0;
  max-width: 40em;
  font-size: 17px;
  line-height: 1.7;
  color: #DCE7FF;
}

.hero-search {
  position: relative;
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 640px;
  margin-top: 8px;
  padding: 6px;
  border-radius: 999px;
  background: #FFFFFF;
  box-shadow: 0 30px 60px -30px rgba(3,10,40,.6);
}

.hero-search > svg {
  position: absolute;
  top: 50%;
  left: 22px;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

.hero-search .field {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 12px 0 46px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
}

.hero-search .btn {
  flex: none;
  min-height: 48px;
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink-dark);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
}

/* ========== Directory Filter Bar ========== */
.filter-panel {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 24px;
  margin-bottom: 28px;
}

.pill-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--ink-body);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}

.pill-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-soft);
}

.pill-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.pill-tab .count-badge {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--bg-tint);
  color: var(--primary);
  white-space: nowrap;
}

.pill-tab.active .count-badge {
  background: rgba(255,255,255,.22);
  color: #FFFFFF;
}

/* ========== Personnel Cards ==========
   Framed cards, four per row. Cards in a row share their rows through CSS
   subgrid, so names, contact lines and links always line up. */
.person-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 20px;
}

.person-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #FFFFFF;
}

@supports (grid-template-rows: subgrid) {
  .person-grid:not(.head-grid) .person-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-row: span 6;
    grid-template-rows: subgrid;
    row-gap: 0;
  }
  .person-grid:not(.head-grid) .person-body {
    display: contents;
  }
}

.person-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-soft);
}

.person-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}

.person-card:hover .person-photo img {
  transform: scale(1.03);
}

.person-photo-empty {
  display: grid;
  place-items: end center;
  width: 100%;
  height: 100%;
  color: #C9D5EE;
}

.person-photo-empty svg {
  width: 62%;
  height: 62%;
}

/* Titles and status: a caption along the bottom of the photo. */
.person-photo-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 7px 12px;
  background: rgba(6,27,68,.8);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.person-name-th {
  margin: 0;
  padding: 16px 18px 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink-navy);
}

/* The name link covers the whole card; contact and evaluation links sit above it. */
.person-name-btn {
  color: inherit;
}

/* A name part or phrase moves to the next line whole; only one wider than its box wraps inside. */
.keep-together {
  display: inline-block;
  max-width: 100%;
}

.person-name-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.person-card:hover .person-name-btn {
  color: var(--primary);
}

.person-name-en {
  margin: 0;
  padding: 2px 18px 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-body);
}

.person-meta {
  padding: 0 18px;
}

.person-titles,
.person-role {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-body);
}

.person-status-text {
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Used by the table view. */
.person-admin-role {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-navy);
}

.person-affs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.person-affs li,
.aff-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-navy);
  overflow-wrap: anywhere;
}

.aff-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(10, 42, 102, .12);
}

.person-contact {
  display: flex;
  flex-direction: column;
  padding: 12px 18px 0;
  font-size: 14px;
  color: var(--ink);
}

.person-contact a,
.person-more a {
  position: relative;
  z-index: 2;
}

.person-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 12px 18px 18px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
}

.person-more a {
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Programme chair / unit head: full-width card, photo | name and title | contact. */
.person-grid.head-grid {
  grid-template-columns: minmax(0, 1fr);
}

.person-card.is-featured {
  --head-photo: calc((100% - 60px) / 4);
  display: grid;
  grid-template-columns: var(--head-photo) minmax(0, 1.3fr) minmax(280px, 1fr);
  align-items: center;
  margin-bottom: 0;
  border-color: var(--border-hover);
}

.is-featured .person-photo {
  align-self: start;
  border-bottom: 0;
  border-right: 1px solid var(--border-soft);
}

.is-featured .person-body {
  padding: 32px 40px;
}

.is-featured .person-name-th,
.is-featured .person-name-en,
.is-featured .person-meta {
  padding-left: 0;
  padding-right: 0;
}

.is-featured .person-name-th {
  padding-top: 0;
  font-size: 30px;
  line-height: 1.35;
}

.is-featured .person-name-en {
  margin-top: 4px;
  font-size: 16px;
}

.is-featured .person-titles {
  margin-top: 16px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink-navy);
}

.is-featured .person-side {
  margin: 32px 0;
  padding: 8px 40px;
  border-left: 1px solid var(--border-soft);
}

.is-featured .person-contact {
  gap: 4px;
  padding: 0;
  font-size: 16px;
}

.is-featured .person-more {
  padding: 16px 0 0;
  font-size: 15px;
}

@media (max-width: 1100px) {
  .person-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .person-card.is-featured {
    --head-photo: calc((100% - 40px) / 3);
  }
}

@media (max-width: 960px) {
  .person-card.is-featured {
    grid-template-columns: var(--head-photo) minmax(0, 1fr);
  }
  .is-featured .person-name-th {
    font-size: 24px;
  }
  .is-featured .person-titles {
    font-size: 16px;
  }
  .is-featured .person-photo {
    grid-row: span 2;
  }
  .is-featured .person-body {
    padding: 24px 28px 0;
  }
  .is-featured .person-side {
    margin: 0;
    padding: 12px 28px 24px;
    border-left: 0;
  }
}

@media (max-width: 820px) {
  .person-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .person-card.is-featured {
    --head-photo: calc((100% - 20px) / 2);
  }
}

.badge-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.badge-head-pill {
  background: var(--bg-tint);
  color: var(--primary);
  border: 1px solid var(--border);
}

.person-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  margin-top: 12px;
}

.person-tag {
  min-width: 0;
  max-width: 100%;
  padding: 2px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  color: var(--ink-body);
  font-size: 12.5px;
  line-height: 1.6;
}

.person-tag-more {
  background: #FFFFFF;
  color: var(--ink-muted);
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  min-height: 28px;
}

.contact-item > svg {
  flex: none;
  color: var(--primary);
}

.contact-item a {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-item a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.contact-ext {
  font-weight: 600;
  color: var(--ink-navy);
}

.copy-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all .15s;
}

.copy-btn:hover {
  background: var(--bg-tint);
  color: var(--primary);
  border-color: var(--border);
}

.btn-card-primary {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg-tint);
  color: var(--primary);
  border: 1px solid transparent;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .2s;
}

.btn-card-primary:hover {
  background: var(--primary);
  color: #FFFFFF;
}

.btn-card-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--ink-body);
  border: 1px solid var(--border);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}

.btn-card-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-soft);
}

/* ========== Compact Table View ========== */
.table-wrap {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow-x: auto;
}

.dir-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.dir-table th {
  text-align: left;
  padding: 16px 20px;
  background: var(--bg-soft);
  color: var(--ink-navy);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dir-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.dir-table tr:last-child td {
  border-bottom: none;
}

.dir-table tr:hover td {
  background: var(--bg-soft);
}

.btn, .btn-card-primary, .btn-card-secondary, .pill-tab {
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}

.btn svg, .btn-card-primary svg, .btn-card-secondary svg {
  flex: none;
}

/* ========== Toast Notification ========== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink-dark);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 16px 32px -8px rgba(6,27,68,.45);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ========== Responsive Breakpoints (matching Main.dc.html) ========== */
@media (max-width: 960px) {
  .navlinks { display: none !important; }
  .hidem { display: none !important; }
  .hdr {
    flex-wrap: wrap;
    border-radius: 22px;
  }
  .mtabs {
    display: grid;
  }
  /* Messages such as "คัดลอกแล้ว" appear above the tab bar, not behind it. */
  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
  .hero {
    padding-top: 106px !important;
    padding-bottom: 72px !important;
  }
  .sec {
    padding-top: 72px !important;
    padding-bottom: 72px !important;
  }
  .secb {
    padding-bottom: 72px !important;
  }
  .intake {
    padding: 20px !important;
    max-width: 100% !important;
  }
  .hero.page-header {
    padding-top: 90px !important;
    padding-bottom: 28px !important;
  }
  .department-directory.sec {
    padding-top: 24px !important;
  }
  .hero.hero-compact {
    padding-top: 98px !important;
    padding-bottom: 48px !important;
  }
}

@media (max-width: 600px) {
  .wrap, .sticky-nav-wrap {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .hdr {
    width: 100%;
    max-width: 100%;
    padding: 8px 14px;
    border-radius: 999px;
  }
  .hdr .site-logo {
    width: 40px;
  }
  .navcta {
    padding: 0 14px !important;
    font-size: 13px !important;
  }
  .panel {
    padding: 28px 20px !important;
  }
  .panel > * {
    max-width: 100%;
    min-width: 0;
  }
  .panel .btn {
    white-space: normal !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  .hero-search .btn {
    padding: 0 18px;
  }
  .person-grid {
    gap: 0 12px;
  }
  .person-card {
    margin-bottom: 12px;
    border-radius: 16px;
  }
  .person-name-th {
    padding: 12px 12px 0;
    font-size: 15px;
  }
  .person-name-en,
  .person-meta {
    padding-left: 12px;
    padding-right: 12px;
    font-size: 12.5px;
  }
  .person-contact {
    padding: 8px 12px 0;
    font-size: 12.5px;
  }
  .person-contact .contact-item svg {
    display: none;
  }
  .person-more {
    padding: 8px 12px 12px;
    font-size: 13px;
  }
  .person-photo-caption {
    padding: 5px 8px;
    font-size: 11.5px;
  }
  .person-card.is-featured {
    --head-photo: calc((100% - 12px) / 2);
    align-items: start;
  }
  .is-featured .person-body {
    padding: 14px 12px 12px;
  }
  .is-featured .person-name-th {
    font-size: 16px;
    line-height: 1.4;
  }
  .is-featured .person-name-en {
    margin-top: 2px;
    font-size: 12.5px;
  }
  .is-featured .person-titles {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
  }
  .is-featured .person-side {
    grid-column: 1 / -1;
    margin: 0;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--border-soft);
  }
  .is-featured .person-contact {
    gap: 0;
    font-size: 14px;
  }
  .is-featured .person-more {
    padding-top: 8px;
    font-size: 14px;
  }
}

/* Phones: each table row becomes a stacked entry instead of a squeezed table. */
@media (max-width: 600px) {
  .table-wrap {
    border-radius: 16px;
  }
  .dir-table thead {
    display: none;
  }
  .dir-table,
  .dir-table tbody,
  .dir-table tr,
  .dir-table td {
    display: block;
    width: 100%;
  }
  .dir-table tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
  }
  .dir-table tr:last-child {
    border-bottom: 0;
  }
  .dir-table td {
    padding: 2px 0;
    border: 0;
    white-space: normal !important;
  }
  .dir-table td:first-child {
    padding-bottom: 4px;
  }
  .dir-table td:last-child {
    padding-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .btn:hover, .card:hover {
    transform: none;
  }
}

/* Personnel landing and department pages — the Main.dc.html design system. */
.sec {
  scroll-margin-top: 140px;
}

.faculty-section {
  min-width: 0;
  margin-top: 40px;
  scroll-margin-top: 140px;
}

/* The tab bar's "ค้นหา" jumps here; keep the field clear of the sticky header. */
#search {
  scroll-margin-top: 120px;
}

.faculty-section:first-child {
  margin-top: 0;
}

.faculty-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.faculty-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-navy);
}

.faculty-meta {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-muted);
}







/* Home page unit index: a bento grid (src/lib/directory.js, departmentListsHtml).
   Three columns for a faculty, four for the support units. Every tile looks the
   same; a programme with several units differs only in size (two columns wide).
   Dense flow fills the gaps. */
.unit-bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.unit-bento-support {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.unit-tile {
  min-width: 0;
  border-radius: 20px;
  background: var(--bg-soft);
}

.unit-tile-full {
  grid-column: 1 / -1;
}

/* The support section already has the soft background, so its tiles are white. */
.unit-tile-support {
  background: #FFFFFF;
}

.unit-tile-group {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 8px;
}

.unit-tile-tall {
  grid-row: span 2;
}

.unit-tile-abbr {
  flex: none;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--bg-tint);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--primary);
}

.unit-tile-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding-bottom: 12px;
}

.unit-tile-head .unit-tile-program {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-body);
}

.unit-tile-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.unit-tile-rows li {
  flex: 1;
  display: flex;
  border-top: 1px solid var(--border);
}

.unit-tile-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 12px 2px;
}

.unit-tile-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.unit-tile-group .unit-tile-name {
  font-size: 17px;
}

.unit-tile-arrow {
  display: grid;
  flex: none;
  color: var(--primary);
  transition: transform .2s;
}

.unit-tile-row:hover .unit-tile-arrow {
  transform: translateX(3px);
}

.unit-tile-row:hover .unit-tile-name {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.unit-tile-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.unit-tile-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 22px;
  border-radius: inherit;
  transition: background .2s;
}

.unit-tile-link:hover {
  background: var(--bg-tint);
}

.unit-tile-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.unit-tile-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 14px;
}

.unit-tile-top .unit-tile-program {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.unit-tile-name {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-navy);
}

.unit-tile-support .unit-tile-name {
  font-size: 17px;
}

.unit-tile-text {
  display: flex;
  flex-direction: column;
}

.unit-tile-top + .unit-tile-text {
  margin-top: auto;
}

/* A faculty with one programme (architecture): a single row, not a tall empty box. */
.unit-tile-full .unit-tile-link {
  flex-direction: row;
  align-items: center;
  gap: 16px 24px;
}

.unit-tile-full .unit-tile-top {
  margin: 0;
}

.unit-tile-full .unit-tile-text {
  flex: 1;
  margin: 0;
}

.unit-tile-full .unit-tile-foot {
  gap: 20px;
  margin: 0;
  padding: 0;
}

.unit-tile-en {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.unit-tile-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  font-size: 14px;
  color: var(--ink-body);
}

.unit-tile-foot svg {
  color: var(--primary);
  transition: transform .2s;
}

.unit-tile-link:hover .unit-tile-foot svg {
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  .unit-tile-link:hover .unit-tile-foot svg,
  .unit-tile-row:hover .unit-tile-arrow {
    transform: none;
  }
}

@media (max-width: 900px) {
  .unit-bento,
  .unit-bento-support {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .unit-tile-odd {
    grid-column: 1 / -1;
  }
}

/* Phones: faculty tiles stack; support units stay two to a row so the list is short. */
@media (max-width: 600px) {
  .unit-bento {
    grid-template-columns: minmax(0, 1fr);
  }
  .unit-tile-group {
    grid-column: auto;
    grid-row: auto;
    padding: 18px 16px 4px;
  }
  .unit-tile-link {
    padding: 18px 16px;
  }
  .unit-tile-full .unit-tile-link {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .unit-tile-full .unit-tile-top {
    align-items: flex-start;
  }
  .unit-tile-group .unit-tile-name {
    font-size: 16px;
  }
  .unit-tile-name {
    font-size: 17px;
  }
  .unit-bento-support {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .unit-tile-support .unit-tile-link {
    padding: 14px;
  }
  .unit-tile-support .unit-tile-name {
    font-size: 15px;
  }
  .unit-tile-support .unit-tile-en {
    display: none;
  }
}









.department-hero {
  padding: 144px 0 72px;
}

/* Listing pages: a short header so the filters and names come first.
   Deep navy with one soft glow and a faint grid that fades out, so the
   title reads first and the right side is not an empty slab of blue. */
.hero.page-header {
  padding: 112px 0 40px;
  background-color: #0A2A66;
  background-image:
    radial-gradient(55% 140% at 88% -10%, rgba(60, 120, 255, .62) 0%, rgba(60, 120, 255, 0) 62%),
    radial-gradient(35% 120% at 0% 120%, rgba(127, 178, 255, .16) 0%, rgba(127, 178, 255, 0) 70%),
    linear-gradient(180deg, #1A44C2 0%, #12358F 55%, #0A2A66 100%);
}

.hero.page-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: right -1px top -1px;
  -webkit-mask-image: radial-gradient(60% 130% at 92% 0%, #000 0%, transparent 72%);
  mask-image: radial-gradient(60% 130% at 92% 0%, #000 0%, transparent 72%);
  pointer-events: none;
}

/* Hairline of light along the bottom edge. */
.hero.page-header::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(127, 178, 255, 0) 0%, rgba(127, 178, 255, .55) 50%, rgba(127, 178, 255, 0) 100%);
  pointer-events: none;
}

.hero.page-header .wrap {
  position: relative;
  z-index: 1;
}

.page-header .department-breadcrumb {
  margin-bottom: 18px;
}

.page-header-title {
  max-width: 30em;
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.3;
  text-wrap: balance;
}

.page-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

/* The header chips plus the view count, which sits outside the list the listing
   script redraws. */
.page-header-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.page-header-facts .page-header-meta {
  margin: 0;
}

/* View counts stay hidden until api/view.php answers (src/scripts/site.js). */
[data-page-views][hidden] {
  display: none;
}

.page-header-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 34px;
  padding: 4px 14px 4px 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 14px;
  line-height: 1.4;
  color: #DCE7FF;
}

.page-header-chip svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: #9FC2FF;
}

.page-header-chip b {
  font-weight: 700;
  color: #FFFFFF;
}

.department-directory.sec {
  padding-top: 32px;
}

.department-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 32px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(220, 231, 255, .72);
}

.department-breadcrumb a {
  transition: color .15s ease;
}

.department-breadcrumb a:hover {
  color: #FFFFFF;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(255, 255, 255, .5);
}

.department-breadcrumb [aria-current="page"] {
  font-weight: 500;
  color: #FFFFFF;
}

.department-breadcrumb svg {
  flex: none;
  width: 14px;
  height: 14px;
  opacity: .55;
}

.department-hero-layout {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  min-width: 0;
}

.department-page-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #FFFFFF;
}

.department-page-icon svg {
  width: 36px;
  height: 36px;
}

.department-hero-content {
  flex: 1;
  min-width: 0;
}

.department-eyebrow {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 15px;
  color: #B9D4FF;
}

.department-page-title {
  max-width: 24em;
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(32px, 3.5vw, 48px);
  line-height: 1.3;
  letter-spacing: -.01em;
}

.department-page-description {
  max-width: 52em;
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.8;
  color: #DCE7FF;
}

.department-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-top: 24px;
  color: #DCE7FF;
  font-size: 14px;
}

.department-hero-meta > span,
.department-hero-meta > a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.department-hero-meta a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(255, 255, 255, .4);
}

.department-hero-meta svg {
  flex: none;
}

.department-directory {
  padding-top: 72px;
  padding-bottom: 104px;
}

.department-detail-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.department-detail-title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.3;
  color: var(--ink-navy);
}

.department-detail-intro {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--ink-muted);
}

.directory-view-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
}

.directory-view-switch .pill-tab {
  min-height: 36px;
  border: none;
}

.directory-filter-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.directory-search {
  position: relative;
  min-width: 0;
}

.directory-search > svg {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

.directory-filter-fields .field {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border-field);
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--ink);
}

.directory-search .field {
  padding-left: 42px;
}

.directory-filter-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  color: var(--ink-muted);
  font-size: 14px;
}

.roster-group {
  min-width: 0;
  margin-top: 40px;
}

.roster-head {
  margin-top: 8px;
}

.roster-head + .roster-group {
  margin-top: 48px;
}

.roster-group:first-child {
  margin-top: 0;
}

.roster-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink-navy);
}

.roster-heading h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.4;
}

.roster-heading small,
.roster-heading .roster-count {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  color: var(--ink-muted);
}

.department-back-action {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

.person-search-match {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.person-search-match-label {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
  color: var(--ink-body);
}

/* Expertise line on cards in the experts tab and in search results. */
.person-expertise {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
}

.person-expertise-label {
  width: 100%;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

.expertise-tag,
.expertise-more {
  max-width: 100%;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  color: var(--ink-body);
  font-size: 12px;
  line-height: 1.5;
}

.expertise-tag.is-match {
  background: var(--bg-tint);
  border-color: var(--border-hover);
  color: var(--primary);
  font-weight: 600;
}

.expertise-more {
  color: var(--ink-muted);
}

/* "Show more" under a long list. */
.show-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.show-more-count {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 45;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: 0 8px 24px rgba(10, 42, 102, .14);
  cursor: pointer;
}

.back-to-top[hidden] {
  display: none;
}

/* Clear the phone bottom bar (shown at 960px and below). */
@media (max-width: 960px) {
  .back-to-top {
    right: 16px;
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

.directory-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--primary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
}

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

@media (max-width: 600px) {
  .faculty-title {
    font-size: 20px;
  }
  .faculty-heading {
    padding-bottom: 16px;
    margin-bottom: 24px;
  }
  .department-breadcrumb {
    margin-bottom: 24px;
  }
  .department-hero-layout {
    flex-direction: column;
    gap: 20px;
  }
  .department-page-icon {
    width: 64px;
    height: 64px;
  }
  .department-page-icon svg {
    width: 28px;
    height: 28px;
  }
  .department-page-description {
    font-size: 16px;
  }
  .department-hero-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .directory-view-switch {
    border-radius: 20px;
  }
  .directory-view-switch .pill-tab {
    padding-right: 12px;
    padding-left: 12px;
    font-size: 13px;
  }
  .filter-panel {
    padding: 20px;
  }
  /* Category chips stay on one line and scroll sideways, running to the panel edges
     so the cut-off chip shows there is more. */
  .pill-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px 2px;
    scroll-padding: 0 20px;
    scrollbar-width: none;
  }
  .pill-tabs::-webkit-scrollbar {
    display: none;
  }
  .pill-tabs .pill-tab {
    flex: none;
    white-space: nowrap;
  }
  .department-breadcrumb,
  .department-detail-heading,
  .directory-filter-fields > *,
  .directory-filter-summary > * {
    min-width: 0;
    max-width: 100%;
  }
}

/* ========== Profile page ==========
   Thin blue banner (breadcrumb), then a white profile card that overlaps it. */
.hero.profile-banner {
  padding-bottom: 104px;
}

.profile-body {
  padding: 0 0 104px;
}

/* Bento header: a portrait tile beside an identity tile, one tile per contact under it.
   The tiles overlap the blue banner. */
.profile-head {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 16px;
  margin-top: -80px;
  margin-bottom: 24px;
}

.profile-head:not(:has(.profile-contacts)) {
  grid-template-rows: 1fr;
}

.profile-photo,
.profile-identity,
.profile-contact-tile {
  border: 1px solid var(--border);
  background: #FFFFFF;
  box-shadow: 0 24px 48px -36px rgba(6,27,68,.4);
}

/* Many photos are cut-outs with no background; they stand in front of a lit studio
   backdrop in the brand blue. Photos with their own background cover it. */
.profile-photo {
  position: relative;
  grid-row: span 2;
  min-height: 420px;
  overflow: hidden;
  border-radius: 28px;
  background:
    radial-gradient(90% 60% at 50% 16%, #FFFFFF 0%, rgba(255,255,255,0) 72%),
    linear-gradient(180deg, #E8EFFF 0%, #C6D7FF 100%);
}

.profile-head:not(:has(.profile-contacts)) .profile-photo {
  grid-row: auto;
}

.profile-photo > img,
.profile-photo > .person-photo-empty {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.profile-photo img {
  display: block;
  object-fit: cover;
  object-position: top center;
}

.profile-views {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 20px -10px rgba(6,27,68,.5);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-body);
}

.profile-views svg {
  flex: none;
  color: var(--primary);
}

.profile-views b {
  font-weight: 600;
  color: var(--ink-navy);
}

.profile-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 36px 40px;
  border-radius: 28px;
}

.profile-name {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 1.25;
  color: var(--ink-dark);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.profile-name > span {
  display: inline-block;
}

.profile-name-en {
  margin: 6px 0 0;
  font-size: 17px;
  color: var(--ink-muted);
}

/* Position, admin role and unit as a plain label/value list. */
.profile-facts {
  align-self: stretch;
  margin: 28px 0 0;
}

.profile-facts > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  column-gap: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}

.profile-facts > div:last-child {
  padding-bottom: 0;
}

.profile-facts dt {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-muted);
}

.profile-facts dd {
  grid-column: 2;
  margin: 0;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.profile-facts dd + dd {
  margin-top: 6px;
}

.profile-fact-admin dd {
  font-weight: 600;
  color: var(--ink-navy);
}

.profile-facts a {
  text-decoration: underline;
  text-decoration-color: var(--border-hover);
  text-underline-offset: 4px;
  transition: color .15s, text-decoration-color .15s;
}

.profile-facts a:hover {
  color: var(--primary);
  text-decoration-color: currentColor;
}

.profile-fact-sub {
  display: block;
  font-size: 14px;
  color: var(--ink-muted);
}

.profile-contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
  min-width: 0;
}

/* The tile is one big link (the link's ::after covers it); the copy button sits on top. */
.profile-contact-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 16px 14px 16px 16px;
  border-radius: 22px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.profile-contact-tile:hover {
  border-color: var(--border-hover);
  box-shadow: 0 24px 40px -28px rgba(31,79,216,.5);
  transform: translateY(-2px);
}

.profile-contact-tile:has(.profile-contact-value:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.profile-contact-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--primary-glow), var(--primary));
  color: #FFFFFF;
}

.profile-contact-icon svg {
  width: 20px;
  height: 20px;
}

.profile-contact-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.profile-contact-value {
  overflow: hidden;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-navy);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-contact-value:focus-visible {
  outline: none;
}

.profile-contact-value::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.profile-contact-tile .copy-btn {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .profile-contact-tile {
    transition: none;
  }
  .profile-contact-tile:hover {
    transform: none;
  }
}

.profile-more {
  margin-top: 4px;
}

.profile-more summary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
}

.profile-more summary::-webkit-details-marker {
  display: none;
}

.profile-more[open] summary {
  display: none;
}

.profile-more .profile-works li:first-child {
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
  gap: 24px;
}

.profile-main,
.profile-aside {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.profile-aside {
  position: sticky;
  top: 112px;
}

.profile-section,
.profile-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #FFFFFF;
}

.profile-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.4;
  color: var(--ink-navy);
}

.profile-section-title svg {
  box-sizing: content-box;
  flex: none;
  padding: 8px;
  border-radius: 12px;
  background: var(--bg-tint);
  color: var(--primary);
}

.profile-section-title small {
  margin-left: auto;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  color: var(--ink-muted);
}

.profile-text {
  margin: 0;
  color: var(--ink-body);
  overflow-wrap: anywhere;
}

.profile-muted {
  color: var(--ink-muted);
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-tags .person-tag {
  padding: 4px 14px;
  font-size: 14px;
  white-space: normal;
}

.profile-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink-body);
  overflow-wrap: anywhere;
}

.profile-list li::marker {
  color: var(--primary);
}

.profile-work-group + .profile-work-group {
  margin-top: 24px;
}

.profile-subtitle {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink-navy);
}

.profile-subtitle small {
  margin-left: auto;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.profile-timeline,
.profile-education,
.profile-works {
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-timeline li,
.profile-works li {
  display: grid;
  grid-template-columns: minmax(0, 168px) minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
  color: var(--ink-body);
}

.profile-works li {
  grid-template-columns: 56px minmax(0, 1fr);
}

.profile-timeline li:first-child,
.profile-works li:first-child,
.profile-education li:first-child {
  padding-top: 0;
  border-top: 0;
}

.profile-timeline-period,
.profile-work-year {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
}

.profile-education li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}

.profile-edu-level {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
}

.profile-edu-degree {
  display: block;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--ink-navy);
}

.profile-edu-school {
  display: block;
  font-size: 14px;
  color: var(--ink-muted);
}

.profile-card {
  padding: 24px;
}

.profile-card-title {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink-navy);
}

.profile-contact-row + .profile-contact-row {
  margin-top: 10px;
}

.profile-contact-label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.profile-contact-row .contact-item {
  font-size: 15px;
  color: var(--ink-body);
}

.profile-affiliations {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-affiliations a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 12px;
  transition: background .2s;
}

.profile-affiliations a:hover {
  background: var(--bg-soft);
}

.profile-affiliations b {
  display: block;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-navy);
}

.profile-affiliations small {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
}

.profile-aff-dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
}

.profile-eval-link {
  width: 100%;
}

@media (max-width: 960px) {
  .profile-head {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }
  .profile-identity {
    padding: 28px;
  }
  .profile-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .profile-aside {
    position: static;
  }
}

@media (max-width: 600px) {
  .profile-head {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    gap: 12px;
    margin-top: -64px;
  }
  .profile-photo {
    grid-row: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    border-radius: 24px;
  }
  .profile-photo:not(:has(img)) {
    aspect-ratio: 2 / 1;
  }
  .profile-name {
    font-size: clamp(24px, 7.6vw, 30px);
  }
  .profile-identity {
    padding: 24px 22px;
    border-radius: 24px;
  }
  .profile-name-en {
    font-size: 16px;
  }
  .profile-facts {
    margin-top: 20px;
  }
  .profile-facts > div {
    grid-template-columns: 92px minmax(0, 1fr);
    column-gap: 12px;
  }
  .profile-facts dd {
    font-size: 15px;
  }
  .profile-contacts {
    gap: 12px;
  }
  .profile-education li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .profile-section {
    padding: 22px 20px;
  }
  .profile-timeline li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

/* Small phones: labels go above their values, and contacts wrap instead of being cut. */
@media (max-width: 400px) {
  .profile-facts > div {
    grid-template-columns: minmax(0, 1fr);
  }
  .profile-facts dd {
    grid-column: 1;
  }
  .profile-contact-tile {
    gap: 12px;
    padding: 14px 10px 14px 14px;
  }
  .profile-contact-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }
  .profile-contact-value {
    font-size: 16px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Department pages list only a handful of people: no search or unit picker,
   just the count and the card/table switch. */
.is-department .directory-filter-fields {
  display: none;
}

.is-department .filter-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.is-department .directory-filter-summary {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* While the listing script applies a tab, search or table view asked for in the address,
   the default list stays hidden instead of flashing first (see DirectoryPage.astro). */
.dir-pending .page-header .wrap,
.dir-pending #directory .wrap {
  visibility: hidden;
}
