/* ===== WIFX Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --bg2: #ffffff;
  --card: #ffffff;
  --text: #333333;
  --muted: #666666;
  --accent: #1a1a1a;
  --accent-blue: #003087;
  --brand-blue: #0040ff;
  --border: #e0e0e0;
  --sidebar-w: 240px;
  --nav-height: 70px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* Sidebar - Hidden */
nav.sidebar { display: none; }

/* Mobile hamburger */
.hamburger {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.4rem;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* ===== Top Navigation Bar ===== */
nav.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 60px;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-left .logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-left .logo-icon {
  width: 36px;
  height: 36px;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-right-icon {
  display: flex;
  align-items: center;
}

.nav-right-icon .search-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--accent);
}

.nav-right-icon .search-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown .dropbtn {
  background: transparent;
  color: var(--text);
  border: none;
  padding: 18px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  font-family: inherit;
  text-decoration: none;
  display: block;
  letter-spacing: 0.3px;
}

.dropdown .dropbtn:hover,
.dropdown:hover .dropbtn {
  color: var(--accent);
}

.dropdown .dropbtn.active {
  color: var(--accent);
  font-weight: 600;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 220px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 200;
  overflow: hidden;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: block;
  padding: 12px 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
  border-bottom: 1px solid #f5f5f5;
}

.dropdown-content a:last-child {
  border-bottom: none;
}

.dropdown-content a:hover {
  background: #f8f9fa;
  color: var(--accent);
}

.dropdown-content a.active {
  color: var(--accent);
  background: #f0f4ff;
}

/* ===== Main content ===== */
main {
  margin-left: 0;
  margin-top: var(--nav-height);
  flex: 1;
  padding: 32px 40px;
  max-width: 100%;
  width: 100%;
}

/* Dashboard header */
.dash-header {
  margin-bottom: 40px;
}
.dash-header h1 { margin: 0 0 8px; font-size: 2rem; color: var(--accent); font-weight: 700; }
.dash-header p { margin: 0; color: var(--muted); font-size: 1rem; }

/* Sections */
section {
  margin-bottom: 48px;
  scroll-margin-top: 20px;
}
section h2 {
  font-size: 1.5rem;
  margin: 0 0 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  color: var(--accent);
  font-weight: 600;
}
section .section-desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 24px;
}

/* Chart containers */
.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
.chart-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  min-height: 400px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.chart-box.full { grid-column: 1 / -1; }
.chart-box h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
}
.chart-box .chart-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 16px;
}
.chart-box .plotly-chart { width: 100%; min-height: 380px; }

/* Controls */
.controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.controls select, .controls input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
}
.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.tab-bar button {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.tab-bar button:hover { background: #f5f5f5; color: var(--text); }
.tab-bar button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ===== Blue Banner ===== */
.blue-banner {
  background: var(--brand-blue);
  color: #ffffff;
  text-align: center;
  padding: 32px 40px;
  font-size: 1.25rem;
  font-weight: 600;
  font-family: 'Playfair Display', Georgia, serif;
  letter-spacing: 0.01em;
}

/* ===== Footer ===== */
.site-footer {
  background: #ffffff;
  padding: 60px 60px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo .logo-icon {
  width: 40px;
  height: 40px;
}

.footer-logo .logo-text {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.footer-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--brand-blue);
}

.footer-copyright {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Legacy footer (for dashboard) */
.footer,
footer:not(.site-footer) {
  background: var(--accent);
  color: #ffffff;
  text-align: center;
  padding: 24px;
  font-size: 0.9rem;
  margin-left: 0;
}

/* ===== Our Mission Page ===== */
.mission-hero {
  text-align: center;
  padding: 60px 40px 50px;
  margin-top: var(--nav-height);
}

.mission-hero .hero-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.mission-hero .hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.15;
  margin: 0;
}

/* Content sections with text + illustration side by side */
.mission-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 60px 60px;
}

.mission-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
  padding: 50px 0;
  border-bottom: 1px solid #f0f0f0;
}

.mission-section:last-child {
  border-bottom: none;
}

.mission-section.reverse .mission-text {
  order: 2;
}

.mission-section.reverse .mission-illustration {
  order: 1;
}

.mission-section .mission-text h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 20px;
  line-height: 1.3;
  border-bottom: none;
  padding-bottom: 0;
}

.mission-section .mission-text p {
  color: #444;
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 16px;
}

.mission-section .mission-text p strong {
  color: var(--accent);
}

.mission-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  background: #f8f9fb;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.mission-illustration svg {
  width: 80%;
  max-width: 300px;
  height: auto;
}

/* Full-width text-only mission section */
.mission-section.full-width {
  grid-template-columns: 1fr;
  max-width: 700px;
}

.mission-section.full-width .mission-text {
  order: 1;
}

/* ===== News & Insight (Index) Page ===== */
.news-hero {
  margin-top: var(--nav-height);
  padding: 60px 60px 40px;
  text-align: center;
}

.news-hero .hero-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.news-hero .hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.15;
  margin: 0;
}

.news-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 60px 60px;
}

.article-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
  padding: 40px 0;
  border-bottom: 1px solid #f0f0f0;
}

.article-card:last-child {
  border-bottom: none;
}

.article-card .article-image {
  background: #f0f2f5;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-card .article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card .article-info {
  padding: 10px 0;
}

.article-card .article-tag {
  display: inline-block;
  background: #e0f5f0;
  color: #1a8a6a;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.article-card .article-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
  margin: 0 0 12px;
}

.article-card .article-title a {
  color: inherit;
  text-decoration: none;
}

.article-card .article-title a:hover {
  color: var(--brand-blue);
}

.article-card .article-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.article-card .article-excerpt {
  color: #555;
  font-size: 0.95rem;
  line-height: 1.7;
  margin-top: 12px;
}

/* ===== Blog Post Page (GRC Index repurposed) ===== */
.post-hero {
  margin-top: var(--nav-height);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  padding: 60px 40px 30px;
}

.post-hero .post-tag {
  display: inline-block;
  background: #e0f5f0;
  color: #1a8a6a;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.post-hero .post-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  margin: 0 0 16px;
}

.post-hero .post-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.post-featured-image {
  max-width: 700px;
  margin: 0 auto 40px;
  padding: 0 40px;
}

.post-featured-image .image-wrapper {
  background: #f0f2f5;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.post-featured-image .image-wrapper svg {
  width: 200px;
  height: auto;
}

.post-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 40px 60px;
}

.post-content h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 2rem 0 1rem;
  border-bottom: none;
  padding-bottom: 0;
}

.post-content p {
  color: #444;
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.post-content ul {
  color: #444;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  line-height: 1.8;
}

.post-content li {
  margin-bottom: 0.5rem;
}

/* ===== Methodology Page ===== */
.methodology-hero {
  text-align: center;
  padding: 60px 40px 50px;
  margin-top: var(--nav-height);
}

.methodology-hero .hero-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.methodology-hero .hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.15;
  margin: 0;
}

.methodology-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 40px 60px;
}

.methodology-section {
  padding: 30px 0;
  border-bottom: 1px solid #f0f0f0;
}

.methodology-section:last-child {
  border-bottom: none;
}

.methodology-section h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 16px;
  border-bottom: none;
  padding-bottom: 0;
}

.methodology-section p {
  color: #444;
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.methodology-section ul {
  color: #444;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  line-height: 1.8;
}

.methodology-section li {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.metric-card {
  display: flex;
  gap: 20px;
  margin-top: 1.5rem;
}

.metric-item {
  flex: 1;
  background: #f8f9fa;
  padding: 24px;
  border-radius: 8px;
  text-align: center;
}

.metric-item h4 {
  color: var(--accent);
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.metric-item .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.metric-item p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ===== Player List (Top 100) ===== */
.player-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.pl-group-collapsed {
  display: none;
}

.pl-group-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  margin: 4px 0;
  cursor: pointer;
  border-radius: 8px;
  background: #f0f2f5;
  color: #555;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s;
}

.pl-group-toggle:hover {
  background: #e2e6eb;
  color: #1a1a1a;
}

.pl-toggle-arrow {
  font-size: 0.75rem;
}

.pl-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: default;
  transition: background 0.15s;
}
.pl-row:hover {
  background: #f0f4ff;
}

/* Score ring — conic gradient based on --pct */
.pl-score-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: conic-gradient(
    hsl(var(--hue), 65%, 50%) calc(var(--pct) * 1%),
    #e8e8e8 calc(var(--pct) * 1%)
  );
  position: relative;
}
.pl-score-ring::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
}
.pl-score-ring span {
  position: relative;
  z-index: 1;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

.pl-rank {
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.pl-info {
  flex: 1;
  min-width: 0;
}
.pl-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-meta {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-awards {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #d4a017;
  background: #fef9e7;
  padding: 1px 7px;
  border-radius: 10px;
  vertical-align: middle;
}

/* ===== Player Hover Card ===== */
.player-card {
  position: absolute;
  z-index: 500;
  width: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  padding: 20px;
  pointer-events: auto;
  transition: opacity 0.15s;
}
.player-card.hidden {
  opacity: 0;
  pointer-events: none;
}

.pc-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.pc-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #003087, #0040ff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 1px;
}

.pc-identity {
  min-width: 0;
}
.pc-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-team {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-comp {
  font-size: 0.75rem;
  color: #999;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #f0f0f0;
  padding-top: 14px;
}
.pc-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pc-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.pc-stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hamburger { display: block; }
  .nav-center { display: none; }
  .hamburger { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; }
  .hamburger span { display: block; width: 20px; height: 2px; background: var(--text); }

  nav.top-nav {
    padding: 0 20px;
  }

  .mission-hero .hero-title {
    font-size: 2.2rem;
  }

  .mission-section {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .mission-section.reverse .mission-text,
  .mission-section.reverse .mission-illustration {
    order: unset;
  }

  .mission-content,
  .news-content {
    padding: 0 20px 40px;
  }

  .article-card {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 30px;
    align-items: center;
  }

  .footer-links {
    align-items: center;
  }

  .site-footer {
    padding: 40px 20px 0;
  }

  main { padding: 16px; margin-top: var(--nav-height); }
  .dash-header { padding-top: 0; }
  .chart-row { grid-template-columns: 1fr; }
  .chart-box .plotly-chart { min-height: 300px; }
}
