/* ── Universal site reset and base styles ─────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light dark;
  --bg:      #F7F4EE;
  --surface: #FFFFFF;
  --surface2:#F0EDE5;
  --border:  #E2DDD3;
  --border2: #CBC5B8;
  --accent:  #5B6FA6;
  --accent2: #3D4F82;
  --gold:    #C8954A;
  --text:    #27231E;
  --muted:   #7D7567;
  --radius:  14px;
  --font:    'DM Sans', 'Inter', system-ui, sans-serif;
}

/* Dark mode — system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:      #17151E;
    --surface: #252234;
    --surface2:#2E2B40;
    --border:  #3D3B56;
    --border2: #524F6E;
    --accent:  #9AAFDE;
    --accent2: #7B94CC;
    --gold:    #DEB468;
    --text:    #F0EDF8;
    --muted:   #AEA9C0;
  }
}

/* Dark mode — explicit user toggle */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:      #17151E;
  --surface: #252234;
  --surface2:#2E2B40;
  --border:  #3D3B56;
  --border2: #524F6E;
  --accent:  #9AAFDE;
  --accent2: #7B94CC;
  --gold:    #DEB468;
  --text:    #F0EDF8;
  --muted:   #AEA9C0;
}

/* Light mode — explicit user toggle (overrides system dark preference) */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:      #F7F4EE;
  --surface: #FFFFFF;
  --surface2:#F0EDE5;
  --border:  #E2DDD3;
  --border2: #CBC5B8;
  --accent:  #5B6FA6;
  --accent2: #3D4F82;
  --gold:    #C8954A;
  --text:    #27231E;
  --muted:   #7D7567;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
}
.topbar-inner { max-width: 1140px; margin: 0 auto; }
.topbar-pill {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  overflow: hidden;
}
.topbar-logo {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface2);
  text-decoration: none;
  transition: background 0.15s;
  flex-shrink: 0;
}
.topbar-logo:hover { background: var(--border); }
.topbar-logo img { height: 48px; width: auto; mix-blend-mode: multiply; display: block; }

/* ── Navigation ──────────────────────────────────────────────────────────── */

.topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 10px;
  flex: 1;
}
.topnav a {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
/* Default hover/active — sport pages override these with their own colors */
.topnav a:hover { background: rgba(91,111,166,0.09); color: var(--accent); }
.topnav a.active { background: rgba(91,111,166,0.13); color: var(--accent2); font-weight: 700; }

/* ── Footer ──────────────────────────────────────────────────────────────── */

/* Simple article footer (blog articles) */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 24px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
}

/* Simple page footer (methodology, authors, profile) */
footer {
  border-top: 1px solid var(--border);
  padding: 26px 24px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
}

/* ── Responsive overrides ────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .topnav { overflow-x: auto; -webkit-overflow-scrolling: touch; justify-content: flex-start; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { white-space: nowrap; flex-shrink: 0; padding: 5px 8px; font-size: 11.5px; }
  .topbar-logo img { height: 34px; }
  .topbar { padding: 8px 12px; }
}

/* ── Theme toggle button ─────────────────────────────────────────────────── */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--muted);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.theme-toggle:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}
.theme-toggle .theme-icon { font-size: 13px; }

/* Logo blend mode — multiply works on light bg, normal on dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topbar-logo img { mix-blend-mode: normal; filter: brightness(0.9); }
}
:root[data-theme="dark"] .topbar-logo img { mix-blend-mode: normal; filter: brightness(0.9); }
