/*
 |--------------------------------------------------------------------------
 | USAMuscle Refresh Stylesheet
 |--------------------------------------------------------------------------
 | Base hooks ready for customization. Add overrides below to tune the
 | refreshed Bootstrap 5 layout without touching markup.
 */

@import url("/assets/bootstrap/bootstrap-icons-1.13.1/bootstrap-icons-1.13.1/bootstrap-icons.css");

:root {
    /* Brand hooks — dark mode only */
    --refresh-primary: #f44336fc;
    --refresh-primary-solid: #f44336;
    --refresh-primary-hover: #e53935;
    --refresh-primary-active: #d32f2f;
    --refresh-primary-contrast: #ffffff;
    --refresh-primary-rgb: 244, 67, 54;
    --refresh-hero-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
    --refresh-surface: rgba(17, 20, 24, 0.95);
    --refresh-surface-muted: rgba(33, 37, 41, 0.85);
    --refresh-surface-subtle: rgba(33, 37, 41, 0.75);
    --refresh-card-text: #dee2e6;
    --refresh-text-muted: #adb5bd;
    --refresh-border-soft: rgba(255, 255, 255, .08);
    --refresh-border-strong: rgba(255, 255, 255, .12);
    --refresh-hover-bg: rgba(255, 255, 255, .05);
    --refresh-navbar-shadow: rgba(0, 0, 0, .45);

    /* ---- Apple HIG shared tokens ---- */

    /* Border Radius — discrete scale */
    --usm-radius-xs: 6px;
    --usm-radius-sm: 8px;
    --usm-radius-md: 12px;
    --usm-radius-lg: 16px;
    --usm-radius-xl: 22px;
    --usm-radius-2xl: 28px;
    --usm-radius-full: 9999px;

    /* Dual-layer shadow system (dark-mode calibrated) */
    --usm-shadow-xs: 0 0.5px 1px rgba(0, 0, 0, 0.25);
    --usm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.24), 0 1px 2px rgba(0, 0, 0, 0.16);
    --usm-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.28), 0 1px 4px rgba(0, 0, 0, 0.2);
    --usm-shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.18);
    --usm-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.42), 0 4px 16px rgba(0, 0, 0, 0.22);

    /* Shadow-rings (replace visible borders on cards) */
    --usm-ring: 0 0 0 0.5px rgba(255, 255, 255, 0.08);
    --usm-ring-hover: 0 0 0 0.5px rgba(255, 255, 255, 0.16);
    --usm-ring-accent: 0 0 0 0.5px rgba(244, 67, 54, 0.4);

    /* Spring-curve transitions */
    --usm-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --usm-ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --usm-transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --usm-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --usm-transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Focus ring */
    --usm-focus-ring: 0 0 0 4px rgba(244, 67, 54, 0.3);

    /* Typography tracking — Apple SF scale */
    --usm-tracking-tight: -0.012em;
    --usm-tracking-normal: -0.006em;
    --usm-tracking-wide: 0.06em;
}

html {
    height: 100%;
    /* Prevent horizontal scroll drift on mobile — content that bleeds
       past the viewport edge (fixed-pos bars, radial-gradient backgrounds,
       negative-margin rows, etc.) must not widen the scrollable area. */
    overflow-x: hidden;
}

body {
    /* Typography / background overrides */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* belt-and-suspenders: catches any body-level overflow */
}

main {
    flex: 1 0 auto;
}

footer {
    margin-top: auto;
    flex-shrink: 0;
}

a {
    /* Link color overrides */
    text-decoration-skip-ink: auto;
}

a:hover,
a:focus {
    /* Link hover/focus overrides */
    text-decoration: none;
}

.visually-hidden-focusable {
    /* Skip link: hidden until focused */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.visually-hidden-focusable:focus,
.visually-hidden-focusable:focus-within {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

.navbar {
    /* Navbar tweaks */
    backdrop-filter: saturate(120%) blur(6px);
    background-color: var(--refresh-surface) !important;
    box-shadow: var(--usm-shadow-md);
    --bs-navbar-color: rgba(var(--bs-emphasis-color-rgb), .75);
    --bs-navbar-hover-color: rgba(var(--bs-emphasis-color-rgb), 1);
    --bs-navbar-active-color: rgba(var(--bs-emphasis-color-rgb), 1);
    --bs-navbar-brand-color: rgba(var(--bs-emphasis-color-rgb), 1);
    --bs-navbar-brand-hover-color: rgba(var(--bs-emphasis-color-rgb), 1);
    --bs-navbar-toggler-border-color: transparent;
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(0,0,0,0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
    --bs-navbar-toggler-focus-width: .15rem;
    z-index: 1040; /* above fixed/sticky (1030/1020), below modals (1050+) */
}

[data-bs-theme="dark"] .navbar {
    --bs-navbar-color: rgba(233, 236, 239, .85);
    --bs-navbar-hover-color: #ffffff;
    --bs-navbar-active-color: #ffffff;
    --bs-navbar-brand-color: #f8f9fa;
    --bs-navbar-brand-hover-color: #f8f9fa;
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(248,249,250,0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

[data-bs-theme="dark"] nav.navbar.border-bottom {
    border-bottom-color: var(--refresh-border-soft) !important;
}

.navbar-brand .brand-logo {
    /* Control brand sizing */
    height: 36px;
    width: 160px;
    display: block;
    background-color: transparent;
    pointer-events: none;
    transition: filter var(--usm-transition-fast);
}

[data-bs-theme="dark"] .navbar-brand .brand-logo {
    filter: brightness(0) invert(1);
}

.navbar-nav .nav-link {
    /* Nav link default state */
    font-weight: 500;
    font-size: 0.9rem;
    transition: color var(--usm-transition-fast), opacity var(--usm-transition-fast);
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:focus,
.navbar-nav .nav-link:hover {
    /* Nav link active/hover/focus state */
    color: var(--refresh-primary);
    opacity: .85;
}

.navbar-nav .nav-link:active {
    transform: scale(.97);
}

.dropdown-menu .dropdown-item {
    font-size: 0.9rem;
    transition: background-color var(--usm-transition-fast), transform var(--usm-transition-fast);
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    transform: translateX(4px);
}

.clip-thumb {
    overflow: hidden;
}

.clip-thumb img {
    transition: transform var(--usm-transition);
}

.clip-thumb:hover img,
.clip-thumb:focus-within img {
    transform: scale(1.05);
}

.clip-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform var(--usm-transition-fast), background var(--usm-transition-fast);
}

.clip-thumb:hover .clip-play-icon,
.clip-thumb:focus-within .clip-play-icon {
    transform: translate(-50%, -50%) scale(1.07);
    background: rgba(244, 67, 54, 0.85);
}

.refresh-hero {
    /* Hero section styling */
    background: var(--refresh-hero-bg);
    overflow: hidden;
}

.refresh-hero .btn-primary {
    /* Primary CTA in hero */
    box-shadow: var(--usm-shadow-sm);
}

.card.shadow-sm,
.card.border-0 {
    /* Card radius or borders */
    border-radius: var(--usm-radius-lg);
    transition: transform var(--usm-transition), box-shadow var(--usm-transition);
}

.card.shadow-sm:hover,
.card.shadow-sm:focus-within,
.card.border-0:hover,
.card.border-0:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--usm-ring-hover), var(--usm-shadow-md);
}

.card.shadow-sm:active,
.card.border-0:active {
    transform: translateY(-1px);
}

.card .card-title {
    /* Card headline styling */
    font-weight: 700;
    letter-spacing: var(--usm-tracking-tight);
}

.card .card-text {
    /* Card body text */
    color: var(--refresh-card-text);
}

/* -------------------------------------------------- */
/* Page pattern helpers
/* -------------------------------------------------- */

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-sequence>.fade-item {
    opacity: 0;
    transform: translateY(24px);
}

body.page-ready .fade-sequence>.fade-item {
    animation: fadeUp .6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

body.page-ready .fade-sequence>.fade-item:nth-child(1) {
    animation-delay: .08s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(2) {
    animation-delay: .16s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(3) {
    animation-delay: .24s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(4) {
    animation-delay: .32s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(5) {
    animation-delay: .40s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(6) {
    animation-delay: .48s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(7) {
    animation-delay: .56s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(8) {
    animation-delay: .64s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(9) {
    animation-delay: .72s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(10) {
    animation-delay: .80s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(11) {
    animation-delay: .88s;
}

body.page-ready .fade-sequence>.fade-item:nth-child(12) {
    animation-delay: .96s;
}

/*
   Generic JS-driven fade support
   The script /assets/js/refresh-fade.js adds .fade-seq and .is-visible with
   an index-specific CSS variable (--fade-index). These rules animate those
   targets using the same fadeUp keyframes with staggered delays.
*/
.fade-seq {
    opacity: 0;
    transform: translateY(24px);
}

body.page-ready .fade-seq.is-visible {
    animation: fadeUp .7s ease forwards;
    animation-delay: calc(var(--fade-index, 0) * 0.08s);
}

/* Prevent initial flash before fade JS runs on modern pages */
html[data-fade-prep="1"] body:not(.page-ready) .container-xxl {
    opacity: 0.001; /* tiny non-zero to keep layout, avoid repaint cost */
    transform: translateY(8px);
}
html[data-fade-prep="1"] body.page-ready .container-xxl {
    opacity: 1;
    transform: none;
    transition: opacity .12s var(--usm-ease), transform .12s var(--usm-ease);
}

.section-subtitle {
    font-size: .94rem;
    color: var(--bs-secondary-color, #6c757d);
    letter-spacing: var(--usm-tracking-normal);
}

.section-panel {
    background: rgba(15, 23, 42, 0.03);
    border-radius: var(--usm-radius-xl);
    padding: clamp(1.5rem, 2vw, 2rem);
    box-shadow: var(--usm-ring), var(--usm-shadow-xs);
    border: none;
}

[data-bs-theme="dark"] .section-panel {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: var(--usm-ring), var(--usm-shadow-sm);
}

.spotlight-panel {
    background: linear-gradient(130deg, rgba(var(--refresh-primary-rgb, 244, 67, 54), 0.08), rgba(15, 23, 42, 0.02));
    border: 1px solid rgba(var(--refresh-primary-rgb, 244, 67, 54), 0.18);
}

[data-bs-theme="dark"] .spotlight-panel {
    background: linear-gradient(130deg, rgba(var(--refresh-primary-rgb, 244, 67, 54), 0.25), rgba(255, 255, 255, 0.06));
    border-color: rgba(var(--refresh-primary-rgb, 244, 67, 54), 0.35);
}

.daily-spotlight-card {
    border-radius: var(--usm-radius-lg);
    overflow: hidden;
}

.daily-spotlight-card .card-body {
    padding: 1rem 1.25rem 1.25rem;
}

.daily-spotlight-badge {
    position: absolute;
    top: .75rem;
    left: .75rem;
    z-index: 2;
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: var(--refresh-primary, #f44336);
    color: var(--refresh-primary-contrast, #ffffff);
    padding: .35rem .6rem;
    border-radius: 999px;
    box-shadow: var(--usm-shadow-sm);
}

/* Compact style when badge is rendered inside the card-body */
.daily-spotlight-card .card-body .daily-spotlight-badge {
    position: static !important;
    display: inline-block;
    font-size: .6rem;
    letter-spacing: .06em;
    padding: .2rem .45rem;
    margin-bottom: .4rem;
    box-shadow: none;
}

/* Prevent Bootstrap .ratio from forcing the spotlight badge to fill the container */
.ratio > .daily-spotlight-badge {
    position: absolute !important;
    inset: auto auto auto auto; /* reset */
    top: .75rem;
    left: .75rem;
    right: auto;
    bottom: auto;
    width: auto;
    height: auto;
    pointer-events: none; /* decorative; allow card clicks */
}

.daily-spotlight-card .card-img-top {
    min-height: 100%;
}

.hover-lift {
    transition: transform var(--usm-transition), box-shadow var(--usm-transition);
}

.hover-lift:hover,
.hover-lift:focus {
    transform: translateY(-2px);
    box-shadow: var(--usm-ring-hover), var(--usm-shadow-sm);
}

.sidebar-stack .card {
    border-radius: var(--usm-radius-lg);
}

.sidebar-stack .card-img-top {
    border-top-left-radius: var(--usm-radius-lg);
    border-top-right-radius: var(--usm-radius-lg);
}

.sidebar-stack .card-body {
    padding: 1rem;
}

.sidebar-card-title {
    font-size: .78rem;
    letter-spacing: var(--usm-tracking-wide);
    text-transform: uppercase;
    line-height: 1.2;
}

.athlete-avatar {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
}

.section-cta {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.section-cta .btn {
    width: 100%;
    max-width: 280px;
}

.btn-hero-outline {
    border-color: #212529;
    color: #212529;
}

.btn-hero-outline:hover,
.btn-hero-outline:focus {
    background-color: #212529;
    color: #ffffff;
    border-color: #212529;
}

[data-bs-theme="dark"] .btn-hero-outline {
    border-color: rgba(248, 249, 250, 0.75);
    color: rgba(248, 249, 250, 0.9);
}

[data-bs-theme="dark"] .btn-hero-outline:hover,
[data-bs-theme="dark"] .btn-hero-outline:focus {
    background-color: rgba(248, 249, 250, 0.18);
    border-color: rgba(248, 249, 250, 0.9);
    color: #ffffff;
}

/* Ensure outline-dark buttons remain legible in dark mode */
[data-bs-theme="dark"] .btn-outline-dark {
    border-color: rgba(248, 249, 250, 0.75);
    color: rgba(248, 249, 250, 0.9);
}

[data-bs-theme="dark"] .btn-outline-dark:hover,
[data-bs-theme="dark"] .btn-outline-dark:focus {
    background-color: rgba(248, 249, 250, 0.18);
    border-color: rgba(248, 249, 250, 0.9);
    color: #ffffff;
}

/* Improve outline-secondary contrast in dark mode (e.g., Browse Gallery) */
[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: rgba(248, 249, 250, 0.6);
    color: rgba(248, 249, 250, 0.9);
}

[data-bs-theme="dark"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:focus {
    background-color: rgba(248, 249, 250, 0.16);
    border-color: rgba(248, 249, 250, 0.85);
    color: #ffffff;
}

/* Subtle pagination polish for modern pages */
.pagination .page-link {
    border-radius: var(--usm-radius-sm);
}
.pagination .page-item:not(.disabled) .page-link:hover,
.pagination .page-item:not(.disabled) .page-link:focus {
    background-color: rgba(var(--refresh-primary-rgb), .08);
}
.pagination .page-item.active .page-link {
    background-color: var(--refresh-primary);
    border-color: var(--refresh-primary);
    color: var(--refresh-primary-contrast);
}

@media (min-width: 992px) {
    .refresh-hero .hero-image-col {
        padding-left: clamp(1.75rem, 3.5vw, 3rem);
    }
}

.card .text-muted {
    /* Muted text override */
    color: var(--refresh-text-muted) !important;
}

.btn-primary {
    /* Primary button base */
    --btn-bg: var(--refresh-primary);
    --btn-border: var(--refresh-primary-solid);
    --btn-color: var(--refresh-primary-contrast);
    background-color: var(--btn-bg);
    border-color: var(--btn-border);
    color: var(--btn-color);
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--refresh-primary-hover);
    border-color: var(--refresh-primary-hover);
    color: var(--refresh-primary-contrast);
}

.btn-primary:active,
.btn-primary.active,
.show>.btn-primary.dropdown-toggle {
    background-color: var(--refresh-primary-active) !important;
    border-color: var(--refresh-primary-active) !important;
    color: var(--refresh-primary-contrast) !important;
}

.btn-primary:focus-visible {
    outline: 0;
    box-shadow: var(--usm-focus-ring);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background-color: rgba(var(--refresh-primary-rgb), .12);
    color: var(--refresh-primary);
    border-color: rgba(var(--refresh-primary-rgb), .38);
}

.btn[data-press] {
    transition: transform var(--usm-transition-fast);
}

.btn[data-press]:active {
    transform: scale(.98);
}

.btn-outline-primary {
    border-width: 1px;
    color: var(--refresh-primary-solid);
    border-color: var(--refresh-primary-solid);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--refresh-primary);
    border-color: var(--refresh-primary-hover);
    color: var(--refresh-primary-contrast);
}

.btn-outline-primary:active,
.btn-outline-primary.active,
.show>.btn-outline-primary.dropdown-toggle {
    background-color: var(--refresh-primary-active) !important;
    border-color: var(--refresh-primary-active) !important;
    color: var(--refresh-primary-contrast) !important;
}

.btn-outline-dark,
.btn-outline-primary {
    /* keep outline width rule */
    border-width: 1px;
}

.badge {
    /* Badge styling */
    font-weight: 600;
    letter-spacing: 0.01em;
}

.rounded-circle {
    /* Athlete circle shadows, etc. */
    box-shadow: 0 0 0 .25rem rgba(var(--refresh-primary-rgb), .05);
}

.list-group-item {
    /* List group borders */
    border-color: var(--refresh-border-strong);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    /* List group hover states */
    background-color: var(--refresh-hover-bg);
}

.section-light {
    /* Full-width light section background */
    background-color: var(--refresh-surface-muted);
    border: none;
    border-radius: var(--usm-radius-lg);
}

.section-medium {
    /* Full-width medium section background */
    background-color: var(--refresh-surface-subtle);
    border: none;
    border-radius: var(--usm-radius-lg);
}

/* .contest-card reserved for future contest-specific styling */

footer a {
    /* Footer link styling */
    color: inherit;
    opacity: .85;
    text-decoration: none;
}

footer a:hover,
footer a:focus {
    /* Footer link interaction */
    opacity: 1;
    text-decoration: underline;
}

footer small,
footer span {
    /* Footer text overrides */
    color: var(--refresh-text-muted);
}

[data-bs-theme="dark"] footer.border-top {
    border-top-color: var(--refresh-border-soft) !important;
}

footer.bg-body {
    background-color: var(--refresh-surface) !important;
}

body.theme-dark {
    background-color: var(--bs-body-bg);
}

/* Product collage framing */
.product-collage {
    display: block;
    width: 100%;
    height: auto;
    background-color: #ffffff;
    padding: .75rem;
    border-radius: var(--usm-radius-lg);
    box-sizing: border-box;
    box-shadow: var(--usm-ring), var(--usm-shadow-xs);
}

[data-bs-theme="dark"] .product-collage {
    background-color: #ffffff;
    box-shadow: var(--usm-ring), var(--usm-shadow-sm);
}

/* Do not crop collage images (products & events). Always show full image with white padding */
.card-img-top.product-collage,
.card-img-top[src*="/assets/images/products/collages/"],
.card-img-top[src*="/assets/images/events/collages/"],
img.product-collage,
img[src*="/assets/images/products/collages/"],
img[src*="/assets/images/events/collages/"] {
    width: 100%;
    height: 100%;
    object-fit: contain !important; /* override any object-fit-cover */
    background-color: #fff; /* padding background */
}

/* Helpers used by new pages */
.object-fit-cover {
    object-fit: cover;
}

.object-fit-contain {
    object-fit: contain;
}

.gallery-thumb {
    aspect-ratio: 4/3;
    object-fit: cover;
}

/* Center align content headers and filter controls across -new layouts */
.container-xxl>header.mb-4 {
    text-align: center;
}

.container-xxl>header.mb-4.d-flex {
    justify-content: center !important;
    align-items: center;
    gap: 1rem;
}

.container-xxl>header.mb-4>* {
    text-align: center;
}

.container-xxl>form.mb-4 {
    text-align: center;
}

.container-xxl>form.mb-4 .row {
    justify-content: center;
}

.container-xxl section>.d-flex.flex-column.flex-md-row.align-items-md-center.justify-content-between {
    justify-content: center !important;
    text-align: center;
    gap: 1rem;
}

.container-xxl section>.d-flex.flex-column.flex-md-row.align-items-md-center.justify-content-between>* {
    text-align: center;
}

.container-xxl section>.d-flex.align-items-center.gap-2 {
    justify-content: center;
}

.athlete-detail .container-xxl section>.d-flex.flex-column.flex-md-row.align-items-md-center.justify-content-between {
    justify-content: space-between !important;
    text-align: left;
    gap: 1rem;
}

.athlete-detail .container-xxl section>.d-flex.flex-column.flex-md-row.align-items-md-center.justify-content-between>* {
    text-align: left;
}

.athlete-detail .container-xxl section>.d-flex.align-items-center.gap-2 {
    justify-content: flex-start;
}

.container-xxl section>.btn-group.flex-wrap,
.container-xxl section>.d-flex.flex-wrap.gap-2,
.container-xxl section>.d-flex.gap-2.mt-3 {
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

/* Cascading fade-in animation for refreshed layouts */
@keyframes refreshFadeIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-seq {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .5s var(--usm-ease), transform .5s var(--usm-ease);
    transition-delay: calc(var(--fade-index, 0) * 80ms);
}

.fade-seq.is-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {

    .fade-seq,
    .fade-seq.is-visible {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }
}

/* ---------------------------------------------- */
/* Members-specific polish and subtle distinction */
/* Applies when <html data-membership="men|women"> is present */
/* ---------------------------------------------- */

[data-membership] {
    /* Slightly boost primary contrast on members pages */
    --refresh-primary: #f44336; /* base */
    --refresh-primary-hover: #e03a30;
    --refresh-primary-active: #c92e26;
}

[data-membership] .navbar {
    /* Thin accent at the very top and a crisper shadow */
    border-top: 3px solid var(--refresh-primary-solid) !important;
    box-shadow: var(--usm-shadow-md);
}

/* Subtle background sheen for members area */
body.is-members::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(1200px 800px at 15% -10%, rgba(var(--refresh-primary-rgb), .06), transparent 55%),
                radial-gradient(1000px 700px at 110% 10%, rgba(0,0,0,.03), transparent 45%);
    z-index: 0;
}

/* Ensure main content sits above background sheen */
body.is-members main,
body.is-members .container-xxl,
body.is-members nav.navbar,
body.is-members footer {
    position: relative;
    z-index: 1;
}

/* Normalize hero badge appearance across members pages */
[data-membership] .refresh-hero .badge,
[data-membership] .badge.text-bg-danger {
    background-color: var(--refresh-primary) !important;
    color: var(--refresh-primary-contrast) !important;
    border: 0;
}

/* Hero panel subtle overlay */
[data-membership] .refresh-hero {
    background: linear-gradient(180deg, rgba(var(--refresh-primary-rgb), .06), rgba(0,0,0,0) 40%), var(--refresh-hero-bg);
}

/* Buttons in hero-outline style get a gentler hover on members pages */
[data-membership] .btn-hero-outline {
    border-color: rgba(0,0,0,.2);
}
[data-membership] .btn-hero-outline:hover,
[data-membership] .btn-hero-outline:focus {
    border-color: var(--refresh-primary);
    color: var(--refresh-primary);
    background: rgba(var(--refresh-primary-rgb), .06);
}

/* Card polish: unify radius and focus halo */
[data-membership] .card {
    border-radius: var(--usm-radius-lg);
}
[data-membership] .card:focus-within {
    box-shadow: var(--usm-focus-ring);
}

/* Badge groups on cards */
[data-membership] .card .badge.text-bg-secondary {
    background: rgba(0,0,0,.6) !important;
    color: #fff !important;
}

/* Pagination polish */
[data-membership] .pagination .page-link {
    border-radius: var(--usm-radius-sm);
}
[data-membership] .pagination .page-item.active .page-link {
    background-color: var(--refresh-primary);
    border-color: var(--refresh-primary);
}

/* Dark theme adjustments for members sheen */
[data-bs-theme="dark"][data-membership] body.is-members::before {
    background: radial-gradient(1200px 800px at 15% -10%, rgba(var(--refresh-primary-rgb), .12), transparent 55%),
                radial-gradient(1000px 700px at 110% 10%, rgba(255,255,255,.035), transparent 45%);
}

/* Consistent focus ring for interactive elements */
.card:focus-within,
.hover-lift:focus-within,
a.card:focus-visible {
    box-shadow: var(--usm-focus-ring);
    outline: none;
}

/* Category icon styles (100x100 PNGs shown at actual size) */
.cat-icon {
    width: auto;         /* show at natural width */
    height: auto;        /* show at natural height */
    max-width: none;     /* do not constrain */
    max-height: none;    /* do not constrain */
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    margin-right: .5rem;
    box-shadow: 0 0 0 1px rgba(0,0,0,.1) inset;
    display: inline-block;
    vertical-align: middle;
}
/* Remove previous downsizing rules for small buttons/dropdowns */
.btn-sm .cat-icon { width: auto; height: auto; vertical-align: middle; }
.dropdown-item .cat-icon { width: auto; height: auto; margin-right: .5rem; vertical-align: middle; }

/* Category badge (rectangular) for legacy button PNGs */
.cat-badge { height: 18px; width: auto; margin-right: .5rem; vertical-align: -3px; }
.btn-sm .cat-badge { height: 16px; vertical-align: -2px; }
.dropdown-item .cat-badge { height: 16px; margin-right: .5rem; vertical-align: -2px; }

/* Prominent category button using photo icon (decorative) */
.btn-cat {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    border-radius: 999px;
    padding: .5rem .9rem;
}
.btn-cat .cat-icon {
    width: clamp(64px, 10vw, 100px);
    height: clamp(64px, 10vw, 100px);
}
.btn-cat span { font-weight: 600; }

/* Ensure members header menus sit above everything */
:root { --bs-dropdown-zindex: 2150; }
.navbar { z-index: 2200 !important; }
.navbar .dropdown-menu { z-index: 2250 !important; }

/* Collection Detail – streamlined hero */
.collection-hero .collage-frame { background: transparent; border-right:1px solid var(--refresh-border-strong); }
.collection-hero .product-collage { width:100%; height:100%; object-fit:contain; /* background inherited from global collage rule */ }

/* =========================================================================
   Mobile Responsive Overhaul
   ========================================================================= */

/* --- Tablet (≤991.98px) — stacking, touch-friendly spacing --- */
@media (max-width: 991.98px) {
    /* Navbar: ensure collapsed menu has comfortable touch targets */
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .navbar-nav .dropdown-menu {
        border: none;
        box-shadow: none;
        padding-left: 1rem;
    }

    .dropdown-menu .dropdown-item {
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }

    /* Hero: stack columns, reduce padding */
    .refresh-hero .row.g-0 {
        flex-direction: column;
    }

    .refresh-hero .hero-image-col {
        max-height: 280px;
        overflow: hidden;
    }

    .refresh-hero .p-4.p-md-5 {
        padding: 1.5rem !important;
    }

    /* Stat deck: allow wrapping on tablets */
    .luxe-stat-deck {
        gap: 0.75rem;
    }

    .luxe-stat {
        min-width: 110px;
        padding: 0.7rem 1rem;
    }

    /* Containers: tighten horizontal gutter */
    .container-xxl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* --- Mobile landscape / large phones (≤767.98px) --- */
@media (max-width: 767.98px) {
    /* Hero: even tighter on phones */
    .refresh-hero .p-4.p-md-5 {
        padding: 1.25rem !important;
    }

    .refresh-hero h1.display-6 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    .refresh-hero .lead {
        font-size: 0.95rem;
    }

    .refresh-hero .hero-image-col {
        max-height: 220px;
    }

    /* Buttons: ensure touch-friendly minimum height */
    .btn {
        min-height: 44px;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .btn-sm {
        min-height: 36px;
    }

    .btn-lg {
        min-height: 48px;
        font-size: 1rem;
    }

    /* Section panels: reduce padding */
    .section-panel {
        padding: clamp(1rem, 3vw, 1.5rem);
    }

    /* Contest/event cards */
    .card .card-body.py-3 {
        padding: 0.75rem !important;
    }

    /* Stat deck: compact on phones */
    .luxe-stat-deck {
        gap: 0.5rem;
    }

    .luxe-stat {
        min-width: 0;
        flex: 1 1 calc(50% - 0.5rem);
        padding: 0.6rem 0.75rem;
    }

    .luxe-stat .value {
        font-size: 1.05rem;
    }

    .luxe-stat .label {
        font-size: 0.65rem;
    }

    /* Footer: stack and center */
    footer .row {
        text-align: center;
    }

    footer .col-md {
        text-align: center !important;
    }

    footer .d-flex.justify-content-md-end {
        justify-content: center !important;
    }

    /* Sidebar columns hidden on mobile via d-none d-lg-block — ensure
       main column takes full width */
    main.col-12 {
        padding-left: 0;
        padding-right: 0;
    }
}

/* --- Small phones (≤575.98px) — most aggressive optimization --- */
@media (max-width: 575.98px) {
    /* Navbar brand logo: slightly smaller */
    .navbar-brand .brand-logo {
        width: 130px;
        height: 30px;
    }

    /* Navbar: tighter vertical padding */
    .navbar {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    /* Top offset for main content (matches smaller navbar) */
    .container-xxl.mt-5.pt-5 {
        margin-top: 1rem !important;
        padding-top: 3.25rem !important;
    }

    /* Hero section */
    .refresh-hero h1.display-6 {
        font-size: 1.35rem;
        line-height: 1.2;
    }

    .refresh-hero .lead {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .refresh-hero .hero-image-col {
        max-height: 180px;
    }

    .refresh-hero .d-flex.flex-wrap.gap-2 {
        flex-direction: column;
    }

    .refresh-hero .d-flex.flex-wrap.gap-2 .btn {
        width: 100%;
    }

    /* Section headings */
    .h3.fw-bold {
        font-size: 1.15rem;
    }

    .h4.fw-bold {
        font-size: 1.05rem;
    }

    /* Section panels */
    .section-panel {
        padding: 1rem;
        border-radius: var(--usm-radius-lg);
    }

    /* Category filter pills: full-width wrap */
    .d-inline-flex.flex-wrap.justify-content-center.gap-2 {
        gap: 0.35rem;
    }

    .d-inline-flex.flex-wrap.justify-content-center.gap-2 .btn-sm {
        font-size: 0.72rem;
        padding: 0.35rem 0.65rem;
    }

    /* Product cards: 2-column stays, tighter gap */
    .row.row-cols-2.g-4 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }

    .row.row-cols-2 .card-body {
        padding: 0.75rem;
    }

    .row.row-cols-2 .card-text.fw-semibold {
        font-size: 0.85rem;
    }

    .row.row-cols-2 .section-subtitle {
        font-size: 0.72rem;
    }

    /* Event cards: single column */
    .row.row-cols-1.row-cols-md-2.g-3 {
        --bs-gutter-y: 0.5rem;
    }

    /* Badge groups on event cards */
    .d-flex.flex-wrap.gap-2.align-items-center.mt-3.small {
        gap: 0.35rem !important;
    }

    .d-flex.flex-wrap.gap-2 .badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.45rem;
    }

    /* Athletes scroller (mobile-only component) */
    .d-flex.gap-3.overflow-auto.pb-2 {
        gap: 0.75rem !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
    }

    .d-flex.gap-3.overflow-auto.pb-2::-webkit-scrollbar {
        display: none;
    }

    /* CTA buttons */
    .section-cta .btn {
        max-width: 100%;
    }

    .d-grid .btn-lg {
        font-size: 0.95rem;
    }

    /* Athlete avatar sizing in featured-athletes component */
    .athlete-avatar {
        width: 72px;
        height: 72px;
    }

    /* Pagination: touch-friendly */
    .pagination .page-link {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* --- Very small screens (≤400px) — edge case protection --- */
@media (max-width: 400px) {
    .container-xxl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Force single column for product cards at very narrow widths */
    .row.row-cols-2 {
        --bs-gutter-x: 0.5rem;
    }

    .refresh-hero h1.display-6 {
        font-size: 1.2rem;
    }

    .luxe-stat {
        flex: 1 1 100%;
    }
}

/* --- Touch interaction improvements (all mobile) --- */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover-only effects that cause sticky state on touch */
    .hover-lift:hover {
        transform: none;
        box-shadow: var(--usm-ring), var(--usm-shadow-sm);
    }

    .card.shadow-sm:hover,
    .card.border-0:hover {
        transform: none;
    }

    /* Active state feedback instead of hover for touch */
    .hover-lift:active {
        transform: scale(0.98);
        transition-duration: 0.1s;
    }

    .card.shadow-sm:active,
    .card.border-0:active {
        transform: scale(0.98);
        transition-duration: 0.1s;
    }

    /* Dropdown items: remove translateX hover (causes jank on touch) */
    .dropdown-menu .dropdown-item:hover,
    .dropdown-menu .dropdown-item:focus {
        transform: none;
    }
}

/* =========================================================================
   Announcement Bar
   ========================================================================= */

.usm-announce-container {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    width: 100%; /* explicit width prevents drift from left/right combo */
    z-index: 2100;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* prevent announcement content from causing scroll drift */
}

.usm-announce {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    max-height: 80px;
}

.usm-announce__body {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0.25rem;
}

.usm-announce__link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.usm-announce__link:hover {
    opacity: 0.85;
}

.usm-announce__close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.usm-announce__close:hover {
    opacity: 1;
}

/* Type variants */
.usm-announce--sale {
    background: var(--refresh-primary-solid, #f44336);
    color: #fff;
}

.usm-announce--alert {
    background: #f59e0b;
    color: #1a1a1a;
}

.usm-announce--info {
    background: rgba(59, 130, 246, 0.9);
    color: #fff;
}

/* Content spacing offset when announcements are visible */
body {
    --usm-announce-offset: 0px;
}

@media (max-width: 575.98px) {
    .usm-announce {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    .usm-announce-container {
        top: 48px; /* matches smaller navbar height */
    }
    .usm-announce__body {
        flex-wrap: wrap;
    }
    .usm-announce__link {
        white-space: normal; /* allow wrapping on very narrow screens */
        margin-left: 0;
    }
}
