/* Minimal, safe tweaks */
a { text-underline-offset: 2px; }
::selection { background: #06b6d4; color: white; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
/* Prefer Inter for body copy, Plus Jakarta for headings */
body { font-family: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; line-height: 1.7; letter-spacing: -0.005em; }
h1, h2, h3 { font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; font-weight: 800; }

/* Design tokens */
:root {
  --brand-50:#ecfeff; --brand-100:#cffafe; --brand-200:#a5f3fc; --brand-300:#67e8f9; --brand-400:#22d3ee; --brand-500:#06b6d4; --brand-600:#0891b2; --brand-700:#0e7490; --brand-800:#155e75; --brand-900:#164e63;
  --surface:white; --surface-muted:rgba(255,255,255,.8); --text:#0f172a; --text-muted:#475569; --outline:rgba(0,0,0,.08);
  --shadow-glow: 0 10px 30px -10px rgba(6,182,212,.45);
}
.dark:root, .dark {
  /* tuned for dark-ish blue background #0F172A */
  --surface:#0F1B2E; /* card base */
  --surface-muted:rgba(21,34,59,.78); /* elevated/translucent variant */
  --text:#E6EEF8;
  --text-muted:#A7B5C8;
  --outline:rgba(148,163,184,.18); /* subtle slate outline */
}
h1, h2, h3 { letter-spacing: -0.015em; }

/* Readability helpers for long-form pages */
.readable { max-width: 68ch; margin-inline: auto; }
.readable p { margin: 0 0 0.75rem; }
.readable ul, .readable ol { margin: 0.5rem 0 1rem 1.25rem; }
.readable li { margin: 0.25rem 0; }
.readable h1 { font-size: clamp(1.9rem, 3vw, 2.5rem); margin: 0 0 0.85rem; }
.readable h2 { font-size: clamp(1.35rem, 2.1vw, 1.6rem); margin: 1.35rem 0 0.6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--outline); }
.readable h3 { font-size: clamp(1.125rem, 1.9vw, 1.3rem); margin: 1.1rem 0 .35rem; }
.readable h4 { font-size: clamp(1rem, 1.6vw, 1.1rem); margin: .9rem 0 .25rem; }
.readable a { text-decoration: underline; text-underline-offset: 2px; }
.dark .readable h2 { border-color: var(--outline); }

/* Ensure readable headings override Tailwind Typography defaults */
.prose.readable h1 { font-size: clamp(2.1rem, 3.4vw, 2.75rem) !important; line-height: 1.25 !important; }
.prose.readable h2 { font-size: clamp(1.6rem, 2.4vw, 1.85rem) !important; line-height: 1.35 !important; }
.prose.readable h3 { font-size: clamp(1.3rem, 2.1vw, 1.45rem) !important; line-height: 1.4 !important; }
.prose.readable h4 { font-size: clamp(1.1rem, 1.8vw, 1.25rem) !important; line-height: 1.45 !important; }

/* AOS fallback: if JS didn't load, don't hide sections */
html.no-aos [data-aos] {
  opacity: 1 !important;
  transform: none !important;
}

/* Improve legibility on busy hero images */
.text-shadow-lg {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Hero readability helpers */
.hero-img {
  filter: brightness(0.55) contrast(1.05) saturate(1.05);
}
@media (max-width: 640px){
  .hero-img { filter: brightness(0.48) contrast(1.05) saturate(1.05); }
}
.hero-card {
  background: rgba(0,0,0,.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.55);
}

/* Removed site-wide blurred background */

/* Ranking table readability */
#rankTable tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.55);
}
.dark #rankTable tbody tr:nth-child(even) {
  background: rgba(17,24,39,0.35);
}
#rankTable td, #rankTable th { line-height: 1.6; }

/* Buttons and chips subtle elevation */
.chip { display:inline-flex; align-items:center; gap:.35rem; padding:.35rem .6rem; border-radius:9999px; border:1px solid rgba(255,255,255,.25); background:rgba(255,255,255,.12); }
.dark .chip { background: rgba(17,24,39,.5); border-color: rgba(55,65,81,.6); }

/* Cursor follow glow (desktop only) */
.cursor-glow {
  position: fixed; inset: 0 auto auto 0; width: 220px; height: 220px;
  border-radius: 50%; pointer-events: none; z-index: 20;
  /* Stronger in light theme for visibility */
  background: radial-gradient(50% 50% at 50% 50%, rgba(6,182,212,.35) 0%, rgba(6,182,212,.22) 35%, rgba(6,182,212,0) 70%);
  filter: blur(16px); mix-blend-mode: normal; opacity: 0; transform: translate3d(-9999px,-9999px,0);
  transition: opacity .2s ease;
}
.dark .cursor-glow {
  background: radial-gradient(50% 50% at 50% 50%, rgba(34,211,238,.25) 0%, rgba(34,211,238,.15) 35%, rgba(34,211,238,0) 70%);
  mix-blend-mode: screen;
}
@media (max-width: 768px){ .cursor-glow { display: none; } }
@media (prefers-reduced-motion: reduce){ .cursor-glow { display: none; } }

/* Small, consistent buttons */
.btn { display:inline-flex; align-items:center; gap:.5rem; padding:.625rem 1rem; border-radius:1rem; font-weight:600; line-height:1; border:1px solid transparent; white-space: nowrap; }
.btn-block { width: 100%; justify-content: center; }
.btn .icon { width:1.15em; height:1.15em; display:inline-flex; align-items:center; justify-content:center; line-height:1; }
.btn-primary { background:#06b6d4; color:#fff; border-color: rgba(255,255,255,.2); box-shadow: 0 10px 24px -12px rgba(6,182,212,.6); }
.btn-primary:hover { background:#0891b2; }
.btn-ghost { background: rgba(255,255,255,.15); color:#fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.25); }

/* Stat chips in a tidy grid */
.stats-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:.5rem; }
@media (max-width: 768px){ .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 420px){ .stats-grid { grid-template-columns: 1fr; } }
.stat { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.55rem .9rem; border-radius:9999px; border:1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); font-weight:500; min-height: 2.5rem; width: 100%; }
.stat .label { color: var(--text-muted); white-space: normal; }
.stat .value { font-weight:700; min-width:2ch; text-align:right; margin-left: auto; }
.dark .stat { background: rgba(17,24,39,.5); border-color: rgba(55,65,81,.6); }
/* Stat hover like buttons */
.stat { transition: box-shadow .18s ease, transform .18s ease, background .18s ease, border-color .18s ease; }
.stat:hover { box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.stat:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.4); }
.dark .stat:hover { background: rgba(31,41,55,.6); border-color: rgba(75,85,99,.7); }
.stat .icon { width:1.1em; height:1.1em; display:inline-flex; align-items:center; justify-content:center; }

/* Tooltip */
.tooltip { position:relative; cursor:help; display:inline-flex; align-items:center; }
.tooltip .tip { position:absolute; left:50%; transform:translateX(-50%); bottom:125%; min-width: 220px; max-width: 320px; padding:.5rem .65rem; border-radius:.5rem; background: var(--surface); color: var(--text); border:1px solid var(--outline); box-shadow: var(--shadow-glow); opacity:0; pointer-events:none; transition:.15s ease; z-index:50; }
.tooltip:hover .tip, .tooltip:focus-within .tip { opacity:1; }
.tooltip .tip:after { content:''; position:absolute; left:50%; transform:translateX(-50%); bottom:-6px; border:6px solid transparent; border-top-color: var(--surface); }

/* Skeletons */
.skeleton { position: relative; overflow:hidden; background: linear-gradient(90deg, rgba(0,0,0,.06), rgba(0,0,0,.08), rgba(0,0,0,.06)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.dark .skeleton { background: linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,.1), rgba(255,255,255,.06)); }
@keyframes shimmer { 0%{ background-position: 200% 0 } 100%{ background-position: -200% 0 } }

/* Unified card styling for symmetry */
.card {
  background: var(--surface-muted);
  border: 1px solid var(--outline);
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  padding: 1.25rem;
}
.card.hover {
  transition: box-shadow .18s ease, transform .18s ease;
}
.card.hover:hover { box-shadow: var(--shadow-glow); transform: translateY(-2px); }
.card-title { font-weight: 600; }
.card-meta { font-size: .85rem; color: var(--text-muted); }

/* KPI section: tidy three-up layout */
.kpi-grid { display:grid; gap:1rem; grid-template-columns: repeat(3, minmax(0,1fr)); }
.kpi-card { display:flex; flex-direction:column; justify-content:space-between; min-height: 7rem; }
.kpi-title { font-size:.85rem; color: var(--text-muted); }
.kpi-value { font-size:1.6rem; font-weight:800; line-height:1.1; }
.kpi-subvalue { font-size:1.6rem; font-weight:800; line-height:1.1; }
