/* Wrestling Champions - Mobile-First CSS */

/* ===== CSS RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ===== CSS VARIABLES ===== */
:root {
    /* Colors - Dark Theme */
    --primary-bg: #0d0e12;
    --secondary-bg: #161920;
    --surface: #20242d;
    --surface-elevated: #2b313c;
    --header-bg: #08090d;
    --text-primary: #fff;
    --text-secondary: #c9ced8;
    --text-muted: #858c9c;
    --accent: #f7c744;
    --accent-strong: #e84d42;
    --accent-cool: #39bfd1;
    --accent-green: #6fce80;
    --border: #343b49;
    --shadow: rgba(0, 0, 0, 0.4);
    --glow: rgba(255, 212, 71, 0.38);
    
    /* Typography - Mobile First */
    --font-family: 'Rajdhani', 'Impact', 'Arial Narrow Bold', sans-serif;
    --font-family-heading: 'Bebas Neue', 'Impact', cursive;
    --font-size-base: 16px;
    --font-size-small: 14px;
    --font-size-large: 18px;
    --font-size-h1: 2.2rem;
    --font-size-h2: 1.6rem;
    --font-size-h3: 1.3rem;
    
    /* Spacing - Mobile First */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Layout */
    --container-max-width: 1200px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ===== BASE STYLES ===== */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background:
        radial-gradient(circle at 14% 0%, rgba(232, 77, 66, 0.2), transparent 30rem),
        radial-gradient(circle at 86% 8%, rgba(57, 191, 209, 0.16), transparent 28rem),
        linear-gradient(180deg, #151720 0, var(--primary-bg) 460px),
        var(--primary-bg);
    color: var(--text-secondary);
    overflow-x: hidden;
}

/* ===== HEADER STYLES ===== */
header {
    background:
        linear-gradient(90deg, rgba(232, 77, 66, 0.2), transparent 36%),
        linear-gradient(270deg, rgba(57, 191, 209, 0.16), transparent 36%),
        rgba(8, 9, 13, 0.88);
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0;
    position: relative;
    z-index: 150;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

header::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent), var(--accent-cool));
}

/* Header Image - Mobile First */
header img {
    width: min(44%, 320px) !important;
    margin: 0 auto;
    border-radius: var(--border-radius);
    /* Fallback for broken images */
    background: var(--secondary-bg);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

header img::before {
    content: "Wrestling Champions";
    color: var(--accent);
    font-weight: bold;
    display: none;
}

header img[src=""], header img:not([src]) {
    background: var(--secondary-bg);
}

header img[src=""]::before, header img:not([src])::before {
    display: block;
}


/* ===== NAVIGATION - MOBILE FIRST ===== */
/* Sticky promotion bar that stays in reach as you scroll the page */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px var(--spacing-sm);
    margin-bottom: 0;
    background: rgba(13, 14, 18, 0.82);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.26);
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: var(--spacing-xs);
    max-width: var(--container-max-width);
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

.nav-links li {
    display: block;
}

.nav-links a {
    display: block;
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
    font-size: var(--font-size-small);
    padding: 9px 13px;
    border-radius: 999px;
    text-align: center;
    text-transform: uppercase;
    transition: var(--transition);
    border: 1px solid rgba(255, 212, 71, 0.28);
    background: rgba(255, 255, 255, 0.04);
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a:focus,
.nav-links a.active {
    background: var(--accent);
    color: var(--primary-bg);
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* ===== MAIN CONTENT ===== */
main {
    padding: var(--spacing-lg) var(--spacing-md) var(--spacing-xl);
    max-width: 1440px;
    margin: 0 auto;
}

/* ===== TRACKER HERO ===== */
.tracker-hero {
    display: grid;
    gap: var(--spacing-lg);
    align-items: stretch;
    margin: 0 auto var(--spacing-lg);
    padding: var(--spacing-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03)),
        rgba(22, 25, 32, 0.72);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 220px;
}

.kicker {
    width: fit-content;
    margin-bottom: var(--spacing-sm);
    padding: 5px 10px;
    border: 1px solid rgba(247, 199, 68, 0.32);
    border-radius: 999px;
    color: var(--accent);
    background: rgba(247, 199, 68, 0.08);
    font-size: var(--font-size-small);
    font-weight: 700;
    text-transform: uppercase;
}

/* Main Title */
main h1 {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-h1);
    color: var(--text-primary);
    text-align: left;
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    text-shadow: 3px 3px 6px var(--shadow), 0 0 20px rgba(255, 212, 71, 0.25);
    letter-spacing: 0;
    font-weight: 400;
}

/* ===== SEARCH / CONTROLS ===== */
.controls {
    display: grid;
    gap: var(--spacing-sm);
    margin: var(--spacing-lg) 0 0;
}

.hero-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    padding: var(--spacing-md);
    background: rgba(8, 9, 13, 0.42);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.stat-grid + .stat-grid {
    margin-top: 10px;
}

.stat-grid-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-grid-primary .stat-card:last-child {
    grid-column: 1 / -1;
}

.stat-grid-mix {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
    min-width: 0;
    min-height: 76px;
    padding: 10px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-card-small {
    min-height: 64px;
    background: rgba(255, 255, 255, 0.055);
}

.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    color: var(--text-primary);
    font-family: var(--font-family-heading);
    font-size: 1.85rem;
    font-weight: 400;
    line-height: 1;
}

.stat-card-small strong {
    font-size: 1.45rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    min-height: 48px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px var(--spacing-md);
    transition: var(--transition);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 212, 71, 0.18), 0 14px 34px rgba(0, 0, 0, 0.18);
}

.search-icon {
    position: relative;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    font-size: var(--font-size-base);
    line-height: 1;
    opacity: 0.8;
}

.search-icon::after {
    content: '';
    position: absolute;
    right: -6px;
    bottom: -4px;
    width: 8px;
    height: 2px;
    background: var(--accent);
    transform: rotate(45deg);
    transform-origin: center;
}

#champ-search {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    padding: var(--spacing-xs) 0;
}

#champ-search::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-summary {
    text-align: left;
    color: var(--text-secondary);
    font-size: var(--font-size-small);
    min-height: 1.2em;
    margin-top: var(--spacing-sm);
}

.view-toggle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    min-height: 44px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.view-button {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: var(--font-size-small);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
}

.view-button.active {
    background: var(--accent);
    color: var(--primary-bg);
}

.subtitle {
    max-width: 560px;
    color: var(--text-secondary);
    font-size: var(--font-size-large);
    margin-bottom: 0;
    letter-spacing: 0;
}

/* ===== SPOTLIGHT ===== */
.spotlight-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
}

.spotlight-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto auto;
    column-gap: var(--spacing-sm);
    align-items: center;
    min-height: 92px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.spotlight-card:hover,
.spotlight-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(247, 199, 68, 0.55);
    background: rgba(255, 255, 255, 0.08);
}

.spotlight-card img {
    grid-row: 1 / 4;
    width: 72px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.spotlight-card span,
.spotlight-card em {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 700;
    text-transform: uppercase;
}

.spotlight-card strong {
    color: var(--text-primary);
    font-size: 1.12rem;
    line-height: 1.1;
    text-transform: uppercase;
}

/* ===== SECTIONS ===== */
section {
    margin-bottom: var(--spacing-xl);
    padding-top: var(--spacing-sm);
    /* Keep anchor targets clear of the sticky nav bar */
    scroll-margin-top: 80px;
}

/* Champion count badge next to each section title */
.section-title .count {
    display: inline-block;
    vertical-align: middle;
    margin-left: var(--spacing-sm);
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--primary-bg);
    font-family: var(--font-family);
    font-size: 0.6em;
    font-weight: 700;
    letter-spacing: 0;
    text-shadow: none;
    line-height: 1.6;
}

.section-title {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-h2);
    color: var(--accent);
    text-align: left;
    margin: var(--spacing-xl) 0 var(--spacing-xs);
    text-transform: uppercase;
    position: relative;
    padding-bottom: var(--spacing-xs);
    letter-spacing: 0;
    font-weight: 400;
    text-shadow: 0 0 10px rgba(255, 212, 71, 0.34);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: none;
    left: 0;
    width: 92px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent), var(--accent-cool));
}

.section-meta {
    margin-bottom: var(--spacing-md);
    color: var(--text-muted);
    font-size: var(--font-size-small);
    font-weight: 700;
    text-transform: uppercase;
}

/* ===== CHAMPION GRID - MOBILE FIRST ===== */
.champion-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: var(--spacing-lg);
}

/* ===== CHAMPION CARDS ===== */
.champion-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100%;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
        var(--secondary-bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 9px;
    text-align: left;
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
    overflow: hidden;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
    position: relative;
    transform: translateY(0);
}

.champion-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.36), 0 0 24px var(--glow);
}

.champion-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 212, 71, 0.12), transparent);
    transition: left 0.6s;
}

.champion-card:hover::before {
    left: 100%;
}

.champion-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
    border-radius: calc(var(--border-radius) - 2px);
    margin-bottom: 12px;
    border: 1px solid var(--border);
    background: var(--primary-bg);
}

.champion-card h3 {
    font-size: var(--font-size-h3);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    line-height: 1.2;
    overflow-wrap: break-word;
}

.champion-card p {
    color: var(--accent);
    font-size: var(--font-size-small);
    font-weight: bold;
    line-height: 1.3;
    overflow-wrap: break-word;
    text-transform: uppercase;
}

body[data-view="compact"] .champion-grid {
    grid-template-columns: 1fr;
}

body[data-view="compact"] .champion-card {
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
    column-gap: var(--spacing-sm);
    align-items: center;
    padding: 8px;
}

body[data-view="compact"] .champion-card img {
    grid-row: 1 / 3;
    width: 72px;
    margin-bottom: 0;
}

body[data-view="compact"] .champion-card h3 {
    margin-bottom: 2px;
    font-size: 1.05rem;
}

body[data-view="compact"] .champion-card p {
    font-size: 0.86rem;
}

/* ===== FOOTER ===== */
footer {
    background: var(--header-bg);
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
    border-top: 3px solid var(--accent);
    margin-top: var(--spacing-xl);
}

.footer-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
}

.footer-content p {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-small);
}

footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}

footer a:hover {
    text-decoration: underline;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Small tablets and large phones */
@media (min-width: 480px) {
    :root {
        --font-size-h1: 2.2rem;
        --font-size-h2: 1.6rem;
        --font-size-h3: 1.3rem;
    }
    
    header {
        padding: var(--spacing-lg);
    }
    
    .nav-links {
        gap: var(--spacing-sm);
    }
    
    .nav-links a {
        font-size: var(--font-size-base);
        padding: var(--spacing-sm) var(--spacing-sm);
    }
    
    .champion-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }

    .spotlight-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablets */
@media (min-width: 768px) {
    :root {
        --font-size-h1: 2.8rem;
        --font-size-h2: 2rem;
        --font-size-h3: 1.4rem;
        --spacing-xl: 48px;
    }
    
    .nav-links {
        justify-content: center;
        flex-wrap: wrap;
        max-width: none;
        gap: var(--spacing-lg);
    }
    
    .nav-links a {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .tracker-hero {
        grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
        padding: var(--spacing-xl);
    }

    .stat-grid-primary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stat-grid-primary .stat-card:last-child {
        grid-column: auto;
    }

    .stat-grid-mix {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .controls {
        grid-template-columns: minmax(0, 1fr) 180px;
        align-items: center;
    }

    .spotlight-strip {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .champion-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    body[data-view="compact"] .champion-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .footer-content p {
        margin-bottom: 0;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    :root {
        --font-size-h1: 3.5rem;
        --font-size-h2: 2.5rem;
        --font-size-h3: 1.6rem;
    }
    
    header {
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .champion-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    body[data-view="compact"] .champion-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
}

/* Large desktop */
@media (min-width: 1200px) {
    .champion-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    body[data-view="compact"] .champion-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== LOADING STATES ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes highlight {
    0% { box-shadow: 0 0 0 0 rgba(255, 212, 71, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(255, 212, 71, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 212, 71, 0); }
}

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

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border: #fff;
        --text-secondary: #fff;
    }
}

/* ===== MISSING-IMAGE PLACEHOLDER ===== */
.champion-card.no-image img {
    object-fit: contain;
    opacity: 0.85;
    background: var(--primary-bg);
}

/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    right: var(--spacing-md);
    bottom: var(--spacing-md);
    z-index: 200;
    width: 48px;
    height: 48px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--header-bg);
    color: var(--accent);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease,
        background 0.2s ease, color 0.2s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus-visible {
    background: var(--accent);
    color: var(--primary-bg);
}

/* ===== FOCUS VISIBILITY ===== */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Hide the visually-hidden skip link until focused */
.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--accent);
    color: var(--primary-bg);
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 300;
    font-weight: bold;
}

.skip-link:focus {
    left: var(--spacing-sm);
}

/* ===== PRINT STYLES ===== */
@media print {
    .site-nav,
    .controls,
    .back-to-top,
    footer {
        display: none;
    }
    
    .champion-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}
