/* Article Slider - mod_articleslider */

.as-slider {
    --as-image-max-w: 350px;
    --as-image-max-h: 150px;
    --as-box-max-h: 220px;
    --as-fade-h: 30px;
    --as-fade-color: #fff;
    --as-divider-color: #ccc;
    --as-transition-duration: 0.6s;
    --as-transition-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

    position: relative;
    width: 100%;
    font-family: inherit;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
}

/* Carousel viewport: a single fixed-size clipping window. Rows are stacked on top
   of each other (position: absolute) and only the inline transform (set by JS)
   decides which one is visible and where the others sit off-screen. */
.as-viewport {
    position: relative;
    width: 100%;
    height: var(--as-box-max-h);
    overflow: hidden;
}

/* ---------- Row: main slide + (optional) next-slide peek, side by side ---------- */

.as-row {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: flex-start;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform var(--as-transition-duration) var(--as-transition-ease);
}

.as-row.as-row--active {
    transform: translateX(0);
}

/* ---------- Main slide (article) ---------- */

.as-slide {
    display: flex;
    align-items: flex-start;
    flex: 0 0 70%;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

/* The peek of the next slide: EXACT same markup/styling as the main slide above,
   just given less width, so it is naturally cropped by the row's own overflow:hidden.
   No shrinking, no thumbnail, no separate treatment. */
.as-slide--peek {
    flex: 0 0 30%;
}

.as-slide .as-image {
    flex: 0 0 auto;
    display: block;
    max-width: var(--as-image-max-w);
    max-height: var(--as-image-max-h);
    overflow: hidden;
    line-height: 0;
}

.as-slide .as-image img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(var(--as-image-max-w), 100%);
    max-height: var(--as-image-max-h);
}

.as-slide .as-content {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    max-height: 100%;
    overflow: hidden;
    margin-left: 10px;
    box-sizing: border-box;
}

/* Fade-out hint at the bottom of the text block when it is taller than the box */
.as-slide .as-content::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--as-fade-h);
    background: linear-gradient(to bottom, transparent, var(--as-fade-color));
    pointer-events: none;
}

.as-slide .as-title {
    margin: 0 0 4px;
    font-size: 1.2rem;
    line-height: 1.3;
}

.as-slide .as-title a {
    text-decoration: none;
    color: inherit;
    display: inline;
}

.as-slide .as-date {
    font-size: 0.8rem;
    opacity: 0.65;
    margin-bottom: 6px;
}

.as-slide .as-excerpt {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
}

.as-row > .as-slide:only-child {
    flex-basis: 100%;
}

/* ---------- Module slide ---------- */

.as-slide--module {
    width: 100%;
    height: 100%;
    display: block;
}

.as-slide--module .as-module-content {
    position: relative;
    width: 100%;
    max-height: 100%;
    overflow: hidden;
}

.as-slide--module .as-module-content::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--as-fade-h);
    background: linear-gradient(to bottom, transparent, var(--as-fade-color));
    pointer-events: none;
}

/* ---------- Diagnostic slide: module failed to load (visible to admins only) ---------- */

.as-slide--error {
    width: 100%;
    height: 100%;
    display: block;
    box-sizing: border-box;
    padding: 14px 16px;
    background: #fff8e6;
    border: 1px dashed #e0b400;
    border-radius: 4px;
    overflow: auto;
}

.as-slide--error .as-error-content {
    color: #6b5300;
    font-size: 0.85rem;
    line-height: 1.4;
}

.as-slide--error .as-error-content strong:first-child {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.as-slide--error .as-error-content ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

/* ---------- Divider ---------- */

.as-divider {
    flex: 0 0 auto;
    align-self: stretch;
    width: 2px;
    margin: 10px 14px;
    background: var(--as-divider-color);
    border-radius: 1px;
}

/* ---------- Controls: dots + pause/play button ---------- */

.as-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.as-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.as-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.as-dot:hover {
    background: rgba(0, 0, 0, 0.45);
}

.as-dot.as-dot--active {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.2);
}

.as-toggle-pause {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.as-toggle-pause:hover {
    border-color: rgba(0, 0, 0, 0.45);
    background: rgba(0, 0, 0, 0.02);
}

.as-toggle-pause svg {
    width: 14px;
    height: 14px;
    display: block;
    color: rgba(0, 0, 0, 0.6);
}

.as-toggle-pause:hover svg {
    color: rgba(0, 0, 0, 0.85);
}

.as-toggle-pause.as-paused .as-pause-icon {
    display: none;
}

.as-toggle-pause.as-paused .as-play-icon {
    display: block;
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
    .as-slide {
        flex-basis: 100%;
    }

    .as-slide .as-image {
        max-width: 25%;
        flex-basis: 25%;
    }

    .as-slide .as-image img {
        width: 100%;
        height: auto;
        max-height: var(--as-image-max-h);
    }

    .as-slide--peek,
    .as-divider {
        display: none !important;
    }
}
