/* ============================================
   LTF CT LIVE — ATHLETE / EVENT DISPLAY STYLES
   Ported from ltf-webscorer-results/assets/css/ltf-ws-frontend.css
   (ATHLETES ARCHIVE GRID section only).

   Scope note: the results-table / podium / standings / year-tab / series-tab
   / countdown styles from the donor are intentionally NOT ported here — the
   live results layer (leaderboard + splits) already owns those classes in
   assets/css/ltf-ct-live.css. Porting them would collide. This file styles
   only the athlete CPT display layer (grid, cards, filter bar, atomic fields).

   Theming:
   - SURFACE COLORS consume the SAME --ltf-ct-* tokens the leaderboard uses
     (see LTF_CT_Style::inline_css_vars), with the donor defaults as fallbacks,
     so one Styling panel themes grid + profile + leaderboard together.
   - LAYOUT tokens (spacing, radius, font) use a distinct ctlive prefix so
     they never collide with the leaderboard's own ltf-ct-space and radius
     root values. Font family inherits the site (Total theme) typography.
   ============================================ */

:root {
    /* Typography — inherit Leadville's Total theme fonts (kills generic-font drift) */
    --ctlive-font: inherit;

    /* Spacing — athlete-layer layout defaults (not themed by the Styling panel) */
    --ctlive-space-xs: 8px;
    --ctlive-space-sm: 12px;
    --ctlive-space-md: 20px;
    --ctlive-space-lg: 30px;
    --ctlive-space-xl: 40px;

    /* Borders & sizing */
    --ctlive-radius: 8px;
    --ctlive-text-size: 16px;
}

/* ============================================
   ATHLETES ARCHIVE GRID
   ============================================ */

/* Archive container */
.ctlive-athletes-archive {
    font-family: var(--ctlive-font);
}

/* Filter Bar */
.ctlive-filter-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ctlive-space-sm);
    margin-bottom: var(--ctlive-space-xl);
}

.ctlive-filter-bar__search-wrap {
    width: 100%;
    max-width: 400px;
    margin-bottom: var(--ctlive-space-sm);
}

.ctlive-filter-bar__search {
    width: 100%;
    padding: var(--ctlive-space-sm) var(--ctlive-space-md);
    font-size: 15px;
    font-family: var(--ctlive-font);
    color: var(--ltf-ct-text, #333333);
    background: var(--ltf-ct-row-bg, #ffffff);
    border: 2px solid var(--ltf-ct-border, #e0e0e0);
    border-radius: var(--ctlive-radius);
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.ctlive-filter-bar__search:focus {
    border-color: var(--ltf-ct-primary, #e31e24);
}

.ctlive-filter-bar__search::placeholder {
    color: var(--ltf-ct-text-light, #666666);
}

/* Filter tab row */
.ctlive-filter-bar__tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--ctlive-space-sm);
}

/* Tab buttons — unified with all other filter buttons */
.ctlive-filter-bar .ctlive-tabs__btn,
button.ctlive-tabs__btn[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--ctlive-font);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ltf-ct-text, #333333);
    background: var(--ltf-ct-row-bg, #ffffff);
    border: 2px solid var(--ltf-ct-border, #e0e0e0);
    border-radius: var(--ctlive-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.ctlive-filter-bar .ctlive-tabs__btn:hover,
button.ctlive-tabs__btn[type="button"]:hover {
    border-color: var(--ltf-ct-primary, #e31e24);
    color: var(--ltf-ct-primary, #e31e24);
}

.ctlive-filter-bar .ctlive-tabs__btn--active,
button.ctlive-tabs__btn--active[type="button"] {
    background: var(--ltf-ct-primary, #e31e24);
    border-color: var(--ltf-ct-primary, #e31e24);
    color: var(--ltf-ct-header-text, #ffffff);
}

.ctlive-filter-bar .ctlive-tabs__btn--active:hover,
button.ctlive-tabs__btn--active[type="button"]:hover {
    background: var(--ltf-ct-primary, #e31e24);
    border-color: var(--ltf-ct-primary, #e31e24);
    color: var(--ltf-ct-header-text, #ffffff);
    opacity: 0.9;
}

/* Athletes Grid */
.ctlive-athletes-grid {
    display: grid;
    /* Column count is authoritative (set by the shortcode `columns` attr → --cols-N
       class below); defaults to 4. Collapses responsively in the media queries. */
    grid-template-columns: repeat(4, 1fr);
    gap: var(--ctlive-space-md, 20px);
}

.ctlive-athletes-grid--cols-1 { grid-template-columns: 1fr; }
.ctlive-athletes-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.ctlive-athletes-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.ctlive-athletes-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
.ctlive-athletes-grid--cols-5 { grid-template-columns: repeat(5, 1fr); }
.ctlive-athletes-grid--cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Athlete Card */
.athlete-card {
    position: relative;
    border-radius: var(--ctlive-radius);
    overflow: hidden;
    border: 2px solid transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.4s ease;
    /* Animation: start hidden, JS adds visible class */
    opacity: 0;
}

/* ---- Animation Variants (initial state) ---- */
.ctlive-athletes-grid--anim-fade-up .athlete-card {
    transform: translateY(20px);
}
.ctlive-athletes-grid--anim-fade-in .athlete-card {
    transform: none;
}
.ctlive-athletes-grid--anim-slide-left .athlete-card {
    transform: translateX(-40px);
}
.ctlive-athletes-grid--anim-slide-right .athlete-card {
    transform: translateX(40px);
}
.ctlive-athletes-grid--anim-scale-up .athlete-card {
    transform: scale(0.85);
}

/* ---- Visible state (applied by JS) ---- */
.athlete-card--visible {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
    transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.4s ease;
}

/* ---- No animation fallback ---- */
.ctlive-athletes-grid--anim-none .athlete-card {
    opacity: 1;
    transform: none;
}

.athlete-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px #00000040;
    border-color: #ffffff80;
}

.athlete-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.athlete-card__image-wrapper {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: var(--ltf-ct-header-bg, #1a1a28);
}

.athlete-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.athlete-card:hover .athlete-card__image {
    transform: scale(1.05);
}

.athlete-card__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--ltf-ct-header-bg, #1a1a28) 0%, #1e1e2acc 100%);
}

.athlete-card__gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(to top, #000000d9 0%, #00000066 40%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.athlete-card__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--ctlive-space-md);
    z-index: 2;
}

.athlete-card__flag {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 4px;
}

.athlete-card__name {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 1px 3px #00000080;
}

/* No results */
.ctlive-no-results {
    text-align: center;
    padding: var(--ctlive-space-xl) var(--ctlive-space-md);
    color: var(--ltf-ct-text-light, #666666);
    font-size: var(--ctlive-text-size);
    font-style: italic;
}

/* Athletes Grid Responsive — collapse the authoritative columns at breakpoints
   (these later rules override any --cols-N by source order at equal specificity). */
@media screen and (max-width: 1024px) {
    .ctlive-athletes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .ctlive-athletes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--ctlive-space-sm, 12px);
    }

    .ctlive-filter-bar__tabs {
        gap: var(--ctlive-space-xs, 8px);
    }

    .ctlive-filter-bar .ctlive-tabs__btn,
    button.ctlive-tabs__btn[type="button"] {
        padding: 6px 10px;
        font-size: 12px;
        min-width: auto;
        letter-spacing: 0.03em;
    }

    .athlete-card__name {
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .ctlive-athletes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   TEMPLATED SINGLE (athlete / event)
   ============================================ */

/* When the plugin renders a WPBakery template on an athlete/event single, hide
   Total's default entry title + meta (date/author) — the template renders the
   name itself. The featured image is already hidden via wpex_post_media_position.
   Scoped to the marker body class so unassigning the template restores defaults. */
.ctlive-templated-single .single-header,
.ctlive-templated-single .single-header + .meta {
    display: none;
}

/* ============================================
   EVENT SINGLE (profile)
   Net-new styles: the donor (ltf-webscorer-results) emitted these classes from
   its event shortcodes but never styled them in its own CSS — LTGP relied on the
   theme/Elementor. Themed here via the shared --ltf-ct-* tokens so the Styling
   panel controls the colors alongside the leaderboard.
   ============================================ */

.ctlive-event-profile {
    font-family: var(--ctlive-font);
}

/* Centered hero column (event name + info + CTAs) */
.ctlive-event-hero {
    text-align: center;
}

.ctlive-event-name {
    font-family: var(--ctlive-font);
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.1;
    color: var(--ltf-ct-text, #1a1a28);
    margin: 0 0 var(--ctlive-space-sm);
}

/* Inline date · location · distance line */
.ctlive-event-info {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--ctlive-space-xs);
    font-size: 17px;
    color: var(--ltf-ct-text-light, #666666);
}

.ctlive-event-info__sep {
    opacity: 0.5;
}

.ctlive-event-hero__meta {
    margin-bottom: var(--ctlive-space-md);
}

.ctlive-event-number {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ltf-ct-primary, #c2a14d);
}

/* CTA buttons ([ctlive_event_links]) */
.ctlive-btn {
    display: inline-block;
    margin: var(--ctlive-space-xs) var(--ctlive-space-xs) 0 var(--ctlive-space-xs);
    padding: 14px 32px;
    font-family: var(--ctlive-font);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    color: var(--ltf-ct-header-text, #ffffff);
    background: var(--ltf-ct-primary, #c2a14d);
    border: 2px solid var(--ltf-ct-primary, #c2a14d);
    border-radius: var(--ctlive-radius);
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.ctlive-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.ctlive-btn--lg {
    padding: 16px 38px;
    font-size: 16px;
}

.ctlive-btn--outline {
    color: var(--ltf-ct-primary, #c2a14d);
    background: transparent;
}

.ctlive-btn--outline:hover {
    color: var(--ltf-ct-header-text, #ffffff);
    background: var(--ltf-ct-primary, #c2a14d);
    opacity: 1;
}

