/* ==========================================================================
   CSS Design Tokens & Theme Variables
   ========================================================================== */
:root {
  --primary: #C8102E;         /* Crimson Red */
  --primary-dark: #6B0F1A;    /* Deep Burgundy */
  --primary-light: #FFF0F2;   /* Soft Tint */
  --gold: #D4AF37;            /* Accent Gold */
  --gold-light: #FFFDF0;
  --surface: #FFFFFF;
  --bg-color: #FAFAFA;
  --text-primary: #111827;
  --text-secondary: #4B5563;
  --border-color: #E5E7EB;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 30px -10px rgba(200, 16, 46, 0.12);
  --radius-lg: 16px;
  --radius-md: 10px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Accessibility Focus States */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Navigation */
.announcement-bar {
  background: var(--primary-dark);
  color: #fff;
  font-size: 0.825rem;
  padding: 6px 0;
  font-weight: 500;
}

.bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-pill {
  background: rgba(255,255,255,0.2);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}

/* Links inside the brand (logos + title) carry no underline */
.brand a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

/* Logo Group & Responsive Handling */
.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
}

.skv-logo {
  background-color: transparent;
  border-radius: 0;
}

.rs-logo {
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.school-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.15rem;
  line-height: 1.2;
}

.sub-title {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 20px;
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-link.highlight {
  background: var(--primary);
  color: #fff !important;
}

.nav-link.highlight:hover {
  background: var(--primary-dark) !important;
}

/* Hero Section */
.hero-section {
  padding: clamp(3rem, 6vw, 5rem) 0;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF0F2 100%);
  border-bottom: 1px solid var(--border-color);
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 3rem;
  align-items: center;
}

.tag-line {
  display: inline-block;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.hero-text h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: 1.15;
  margin-bottom: 1.2rem;
}

.hero-text h1 span {
  color: var(--primary);
}

.hero-text p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.hero-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-size: 0.95rem;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-outline { border: 2px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary-light); transform: translateY(-2px); }
.btn-full { width: 100%; justify-content: center; }

.glass-card {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.gc-icon {
  width: 50px;
  height: 50px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.stat-row {
  display: flex;
  gap: 2rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.stat-row strong { font-size: 1.5rem; color: var(--primary); display: block; }
.stat-row span { font-size: 0.85rem; color: var(--text-secondary); }

/* Section Headers */
.sub-heading-badge {
  display: inline-block;
  background: var(--gold-light);
  color: #B45309;
  border: 1px solid #FCD34D;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.section-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 3vw, 2.5rem);
  color: var(--text-primary);
}

.section-desc {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

/* IDEALS Grid */
.ideals-master-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.ideal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.ideal-box:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.ideal-letter {
  position: absolute;
  right: -10px;
  bottom: -20px;
  font-size: 8rem;
  font-weight: 800;
  color: rgba(200, 16, 46, 0.04);
  user-select: none;
}

.ideal-icon {
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* Quiz UI Components */
.quiz-wrapper {
  max-width: 680px;
  margin: 3rem auto;
}

.app-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  outline: none;
  background: #fff;
}

.quiz-progress-track {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.quiz-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.quiz-stats-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.timer-badge { color: var(--primary); }

.options-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 1.5rem 0;
}

.opt-btn {
  background: var(--surface);
  border: 2px solid var(--border-color);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  font-size: 0.95rem;
}

.opt-btn:hover:not([disabled]) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.opt-btn.correct { background: #E8F5E9; border-color: #2E7D32; color: #2E7D32; }
.opt-btn.incorrect { background: #FFEBEE; border-color: #C62828; color: #C62828; }

.score-ring-box {
  margin: 2rem 0;
}

#final-score-val {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.max-val {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* Leaderboard Table */
.leaderboard-wrapper {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.lb-tabs {
  display: flex;
  background: #F3F4F6;
  border-bottom: 1px solid var(--border-color);
}

.lb-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.lb-tab:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.lb-tab.active {
  color: var(--primary);
  background: var(--surface);
  border-bottom-color: var(--primary);
}

.lb-notice {
  padding: 0.85rem 1.5rem;
  background: #FFF7ED;
  border-bottom: 1px solid #FED7AA;
  color: #9A3412;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Horizontal scroll for the table on narrow screens.
   The right/left shadows appear only while there is more to scroll. */
.lb-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) left center,
    linear-gradient(to left, var(--surface) 30%, rgba(255, 255, 255, 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(107, 15, 26, 0.18), rgba(107, 15, 26, 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(107, 15, 26, 0.18), rgba(107, 15, 26, 0)) right center;
  background-repeat: no-repeat;
  background-size: 42px 100%, 42px 100%, 16px 100%, 16px 100%;
  background-attachment: local, local, scroll, scroll;
}
.lb-scroll::-webkit-scrollbar { height: 8px; }
.lb-scroll::-webkit-scrollbar-thumb { background: rgba(107, 15, 26, 0.35); border-radius: 4px; }
.lb-scroll::-webkit-scrollbar-track { background: transparent; }

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table th {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 1rem 1.5rem;
  text-align: left;
  font-weight: 800;
}

.lb-table td {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.rank-pill {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: var(--border-color);
}

.rank-pill.rank-1 { background: #FEF3C7; color: #D97706; }
.rank-pill.rank-2 { background: #E2E8F0; color: #475569; }
.rank-pill.rank-3 { background: #FFEDD5; color: #C2410C; }

.lb-date {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* The time portion (am/pm) is shown in grey */
.lb-time {
  color: #9CA3AF;
  font-weight: 600;
}

/* Pagination controls */
.lb-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.lb-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-secondary);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.lb-page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.lb-page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  cursor: default;
}

.lb-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lb-ellipsis {
  padding: 0 4px;
  color: var(--text-secondary);
  font-weight: 700;
}

.empty-state-box {
  padding: 4rem 2rem;
}

.empty-icon {
  font-size: 3.5rem;
  color: var(--border-color);
  margin-bottom: 1rem;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.section { padding: 4rem 0; }
.footer { padding: 2rem 0; background: #fff; border-top: 1px solid var(--border-color); margin-top: 4rem; font-weight: 600; color: var(--text-secondary); }
.footer-link { color: var(--primary); text-decoration: none; font-weight: 700; }
.footer-link:hover { text-decoration: underline; }
.footer-credit { font-size: 0.8rem; margin-top: 0.4rem; color: var(--text-secondary); }
.footer-batch { color: #9CA3AF; }

/* ==========================================================================
   Architecture Infographic Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal-box {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  max-width: 960px;
  width: 100%;
  margin: auto;
  overflow: hidden;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.45);
  animation: modalPop 0.25s ease;
}

@keyframes modalPop {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-dark);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.modal-close:hover { background: #fff; transform: rotate(90deg); }

/* Infographic */
.ig { color: var(--text-primary); }

.ig-header {
  background: linear-gradient(135deg, #C8102E 0%, #6B0F1A 55%, #7C3AED 135%);
  color: #fff;
  padding: 2.5rem 2rem;
  text-align: center;
}

.ig-kicker {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 0.85rem;
}

.ig-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 0.4rem;
}

.ig-header p { opacity: 0.92; font-size: 1rem; }

.ig-section { padding: 1.9rem 2rem; }
.ig-section + .ig-section { border-top: 1px solid var(--border-color); }

.ig-h {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  margin-bottom: 1.4rem;
  color: var(--text-primary);
}

.ig-num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.ig-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.ig-card {
  border-radius: 16px;
  padding: 1.6rem;
  color: #fff;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.35);
}

.ig-card h4 { font-size: 1.15rem; margin: 0.7rem 0 0.4rem; }
.ig-card p { font-size: 0.9rem; line-height: 1.55; opacity: 0.96; }

.ig-ic {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.ig-tag {
  display: inline-block;
  margin-top: 0.9rem;
  background: rgba(255, 255, 255, 0.24);
  padding: 3px 12px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 700;
}

.ig-card code {
  background: rgba(255, 255, 255, 0.24);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.85em;
}

.c-blue { background: linear-gradient(135deg, #0EA5E9, #2563EB); }
.c-purple { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
.c-gold { background: linear-gradient(135deg, #F59E0B, #D97706); }

/* Data flow */
.ig-flow {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ig-node {
  flex: 1;
  min-width: 128px;
  border-radius: 14px;
  padding: 1.15rem 0.8rem;
  text-align: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  box-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.4);
}

.ig-node-ic { font-size: 1.7rem; line-height: 1; }
.ig-node span { font-size: 0.85rem; word-break: break-word; }
.n-blue { background: linear-gradient(135deg, #0EA5E9, #2563EB); }
.n-purple { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
.n-gold { background: linear-gradient(135deg, #F59E0B, #D97706); }

.ig-arrow {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 106px;
  padding: 0 2px;
}

.ig-arrow-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  padding: 4px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.ig-arrow-label.send { background: #ECFDF5; color: #047857; }
.ig-arrow-label.recv { background: #EEF2FF; color: #4338CA; }

.ig-endpoints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.4rem;
}

.ig-endpoints span {
  background: #F3F4F6;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.ig-endpoints code { color: var(--primary); font-weight: 700; }

/* Steps */
.ig-steps { display: flex; flex-direction: column; gap: 0.9rem; }

.ig-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #FAFAFA;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem 1.2rem;
}

.ig-step-n {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C8102E, #6B0F1A);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.ig-step-body h5 { font-size: 1rem; margin-bottom: 3px; color: var(--text-primary); }
.ig-step-body p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.45; }

.ig-foot {
  text-align: center;
  padding: 1.5rem 2rem 2rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 640px) {
  .nav-container { flex-direction: column; gap: 1rem; }
  .nav-links { flex-wrap: wrap; justify-content: center; }
  .modal-overlay { padding: 1rem 0.6rem; }
  .ig-section { padding: 1.5rem 1.2rem; }
  .ig-header { padding: 2rem 1.2rem; }
  .ig-arrow { min-width: 90px; }

  /* Keep the leaderboard columns intact and let the table scroll sideways */
  .lb-table { min-width: 520px; }
  .lb-table th { padding: 0.85rem 1rem; font-size: 0.85rem; white-space: nowrap; }
  .lb-table td { padding: 0.9rem 1rem; font-size: 0.9rem; }
}