/* ============================================================
   Tailgate Streaming Hub — design tokens + components
   Art direction: prime-time American football broadcast at
   night — dark charcoal surfaces, one end-zone orange-red
   accent, condensed bold display type for matchups/headers.
   ============================================================ */

:root,
[data-theme='light'] {
  /* Surfaces — warm paper */
  --color-bg: #f4f2ec;
  --color-surface: #ffffff;
  --color-surface-2: #faf8f3;
  --color-surface-offset: #ece8de;
  --color-surface-offset-2: #e3ded2;
  --color-divider: #e0dbcd;
  --color-border: #d8d2c1;

  /* Text */
  --color-text: #1b1712;
  --color-text-muted: #6c6558;
  --color-text-faint: #a49c8b;
  --color-text-inverse: #f7f4ec;

  /* Primary accent — neon orange */
  --color-primary: #e05f00;
  --color-primary-hover: #c25000;
  --color-primary-active: #a34200;
  --color-primary-highlight: #ffe6cc;

  /* Secondary accent — broadcast gold (used sparingly: live/badges) */
  --color-gold: #a97a15;
  --color-gold-highlight: #f0e2bd;

  --color-success: #3f7a34;
  --color-success-highlight: #d7e6cf;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 40 / 0.08);
  --shadow-md: 0 6px 16px oklch(0.2 0.02 40 / 0.1);
  --shadow-lg: 0 16px 40px oklch(0.2 0.02 40 / 0.16);

  --content-narrow: 640px;
  --content-default: 780px;
  --content-wide: 1120px;
  --content-full: 100%;

  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
}

[data-theme='dark'] {
  --color-bg: #0c0d10;
  --color-surface: #15161b;
  --color-surface-2: #1a1c22;
  --color-surface-offset: #1f2128;
  --color-surface-offset-2: #262832;
  --color-divider: #26282f;
  --color-border: #2d2f38;

  --color-text: #eeece5;
  --color-text-muted: #9b988f;
  --color-text-faint: #5d5b55;
  --color-text-inverse: #15161b;

  --color-primary: #ff6a00;
  --color-primary-hover: #ff8a33;
  --color-primary-active: #ffaa66;
  --color-primary-highlight: #3a2510;

  --color-gold: #d9a936;
  --color-gold-highlight: #37301a;

  --color-success: #6fae56;
  --color-success-highlight: #263521;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow-md: 0 8px 20px oklch(0 0 0 / 0.45);
  --shadow-lg: 0 20px 48px oklch(0 0 0 / 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0c0d10;
    --color-surface: #15161b;
    --color-surface-2: #1a1c22;
    --color-surface-offset: #1f2128;
    --color-surface-offset-2: #262832;
    --color-divider: #26282f;
    --color-border: #2d2f38;
    --color-text: #eeece5;
    --color-text-muted: #9b988f;
    --color-text-faint: #5d5b55;
    --color-text-inverse: #15161b;
    --color-primary: #ff6a00;
    --color-primary-hover: #ff8a33;
    --color-primary-active: #ffaa66;
    --color-primary-highlight: #3a2510;
    --color-gold: #d9a936;
    --color-gold-highlight: #37301a;
    --color-success: #6fae56;
    --color-success-highlight: #263521;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4);
    --shadow-md: 0 8px 20px oklch(0 0 0 / 0.45);
    --shadow-lg: 0 20px 48px oklch(0 0 0 / 0.55);
  }
}

:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  --text-hero: clamp(2.75rem, 1rem + 5vw, 5.5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
}

/* ============ Layout primitives ============ */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: oklch(from var(--color-bg) l c h / 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid oklch(from var(--color-border) l c h / 0.7);
}
.header-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-block: var(--space-1);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
  margin-right: auto;
}
.brand-mark {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  letter-spacing: 0.01em;
}
.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  border: 1px solid oklch(from var(--color-border) l c h / 0.8);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--color-primary); border-color: var(--color-primary); }
.theme-toggle svg { width: 18px; height: 18px; }

/* Week nav */
.week-nav-wrap {
  border-top: 1px solid oklch(from var(--color-border) l c h / 0.5);
  overflow-x: auto;
  scrollbar-width: none;
}
.week-nav-wrap::-webkit-scrollbar { display: none; }
.week-nav {
  display: flex;
  gap: var(--space-2);
  padding-block: var(--space-3);
  width: max-content;
}
.week-pill {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid oklch(from var(--color-border) l c h / 0.8);
  white-space: nowrap;
  background: var(--color-surface);
}
.week-pill:hover, .week-pill:focus-visible { color: var(--color-primary); border-color: var(--color-primary); }
.week-pill[aria-current='true'] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

/* ============ Hero ============ */
.hero {
  padding-block: var(--space-4) var(--space-3);
  position: relative;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 200px;
  background: radial-gradient(60% 60% at 30% 20%, oklch(from var(--color-primary) l c h / 0.22), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
  line-height: 1.15;
  max-width: 40ch;
}

/* ============ Schedule ============ */
.schedule { padding-top: var(--space-4); padding-bottom: clamp(var(--space-10), 6vw, var(--space-16)); }

@media (max-width: 600px) {
  .hero { padding-block: var(--space-2) var(--space-1); }
  .hero h1 { max-width: 22ch; }
  .schedule { padding-top: var(--space-2); }
}

.day-group { margin-bottom: clamp(var(--space-10), 5vw, var(--space-16)); scroll-margin-top: var(--space-24); }
.day-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.day-heading .icon { color: var(--color-primary); flex-shrink: 0; width: 22px; height: 22px; }
.day-heading h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-2xl);
  margin-right: auto;
}
.day-heading .weekday-label { color: var(--color-primary); }

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  min-height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color var(--transition-interactive), color var(--transition-interactive), background var(--transition-interactive);
}
.download-btn .icon { width: 16px; height: 16px; color: currentColor; }
.download-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.download-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.download-btn:active { background: var(--color-surface-2); }

.match-grid {
  display: grid;
  gap: var(--space-4);
}

.match-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-4);
}
.match-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.match-time {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
  min-width: 4.5ch;
}
.match-time.is-tbd { color: var(--color-text-faint); font-size: var(--text-sm); font-family: var(--font-body); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.broadcaster-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  text-transform: uppercase;
  white-space: nowrap;
}
.matchup {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-lg);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.matchup .vs { color: var(--color-text-faint); font-weight: 400; }
.matchup .host { color: var(--color-text); }
.matchup .guest { color: var(--color-text-muted); }

.stream-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}
.stream-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: var(--space-1);
}
.stream-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-highlight);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  min-height: 36px;
}
.stream-chip:hover, .stream-chip:focus-visible {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.stream-chip svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Week (TBD) header variant */
.day-heading.is-tbd h2 { font-size: var(--text-xl); }
.day-heading.is-tbd .icon { color: var(--color-text-faint); }

/* ============ States ============ */
.state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  padding-block: var(--space-20);
  color: var(--color-text-muted);
}
.state-panel .icon { width: 40px; height: 40px; color: var(--color-text-faint); }
.retry-btn {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-inverse);
  background: var(--color-primary);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
}
.retry-btn:hover { background: var(--color-primary-hover); }

.skeleton-card {
  height: 108px;
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--color-surface-offset) 30%, var(--color-surface-offset-2) 50%, var(--color-surface-offset) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-10);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.footer-links { display: flex; gap: var(--space-5); }
.footer-links a { color: var(--color-text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--color-primary); }
.footer-note { max-width: 60ch; margin-top: var(--space-4); font-size: var(--text-xs); color: var(--color-text-faint); }

/* ============ Responsive ============ */
@media (min-width: 640px) {
  .match-card { grid-template-columns: auto 1fr; align-items: center; }
  .match-top { flex-direction: column; align-items: flex-start; gap: var(--space-2); min-width: 120px; }
  .match-main { display: flex; flex-direction: column; gap: var(--space-3); }
}
@media (max-width: 639px) {
  .match-top {
    flex-direction: row;
    justify-content: space-between;
  }
}
