/* ============================================
   FOOTSTATS — DATA DEFINITIONS · V2
   Editorial · Fraunces + Inter · Dark & Light
   ============================================ */

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

/* THEMES */
:root,
[data-theme="dark"] {
  --bg:           #0E0E10;
  --surface:      #17171A;
  --surface-hi:   #1F1F23;
  --surface-lo:   #0A0A0C;
  --border:       #26262B;
  --border-soft:  #1C1C20;

  --accent:       #F5C100;
  --accent-ink:   #F5C100;
  --accent-dim:   rgba(245, 193, 0, 0.09);

  --text-primary:   #EDEDEF;
  --text-secondary: #A1A1AA;
  --text-tertiary:  #6B6B74;

  --video-bg:     #000;
  --shadow-sm:    0 1px 0 0 rgba(255,255,255,0.03);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg:           #FAFAF7;
  --surface:      #FFFFFF;
  --surface-hi:   #F2F2EE;
  --surface-lo:   #F4F4F0;
  --border:       #E6E6E0;
  --border-soft:  #EEEEE8;

  --accent:       #F5C100;
  --accent-ink:   #8C6A00;
  --accent-dim:   rgba(245, 193, 0, 0.16);

  --text-primary:   #0E0E10;
  --text-secondary: #52525B;
  --text-tertiary:  #8A8A94;

  --video-bg:     #111;
  --shadow-sm:    0 1px 2px rgba(10,10,10,0.04);

  color-scheme: light;
}

:root {
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-serif: 'Fraunces', 'Times New Roman', serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --header-h:   64px;
  --sidebar-w:  300px;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  transition: background 0.2s ease, color 0.2s ease;
}

.hidden { display: none !important; }

button { font-family: inherit; color: inherit; }

::selection { background: var(--accent-dim); color: var(--text-primary); }

/* HEADER */
.site-header {
  position: fixed; inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 100;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  height: 100%;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.icon-btn svg { width: 16px; height: 16px; }

.menu-toggle { display: none; }

.logo-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
}

.logo-mark {
  width: 22px;
  height: 22px;
  color: var(--accent-ink);
  transform: translateY(3px);
  flex-shrink: 0;
}

.logo-word {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.logo-sep { color: var(--text-tertiary); font-size: 14px; }

.logo-kicker {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 17px;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Theme icon visibility */
.theme-icon-sun  { display: none; }
.theme-icon-moon { display: block; }
[data-theme="light"] .theme-icon-sun  { display: block; }
[data-theme="light"] .theme-icon-moon { display: none; }

/* LANG TOGGLE */
.lang-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  height: 34px;
  align-items: center;
}

.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  padding: 5px 10px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.lang-btn.active {
  background: var(--surface-hi);
  color: var(--text-primary);
}
.lang-btn:hover:not(.active) { color: var(--text-primary); }

/* APP LAYOUT */
.app-layout {
  position: fixed;
  top: var(--header-h);
  inset: var(--header-h) 0 0 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* SIDEBAR */
.sidebar {
  background: var(--surface-lo);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-search {
  position: relative;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-search svg {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px 0 34px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-input::placeholder { color: var(--text-tertiary); }
.search-input:focus {
  border-color: color-mix(in oklab, var(--accent-ink) 55%, var(--border));
  background: var(--surface-hi);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 32px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.sidebar-group { margin-bottom: 20px; }

.sidebar-group-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 8px 12px 6px;
}

.sidebar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 5px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: background 0.12s, color 0.12s;
  border: 1px solid transparent;
}
.sidebar-item:hover {
  background: var(--surface);
  color: var(--text-primary);
}
.sidebar-item.is-active {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.sidebar-item-index {
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  flex-shrink: 0;
  width: 18px;
}
.sidebar-item.is-active .sidebar-item-index { color: var(--accent-ink); }

.sidebar-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  font-style: italic;
  font-family: var(--font-serif);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(0,0,0,0.45);
  z-index: 50;
}

/* DETAIL */
.detail {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.detail::-webkit-scrollbar { width: 8px; }
.detail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.detail-article {
  max-width: 820px;
  margin: 0 auto;
  padding: 56px 56px 120px;
}

.detail-header { margin-bottom: 36px; }

.detail-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-bottom: 18px;
  font-weight: 500;
}
.detail-breadcrumb-sep {
  color: var(--text-tertiary);
  opacity: 0.6;
}
.detail-breadcrumb-cat {
  color: var(--text-secondary);
}
.detail-breadcrumb-num {
  font-feature-settings: 'tnum';
  letter-spacing: 0.02em;
}

.detail-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(44px, 6.5vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variation-settings: 'opsz' 144;
}
.detail-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-ink);
}

/* Video */
.detail-video {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--video-bg);
  margin: 36px 0 48px;
  box-shadow: var(--shadow-sm);
}

/* Plyr theming — map Plyr's CSS variables to our design tokens */
.detail-video .plyr {
  --plyr-color-main:              var(--accent-ink);
  --plyr-video-background:        var(--video-bg);
  --plyr-video-control-color:     rgba(255, 255, 255, 0.92);
  --plyr-video-control-color-hover: #fff;
  --plyr-video-control-background-hover: var(--accent-ink);
  --plyr-control-radius:          6px;
  --plyr-control-spacing:         10px;
  --plyr-range-thumb-background:  var(--accent-ink);
  --plyr-range-fill-background:   var(--accent-ink);
  --plyr-tooltip-background:      rgba(20, 20, 22, 0.94);
  --plyr-tooltip-color:           #fff;
  --plyr-menu-background:         rgba(20, 20, 22, 0.96);
  --plyr-menu-color:              rgba(255, 255, 255, 0.92);
  --plyr-font-family:             var(--font-sans);
  --plyr-font-size-base:          13px;
  --plyr-font-size-small:         12px;
  --plyr-font-weight-regular:     400;
  --plyr-font-weight-bold:        500;

  font-family: var(--font-sans);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

[data-theme="light"] .detail-video .plyr {
  --plyr-video-control-color:     rgba(255, 255, 255, 0.96);
  --plyr-tooltip-background:      rgba(14, 14, 16, 0.92);
  --plyr-menu-background:         rgba(14, 14, 16, 0.96);
}

.detail-video .plyr__control--overlaid {
  background: color-mix(in oklab, var(--accent-ink) 88%, transparent);
}
.detail-video .plyr__control--overlaid:hover,
.detail-video .plyr__control--overlaid:focus {
  background: var(--accent-ink);
}

.detail-video video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--video-bg);
  object-fit: contain;
}

/* Clip navigation strip (shown when a stat has multiple clips) */
.clip-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -32px 0 48px;
}
.clip-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.3;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.clip-card:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}
.clip-card.is-active {
  background: var(--accent-dim);
  border-color: color-mix(in oklab, var(--accent-ink) 40%, var(--border));
  color: var(--accent-ink);
}
.clip-number {
  font-feature-settings: 'tnum';
  font-weight: 500;
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}
.clip-card.is-active .clip-number { color: var(--accent-ink); }
.clip-label {
  font-weight: 400;
}

/* Section labels */
.section-label {
  display: inline-block;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

.detail-summary { margin-bottom: 44px; }

.detail-body {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 62ch;
}

.detail-extra {
  margin-top: 44px;
  padding-top: 36px;
  border-top: 1px solid var(--border-soft);
}

/* Qualifiers */
.detail-qualifiers {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}
.qualifier-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.qualifier-label {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-tertiary);
}
.qualifier-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.qtag {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
}

/* Cases */
.detail-cases {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: case-counter;
}
.detail-cases li {
  font-size: 14.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  line-height: 1.5;
}
.case-result {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.case-result--yes {
  color: #3FA665;
  background: rgba(63, 166, 101, 0.10);
  border: 1px solid rgba(63, 166, 101, 0.22);
}
.case-result--no {
  color: #C74A3E;
  background: rgba(199, 74, 62, 0.10);
  border: 1px solid rgba(199, 74, 62, 0.22);
}
[data-theme="light"] .case-result--yes { color: #2F7A4A; background: rgba(63,166,101,0.12); }
[data-theme="light"] .case-result--no  { color: #A83428; background: rgba(199,74,62,0.10); }

/* xG variables (numbered, no emoji) */
.xg-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
  counter-reset: xg-counter;
}
.xg-item {
  counter-increment: xg-counter;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 14.5px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  line-height: 1.55;
}
.xg-item::before {
  content: counter(xg-counter, decimal-leading-zero);
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding-top: 2px;
  letter-spacing: 0.04em;
  min-width: 20px;
}
.xg-item strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* RESPONSIVE */
@media (max-width: 920px) {
  :root { --sidebar-w: 280px; }
  .menu-toggle { display: inline-flex; }
  .logo-kicker, .logo-sep { display: none; }
  [data-theme="light"] .logo-kicker,
  [data-theme="light"] .logo-sep { display: none; }

  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }

  .detail-article { padding: 36px 26px 96px; }
}

@media (max-width: 480px) {
  .header-inner { gap: 10px; padding: 0 14px; }
  .logo-word { font-size: 15px; }
  .detail-article { padding: 28px 20px 72px; }
  .detail-title { font-size: 38px; }
  .detail-qualifiers { flex-direction: column; gap: 26px; }
  .detail-cases li { flex-direction: column; gap: 6px; }
  .xg-list { grid-template-columns: 1fr; }
  .header-actions .lang-toggle { padding: 1px; height: 30px; }
  .lang-btn { padding: 4px 7px; }
}
