/* ========================================================================
   AI Accelerator Eval - Multi-page Site Stylesheet
   ======================================================================== */

/* ---- CSS Custom Properties ---- */
:root {
  /* Dark theme (default) */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.8);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --gradient-start: #3b82f6;
  --gradient-mid: #8b5cf6;
  --gradient-end: #ec4899;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5), 0 8px 10px -6px rgba(0,0,0,0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --blur: blur(12px);
  --transition: all 0.3s ease;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Score colours */
  --score-red: #ef4444;
  --score-yellow: #eab308;
  --score-green: #22c55e;
  --score-emerald: #10b981;
}

/* Light theme overrides */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #e2e8f0;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

/* OS-level preference fallback (when no data-theme set) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg-primary: #f8fafc;
    --bg-secondary: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; }
a { color: var(--accent-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

/* ========================================================================
   STICKY NAVIGATION
   ======================================================================== */
.sticky-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}
[data-theme="light"] .sticky-nav {
  background: rgba(248, 250, 252, 0.9);
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  padding: 0 2rem;
}
.nav-brand {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 4px;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
}
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }
.nav-links a:hover { color: var(--text-primary); }

/* Theme toggle button */
#theme-toggle {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}
#theme-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ========================================================================
   HERO
   ======================================================================== */
.hero {
  position: relative;
  padding: 6rem 2rem 5rem;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease-in-out infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255,255,255,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 50%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(to top, var(--bg-primary) 0%, transparent 100%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
  letter-spacing: -0.03em;
}
.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: rgba(255,255,255,0.9);
  margin-bottom: 1rem;
  font-weight: 500;
}
.hero-meta {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
}

/* ========================================================================
   LAYOUT
   ======================================================================== */
.section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

/* ========================================================================
   GLASSMORPHISM CARDS
   ======================================================================== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}
.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ========================================================================
   SUMMARY CARDS
   ======================================================================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.summary-card {
  text-align: center;
  position: relative;
  overflow: hidden;
}
.summary-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
}
.summary-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.big-num {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
}

/* ========================================================================
   LEADERBOARD TABLE
   ======================================================================== */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.leaderboard thead { background: rgba(99, 102, 241, 0.1); }
.leaderboard th {
  padding: 0.85rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
}
.leaderboard th:hover { color: var(--accent-light); }
.leaderboard td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.leaderboard tbody tr {
  transition: var(--transition);
  cursor: pointer;
}
.leaderboard tbody tr:hover {
  background: rgba(99, 102, 241, 0.08);
}
.leaderboard tbody tr:last-child td { border-bottom: none; }
.clickable-row { cursor: pointer; }

/* ========================================================================
   SCORE BADGES
   ======================================================================== */
.score-badge {
  display: inline-block;
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
}

/* ========================================================================
   RANK BADGES
   ======================================================================== */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 900;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ========================================================================
   PROGRESS BARS
   ======================================================================== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease-out;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  animation: shimmer 2s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ========================================================================
   CIRCULAR PROGRESS
   ======================================================================== */
.circular-progress {
  --size: 120px;
  --stroke: 8px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: conic-gradient(
    var(--accent) calc(var(--pct) * 1%),
    rgba(255,255,255,0.08) calc(var(--pct) * 1%)
  );
  margin: 1rem auto;
}
.circular-progress::before {
  content: '';
  position: absolute;
  inset: var(--stroke);
  border-radius: 50%;
  background: var(--bg-card);
}
.circular-progress .pct-label {
  position: relative;
  z-index: 1;
  font-size: 1.6rem;
  font-weight: 800;
}

/* ========================================================================
   SCORE TABLE
   ======================================================================== */
.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.score-table th {
  text-align: left;
  padding: 0.5rem 0.4rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
}
.score-table td {
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--border-color);
}
.score-table tr:last-child td { border-bottom: none; }

/* ========================================================================
   TEAM DETAIL PAGE
   ======================================================================== */
.team-detail { max-width: 960px; margin: 0 auto; }
.team-detail h1 {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.team-desc {
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 1.5rem;
}
.score-hero { text-align: center; margin: 2rem 0; }

/* ========================================================================
   FINDINGS, HIGHLIGHTS, CONCERNS
   ======================================================================== */
.highlights li { color: var(--score-green); }
.concerns li { color: var(--score-red); }
.highlight-item, .concern-item {
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

/* ========================================================================
   TECH STACK TAGS
   ======================================================================== */
.tech-stack { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.tech-tag {
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
  font-weight: 500;
}

/* ========================================================================
   DIMENSION PAGE
   ======================================================================== */
.dimension-card {
  margin-bottom: 2rem;
}
.dim-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.dim-stats strong { color: var(--text-primary); }

/* ========================================================================
   SCORE BANDS (methodology)
   ======================================================================== */
.score-bands {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0 2rem;
}
.band {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

/* ========================================================================
   MERMAID CONTAINERS
   ======================================================================== */
pre.mermaid {
  background: transparent !important;
  margin: 1rem 0;
  overflow-x: auto;
}

/* ========================================================================
   ANIMATED BACKGROUND PARTICLES
   ======================================================================== */
.bg-particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-particles::before,
.bg-particles::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  animation: float 20s ease-in-out infinite;
}
.bg-particles::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: -200px; right: -200px;
}
.bg-particles::after {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  animation-delay: -10s;
  animation-duration: 25s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(50px, -80px) scale(1.1); }
  50%      { transform: translate(-30px, 60px) scale(0.95); }
  75%      { transform: translate(40px, 30px) scale(1.05); }
}

/* ========================================================================
   SECTION SUBTITLE
   ======================================================================== */
.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* ========================================================================
   LEADERBOARD WRAP (horizontal scroll on mobile)
   ======================================================================== */
.leaderboard-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.leaderboard-wrap .leaderboard {
  border: none;
  border-radius: 0;
}

/* ========================================================================
   SORT INDICATORS
   ======================================================================== */
.leaderboard th.sort-asc::after { content: ' \25B2'; font-size: 0.65em; opacity: 0.7; }
.leaderboard th.sort-desc::after { content: ' \25BC'; font-size: 0.65em; opacity: 0.7; }

/* ========================================================================
   BACK LINK
   ======================================================================== */
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: var(--transition);
}
.back-link:hover { color: var(--accent-light); }

/* ========================================================================
   SCROLL TO TOP
   ======================================================================== */
.scroll-top {
  position: fixed;
  bottom: 2rem; right: 2rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: var(--transition);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}
.scroll-top.visible { opacity: 1; transform: translateY(0); }
.scroll-top:hover { background: var(--accent-light); transform: translateY(-2px); }

/* ========================================================================
   FOOTER
   ======================================================================== */
.site-footer {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: 4rem;
}
.site-footer strong { color: var(--accent-light); }
.site-footer p + p { margin-top: 0.25rem; }

/* ========================================================================
   ANIMATIONS
   ======================================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

/* Card hover flip effect */
.flip-card {
  perspective: 1000px;
}
.flip-card-inner {
  transition: transform 0.6s;
  transform-style: preserve-3d;
}
.flip-card:hover .flip-card-inner {
  transform: rotateY(5deg);
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */
@media (max-width: 768px) {
  .hero { padding: 4rem 1rem 3rem; }
  .section { padding: 2.5rem 1rem; }
  .nav-inner { padding: 0 1rem; }
  .nav-links { gap: 0.75rem; }
  .nav-links a { font-size: 0.8rem; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .dim-stats { flex-direction: column; gap: 0.5rem; }
}

@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 0.5rem; }
  .nav-links a { font-size: 0.75rem; }
  #theme-toggle { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
}

/* ========================================================================
   PRINT STYLES
   ======================================================================== */
@media print {
  :root {
    --bg-primary: #fff !important;
    --bg-secondary: #f9fafb !important;
    --bg-card: #fff !important;
    --text-primary: #111 !important;
    --text-secondary: #555 !important;
    --border-color: #ddd !important;
  }
  body { background: #fff !important; color: #111 !important; }
  .hero { background: #e0e7ff !important; }
  .hero h1, .hero-subtitle { color: #111 !important; text-shadow: none !important; }
  .hero::before, .hero::after { display: none !important; }
  .sticky-nav, #theme-toggle, .bg-particles, .scroll-top { display: none !important; }
  .glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
  }
  .glass-card:hover { transform: none !important; }
  pre.mermaid { page-break-inside: avoid; }
  .section { padding: 1.5rem 0; }
  @page { margin: 1.5cm; }
}
