/* ==========================================================================
   SA SOFTBALL PLATFORM — MODERN ATHLETIC DESIGN SYSTEM & MOTION
   ========================================================================== */

:root {
    --sa-green-deep: #0c562e;
    --sa-green-turf: #16a34a;
    --sa-optic-yellow: #d4f000;
    --sa-gold: #f3b71a;
    --sa-seam-red: #e63946;
    --sa-clay: #c85a32;
    --sa-navy-stadium: #090d16;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

h1:focus {
    outline: none;
}

/* Tabular numerals for scores, innings, standings logs, and timers */
.tabular-nums,
table td,
table th,
.score-numeral,
.rank-circle-badge {
    font-variant-numeric: tabular-nums;
}

/* Broadcast display typography */
.font-broadcast {
    font-family: 'Montserrat', 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

/* Accessible visually hidden & skip link (Modern Web Guidance: accessibility) */
.visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.skip-link:focus-visible {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 99999;
    padding: 0.65rem 1.25rem;
    border-radius: 0.75rem;
    background: #16a34a;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.85rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    outline: 3px solid #f3b71a;
    outline-offset: 2px;
}

/* High-contrast keyboard focus rings (Modern Web Guidance: accessibility) */
:where(a:any-link, button, select, input, [tabindex="0"]):focus-visible {
    outline: 2.5px solid #16a34a;
    outline-offset: 2px;
}

html.dark :where(a:any-link, button, select, input, [tabindex="0"]):focus-visible {
    outline: 2.5px solid #d4f000;
    outline-offset: 2px;
}

/* ==========================================================================
   SOFTBALL STADIUM & DUGOUT SURFACES
   ========================================================================== */

.dugout-card {
    position: relative;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.22s ease;
}

@media (prefers-reduced-motion: no-preference) {
    .dugout-card:hover {
        transform: translateY(-3px);
    }
}

/* Subtle Softball Diamond Grid & Seam Texture for Hero / Featured Panels */
.stadium-hero-surface {
    background-image:
        radial-gradient(circle at 88% 18%, rgba(212, 240, 0, 0.14) 0%, transparent 45%),
        radial-gradient(circle at 12% 85%, rgba(22, 163, 74, 0.14) 0%, transparent 50%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 249, 0.94) 100%);
}

html.dark .stadium-hero-surface {
    background-image:
        radial-gradient(circle at 88% 18%, rgba(212, 240, 0, 0.10) 0%, transparent 45%),
        radial-gradient(circle at 12% 85%, rgba(22, 163, 74, 0.18) 0%, transparent 50%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.94) 0%, rgba(9, 13, 22, 0.97) 100%);
}

/* Responsive Accessible Table Wrapper (Modern Web Guidance: responsive-table) */
.standings-table-region {
    overflow-x: auto;
    max-inline-size: 100%;
    container-type: inline-size;
}

.standings-table-region thead {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
}

/* ==========================================================================
   PURPOSEFUL SOFTBALL ANIMATIONS (Compositor-Only & Reduced-Motion Safe)
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    /* 1. Dugout Rise Entrance */
    @keyframes dugout-rise {
        from {
            opacity: 0;
            transform: translateY(14px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .animate-dugout-rise {
        animation: dugout-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .animate-delay-1 { animation-delay: 60ms; }
    .animate-delay-2 { animation-delay: 120ms; }
    .animate-delay-3 { animation-delay: 180ms; }
    .animate-delay-4 { animation-delay: 240ms; }

    /* 2. Spinning Softball SVG in Hero & Headers */
    @keyframes softball-spin-slow {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    .animate-softball-spin {
        animation: softball-spin-slow 18s linear infinite;
    }

    /* 3. Floating Pitch Arc */
    @keyframes pitch-float {
        0%, 100% { transform: translateY(0px) rotate(0deg); }
        50% { transform: translateY(-6px) rotate(8deg); }
    }

    .animate-pitch-float {
        animation: pitch-float 3.6s ease-in-out infinite;
    }

    /* 4. Animated Diamond Basepath Runner Pulse */
    @keyframes basepath-dash {
        0% { stroke-dashoffset: 320; }
        100% { stroke-dashoffset: 0; }
    }

    .animate-basepath-runner {
        stroke-dasharray: 16 12;
        animation: basepath-dash 8s linear infinite;
    }

    /* 5. Base Glow Sequence (Home -> 1st -> 2nd -> 3rd) */
    @keyframes base-pulse {
        0%, 100% { transform: scale(1); opacity: 0.85; }
        50% { transform: scale(1.22); opacity: 1; }
    }

    .animate-base-1 { animation: base-pulse 2.8s ease-in-out infinite 0s; transform-box: fill-box; transform-origin: center; }
    .animate-base-2 { animation: base-pulse 2.8s ease-in-out infinite 0.7s; transform-box: fill-box; transform-origin: center; }
    .animate-base-3 { animation: base-pulse 2.8s ease-in-out infinite 1.4s; transform-box: fill-box; transform-origin: center; }
    .animate-base-home { animation: base-pulse 2.8s ease-in-out infinite 2.1s; transform-box: fill-box; transform-origin: center; }

    /* 6. Winning Score Pop */
    @keyframes winner-score-pop {
        0% { transform: scale(0.88); opacity: 0.7; }
        70% { transform: scale(1.06); opacity: 1; }
        100% { transform: scale(1); opacity: 1; }
    }

    .animate-score-pop {
        animation: winner-score-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    }

    /* 7. Scroll-Driven Card Entry Reveal (Modern Web Guidance: scroll-entry-exit-effects) */
    @supports ((animation-timeline: view()) and (animation-range: entry)) {
        @keyframes scroll-card-enter {
            from {
                opacity: 0.25;
                transform: translateY(18px) scale(0.985);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .scroll-reveal-card {
            animation: scroll-card-enter auto ease-out backwards;
            animation-timeline: view();
            animation-range: entry 0% entry 28%;
        }
    }
}

/* Error UI Fallback */
#blazor-error-ui {
    color-scheme: light only;
    background: #dc2626;
    color: #ffffff;
    bottom: 1rem;
    right: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
    display: none;
    padding: 0.85rem 1.25rem;
    position: fixed;
    border-radius: 0.85rem;
    z-index: 10000;
}
