/* ==========================================================================
   Crikky — core app styles (home, stats, compare, leaderboard, matchup, fastest/slowest)
   Loaded via {% block extra_css %} in core templates. Only core pages depend on this file.
   ========================================================================== */

/* Bottom filter bar (stats pages) — in normal flow below the scroll area, so it
   never overlaps the table (iOS Safari breaks touch hit-testing on bars that
   float over scrollable content). */
.filter-bar {
  z-index: 1001;
  flex-shrink: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 12px rgba(2, 6, 23, 0.05);
  overflow: visible;
}
.filter-bar__inner {
  padding: 0.75rem;
  overflow: visible;
}
.filter-bar__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.filter-bar__form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.filter-bar__dropdowns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.5rem 0.5rem 0;
}
.filter-bar__dropdowns .dropdown {
  min-width: 0;
}
.filter-bar__dropdowns .dropdown__toggle {
  width: 100%;
}
@media (min-width: 768px) {
  .filter-bar__inner {
    padding: 1rem;
  }
  .filter-bar__body {
    gap: 1rem;
  }
  .filter-bar__form {
    gap: 1rem;
  }
}
/* Stats pages: flex column — header, internally-scrolling table area, then the
   filter bar in normal flow. The table can never sit behind the bar. */
.page--stats {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0;
}
.page-header--stats {
  flex-shrink: 0;
}
@media (max-width: 767.98px) {
  /* Small screens: pull the live match badge tight against the table */
  .page-header--stats:has(.live-badge) {
    margin-bottom: 0;
  }
  .page-header--stats:has(.live-badge) + .stats-scroll .table-panel {
    margin-top: 0;
  }
}
.stats-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Wrapper for data tables */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.stat-grid--3col {
  grid-template-columns: 1fr;
}
.filter-bar__ranges {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.filter-bar__autocomplete {
  margin-top: 0.5rem;
  padding: 0 0.5rem;
}
.filter-bar__autocomplete-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
@media (min-width: 768px) {
  .divider {
    margin: 1.5rem 0;
  }
}
@media (min-width: 1024px) {
  .stat-grid--3col {
    grid-template-columns: repeat(3, 1fr);
  }
}
.table-panel {
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
  outline: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  margin-top: 0.75rem;
  overflow-x: auto;
}
@media (min-width: 768px) {
  .table-panel {
    margin-top: 1rem;
  }
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: var(--radius-full);
  background: var(--color-warning-soft);
  color: #b45309;
  outline: 1px solid #fde68a;
  padding: 0.25rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   1. Home hero & link cards
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(to bottom right, #064e3b, #0f766e, #164e63);
  padding: 1.5rem;
  /* Flush with top/left/right edges of the page (counter .page padding),
     keeping space only below */
  margin: -0.5rem -0.5rem 1.5rem;
}
.hero__glow {
  position: absolute;
  border-radius: var(--radius-full);
  filter: blur(48px);
}
.hero__glow--tl {
  top: -5rem;
  right: -5rem;
  width: 16rem;
  height: 16rem;
  background: rgba(52, 211, 153, 0.1);
}
.hero__glow--bl {
  bottom: -2.5rem;
  left: -2.5rem;
  width: 12rem;
  height: 12rem;
  background: rgba(34, 211, 238, 0.1);
}
.hero__pattern {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 50%,
    rgba(255, 255, 255, 0.03) 0%,
    transparent 70%
  );
}
.hero__content {
  position: relative;
  z-index: 10;
}
.hero__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.hero__logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  outline: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg);
}
.hero__title {
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.01em;
  font-size: var(--font-size-xl);
}
.hero__tagline {
  color: rgba(167, 243, 208, 0.8);
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-top: 0.125rem;
}
.hero__text {
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--font-size-sm);
  max-width: 42rem;
  line-height: 1.625;
}
@media (min-width: 768px) {
  .hero {
    padding: 2rem;
    margin: -1rem -1rem 2rem;
  }
  .hero__header {
    gap: 1rem;
    margin-bottom: 1rem;
  }
  .hero__logo {
    width: 3rem;
    height: 3rem;
  }
  .hero__title {
    font-size: var(--font-size-2xl);
  }
  .hero__tagline {
    font-size: var(--font-size-sm);
  }
  .hero__text {
    font-size: var(--font-size-base);
  }
}
@media (min-width: 1024px) {
  /* .page left/right padding grows to 1.5rem at this breakpoint */
  .hero {
    margin: -1rem -1.5rem 2rem;
  }
}
.link-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-text-strong) 90%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  outline: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  border-left: 4px solid var(--color-success);
  transition: box-shadow 0.3s, outline-color 0.3s, transform 0.3s;
}
.link-card:hover {
  box-shadow: var(--shadow-lg);
  outline-color: rgba(52, 211, 153, 0.3);
}
.link-card:active {
  transform: scale(0.98);
}
.link-card__title {
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: var(--font-size-base);
  line-height: 1.375;
  transition: color 0.2s;
}
.link-card:hover .link-card__title {
  color: #34d399;
}
.link-card__text {
  color: var(--color-text-faint);
  font-size: var(--font-size-xs);
  margin-top: 0.25rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}
.link-card:hover .link-card__text {
  color: var(--color-border-strong);
}
@media (min-width: 640px) {
  .link-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  .link-card {
    padding: 1.5rem;
  }
}
@media (min-width: 1280px) {
  .link-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --------------------------------------------------------------------------
   2. Stats (matchup tiles + stat cards)
   -------------------------------------------------------------------------- */
.stat {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-surface) 80%, transparent);
  outline: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
}
.stat::after {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 0.25rem;
  background: linear-gradient(to bottom, var(--color-success), #14b8a6);
}
.stat__label {
  color: var(--color-text-faint);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat__value {
  color: var(--color-text-strong);
  font-weight: 700;
  font-size: var(--font-size-xl);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
@media (min-width: 768px) {
  .stat {
    padding: 1.25rem 1.5rem;
  }
  .stat__label {
    font-size: var(--font-size-xs);
  }
  .stat__value {
    font-size: var(--font-size-3xl);
  }
}

/* Stats page heading — smaller, prominent via brand color */
.page-header--stats .page-header__title {
  font-size: var(--font-size-lg);
  line-height: 1.3;
  color: var(--color-primary);
}
@media (min-width: 768px) {
  .page-header--stats .page-header__title {
    font-size: var(--font-size-xl);
  }
}
