/* =========================================================
   math-professor.com — Design System
   ========================================================= */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,700;1,500&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Brand palette */
  --navy:        #0f1b2d;
  --navy-light:  #162236;
  --navy-mid:    #1e2d44;
  --gold:        #d4a843;
  --gold-light:  #e8c97a;
  --gold-dark:   #b8922e;
  --accent-blue: #4a90d9;
  --accent-teal: #2ec4b6;

  /* Surfaces – Light theme defaults */
  --bg:          #f5f5f7;
  --bg-alt:      #eaebef;
  --surface:     #ffffff;
  --surface-alt: #f8f8fa;
  --text:        #1a1a2e;
  --text-secondary: #555;
  --text-muted:  #888;
  --border:      rgba(0,0,0,.08);

  /* Elevation */
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06);
  --shadow-md:   0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
  --shadow-glow: 0 0 24px rgba(212,168,67,.15);

  /* Typography */
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;

  /* Spacing & radius */
  --radius:   12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --max-width: 1200px;

  /* Transitions */
  --transition: .3s cubic-bezier(.4,0,.2,1);
}

/* ---------- Dark Theme ---------- */
[data-theme="dark"] {
  --bg:          #0a0f1a;
  --bg-alt:      #111827;
  --surface:     #162236;
  --surface-alt: #1e2d44;
  --text:        #e8e8ec;
  --text-secondary: #a0a4b0;
  --text-muted:  #6b7084;
  --border:      rgba(255,255,255,.08);
  --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.5);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ---------- Navigation ---------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  background: rgba(15,27,45,.82);
  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: background var(--transition);
}
.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.navbar-brand {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}
.navbar-brand span { color: var(--gold); }
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a {
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(212,168,67,.15);
}

/* Theme toggle */
.theme-toggle {
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
}
.theme-toggle:hover { background: rgba(212,168,67,.25); }

/* Mobile hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 24px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all var(--transition);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 140px 24px 80px;
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, #1a2a4a 100%);
  z-index: 0;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
}
.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.2;
}
.hero .subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: rgba(255,255,255,.7);
  margin-bottom: 16px;
  font-weight: 300;
}
.hero .gold-line {
  width: 60px; height: 3px;
  background: var(--gold);
  margin: 0 auto 20px;
  border-radius: 2px;
}
.hero .tagline {
  font-size: 1rem;
  color: rgba(255,255,255,.55);
  max-width: 600px;
  margin: 0 auto;
}

/* Decorative dots */
.hero .dots {
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  border: 1px solid rgba(212,168,67,.08);
  top: -60px; right: -80px;
  z-index: 1;
}
.hero .dots::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  border: 1px solid rgba(212,168,67,.06);
  top: 50px; left: 50px;
}

/* ---------- Sections ---------- */
.section {
  padding: 80px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.section-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: .95rem;
}
.section-title .accent { color: var(--gold); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(212,168,67,.2);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
}
.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.card p {
  color: var(--text-secondary);
  font-size: .92rem;
  line-height: 1.6;
}

/* Glass card variant */
.glass-card {
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.08);
}

/* ---------- Stat badges ---------- */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 40px;
}
.stat-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  text-align: center;
  flex: 1;
  min-width: 150px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.stat-badge:hover {
  box-shadow: var(--shadow-glow);
  border-color: rgba(212,168,67,.25);
}
.stat-badge .number {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.stat-badge .label {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ---------- Publication list ---------- */
.pub-category {
  margin-bottom: 40px;
}
.pub-category h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold);
  display: inline-block;
}
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pub-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: .9rem;
  line-height: 1.65;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.pub-item:hover {
  border-color: rgba(212,168,67,.2);
  box-shadow: var(--shadow-sm);
}
.pub-item .pub-links {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.pub-item .pub-links a {
  font-size: .8rem;
  font-weight: 500;
  color: var(--accent-blue);
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(74,144,217,.08);
  transition: all var(--transition);
}
.pub-item .pub-links a:hover {
  background: rgba(74,144,217,.18);
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 32px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--gold), var(--gold-dark), transparent);
}
.timeline-item {
  position: relative;
  margin-bottom: 24px;
  padding-left: 16px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -26px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bg);
}
.timeline-item .year {
  font-weight: 600;
  color: var(--gold);
  font-size: .85rem;
}
.timeline-item .detail {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-top: 2px;
}

/* ---------- Tables (Schools page) ---------- */
.table-controls {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}
.search-input {
  flex: 1;
  min-width: 240px;
  padding: 10px 16px 10px 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-family: var(--font-body);
  transition: all var(--transition);
  outline: none;
}
.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,168,67,.12);
}
.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.search-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: .85rem;
  opacity: .5;
}
.filter-select {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
}
.filter-select:focus {
  border-color: var(--gold);
}

.data-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--surface);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.data-table thead {
  background: var(--navy);
  color: #fff;
  position: sticky; top: 0;
}
.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.data-table th:hover { background: var(--navy-mid); }
.data-table th .sort-icon {
  margin-left: 6px;
  opacity: .4;
  font-size: .7rem;
}
.data-table th.sorted-asc .sort-icon,
.data-table th.sorted-desc .sort-icon {
  opacity: 1;
  color: var(--gold);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(212,168,67,.04); }
.data-table tbody tr:last-child td { border-bottom: none; }

.school-name {
  font-weight: 600;
  color: var(--text);
}
.school-name a { color: var(--text); }
.school-name a:hover { color: var(--gold); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-coed { background: rgba(46,196,182,.12); color: #1a9d8f; }
.badge-girls { background: rgba(212,100,167,.12); color: #c4528a; }
.badge-boys { background: rgba(74,144,217,.12); color: #3a78b5; }
.badge-religious { background: rgba(212,168,67,.12); color: var(--gold-dark); }

.tuition-value {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

/* Ranking badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: .8rem;
  background: rgba(212,168,67,.1);
  color: var(--gold);
  border: 1px solid rgba(212,168,67,.2);
}
.no-data {
  color: var(--text-muted);
  font-style: italic;
  font-size: .82rem;
}

/* ---------- Info Hub Cards ---------- */
.info-card {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}
.info-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: rgba(212,168,67,.2);
}
.info-card .info-icon {
  flex-shrink: 0;
  width: 64px; height: 64px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.info-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.info-card p {
  color: var(--text-secondary);
  font-size: .9rem;
}
.info-card .arrow {
  margin-left: auto;
  align-self: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: all var(--transition);
}
.info-card:hover .arrow {
  color: var(--gold);
  transform: translateX(4px);
}

/* ---------- Service Cards ---------- */
.service-card {
  display: flex;
  flex-direction: column;
}
.service-card h3 {
  color: var(--gold);
}
.service-list {
  margin-top: 14px;
  padding-left: 18px;
  list-style: disc;
}
.service-list li {
  color: var(--text-secondary);
  font-size: .88rem;
  line-height: 1.7;
  padding-left: 4px;
}

/* ---------- Affiliation Badges ---------- */
.affil-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
  font-size: .85rem;
  transition: all var(--transition);
  text-decoration: none;
}
.affil-badge:hover {
  background: rgba(255,255,255,.14);
  border-color: rgba(212,168,67,.3);
  color: #fff;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--navy);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 40px 24px;
  font-size: .85rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.footer a { color: var(--gold); }
.footer .footer-brand {
  font-family: var(--font-heading);
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

/* ---------- Page header (non-home pages) ---------- */
.page-header {
  padding: 120px 24px 60px;
  text-align: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  position: relative;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.page-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: #fff;
  margin-bottom: 8px;
}
.page-header p {
  color: rgba(255,255,255,.6);
  max-width: 600px;
  margin: 0 auto;
  font-size: .95rem;
}
.breadcrumb {
  margin-bottom: 16px;
  font-size: .85rem;
}
.breadcrumb a { color: rgba(255,255,255,.5); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb span { color: rgba(255,255,255,.3); margin: 0 8px; }

/* ---------- Scroll-reveal animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Disclaimer ---------- */
.disclaimer {
  background: rgba(212,168,67,.06);
  border: 1px solid rgba(212,168,67,.15);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: .85rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}
.disclaimer strong { color: var(--gold-dark); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: rgba(15,27,45,.96);
    backdrop-filter: blur(16px);
    flex-direction: column;
    padding: 16px 24px;
    gap: 4px;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .nav-links.open { display: flex; }
  .hamburger { display: flex; }

  .hero { padding: 120px 20px 60px; }
  .section { padding: 48px 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .stats-row { gap: 12px; }
  .stat-badge { padding: 16px; min-width: 100px; }
  .stat-badge .number { font-size: 1.6rem; }

  .info-card { flex-direction: column; }
  .info-card .arrow { margin-left: 0; }

  .table-controls { flex-direction: column; }
  .search-wrapper { width: 100%; }
}

@media (max-width: 480px) {
  .stats-row { flex-direction: column; }
}
