/* ============================================================
   Article Banner — Base Section
   ============================================================ */
.article-banner-section {
    position: relative;
    overflow: hidden;
    min-height: 412px;
    display: flex;
    align-items: stretch;
}

/* ── Container sits above the image layer ──────────────────── */
.article-banner-section .ab-container {
    position: relative;
    z-index: 2;
    padding-top: 64px;
    padding-bottom: 64px;
    width: 100%;
    display: flex;
    align-items: center;
}

/* ── Bootstrap row inside banner ───────────────────────────── */
.article-banner-section .article-banner {
    width: 100%;
    display: flex;
    align-items: center;
    height: 100%;
}

/* Row-level justify mirrors content alignment */
.ab-align-left  .article-banner { justify-content: flex-start; }
.ab-align-center .article-banner { justify-content: center; }
.ab-align-right  .article-banner { justify-content: flex-end; }

/* ============================================================
   Content Column — .ab-content
   ============================================================ */
.ab-content {
    display: flex;
    flex-direction: column;
    /* Use flex: 0 0 auto so justify-content on the row can center it */
    flex: 0 0 auto;
    width: 100%;
}

/* ── Alignment: LEFT ───────────────────────────────────────── */
.ab-align-left .ab-content {
    align-items: flex-start;
    text-align: left;
}

/* ── Alignment: CENTER ─────────────────────────────────────── */
.ab-align-center .ab-content {
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 820px; /* cap width for readability */
}

/* ── Alignment: RIGHT ──────────────────────────────────────── */
/* Content COLUMN is pushed to the right side of the banner,   */
/* but text within the column remains left-aligned             */
.ab-align-right .ab-content {
    align-items: flex-start;
    text-align: left;
}

/* ── When image is present, content width is set inline ────── */
/* (max-width applied via style attribute from PHP)            */
/* For image layouts, content should fill its allocated width  */
.ab-img-right .ab-content,
.ab-img-left  .ab-content {
    flex: 0 0 auto;
}

/* ============================================================
   Background Image Panel — full-width cover
   ============================================================ */
.ab-image-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 1;
}

/* Both variants are full-width — no side-specific positioning needed */
.ab-image-right,
.ab-image-left {
    left: 0;
    right: 0;
}

/* ============================================================
   Typography — defaults (overridden by inline style from PHP)
   ============================================================ */
.article-banner-section h1 {
    color: #111111;
    font-size: 48px;
    font-weight: 400;
    line-height: 1.15;
    margin-bottom: 0px;
    letter-spacing: 2px;
}

.ab-subtitle {
    color: #6b7280;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.65;
    margin-bottom: 0;
    margin-top: 16px;
    max-width: 640px;
}

/* Subtitle max-width: center alignment → auto, left/right → inherit */
.ab-align-center .ab-subtitle {
    max-width: 600px;
}

/* ============================================================
   Button Row
   ============================================================ */
.banner-article-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
}

/* Mirror content alignment for buttons */
.ab-align-center .banner-article-btn {
    justify-content: center;
}
.ab-align-right .banner-article-btn {
    justify-content: flex-start; /* text is left-aligned, buttons follow */
}
.ab-align-left .banner-article-btn {
    justify-content: flex-start;
}

/* ── "Summarize with AiDE" button ──────────────────────────── */
.ab-summarize-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    /* Gradient border via background-clip trick */
    background: linear-gradient(#ffffff, #ffffff) padding-box,
                linear-gradient(135deg, #7B7CF8 0%, #C5C8FA 100%) border-box;
    border: 1.5px solid transparent;
    color: #111111;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.ab-summarize-btn:hover {
    box-shadow: 0 4px 18px rgba(123, 124, 248, 0.3);
    transform: translateY(-1px);
}

.ab-aide-icon {
    flex-shrink: 0;
}

.ab-aide-wordmark {
    font-weight: 700;
    letter-spacing: -0.3px;
}

.ab-aide-wordmark sup {
    font-size: 0.6em;
    vertical-align: super;
}

/* ── Listen button ─────────────────────────────────────────── */
/* Base styles — color overridden by inline style from PHP */
.listen-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 12px;
    background: #111111; /* default — overridden by inline style */
    color: #ffffff;      /* default — overridden by inline style */
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.listen-trigger:hover {
background: linear-gradient(91deg, #544FF8 59.65%, #2EB6AE 99.41%), #000 !important;
}

/* Play icon circle inside the Listen button */
.listen-play-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    /* background color set via inline style (= btn text color) */
}

/* ============================================================
   Listen overlay / popup
   ============================================================ */
.listen-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.35);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80vh;
    z-index: 1000;
}
.listen-overlay.open { display: flex; }

.listen-popup {
    background: #ffffff;
    border-radius: 20px;
    padding: 16px 20px 14px 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    font-family: inherit;
}
.listen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.listen-title {
    color: #000;
    font-size: 19px;
    font-weight: 500;
    line-height: 28.5px;
    margin-bottom: 0;
}
.listen-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #16161a;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.listen-close:hover { background: #f2f2f0; }
.listen-close svg { width: 22px; height: 22px; }

.listen-divider {
    border: none;
    border-top: 1px solid #D9D9D9;
    margin: 0 0 10px;
    opacity: 1;
}

.listen-controls {
    display: flex;
    align-items: center;
    gap: 18px;
}

.listen-playbtn {
    flex: 0 0 auto;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #16161a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.listen-playbtn:hover { background: #000; }
.listen-playbtn svg { width: 20px; height: 20px; }
.listen-playbtn:disabled { opacity: 0.5; cursor: default; }

.listen-track-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.listen-waveform {
    position: relative;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
}
.listen-waveform .bar {
    flex: 1 1 0;
    min-width: 1px;
    max-width: 0px;
    border-radius: 2px;
    background: #B3B3B3;
    transition: background 0.15s ease;
}
.listen-waveform .bar.played { background: #544FF8; }
.listen-waveform .playhead {
    position: absolute;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #544FF8;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 0 1px #ffffff;
    left: 0%;
}

.listen-times {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}
.listen-times span {
    background: #2A2A2A;
    color: #fff;
    font-size: 8px;
    font-weight: 500;
    line-height: 11.6px;
    padding: 2px 3px;
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Responsive — Tablet (≤ 1199.98px)
   ============================================================ */
@media (max-width: 1199.98px) {

    .article-banner-section h1 {
        font-size: 40px;
        line-height: 1.2;
    }

    /* Full-width image stays visible — reset content column width only */
    .ab-img-right .ab-content,
    .ab-img-left .ab-content {
        max-width: 100% !important;
    }
}

/* ============================================================
   Responsive — Mobile (≤ 767.98px)
   ============================================================ */
@media (max-width: 767.98px) {

    .article-banner-section h1 {
        font-size: 32px;
    }

    .ab-subtitle {
        font-size: 15px;
    }

    /* Force center alignment on small screens for readability */
    .ab-align-right .ab-content {
        align-items: flex-start;
        text-align: left;
    }
    .ab-align-right .banner-article-btn {
        justify-content: flex-start;
    }
}

/* ============================================================
   Responsive — Small mobile (≤ 597.98px)
   ============================================================ */
@media (max-width: 597.98px) {

    .banner-article-btn {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .ab-summarize-btn,
    .listen-trigger {
        width: 100%;
        justify-content: center;
        border-radius: 14px;
        padding: 14px 20px;
        font-size: 17px;
    }

    .listen-popup {
        width: 95%;
    }
}
