/* ═══════════════════════════════════════════════════════════════════════════
   Base — Resets, Typography Defaults, Global Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Box model reset ────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ── Body ───────────────────────────────────────────────────────────────── */
html {
  overflow-y: auto;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 68px 0 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* clip, not hidden: clip creates no scroll container, so position: sticky
     inside the page keeps working. This came from base-min.css, which
     tournaments.html loaded instead of this file, and is what kept that
     page from scrolling sideways: its tab strip has a min-content width
     wider than a 375px viewport. Setting it here rather than on html keeps
     the computed value clip; html already sets overflow-y, and the pair
     would coerce to hidden. */
  overflow-x: clip;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: var(--space-3);
  letter-spacing: 0.02em;
}

.display-font {
  font-family: var(--font-display);
  font-weight: var(--weight-normal);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl);  }
h6 { font-size: var(--text-lg);  }

p {
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

a:hover {
  color: var(--accent-hover);
}

small, .text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

.text-accent {
  color: var(--accent) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-warning {
  color: var(--warning) !important;
}

.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Selection ──────────────────────────────────────────────────────────── */
::selection {
  background: var(--accent);
  color: var(--bg-deep);
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-surface);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Focus ring ─────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Images ─────────────────────────────────────────────────────────────── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Grain texture overlay (applied to body) ───────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ── Section spacing ────────────────────────────────────────────────────── */
.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-10) 0;
}

/* ── Scroll-reveal animation ─────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.fade-up {
  opacity: 0;
}

.fade-up-d1 { animation-delay: 0.12s; }
.fade-up-d2 { animation-delay: 0.24s; }
.fade-up-d3 { animation-delay: 0.36s; }
.fade-up-d4 { animation-delay: 0.48s; }
.fade-up-d5 { animation-delay: 0.60s; }
.fade-up-d6 { animation-delay: 0.72s; }

/* ── Angular section divider ────────────────────────────────────────────── */
.section-angled {
  position: relative;
}

.section-angled::before {
  content: '';
  position: absolute;
  top: -40px;
  left: 0;
  right: 0;
  height: 80px;
  background: inherit;
  clip-path: polygon(0 50%, 100% 0, 100% 100%, 0 100%);
  z-index: 1;
}

/* ── Accent stripe (horizontal rule with character) ─────────────────────── */
.accent-stripe {
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-warm) 50%, transparent 100%);
  border: none;
  margin: 0;
}

/* ── Highlight marker (warm accent underline on text) ───────────────────── */
.text-highlight {
  position: relative;
  display: inline;
  background: linear-gradient(transparent 65%, rgba(245,158,11,0.25) 65%);
  padding-bottom: 2px;
}

/* ── Page content wrapper ───────────────────────────────────────────────── */
.page-content {
  padding: 0 var(--space-4) var(--space-16);
}

/* ── Dividers ───────────────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}

/* ── Bootstrap utility overrides — redirect to design system ───────────── */
.text-muted    { color: var(--text-muted) !important; }
.text-warning  { color: var(--tier-accent) !important; }
.text-info     { color: var(--accent) !important; }
.text-success  { color: var(--success) !important; }
.text-danger   { color: var(--danger) !important; }
.text-white    { color: var(--text-primary) !important; }
.text-light    { color: var(--text-secondary) !important; }
.border-secondary { border-color: var(--border) !important; }
.bg-dark       { background-color: var(--bg-elevated) !important; }

/* ── Skip navigation link ────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 10000;
  padding: var(--space-3) var(--space-6);
  background: var(--accent);
  color: var(--bg-deep);
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--duration) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ── Skeleton loaders ───────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
  width: 80%;
}

.skeleton-text-sm {
  height: 0.75em;
  width: 60%;
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-4);
  text-align: center;
}

.empty-state-icon {
  font-size: var(--text-4xl);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 320px;
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .fade-up {
    opacity: 1;
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}
