/* ============================================================
   AGP News Carousel v2 — Stylesheet
   Layout : image à gauche | texte centré à droite
   ============================================================ */

/* --- Defaults (overridable via CSS vars injected inline) --- */
.agp-carousel-wrapper {
    --agp-accent:      #c0392b;
    --agp-bg:          #0f1923;
    --agp-text:        #ffffff;
    --agp-img-w:       40%;
    --agp-text-w:      60%;
    --agp-height:      520px;
    --agp-radius:      0px;
    --agp-font-title:  'Playfair Display', Georgia, serif;
    --agp-font-body:   'Source Sans 3', 'Segoe UI', sans-serif;
    --agp-autoplay:    5000ms;

    /* Internal */
    --agp-accent-dark:  color-mix(in srgb, var(--agp-accent) 75%, black);
    --agp-transition:   0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

/* ---- Wrapper -------------------------------------------- */
.agp-carousel-wrapper {
    position: relative;
    width: 100%;
    height: var(--agp-height);
    overflow: hidden;
    border-radius: var(--agp-radius);
    background: var(--agp-bg);
    font-family: var(--agp-font-body);
    -webkit-user-select: none;
    user-select: none;
    box-shadow: 0 8px 40px rgba(0,0,0,0.28);
}

/* ---- Track --------------------------------------------- */
.agp-carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ---- Slide --------------------------------------------- */
.agp-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: stretch;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--agp-transition);
    will-change: opacity;
}
.agp-slide.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}
.agp-slide.is-leaving {
    opacity: 0;
    z-index: 1;
}

/* ---- IMAGE PANEL --------------------------------------- */
.agp-slide__image-panel {
    position: relative;
    width: var(--agp-img-w);
    flex-shrink: 0;
    overflow: hidden;
    background: #111;
}

.agp-slide__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transform: scale(1.04);
    transition: transform 0.8s cubic-bezier(0.25,0.46,0.45,0.94);
}
.agp-slide.is-active .agp-slide__img {
    transform: scale(1);
}

/* Subtle dark edge on image right side */
.agp-slide__image-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent 70%, rgba(0,0,0,0.45) 100%);
    pointer-events: none;
}

/* Image placeholder */
.agp-slide__img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2535 0%, #0d1520 100%);
}

/* Counter badge */
.agp-slide__counter {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    align-items: baseline;
    gap: 3px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 4px 12px;
    z-index: 3;
}
.agp-slide__counter-current {
    font-family: var(--agp-font-title);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--agp-accent);
    line-height: 1;
}
.agp-slide__counter-sep {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}
.agp-slide__counter-total {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.55);
}

/* Divider styles */
.agp-divider--solid .agp-slide__image-panel {
    border-right: 2px solid rgba(255,255,255,0.1);
}
.agp-divider--accent .agp-slide__image-panel {
    border-right: 3px solid var(--agp-accent);
}
.agp-divider--glow .agp-slide__image-panel {
    border-right: 1px solid transparent;
    box-shadow: 4px 0 20px -4px var(--agp-accent);
}

/* ---- TEXT PANEL ---------------------------------------- */
.agp-slide__text-panel {
    flex: 1;
    background: var(--agp-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 5%, 60px);
    position: relative;
    overflow: hidden;
}

/* Subtle background pattern */
.agp-slide__text-panel::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--agp-accent) 15%, transparent) 0%, transparent 70%);
    pointer-events: none;
}

.agp-slide__text-inner {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;

    /* Slide-in animation on active */
    transform: translateY(12px);
    opacity: 0;
    transition:
        transform 0.55s cubic-bezier(0.25,0.46,0.45,0.94) 0.15s,
        opacity   0.55s ease 0.15s;
}
.agp-slide.is-active .agp-slide__text-inner {
    transform: translateY(0);
    opacity: 1;
}

/* Category badge */
.agp-slide__category {
    display: inline-block;
    background: var(--agp-accent);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 2px;
    margin-bottom: 14px;
    transition: background 0.2s, transform 0.2s;
    position: relative;
}
.agp-slide__category::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: var(--agp-accent);
    border-radius: 2px;
}
.agp-slide__category:hover {
    background: var(--agp-accent-dark);
    color: #fff;
    transform: translateX(2px);
}

/* Title */
.agp-slide__title {
    font-family: var(--agp-font-title);
    font-size: clamp(1.1rem, 2.4vw, 1.65rem);
    font-weight: 700;
    line-height: 1.28;
    margin: 0 0 14px;
    color: var(--agp-text);
}
.agp-slide__title a {
    color: inherit;
    text-decoration: none;
    background-image: linear-gradient(var(--agp-accent), var(--agp-accent));
    background-repeat: no-repeat;
    background-size: 0% 2px;
    background-position: 0 100%;
    transition: background-size 0.35s ease;
    padding-bottom: 2px;
}
.agp-slide__title a:hover {
    background-size: 100% 2px;
}

/* Excerpt */
.agp-slide__excerpt {
    font-size: 0.88rem;
    line-height: 1.65;
    color: color-mix(in srgb, var(--agp-text) 70%, transparent);
    margin: 0 0 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta row */
.agp-slide__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-top: 14px;
    border-top: 1px solid color-mix(in srgb, var(--agp-text) 12%, transparent);
}
.agp-slide__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: color-mix(in srgb, var(--agp-text) 60%, transparent);
    text-decoration: none;
    transition: color 0.2s;
}
.agp-slide__meta-item:hover {
    color: var(--agp-text);
}

/* Read more button */
.agp-slide__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--agp-accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 10px 22px;
    border-radius: 2px;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--agp-accent) 40%, transparent);
}
.agp-slide__btn:hover {
    background: var(--agp-accent-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--agp-accent) 50%, transparent);
}
.agp-slide__btn svg {
    transition: transform 0.2s;
}
.agp-slide__btn:hover svg {
    transform: translateX(3px);
}

/* ---- ARROWS -------------------------------------------- */
.agp-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.25s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0;
}
.agp-arrow:hover {
    background: var(--agp-accent);
    border-color: var(--agp-accent);
    transform: translateY(-50%) scale(1.1);
}
.agp-arrow--prev { left: 14px; }
.agp-arrow--next { right: 14px; }

/* ---- DOTS ---------------------------------------------- */
.agp-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 7px;
    align-items: center;
}
.agp-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, width 0.3s, border-radius 0.3s;
    flex-shrink: 0;
}
.agp-dot.is-active {
    background: var(--agp-accent);
    width: 22px;
    border-radius: 4px;
}
.agp-dot:hover {
    background: rgba(255,255,255,0.65);
}

/* ---- PROGRESS BAR ------------------------------------- */
.agp-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.08);
    z-index: 10;
    overflow: hidden;
}
.agp-progress__bar {
    height: 100%;
    width: 0;
    background: var(--agp-accent);
    transition: width linear;
}

/* ---- RESPONSIVE --------------------------------------- */
@media (max-width: 700px) {
    .agp-carousel-wrapper {
        height: auto !important;
        min-height: 400px;
    }
    .agp-slide {
        flex-direction: column;
    }
    .agp-slide__image-panel {
        width: 100% !important;
        height: 200px;
        flex-shrink: 0;
    }
    .agp-slide__text-panel {
        padding: 20px 18px 40px;
    }
    .agp-slide__image-panel::after {
        background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.4) 100%);
    }
    .agp-divider--solid .agp-slide__image-panel,
    .agp-divider--accent .agp-slide__image-panel,
    .agp-divider--glow   .agp-slide__image-panel {
        border-right: none;
        border-bottom: 3px solid var(--agp-accent);
    }
    .agp-arrow { display: none; }
    .agp-dots  { bottom: 10px; }
}

.agp-no-posts {
    padding: 20px;
    color: #888;
}
