/* ============================================================
   VARSITY WISE — faculty_detail.css
   Aesthetic: Editorial magazine · Deep crimson · Refined
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,800;1,700&family=DM+Sans:wght@400;500;600&display=swap');

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --crimson:        #9e0157;
  --crimson-dark:   #7a0041;
  --crimson-deeper: #5c0030;
  --crimson-light:  #fce7f3;
  --crimson-mid:    #f3c6dc;

  --ink:            #0f1117;
  --ink-80:         #1e2333;
  --ink-60:         #3d4461;
  --ink-40:         #6b7280;
  --ink-20:         #94a3b8;
  --ink-10:         #e2e8f0;
  --ink-05:         #f8fafc;

  --surface:        #ffffff;
  --surface-2:      #f9fafb;
  --surface-3:      #f1f5f9;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --safe-l: env(safe-area-inset-left,  0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html { max-width: 100%; overflow-x: hidden; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--surface-3);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

/* ── Skip link ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px; top: auto;
  width: 1px; height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 16px; top: 16px;
  width: auto; height: auto;
  padding: 10px 18px;
  background: var(--crimson);
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  border-radius: 8px;
  z-index: 9999;
  text-decoration: none;
}

/* ── Faculty hero ────────────────────────────────────────── */
.faculty-hero {
  width: 100%;
  overflow: hidden;
  position: relative;
  /* Fallback when no banner image */
  background: var(--crimson-deeper);
}

/* Dark overlay — used both when banner is present and when not */
.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.28) 0%, rgba(0,0,0,.80) 100%);
  pointer-events: none;
}

/* When no banner: faint geometric circles */
.faculty-hero::before,
.faculty-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: rgba(255,255,255,.05);
}
.faculty-hero::before { width: 440px; height: 440px; top: -170px; right: -100px; }
.faculty-hero::after  { width: 240px; height: 240px; bottom: -110px; left: -60px; }

.faculty-hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding:
    clamp(20px, 4vw, 36px)
    calc(clamp(14px, 4vw, 40px) + var(--safe-r))
    clamp(24px, 4vw, 36px)
    calc(clamp(14px, 4vw, 40px) + var(--safe-l));
  position: relative;
  z-index: 2;
}

/* Breadcrumb */
.breadcrumb-nav { margin-bottom: clamp(14px, 3vw, 20px); }

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  gap: 0;
  font-size: clamp(.72rem, 1.5vw, .8rem);
}

.breadcrumb-item { display: contents; }

.breadcrumb-link {
  color: rgba(255,255,255,.68);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
}
.breadcrumb-link:hover { color: #fff; }
.breadcrumb-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }

.breadcrumb-sep {
  color: rgba(255,255,255,.30);
  margin: 0 7px;
  font-size: .7rem;
  flex-shrink: 0;
}

.breadcrumb-current {
  color: rgba(255,255,255,.60);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

/* Back link */
.uni-back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(.78rem, 1.8vw, .86rem);
  color: rgba(255,255,255,.62);
  text-decoration: none;
  margin-bottom: 10px;
  transition: color .15s;
  min-height: 40px;
}
.uni-back-link:hover { color: rgba(255,255,255,.90); }
.uni-back-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }

/* H1 */
.faculty-hero-inner h1 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4.5vw, 2.2rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.18;
  letter-spacing: -.025em;
  text-shadow: 0 2px 8px rgba(0,0,0,.25);
  margin-bottom: 10px;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Faculty description */
.faculty-desc {
  color: rgba(255,255,255,.75);
  max-width: 680px;
  line-height: 1.7;
  font-size: clamp(.875rem, 2vw, .975rem);
  overflow-wrap: break-word;
}

/* ── Page body ───────────────────────────────────────────── */
.faculty-page {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding:
    clamp(16px, 3vw, 32px)
    calc(clamp(14px, 4vw, 40px) + var(--safe-r))
    calc(clamp(48px, 8vw, 80px) + var(--safe-b))
    calc(clamp(14px, 4vw, 40px) + var(--safe-l));
  overflow-x: hidden;
}

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: clamp(14px, 3vw, 20px);
}

.filter-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-20);
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 32px;
}

.qual-pill {
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: clamp(.74rem, 1.8vw, .8rem);
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  background: var(--surface);
  color: var(--ink-40);
  border: 1.5px solid var(--ink-10);
  white-space: nowrap;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.qual-pill:hover  { background: var(--crimson-light); color: var(--crimson); border-color: var(--crimson-mid); }
.qual-pill.active { background: var(--crimson); color: #fff; border-color: var(--crimson); }
.qual-pill:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; border-radius: 9999px; }

/* ── Results bar ─────────────────────────────────────────── */
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(12px, 2.5vw, 16px);
  flex-wrap: wrap;
  gap: 8px;
}

.results-count {
  font-size: clamp(.82rem, 2vw, .875rem);
  color: var(--ink-40);
}
.results-count strong { color: var(--ink-80); }

.clear-link {
  font-size: .82rem;
  color: var(--crimson);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  transition: color .15s;
}
.clear-link:hover { color: var(--crimson-dark); text-decoration: underline; }
.clear-link:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; border-radius: 4px; }

/* ── Programme list ──────────────────────────────────────── */
.programmes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ── Programme card ──────────────────────────────────────── */
.prog-card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--ink-10);
  padding: clamp(14px, 3vw, 20px) clamp(14px, 3vw, 22px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: border-color .18s, box-shadow .18s, transform .18s;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

/* Crimson left sweep on hover */
.prog-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: var(--crimson);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  border-radius: 0 2px 2px 0;
}

.prog-card:hover {
  border-color: var(--crimson-mid);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.prog-card:hover::before { transform: scaleY(1); }
.prog-card:active { transform: translateY(0); }
.prog-card:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
  border-radius: 14px;
}

/* Programme name */
.prog-info { min-width: 0; }

.prog-name {
  font-family: var(--font-display);
  font-size: clamp(.9rem, 2.2vw, 1rem);
  font-weight: 700;
  color: var(--ink-80);
  margin-bottom: 7px;
  line-height: 1.32;
  overflow-wrap: break-word;
  word-break: break-word;
  letter-spacing: -.01em;
  transition: color .15s;
}
.prog-card:hover .prog-name { color: var(--crimson); }

/* Tags */
.prog-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.prog-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: .7rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--ink-60);
  border: 1px solid var(--ink-10);
  white-space: nowrap;
}

/* Tag variants */
.prog-tag.qual  {
  background: var(--crimson-light);
  color: var(--crimson-dark);
  border-color: var(--crimson-mid);
}
.prog-tag.nsfas {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.prog-tag.mode  {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde68a;
}

/* Description */
.prog-desc {
  font-size: clamp(.78rem, 1.8vw, .83rem);
  color: var(--ink-40);
  line-height: 1.6;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Right meta: APS badge, duration, arrow */
.prog-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
}

/* APS badge — crimson instead of purple gradient */
.aps-badge {
  background: var(--crimson);
  color: #fff;
  border-radius: 10px;
  padding: 8px 13px;
  text-align: center;
  min-width: 64px;
  box-shadow: 0 3px 10px rgba(158,1,87,.25);
  transition: background .15s;
}
.prog-card:hover .aps-badge { background: var(--crimson-dark); }

.aps-val { font-family: var(--font-display); font-size: clamp(1.1rem, 3vw, 1.3rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.aps-lbl { font-size: .58rem; text-transform: uppercase; letter-spacing: .08em; opacity: .82; margin-top: 2px; font-weight: 600; }

.prog-duration {
  font-size: .78rem;
  color: var(--ink-20);
  font-weight: 600;
  white-space: nowrap;
}

.view-arrow {
  font-size: .8rem;
  color: var(--crimson);
  font-weight: 700;
  white-space: nowrap;
  transition: color .15s;
}
.prog-card:hover .view-arrow { color: var(--crimson-dark); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: clamp(40px, 8vw, 64px) 24px;
  color: var(--ink-40);
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--ink-10);
  box-shadow: var(--shadow-sm);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .3; }
.empty-state p { font-size: .9rem; line-height: 1.6; }

/* ── Focus rings ─────────────────────────────────────────── */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 540px) {
  .breadcrumb-nav { display: none; }
  .prog-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .prog-meta {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid var(--ink-10);
  }
  .view-arrow { margin-left: auto; }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .prog-card, .prog-card::before,
  .qual-pill, .aps-badge { transition: none !important; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .faculty-hero { background: var(--crimson-deeper) !important; }
  .skip-link { display: none !important; }
  .prog-card:hover { transform: none; }
}