/* ===== Bühne: full-bleed, 100vh (wie die anderen Sections) ===== */
.books-section {
    position: relative;
    /*min-height: 100dvh;*/

    /* Full-bleed */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);

    display: flex;          /* wir zentrieren das innere Grid vertikal */
    align-items: center;
}

/* ===== Inneres Grid mit gleicher Content-Breite wie die anderen (70%) ===== */
.books-grid {
    width: 70%;
    margin: 0 auto;

    display: grid;
    /* Statt 50vw/30vw: fr-Units → stabil zur Containerbreite */
    grid-template-columns: 1.25fr 0.85fr; /* links Text, rechts Carousel */
    grid-template-areas:
    "title   carousel"
    "desc    carousel";
    column-gap: clamp(20px, 2.5vw, 32px);
    row-gap: 1rem;
    align-items: start;
}

/* Grid Areas */
.book-title       { grid-area: title; }
.book-description { grid-area: desc; }
.book-carousel    { grid-area: carousel; position: relative; width: 100%; }

.book-description #book-type  {
    font-family: 'Henriette', serif;
    font-style: italic;
    font-size: clamp(1.3rem, 0.8vw + 1rem, 1.8rem);
    margin: 0.5rem 0 1rem;
    color: #003763;
}
.book-description p {
    font-size: clamp(1rem, 0.4vw + 0.8rem, 1.2rem);
    line-height: 1.8;
    color: #003763;
    padding-right: 80px;
}

/* === Carousel === */
.carousel-viewport { width: 100%; overflow: hidden; }
.carousel-track {
    display: flex;
    width: 200%;                   /* 2 Slides */
    transition: transform 450ms ease;
    will-change: transform;
}
.carousel-item {
    width: 100%;                   /* füllt die rechte Spalte */
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: contain;
    display: block;
    background: transparent;
    border: none;
    max-height: 65vh;
}

/* Pfeile – innen positionieren, nicht zu weit nach außen */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 42px;
    width: 42px;
    /*border-radius: 50%;*/
    /*border: 1px solid #ccc;*/
    border:none;
    background: transparent;
    /*color: #333;*/
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    opacity: 0.9;
    transition: transform 120ms ease, opacity 120ms ease;
    z-index: 2;
    font-size: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 58% auto;
}

.carousel-btn.prev {
    background-image: url("images/arrow-left.png");
}
.carousel-btn.next {
    background-image: url("images/arrow-right.png");
}

.carousel-btn:hover { opacity: 1; transform: translateY(-50%) scale(1.05); }
.carousel-btn.prev { left: -8px; }   /* leicht überlappend, aber innerhalb */
.carousel-btn.next { right: -8px; }

/* Dots */
.carousel-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}
.carousel-dots .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 1px solid #666;
    background: #bbb;
    cursor: pointer;
    opacity: .7;
}
.carousel-dots .dot.active {
    background: #333;
    opacity: 1;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .books-grid {
        width: 85%;
        grid-template-columns: 1fr;
        grid-template-areas:
        "title"
        "carousel"
        "desc";
    row-gap: 1.25rem;
    }
    .book-description p { padding-right: 0; }

    .carousel-item { max-height: 45vh; }
    .carousel-btn.prev { left: 6px; }
    .carousel-btn.next { right: 6px; }
}

/* Buttons unter der Buchbeschreibung */
.book-buttons{
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;                   /* bleibt Zeilenlayout */
    gap: clamp(8px, 1vw, 12px);
}

/* Überschrift "Lagernd bei:" soll eine neue Zeile beginnen */
.lagernd-header{
    flex: 0 0 100%;                    /* bricht in die nächste Zeile */
    margin-top: .25rem;
    font-family: 'Henriette', serif;
    font-weight: 700;
    font-size: clamp(1rem, .6vw + .9rem, 1.25rem);
    color: #003763;
}

/* Händler-Buttons (kleiner, weißer Hintergrund, blauer Text) */
.book-buttons .btn-dealer {
    background: #fff;
    color: #003763;
    border-color: #003763;
    font-size: clamp(.85rem, .5vw + .7rem, 1.05rem);  /* kleiner als primary */
    padding: .55rem .9rem;                             /* kompakter */
    border-width: 1.5px;                               /* etwas dünner */
}

/* Mobile: Buttons dürfen umbrechen */
@media (max-width: 900px){
    .book-buttons{ gap: 10px; }
}

/* ===== Bücher-Layout mit Grid-Areas ===== */
.books-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
    "title title"
    "desc  carousel"
    "desc  covertext";
    column-gap: clamp(16px, 2vw, 28px);
    row-gap: clamp(12px, 1.4vw, 20px);
}

/* Elemente den Areas zuordnen */
#book-title{ grid-area: title; }
.book-description{ grid-area: desc; }
.book-carousel{ grid-area: carousel;}

/* Cover-Text: direkt unter dem Karussell */
/* Karussell in der rechten Spalte mittig begrenzen */
.book-carousel{
    grid-area: carousel;
    justify-self: center;              /* zentriert in der rechten Spalte */
    width: min(100%, var(--carousel-w));
    display: grid;
    justify-items: center;             /* zentriert Kinder wie Dots/Cover-Text */
}

/* Viewport/Dots füllen die Karussellbreite */
.carousel-viewport{ width: 100%; }
.carousel-dots{ width: 100%; }

/* Cover-Text: gleich breit wie Karussell, Container zentriert,
 *  aber Text linksbündig + Einzug */
.book-cover-text{
    width: 100%;                       /* exakt Karussellbreite */
    margin: 3px 0 0;                   /* kleiner Abstand zu den Dots */
    padding:0;
    text-align: left;                  /* Text linksbündig */
    color: #5f7b93;
    font-size: clamp(.85rem, .25vw + .75rem, 1rem);
    line-height: 1.35;
}

/* Optional: Links im Cover-Text */
.book-cover-text a{
    color: inherit;
    text-underline-offset: 1px;
}

/* ===== Mobil: Reihenfolge explizit untereinander ===== */
@media (max-width: 900px){
    .books-grid{
        grid-template-columns: 1fr;
        grid-template-areas:
        "title"
        "carousel"
        "covertext"
        "desc";
    }
}
