/**
 * GMG Geo Events — front-end styles
 * Themed to Hot Wheels Monster Trucks Live (red #e4002b, yellow #f5c800,
 * dark surfaces). Covers the hero overlay card, the "nearby events" grid,
 * and the archive distance-sort banner.
 */

/* ─────────────────────────────────────────────────────────────
   Task 2 — Hero overlay card
   ───────────────────────────────────────────────────────────── */

/* Anchor the absolutely-positioned overlay to the hero section. */
#callouts { position: relative; }

.gmg-hero-overlay {
    position: absolute;
    top: clamp(16px, 3vw, 40px);
    left: clamp(16px, 3vw, 48px);
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(440px, 44%);
    /* Reserve vertical space so hydration (text swap) causes no shift. */
    min-height: 168px;
    pointer-events: none; /* let clicks pass to the video except on the card */
}
.gmg-hero-overlay > * { pointer-events: auto; }

.gmg-hero-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #f5c800;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.gmg-hero-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gmg-hero-card {
    background: rgba(12, 12, 12, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-top: 4px solid #e4002b;
    border-radius: 8px;
    padding: 16px 18px;
    color: #f0f0f0;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}
@supports not (backdrop-filter: blur(4px)) {
    .gmg-hero-card { background: rgba(12, 12, 12, 0.92); }
}

.gmg-hero-card--secondary {
    margin-left: clamp(16px, 6%, 40px);
    padding: 12px 16px;
    border-top-width: 3px;
    opacity: 0.96;
}

.gmg-hero-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.gmg-hero-city {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.05;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}
.gmg-hero-card--secondary .gmg-hero-city { font-size: 18px; }

.gmg-hero-distance {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0px;
    text-transform: uppercase;
    color: #000;
    background: #e4002b;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
	background-color: var(--green);
}

.gmg-hero-dates {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 700;
    color: #f5c800;
}
.gmg-hero-card--secondary .gmg-hero-dates { font-size: 12px; }

.gmg-hero-venue {
    margin-top: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}
.gmg-hero-address {
    margin-top: 2px;
    font-size: 12px;
    color: #b3b3b3;
    line-height: 1.35;
}

.gmg-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.gmg-hero-card--secondary .gmg-hero-actions { margin-top: 10px; }

.gmg-hero-btn {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 8px 14px;
    border-radius: 4px;
    text-decoration: none;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.gmg-hero-btn--tickets { background: #e4002b; color: #fff; }
.gmg-hero-btn--tickets:hover { background: #c40025; color: #fff; }
.gmg-hero-btn--info {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.45);
}
.gmg-hero-btn--info:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* The [hidden] attribute must beat the display rules above. The UA sheet's
   `[hidden] { display: none }` loses to any author `display`, and these
   elements are also flex/grid items (which blockifies them), so without this
   a ticketless event still renders a Buy Tickets button, and the hydration
   JS's `el.hidden = true` calls silently do nothing. */
.gmg-hero-btn[hidden],
.gmg-hero-distance[hidden],
.gmg-hero-eyebrow[hidden],
.gmg-hero-card[hidden] { display: none !important; }

/* Mobile: drop the overlay out of the hero and let it flow beneath it.
   Rendered server-side, so this reserves its own space — no layout shift. */
@media (max-width: 767.98px) {
    .gmg-hero-overlay {
        position: static;
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 14px clamp(12px, 4vw, 20px) 18px;
        background: #0d0d0d;
    }
    .gmg-hero-card--secondary { margin-left: 0; }
}

/* ─────────────────────────────────────────────────────────────
   Task 3 — Nearby events grid
   ───────────────────────────────────────────────────────────── */

.gmg-nearby-events-widget { position: relative; }

.gmg-nearby-label-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px 16px;
	margin-top: -20px;
	margin-bottom: 25px;
}

.gmg-nearby-locmark {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #e4002b;
}

.gmg-nearby-cards-grid .gmg-event-card-wrap { display: block; }

/* Distance chip injected onto a card when show_distance="true". */
.gmg-card-distance {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
    background: #e4002b;
    padding: 4px 9px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* ─────────────────────────────────────────────────────────────
   Task 4 — Archive distance-sort banner
   ───────────────────────────────────────────────────────────── */

.gmg-archive-sort-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 0 0 20px;
    padding: 10px 16px;
    background: rgba(228, 0, 43, 0.10);
    border: 1px solid rgba(228, 0, 43, 0.35);
    border-radius: 6px;
    font-size: 13px;
    color: #f0f0f0;
}
.gmg-archive-sort-banner .gmg-archive-sort-icon { color: #e4002b; }
.gmg-archive-sort-banner strong { color: #fff; }
.gmg-archive-sort-toggle {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #f5c800;
    text-decoration: none;
    white-space: nowrap;
}
.gmg-archive-sort-toggle:hover { color: #fff; text-decoration: underline; }

/* .gmg-hero-rail: wraps .gmg-hero-overlay (see gmg_shortcode_hero_event() in
   the plugin). display:contents makes the wrapper have no effect on layout
   or on the absolute-positioning containing-block chain, so .gmg-hero-overlay
   continues to position itself exactly as it did before this wrapper existed
   (its own `top: min(...)` calc below already parks it near the viewport
   bottom). If .gmg-hero-rail is meant to become a true sticky track spanning
   the hero, that needs the surrounding #callouts/hero markup and CSS to do
   correctly — flagging rather than guessing at that layout. */
.gmg-hero-rail { display: contents; }

/* ─────────────────────────────────────────────────────────────
   Hero overlay — desktop/tablet wide bar (>= 768px)
   ─────────────────────────────────────────────────────────────
   Restyles the same DOM the mobile card uses into a full-width bar
   pinned near the bottom of the viewport. No markup changes, so the
   hydration JS keeps finding .gmg-hero-card / .gmg-hero-city / etc.

   --gmg-hero-header is the site header's height. The overlay's
   containing block (#callouts) starts *below* the sticky header, so
   that height has to be subtracted to land the bar on the viewport
   bottom. Overestimating is the safe direction — it sits slightly
   higher, still above the fold. Tune here if the header changes.
   ───────────────────────────────────────────────────────────── */

@media (min-width: 768px) {

    .gmg-hero-overlay {
        --gmg-hero-header: 124px;
        --gmg-hero-gap:    clamp(14px, 3vh, 34px);
        --gmg-hero-pad-x:  clamp(16px, 2vw, 30px);

        /* Sit on the viewport bottom, but never below the hero's own
           bottom edge — min() picks whichever is higher up the page.
           translateY(-100%) makes `top` behave as the bar's bottom edge,
           so its height never has to be known. */
        top: min(
            calc(100vh - var(--gmg-hero-header) - var(--gmg-hero-gap)),
            calc(100%  - var(--gmg-hero-gap))
        );
        left: 50%;
        transform: translate(-50%, -100%);

        width: 90%;
        max-width: 1720px;
        min-height: 0;
        display: block;
        gap: 0;

        /* The overlay itself is now the bar surface. */
        padding: 38px var(--gmg-hero-pad-x) 16px;
        background: rgba(10, 10, 10, 0.86);
        border-top: 4px solid #e4002b;
        border-radius: 3px;
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(5px);
        pointer-events: auto;
    }
    @supports not (backdrop-filter: blur(5px)) {
        .gmg-hero-overlay { background: rgba(10, 10, 10, 0.94); }
    }

    /* Top strip: eyebrow left, distance pill right. Both are absolutely
       placed and the 38px padding-top reserves their row, so revealing
       them at hydration shifts nothing. */
    .gmg-hero-overlay .gmg-hero-eyebrow {
        position: absolute;
        top: 13px;
        left: var(--gmg-hero-pad-x);
        margin: 0;
        font-size: 12px;
        letter-spacing: 2.5px;
    }
    .gmg-hero-overlay .gmg-hero-distance {
        position: absolute;
        top: 10px;
        right: var(--gmg-hero-pad-x);
        font-size: 12px;
        padding: 4px 11px;
    }

    /* Card is just a layout grid now — the overlay carries the surface. */
    .gmg-hero-stack { gap: 0; }

    .gmg-hero-overlay .gmg-hero-card {
        background: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        backdrop-filter: none;
        padding: 0;
        margin: 0;
    }

    .gmg-hero-card--primary {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
        grid-template-areas:
            "city    venue"
            "dates   address"
            "actions actions";
        column-gap: clamp(18px, 3vw, 52px);
        row-gap: 2px;
    }

    .gmg-hero-card--primary .gmg-hero-card__head {
        grid-area: city;
        display: block;
    }
    .gmg-hero-card--primary .gmg-hero-dates   { grid-area: dates;   margin-top: 3px; }
    .gmg-hero-card--primary .gmg-hero-venue   { grid-area: venue;   margin-top: 0; align-self: end; }
    .gmg-hero-card--primary .gmg-hero-address { grid-area: address; align-self: start; }
    .gmg-hero-card--primary .gmg-hero-actions { grid-area: actions; margin-top: 14px; }

    .gmg-hero-overlay .gmg-hero-city {
        font-size: clamp(24px, 2.3vw, 38px);
        line-height: 1;
        letter-spacing: 0.5px;
    }
    .gmg-hero-overlay .gmg-hero-dates   { font-size: clamp(14px, 1.05vw, 18px); }
    .gmg-hero-overlay .gmg-hero-venue   { font-size: clamp(15px, 1.1vw, 19px); }
    .gmg-hero-overlay .gmg-hero-address { font-size: clamp(12px, 0.9vw, 15px); }
    .gmg-hero-overlay .gmg-hero-btn     { font-size: 13px; padding: 10px 18px; }

    /* Only ever one event in the bar. If count=2 is ever passed, the
       secondary would stack awkwardly inside the bar — hide it here
       rather than let it break the layout. */
    .gmg-hero-overlay .gmg-hero-card--secondary { display: none; }
}

/* Wide enough for the actions to move into their own right-hand column. */
@media (min-width: 1100px) {
    .gmg-hero-card--primary {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
        grid-template-areas:
            "city  venue   actions"
            "dates address actions";
    }
    .gmg-hero-card--primary .gmg-hero-actions {
        margin-top: 0;
        align-self: center;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }
}
@media (min-width: 1201px) {
	 .gmg-hero-overlay {
		padding: 50px calc(var(--gmg-hero-pad-x) + 20px) 36px;
	  }
	.gmg-hero-overlay .gmg-hero-eyebrow {
		left: calc(var(--gmg-hero-pad-x) + 20px);
		top:18px;
	}
	.gmg-hero-overlay .gmg-hero-distance {
		right:  calc(var(--gmg-hero-pad-x) + 20px);
		top:18px;
	}
	.gmg-hero-overlay {
		--gmg-hero-gap: clamp(34px, 5vh, 54px);
		top: min( calc(100vh - var(--gmg-hero-header) - var(--gmg-hero-gap)), calc(100% - var(--gmg-hero-gap)) );
	}
	
	.gmg-hero-overlay .gmg-hero-eyebrow {
		font-size: 16px;
		font-weight: 700;
	}
	.gmg-hero-overlay .gmg-hero-distance {
		font-size: 16px;
		font-weight: 700;
	}
	.gmg-hero-overlay .gmg-hero-dates {
		font-size: 16px;
		font-weight: 700;
	}
	.gmg-hero-overlay .gmg-hero-venue {
		font-size: 22px;
		font-weight: 700;
	}
	.gmg-hero-overlay .gmg-hero-address {
		font-size: 21px;
	}
	.gmg-hero-card--primary .gmg-hero-venue {
		align-self: center;
	}
	.gmg-hero-overlay .gmg-hero-address {
		margin-top: 0;
	}
	.gmg-hero-overlay .gmg-hero-btn {
		font-size: 20px;
	}
}