/* ============================================================
   AE Video Section Widget — CSS
   Exact match to original theme.css values
   ============================================================ */

.ae-video-section {
    width: 100%;
    background-color: #fff;
    overflow: hidden;
    position: relative;
    padding: 8rem 0 1rem;
}

.ae-video-container {
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 16:9 wrapper — max-height 640px */
.ae-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 640px;
    overflow: hidden;
    border-radius: 0;
    background: #111;
}

/* Video element */
.ae-video-el {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ── Play/Pause button ───────────────────────────────── */
.ae-video-btn {
    position: absolute;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 12px 12px;
    border-radius: 4px;
    background-color: rgba(20, 20, 20, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    color: #ffffff;
    font-family: Montserrat, sans-serif;
    font-size: 0.8125rem;          /* 13px */
    font-weight: 600;
    letter-spacing: 0.04em;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background-color 0.2s ease, border-color 0.2s ease,
                opacity 0.25s ease, transform 0.25s ease;
    user-select: none;
    /* Visible by default (original fades in via JS — we start visible) */
    opacity: 1;
    transform: translateY(0);
}

.ae-video-btn:hover {
    background-color: rgba(30, 30, 30, 0.92);
    border-color: rgba(255, 255, 255, 0.35);
}

.ae-video-btn:active {
    transform: scale(0.97);
}

/* Button positions */
.ae-video-btn--bottom-left {
    bottom: 20px;
    left: 20px;
}

.ae-video-btn--bottom-right {
    bottom: 20px;
    right: 20px;
}

.ae-video-btn--bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.ae-video-btn--bottom-center:hover {
    transform: translateX(-50%);
}

/* Icons */
.ae-video-icon {
    flex-shrink: 0;
    display: block;
}

.ae-video-label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* ── Progress bar ──────────────────────────────────── */
.ae-video-progress {
    display: block;
    width: 60px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.ae-video-progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    background-color: #e8192c;
    border-radius: 2px;
    transition: width 0.25s linear;
}

/* ── Placeholder (no video uploaded yet) ───────────── */
.ae-video-placeholder {
    width: 100%;
    height: 100%;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
}

.ae-video-placeholder p {
    color: rgba(255, 255, 255, 0.5);
    font-family: Montserrat, sans-serif;
    font-size: 14px;
    margin: 0;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1023px) {
    .ae-video-section {
        padding: 4rem 0 1rem;
    }
}

@media (max-width: 767px) {
    .ae-video-section {
        padding: 2rem 0 0.5rem;
    }
    .ae-video-container {
        padding: 0 1rem;
    }
    .ae-video-btn {
        padding: 6px 12px 10px 10px;
        font-size: 12px;
    }
    .ae-video-progress {
        width: 40px;
    }
}

/* ══════════════════════════════════════════════════════════
   IFRAME (YouTube / Vimeo)
   ══════════════════════════════════════════════════════════ */

.ae-video-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #000;
}

/* Make wrapper relative + sized for iframe */
.ae-video-wrapper {
    position: relative;
}

/* ── Placeholder enhancements ────────────────────────── */
.ae-video-placeholder {
    flex-direction: column;
    gap: 12px;
}

.ae-video-placeholder-icon {
    font-size: 48px;
    line-height: 1;
    display: block;
}

.ae-video-placeholder p {
    text-align: center;
    max-width: 280px;
}

/* ══════════════════════════════════════════════════════════
   HOVER-ONLY CONTROLS
   Button hidden by default, visible on wrapper hover
   Smooth fade + slight upward slide — same feel as original
   ══════════════════════════════════════════════════════════ */

/* Hide the button initially */
.ae-video-btn[data-hover-only="yes"] {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition:
        opacity    0.28s ease,
        transform  0.28s ease;
}

/* Show on wrapper hover */
.ae-video-wrapper:hover .ae-video-btn[data-hover-only="yes"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Keep visible while video is paused so user can click Play */
.ae-video-wrapper.ae-video-paused .ae-video-btn[data-hover-only="yes"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Touch devices: always show (no hover state) */
@media (hover: none) {
    .ae-video-btn[data-hover-only="yes"] {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
}

/* ══════════════════════════════════════════════════════════
   VIDEO HEADING BLOCK
   Sub-heading + Heading + Content — above or below video
   ══════════════════════════════════════════════════════════ */
.ae-vid-heading-block {
    width: 100%;
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 1.5rem 2.5rem;
    box-sizing: border-box;
    text-align: center;
}

.ae-vid-subheading {
    display: block;
    font-family: Montserrat, sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #e8192c;
    margin-bottom: 10px;
}

.ae-vid-heading {
    font-family: Lato, sans-serif;
    font-size: clamp(22px, 4vw, 36px);
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.25;
    margin: 0 0 14px;
}

.ae-vid-content {
    font-family: Montserrat, sans-serif;
    font-size: clamp(14px, 2vw, 16px);
    color: #666666;
    line-height: 1.6;
    max-width: 680px;
    margin: 0 auto;
}

/* Bottom position: padding goes on top, not bottom */
.ae-video-section .ae-vid-heading-block:last-child {
    padding-top: 2.5rem;
    padding-bottom: 0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1023px) {
    .ae-vid-heading-block { padding: 0 1.25rem 2rem; }
}
@media (max-width: 767px) {
    .ae-vid-heading-block { padding: 0 1rem 1.5rem; }
    .ae-vid-heading { font-size: clamp(20px, 5.5vw, 28px); }
    .ae-vid-content { font-size: 14px; }
}
@media (max-width: 479px) {
    .ae-vid-heading-block { padding: 0 0.75rem 1.25rem; }
    .ae-vid-heading { font-size: 20px; }
}

/* ══════════════════════════════════════════════════════════
   VIDEO OVERLAY
   Text content overlaid directly on the video
   Positions: top / middle / bottom
   Alignments: left / center / right
   ══════════════════════════════════════════════════════════ */

.ae-vid-overlay {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    padding: 32px 40px;
    box-sizing: border-box;
    pointer-events: none; /* let clicks through to video */
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

/* ── Vertical positions ──────────────────────────────────── */
.ae-vid-overlay--top {
    top: 0;
    bottom: auto;
    /* Fade from top */
    background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 100%);
}

.ae-vid-overlay--middle {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    background: transparent;
}

.ae-vid-overlay--bottom {
    bottom: 0;
    top: auto;
    /* Fade from bottom */
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%);
}

/* ── Inner: stacks items in chosen alignment ─────────────── */
.ae-vid-overlay-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: var(--ov-align-items, flex-start);
    max-width: 680px;
    pointer-events: auto; /* re-enable for button clicks */
}

/* Horizontal alignment — inner block position */
.ae-vid-overlay--left   .ae-vid-overlay-inner { margin-right: auto; }
.ae-vid-overlay--center .ae-vid-overlay-inner { margin: 0 auto; }
.ae-vid-overlay--right  .ae-vid-overlay-inner { margin-left: auto; }

/* ── Sub-heading ──────────────────────────────────────────── */
.ae-vid-overlay-sub {
    display: inline-block;
    font-family: Montserrat, sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #e8192c;
    background: rgba(255, 255, 255, 0.92);
    padding: 4px 10px;
    border-radius: 3px;
    line-height: 1.4;
}

/* ── Heading ─────────────────────────────────────────────── */
.ae-vid-overlay-heading {
    font-family: Lato, sans-serif;
    font-size: clamp(24px, 4vw, 48px);
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

/* ── Content ─────────────────────────────────────────────── */
.ae-vid-overlay-content {
    font-family: Montserrat, sans-serif;
    font-size: clamp(14px, 1.8vw, 16px);
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.65;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    max-width: 520px;
}

/* ── Button ──────────────────────────────────────────────── */
.ae-vid-overlay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background-color: #e8192c;
    color: #ffffff;
    font-family: Montserrat, sans-serif;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.22s ease, transform 0.18s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 16px rgba(232, 25, 44, 0.35);
    margin-top: 4px;
}

.ae-vid-overlay-btn:hover {
    background-color: #c41020;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 25, 44, 0.45);
}

.ae-vid-overlay-btn:active {
    transform: translateY(0);
}

.ae-vid-overlay-btn--no-url {
    cursor: default;
    opacity: 0.75;
    box-shadow: none;
}
.ae-vid-overlay-btn--no-url:hover {
    transform: none;
}

/* ── Play/Pause button z-index bump (stays above overlay) ─── */
.ae-video-btn {
    z-index: 10; /* above overlay's z-index 8 */
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — overlay text scales down on small screens
   ══════════════════════════════════════════════════════════ */

/* Tablet 768–1023px */
@media (max-width: 1023px) {
    .ae-vid-overlay {
        padding: 24px 28px;
    }
    .ae-vid-overlay-heading {
        font-size: clamp(20px, 3.5vw, 36px);
    }
    .ae-vid-overlay-inner {
        gap: 10px;
    }
}

/* Mobile 480–767px */
@media (max-width: 767px) {
    .ae-vid-overlay {
        padding: 18px 20px;
    }
    .ae-vid-overlay-heading {
        font-size: clamp(18px, 5vw, 28px);
    }
    .ae-vid-overlay-content {
        font-size: 13px;
        /* Trim to 2 lines on mobile */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .ae-vid-overlay-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    .ae-vid-overlay-inner {
        gap: 8px;
        max-width: 100%;
    }
}

/* Small Mobile 320–479px */
@media (max-width: 479px) {
    .ae-vid-overlay {
        padding: 12px 14px;
    }
    .ae-vid-overlay-heading {
        font-size: clamp(16px, 5.5vw, 22px);
    }
    .ae-vid-overlay-content {
        display: none; /* hide body on tiny screens */
    }
    .ae-vid-overlay-sub {
        font-size: 10px;
        padding: 3px 7px;
    }
    .ae-vid-overlay-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    .ae-vid-overlay-inner {
        gap: 6px;
    }
}

/* Landscape orientation — compact vertical spacing */
@media (max-width: 767px) and (orientation: landscape) {
    .ae-vid-overlay--top,
    .ae-vid-overlay--bottom {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .ae-vid-overlay-heading {
        font-size: clamp(14px, 4vh, 22px);
    }
    .ae-vid-overlay-content {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════
   CUSTOM EMBED WRAPPER
   Fills .ae-video-wrapper fully, handles Vimeo's own
   padding-top:56.25% wrapper and any other embed format.
   ══════════════════════════════════════════════════════════ */
.ae-embed-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Vimeo & similar: the embed itself has a padding-top wrapper */
.ae-embed-wrap > div {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;   /* override Vimeo's padding-top:56% */
}

/* The iframe inside the embed */
.ae-embed-wrap iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block;
}
