/* inKnot Dynamic Slider - Frontend */

.inknot-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #111;
    margin: 0;
    padding: 0;
    font-family: 'Raleway', sans-serif;
}

/* Fascetta Novità */
.inknot-slide-badge {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 200px;
    z-index: 5;
    overflow: visible;
    pointer-events: none;
    font-size: 0;
    color: transparent;
}

.inknot-slide-badge::before {
    content: 'Novità';
    position: absolute;
    top: 34px;
    left: -56px;
    width: 250px;
    padding: 10px 0;
    background: #f5c518;
    color: #000;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
    transform: rotate(-45deg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.inknot-slider-track {
    position: relative;
    width: 100%;
    height: 100%;
}

/* === SLIDE BASE === */
.inknot-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    z-index: 1;
}

.inknot-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* === SFONDO SFOCATO === */
.inknot-slide-bg {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    filter: blur(25px) brightness(0.4) saturate(1.2);
    will-change: transform;
    transform: scale(1.1);
    transition: transform 0.01s linear;
}

/* === OVERLAY SCURO === */
.inknot-slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2;
}

/* === LAYOUT A DUE COLONNE === */
.inknot-slide-inner {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(30px, 5vw, 80px);
    height: 100%;
    padding: 60px clamp(40px, 8vw, 120px);
    box-sizing: border-box;
    max-width: 1400px;
    margin: 0 auto;
}

/* === COLONNA SINISTRA: COPERTINA === */
.inknot-slide-cover {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inknot-book-cover {
    width: clamp(200px, 22vw, 320px);
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.4),
        0 20px 60px rgba(0, 0, 0, 0.25);
    transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1),
                box-shadow 0.5s cubic-bezier(0.25, 0.8, 0.25, 1),
                filter 0.5s ease;
}

.inknot-slide.active .inknot-book-cover {
    animation: coverReveal 0.8s ease-out forwards;
}

@keyframes coverReveal {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Hover copertina via link */
.inknot-cover-link:hover .inknot-book-cover {
    transform: translateY(-8px) scale(1.03);
    box-shadow:
        0 12px 20px rgba(0, 0, 0, 0.4),
        0 20px 50px rgba(0, 0, 0, 0.45),
        0 40px 90px rgba(0, 0, 0, 0.3);
    filter: brightness(1.08);
}

/* === COLONNA DESTRA: INFORMAZIONI === */
.inknot-slide-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 550px;
}

/* Titolo */
.inknot-slide-title {
    font-size: clamp(1.6rem, 3.2vw, 3rem);
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px 0;
    line-height: 1.15;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.inknot-slide-title a {
    color: inherit;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

.inknot-slide-title a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #fff;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.inknot-slide-title a:hover {
    color: rgba(255, 255, 255, 0.85);
}

.inknot-slide-title a:hover::after {
    width: 100%;
}

/* Copertina link */
.inknot-cover-link {
    display: block;
    line-height: 0;
}

/* Autore - stesso font del titolo */
.inknot-slide-author {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    font-weight: 600;
}

.inknot-slide-author a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.inknot-slide-author a:hover {
    color: #fff;
    border-color: #fff;
}

.inknot-slide-phrase {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 28px;
    line-height: 1.7;
    max-width: 480px;
}

/* === SLOGAN === */
.inknot-slide-slogan {
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    font-style: italic;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 20px;
    line-height: 1.6;
    max-width: 450px;
}

/* === BOTTONE "LEGGI DI PIU" === */
.inknot-slide-btn {
    display: inline-block;
    padding: 10px 28px;
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    border-radius: 50px;
    text-decoration: none;
    font-size: clamp(0.75rem, 1vw, 0.85rem);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.inknot-slide-btn:hover {
    background: #fff;
    color: #111;
    border-color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.25);
}

/* === SLIDE AGGREGATA - STACK DI COPERTINE === */
.inknot-slide-aggregated-inner {
    display: flex;
    align-items: center;
    gap: 60px;
}

.inknot-slide-cover-stack {
    position: relative;
    width: 320px;
    height: 450px;
    flex-shrink: 0;
}

.inknot-stack-cover {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: visible;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: center bottom;
}

.inknot-stack-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Stato iniziale: impilati con distanza maggiore */
.inknot-slide-aggregated .inknot-stack-cover:nth-child(1) {
    transform: rotate(-4deg) translateX(-25px);
}

.inknot-slide-aggregated .inknot-stack-cover:nth-child(2) {
    transform: rotate(0deg) translateX(0px);
}

.inknot-slide-aggregated .inknot-stack-cover:nth-child(3) {
    transform: rotate(4deg) translateX(25px);
}

.inknot-slide-aggregated .inknot-stack-cover:nth-child(4) {
    transform: rotate(8deg) translateX(50px);
}

/* Effetto hover: si aprono a ventaglio - scopre molto di più (+20%) */
.inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(1) {
    transform: rotate(-26deg) translateX(-132px) translateY(-24px);
}

.inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(2) {
    transform: rotate(-10deg) translateX(-48px) translateY(-12px);
}

.inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(3) {
    transform: rotate(10deg) translateX(48px) translateY(-12px);
}

.inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(4) {
    transform: rotate(26deg) translateX(132px) translateY(-24px);
}

/* Ombra che segue perfettamente il perimetro */
.inknot-slide-cover-stack:hover .inknot-stack-cover {
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

/* ===================================================================
   TRANSIZIONI - attivate dalla classe sul container .inknot-slider
   =================================================================== */

/* --- KEN BURNS --- */
.inknot-transition-kenburns .inknot-slide.kenburns-in .inknot-slide-bg {
    animation: kenburnsIn 8s ease-out forwards;
}

.inknot-transition-kenburns .inknot-slide.kenburns-out .inknot-slide-bg {
    animation: kenburnsOut 8s ease-out forwards;
}

@keyframes kenburnsIn {
    0% {
        transform: scale(1.1) translate(0, 0);
    }
    100% {
        transform: scale(1.2) translate(-2%, -1%);
    }
}

@keyframes kenburnsOut {
    0% {
        transform: scale(1.2) translate(-2%, -1%);
    }
    100% {
        transform: scale(1.1) translate(0, 0);
    }
}

/* --- PARALLAX (stile base, effetto mouse gestito via JS) --- */
.inknot-transition-parallax .inknot-slide-bg {
    transform: scale(1.1) translateY(5%);
}

.inknot-transition-parallax .inknot-slide.active .inknot-slide-bg {
    transform: scale(1.1) translateY(-5%);
}

/* --- FADE --- */
.inknot-transition-fade .inknot-slide {
    transition: opacity 1.2s ease, visibility 1.2s ease;
}

.inknot-transition-fade .inknot-slide.fade-in {
    animation: fadeIn 1.2s ease forwards;
}

.inknot-transition-fade .inknot-slide.fade-out {
    animation: fadeOut 1.2s ease forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* --- SLIDE (scorrimento orizzontale) --- */
.inknot-transition-slide .inknot-slide.prev {
    animation: slideOutLeft var(--slide-speed, 1.2s) cubic-bezier(0.65, 0, 0.35, 1) forwards;
    z-index: 1;
}

.inknot-transition-slide .inknot-slide.next {
    animation: slideOutRight var(--slide-speed, 1.2s) cubic-bezier(0.65, 0, 0.35, 1) forwards;
    z-index: 1;
}

@keyframes slideOutLeft {
    0% { transform: translateX(0); opacity: 1; visibility: visible; }
    100% { transform: translateX(-100%); opacity: 0; visibility: hidden; }
}

@keyframes slideOutRight {
    0% { transform: translateX(0); opacity: 1; visibility: visible; }
    100% { transform: translateX(100%); opacity: 0; visibility: hidden; }
}

/* === FRECCE NAVIGAZIONE === */
.inknot-slider-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.25);
    color: #fff;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, border-color 0.3s ease;
    backdrop-filter: blur(4px);
    padding: 0;
}

.inknot-slider-arrow svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    pointer-events: none;
}

.inknot-slider-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.inknot-arrow-prev { left: 24px; }
.inknot-arrow-next { right: 24px; }

/* === PUNTI NAVIGAZIONE === */
.inknot-slider-dots {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 10px;
}

.inknot-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    padding: 0;
}

.inknot-dot:hover {
    border-color: #fff;
    transform: scale(1.2);
}

.inknot-dot.active {
    background: #fff;
    border-color: #fff;
    transform: scale(1.2);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .inknot-slide-inner {
        flex-direction: column;
        gap: 24px;
        padding: 40px 24px;
        text-align: center;
    }

    .inknot-slide-info {
        align-items: center;
        max-width: 100%;
    }

    .inknot-slide-phrase {
        text-align: center;
    }

    .inknot-slide-btn {
        align-self: center;
    }

    .inknot-book-cover {
        width: clamp(250px, 55vw, 350px);
    }

    .inknot-slider-arrow {
        width: 40px;
        height: 40px;
    }

    .inknot-arrow-prev { left: 12px; }
    .inknot-arrow-next { right: 12px; }

    .inknot-dot {
        width: 10px;
        height: 10px;
    }

    /* Slide aggregate responsive */
    .inknot-slide-aggregated-inner {
        flex-direction: column;
        gap: 30px;
    }

    .inknot-slide-cover-stack {
        width: 240px;
        height: 340px;
    }

    .inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(1) {
        transform: rotate(-22deg) translateX(-96px) translateY(-18px);
    }

    .inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(2) {
        transform: rotate(-8deg) translateX(-36px) translateY(-10px);
    }

    .inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(3) {
        transform: rotate(8deg) translateX(36px) translateY(-10px);
    }

    .inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(4) {
        transform: rotate(22deg) translateX(96px) translateY(-18px);
    }
}

@media (max-width: 480px) {
    .inknot-slide-inner {
        padding: 30px 16px;
    }

    .inknot-book-cover {
        width: 300px;
    }

    .inknot-slide-cover-stack {
        width: 180px;
        height: 255px;
    }

    .inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(1) {
        transform: rotate(-18deg) translateX(-72px) translateY(-14px);
    }

    .inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(2) {
        transform: rotate(-6deg) translateX(-26px) translateY(-7px);
    }

    .inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(3) {
        transform: rotate(6deg) translateX(26px) translateY(-7px);
    }

    .inknot-slide-cover-stack:hover .inknot-stack-cover:nth-child(4) {
        transform: rotate(18deg) translateX(72px) translateY(-14px);
    }
}
