/* Theme tokens — match Next globals.css
 * RGB channels enable Tailwind opacity modifiers: text-foreground/75, bg-foreground/5, etc.
 */
:root,
html.dark {
  --background: #0b1220;
  --foreground: #f3f4f6;
  --card: #111827;
  --muted: #9ca3af;
  --accent: #34d399;
  --danger: #fb7185;
  --header-bg: rgba(11, 18, 32, 0.95);
  --page-glow: rgba(16, 185, 129, 0.12);
  --hero-from: rgba(17, 24, 39, 0.98);
  --hero-to: rgba(11, 18, 32, 0.99);
  --font-noto: "Noto Sans Thai", system-ui, sans-serif;

  /* space-separated RGB for Tailwind <alpha-value> */
  --background-rgb: 11 18 32;
  --foreground-rgb: 243 244 246;
  --card-rgb: 17 24 39;
  --muted-rgb: 156 163 175;
  --accent-rgb: 52 211 153;
  --danger-rgb: 251 113 133;
}

html.light {
  --background: #f4f6f9;
  --foreground: #0f172a;
  --card: #ffffff;
  --muted: #64748b;
  --accent: #059669;
  --danger: #e11d48;
  --header-bg: rgba(255, 255, 255, 0.92);
  --page-glow: rgba(16, 185, 129, 0.08);
  --hero-from: rgba(255, 255, 255, 0.98);
  --hero-to: rgba(241, 245, 249, 0.99);

  --background-rgb: 244 246 249;
  --foreground-rgb: 15 23 42;
  --card-rgb: 255 255 255;
  --muted-rgb: 100 116 139;
  --accent-rgb: 5 150 105;
  --danger-rgb: 225 29 72;
}

html {
  color-scheme: dark;
}
html.light {
  color-scheme: light;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-noto), system-ui, sans-serif;
  min-height: 100%;
}

/* Kill browser default link blue / visited purple (prev/next date buttons) */
a,
a:link,
a:visited,
a:hover,
a:active {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  background:
    radial-gradient(1200px 400px at 50% -10%, var(--page-glow), transparent),
    var(--background);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
}

.site-logo {
  display: block;
  height: 2rem;
  width: 2rem;
  border-radius: 0.55rem;
  box-shadow: 0 4px 12px -4px rgba(16, 185, 129, 0.45);
}

.match-hero {
  background: linear-gradient(165deg, var(--hero-from) 0%, var(--hero-to) 100%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--foreground) 6%, transparent) inset,
    0 20px 50px -24px rgba(0, 0, 0, 0.35);
}

.match-hero-logo {
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.35);
}

.match-hero-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  background: color-mix(in srgb, var(--foreground) 4%, transparent);
  padding: 0.3rem 0.7rem;
  font-size: 11px;
  line-height: 1.25;
  color: color-mix(in srgb, var(--foreground) 55%, transparent);
}

.match-hero-chip-amber {
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
  font-weight: 600;
}

html.dark .match-hero-chip-amber {
  color: rgba(253, 230, 138, 0.95);
}

/* Pitch is always dark-green; force light text so light theme does not invert names. */
.pitch-card {
  color: #f8fafc;
}
.pitch-card .pitch-name {
  color: #ffffff !important;
  background-color: rgba(0, 0, 0, 0.65) !important;
}
.pitch-field {
  background:
    repeating-linear-gradient(
      90deg,
      #14532d 0px,
      #14532d 28px,
      #166534 28px,
      #166534 56px
    );
}

/* Soft-nav progress bar */
.nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.15s;
}
.nav-progress.is-on {
  opacity: 1;
}
.nav-progress-bar {
  display: block;
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, transparent, #34d399, transparent);
  animation: nav-progress-slide 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes nav-progress-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(400%);
  }
}

/* Live badge: never show "สด" on finished rows even if class "block" sneaks in */
[data-live-tag][hidden],
[data-live-tag].hidden {
  display: none !important;
}

/* =====================================================================
 * Semantic color utilities (fallback + guarantee opacity works)
 * Mirrors Next Tailwind v4 theme tokens. Important so they win over a
 * broken CDN rule that ignores opacity on CSS variables.
 * ===================================================================== */

.bg-background {
  background-color: rgb(var(--background-rgb) / 1) !important;
}
.bg-card {
  background-color: rgb(var(--card-rgb) / 1) !important;
}
.bg-foreground {
  background-color: rgb(var(--foreground-rgb) / 1) !important;
}

.text-foreground {
  color: rgb(var(--foreground-rgb) / 1) !important;
}
.text-background {
  color: rgb(var(--background-rgb) / 1) !important;
}
.text-muted {
  color: rgb(var(--muted-rgb) / 1) !important;
}
.text-accent {
  color: rgb(var(--accent-rgb) / 1) !important;
}
.text-danger {
  color: rgb(var(--danger-rgb) / 1) !important;
}

/* text-foreground / opacity */
.text-foreground\/25 {
  color: rgb(var(--foreground-rgb) / 0.25) !important;
}
.text-foreground\/30 {
  color: rgb(var(--foreground-rgb) / 0.3) !important;
}
.text-foreground\/35 {
  color: rgb(var(--foreground-rgb) / 0.35) !important;
}
.text-foreground\/40 {
  color: rgb(var(--foreground-rgb) / 0.4) !important;
}
.text-foreground\/45 {
  color: rgb(var(--foreground-rgb) / 0.45) !important;
}
.text-foreground\/50 {
  color: rgb(var(--foreground-rgb) / 0.5) !important;
}
.text-foreground\/55 {
  color: rgb(var(--foreground-rgb) / 0.55) !important;
}
.text-foreground\/60 {
  color: rgb(var(--foreground-rgb) / 0.6) !important;
}
.text-foreground\/70 {
  color: rgb(var(--foreground-rgb) / 0.7) !important;
}
.text-foreground\/75 {
  color: rgb(var(--foreground-rgb) / 0.75) !important;
}
.text-foreground\/80 {
  color: rgb(var(--foreground-rgb) / 0.8) !important;
}
.text-foreground\/85 {
  color: rgb(var(--foreground-rgb) / 0.85) !important;
}
.text-foreground\/90 {
  color: rgb(var(--foreground-rgb) / 0.9) !important;
}

/* bg-foreground / opacity */
.bg-foreground\/5 {
  background-color: rgb(var(--foreground-rgb) / 0.05) !important;
}
.bg-foreground\/10 {
  background-color: rgb(var(--foreground-rgb) / 0.1) !important;
}
.bg-foreground\/\[0\.02\] {
  background-color: rgb(var(--foreground-rgb) / 0.02) !important;
}
.bg-foreground\/\[0\.03\] {
  background-color: rgb(var(--foreground-rgb) / 0.03) !important;
}
.bg-foreground\/\[0\.04\] {
  background-color: rgb(var(--foreground-rgb) / 0.04) !important;
}
.bg-foreground\/\[0\.06\] {
  background-color: rgb(var(--foreground-rgb) / 0.06) !important;
}

/* border-foreground / opacity */
.border-foreground\/5 {
  border-color: rgb(var(--foreground-rgb) / 0.05) !important;
}
.border-foreground\/10 {
  border-color: rgb(var(--foreground-rgb) / 0.1) !important;
}
.border-foreground\/25 {
  border-color: rgb(var(--foreground-rgb) / 0.25) !important;
}

/* ring */
.ring-foreground\/10 {
  --tw-ring-color: rgb(var(--foreground-rgb) / 0.1);
}
.ring-foreground\/15 {
  --tw-ring-color: rgb(var(--foreground-rgb) / 0.15);
}

/* divide */
.divide-foreground\/5 > :not([hidden]) ~ :not([hidden]) {
  border-color: rgb(var(--foreground-rgb) / 0.05);
}
.divide-foreground\/10 > :not([hidden]) ~ :not([hidden]) {
  border-color: rgb(var(--foreground-rgb) / 0.1);
}

/* hover variants used across UI */
.hover\:bg-foreground\/5:hover {
  background-color: rgb(var(--foreground-rgb) / 0.05) !important;
}
.hover\:bg-foreground\/10:hover {
  background-color: rgb(var(--foreground-rgb) / 0.1) !important;
}
.hover\:bg-foreground\/\[0\.03\]:hover {
  background-color: rgb(var(--foreground-rgb) / 0.03) !important;
}
.hover\:bg-foreground\/\[0\.04\]:hover {
  background-color: rgb(var(--foreground-rgb) / 0.04) !important;
}
.hover\:text-foreground:hover {
  color: rgb(var(--foreground-rgb) / 1) !important;
}
.hover\:border-emerald-500\/40:hover {
  border-color: rgb(16 185 129 / 0.4) !important;
}
.hover\:border-rose-500\/40:hover {
  border-color: rgb(244 63 94 / 0.4) !important;
}

/* Date nav chip states (explicit — prev/next must match) */
.date-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
  color: rgb(var(--foreground-rgb) / 0.75);
  background-color: rgb(var(--foreground-rgb) / 0.05);
}
.date-chip:hover {
  color: rgb(var(--foreground-rgb) / 1);
  background-color: rgb(var(--foreground-rgb) / 0.1);
}
.date-chip.is-active {
  color: #047857; /* emerald-700 */
  background-color: rgb(16 185 129 / 0.25);
}
html.dark .date-chip.is-active {
  color: #a7f3d0; /* emerald-200 */
}

.date-step {
  display: inline-flex;
  height: 2.25rem;
  width: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
  text-decoration: none;
  color: rgb(var(--foreground-rgb) / 0.8);
  background-color: rgb(var(--foreground-rgb) / 0.05);
  transition: background-color 0.15s, color 0.15s;
}
.date-step:hover {
  color: rgb(var(--foreground-rgb) / 1);
  background-color: rgb(var(--foreground-rgb) / 0.1);
}
.date-step:link,
.date-step:visited,
.date-step:active {
  color: rgb(var(--foreground-rgb) / 0.8);
}
.date-step:hover:link,
.date-step:hover:visited {
  color: rgb(var(--foreground-rgb) / 1);
}
