body {
    margin: 0;
    font-family: "Atkinson Hyperlegible", sans-serif;
    background: var(--viola-scuro);
    color: var(--bianco-crema);
}

body,
html {
    overflow: auto;
}

h1,
h2,
h3,
h4 {
    color: var(--oro-caldo);
}

/* Header */
header {
    background: var(--viola-profondo);
    color: var(--oro-caldo);
    padding: 1rem 2rem;
}

.header-items {
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin: 0 auto;
}

.logo {
    color: var(--oro-caldo);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 1rem;
}

nav a {
    color: var(--oro-caldo);
    font-size: 1.4rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

nav a:hover {
    opacity: 0.7;
}

/* Cover — container generico (biografia usa bande) */
.cover {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 70vh;
    width: 100%;
}


/* Cover copy (libri, premi, ecc.) */
.cover-copy {
    height: auto;
    margin: 0 auto;
    max-height: 30vh;
    position: relative;
}

.cover-copy img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.overlay {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.overlay .title {
    font-size: 9vh;
    font-weight: 400;
    text-transform: uppercase;
    font-family: "Atkinson Hyperlegible", sans-serif;
    color: var(--oro-caldo);
}

.overlay nav a {
    color: var(--oro-caldo);
    font-size: 9vh;
    text-decoration: none;
}

.overlay nav a:hover {
    color: var(--ottanio-luminoso);
}

/* Profilo */
section {
    padding: 4rem 2rem;
    text-align: center;
}

section.cover {
    padding: 0;
}


section h2 {
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.profilo p {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    font-size: 1.1rem;
    text-align: justify;
}

/* Carosello Libri */

.carosello-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto;
}

.slot-container {
    display: flex;
    width: 100%;
    gap: 15px;
    justify-content: space-between;
    transition: opacity 0.8s ease-in-out;
}

.slot-container.fade-out {
    opacity: 0;
}

.slot-container.fade-in {
    opacity: 1;
}

.slot {
    aspect-ratio: 2 / 4.5;
    width: 33%;
    background: var(--grigio-viola);
    border-radius: 8px;
    border: 1px solid var(--bianco-crema);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    padding: 0 0 15px 0;
    text-align: center;
    overflow: hidden;
}

.slot-link {
    display: flex;
    /* importante */
    flex-direction: column;
    height: 100%;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.slot h1,
h2,
h3,
h4,
p {
    margin: 10px auto;
}

.slot img {
    width: 100%;
    border-radius: 6px 6px 0 0;
}

#slot1,
#slot3 {
    transform: scale(0.85);
    opacity: 0.7;
    transition: transform 0.3s, opacity 0.3s;
}

#slot2 {
    transform: scale(1);
    transition: transform 0.3s;
}

.trasparenza {
    opacity: 0.1;
}

.nav-btn {
    background: #222;
    color: var(--oro-caldo);
    border: none;
    padding: 10px 14px;
    font-size: 24px;
    cursor: pointer;
    border-radius: 6px;
}

.pallini {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    gap: 8px;
}

.pallini span {
    width: 10px;
    height: 10px;
    background: var(--bianco-crema);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.pallini span.active {
    background: var(--oro-caldo);
}

/* Titolo orizzontale */
.titolo-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.titolo-scroll {
    display: inline-block;
    white-space: nowrap;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

/* Didascalia verticale */
.didascalia-wrapper {
    height: 90px;
    overflow: hidden;
    position: relative;
}

.didascalia-scroll {
    display: inline-block;
    white-space: normal;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

/* Animazioni dinamiche */
@keyframes scroll-title {
    0%   { transform: translateX(0); }
    100% { transform: translateX(var(--scroll-title-distance)); }
}

@keyframes scroll-caption {
    0%   { transform: translateY(0); }
    100% { transform: translateY(var(--scroll-caption-distance)); }
}

/* Premi */
.premi-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.premio {
    background: var(--viola-profondo);
    width: 80%;
    max-width: 700px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.premio:hover {
    border-left: #061821 solid 5px;
    padding-right: 5px;
}

.premio h3 {
    margin-bottom: 0.5rem;
    color: var(--clr-scuro);
}

.premio .anno {
    color: var(--oro-caldo);
}

/* Footer */
footer {
    display: flex;
    justify-content: center;
    background: var(--clr-scuro);
    padding: 1rem 0;
    margin-top: 70px;
}


/* ------------------------- */
/* SCHERMI INFERIORI A 768px */
/* ------------------------- */
@media (max-width: 768px) {
    .overlay .title,
    .overlay nav a {
        font-size: 4vh;

    }


    .carosello-wrapper {
        padding: 0 20px;
    }

    .slot {
        width: auto;              /* cornice aderente alla copertina */
        display: inline-block;
        padding: 0;               /* niente padding che allargava */
        aspect-ratio: auto;
        text-align: center;
    }

    #slot1,
    #slot3 {
        display: none;
    }

   

    .premio {
        width: 100%;
    }

    /* Titoli e sottotitoli proporzionati */
    .slot h3 {
        font-size: 4vw;
        line-height: 1.2;
        max-width: 100%;
        margin: 0 auto;
    }

    .slot h4 {
        font-size: 3.5vw;
        line-height: 1.2;
        max-width: 100%;
        margin: 0 auto;
    }

    /* Didascalia proporzionata */
    .didascalia-wrapper {
        max-height: 30vh;
        font-size: 3vw;
        line-height: 1.3;
        overflow: hidden;
        max-width: 100%;
        margin: 0 auto;
    }

    /* Copertina proporzionata */
    .slot img {
        display: block;
        width: 100%;
        height: auto;
        object-fit: cover;
    }
}


/* ------------------------- */
/* SCHERMI INFERIORI A 510px */
/* ------------------------- */
@media (max-width: 510px) {
    section {
        padding: 4rem 2rem;
        text-align: center;
    }

    .carosello-wrapper {
        padding: 0;
    }


    .premio {
        width: 100%;
    }

    .premio:hover {
        border-left: #061821 solid 0px;
        padding-right: 0px;
    }

    .premio h3 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .premio p {
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }

    /* Ulteriore riduzione testi */
    .slot h3 {
        font-size: 3.8vw;
    }

    .slot h4 {
        font-size: 3.2vw;
    }

    .didascalia-wrapper {
        max-height: 35vh;
        font-size: 3vw;
    }
}

/* Spaziatura sezione notizie */
#notizie {
    margin-top: 3rem; /* distanzia la sezione dall'head */
}

#notizie h3:first-of-type {
    margin-top: 7rem; /* spazio extra solo sul primo titolo */
}

/* Testo articolo singolo giustificato */
.contenuto-articolo {
    text-align: justify;
    line-height: 1.6; /* opzionale: rende più leggibile */
    font-size: clamp(1.1rem, 1.2vw + 0.5rem, 1.3rem); 
}

/* Titolo articolo singolo */
.contenuto-articolo h2 {
    max-width: 100%;        /* stessa larghezza del contenuto */
    margin-top: 4rem;       /* stacco dall'head */
    margin-bottom: 1.5rem;  /* respiro prima del testo */
    text-align: justify;    /* giustificato */
    white-space: nowrap;    /* su una sola riga */
    font-size: clamp(1rem, 4vw, 2rem);
}


@media (max-width: 768px) {
  .titolo-singolo {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    animation: scrollPingPong 8s linear infinite alternate;
  }
}

@keyframes scrollPingPong {
  0%   { transform: translateX(0); }
  100% { transform: translateX(calc(-100% + 100vw - 2rem)); }
}

@media (max-width: 768px) {
  /* il contenitore nasconde le parti fuori dallo schermo */
  .contenuto-articolo {
    overflow: hidden;
  }

  /* il titolo resta su una riga e diventa animabile */
  .contenuto-articolo h2 {
    position: relative;
    white-space: nowrap;
  }

  /* l’elemento interno che scorre orizzontalmente */
  .contenuto-articolo h2 .titolo-scroll {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
    transform: translateX(0);
    animation: titlePingPong var(--titolo-dur, 8s) ease-in-out infinite alternate;
  }
}

@keyframes titlePingPong {
  from { transform: translateX(0); }
  to   { transform: translateX(var(--titolo-dist, 0)); }
}


.contenuto-articolo a {
  color: var(--lavanda);
  text-decoration: none;
  font-weight: bold;
}

.contenuto-articolo a:hover {
  color: var(--ottanio-luminoso);
  text-decoration: none;
  font-weight: bold;
}

/* Il pulsante deve ignorare lo stile dei link normali */
.contenuto-articolo a.enigmi-button {
    color: var(--viola-profondo) !important;
    text-decoration: none !important;
    font-weight: bold;
}


.enigmi-button-wrapper {
    text-align: center;
    margin-top: 2rem;
}


/* Pulsante per aprire l'area enigmi */
.enigmi-button {
    background-color: var(--oro-caldo);
    color: var(--viola-profondo);
    border: none;
    padding: 0.8rem 1.4rem;
    font-size: 2rem;
    cursor: pointer;
    border-radius: 4px;
    transition:
        background-color 0.25s ease,
        transform 0.25s ease;
display: inline-block;
}

.enigmi-button:hover {
    background-color: var(--ottanio-luminoso);
    transform: scale(1.06);
}

/* ===== COVER BIOGRAFIA — TRE BANDE + RESPONSIVE ===== */

/* Bande a tutta larghezza */
.cover-banda1,
.cover-banda2,
.cover-banda3 {
    width: 100%;
}

/* Banda 1: titolo + home */
.cover-banda1 {
    height: 22%;
    background: var(--viola-profondo);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

/* Titolo in banda 1 (desktop) */
.cover-banda1 .title {
    font-family: "Atkinson Hyperlegible", sans-serif;
    font-style: normal;
    font-weight: 400;
    text-transform: uppercase;
    color: var(--oro-caldo);
    font-size: clamp(2.4rem, 5vw, 3.4rem);
}

/* Home in banda 1 (desktop) */
.cover-banda1 nav a {
    color: var(--oro-caldo);
    font-size: clamp(2.4rem, 5vw, 3.4rem);
    text-decoration: none;
}

.cover-banda1 nav a:hover {
    color: var(--ottanio-luminoso);
}

/* Banda 2: citazione (desktop) */
.cover-banda2 {
    height: 56%;
    background: var(--grigio-viola);
    display: flex;
    align-items: center;
    padding-left: 2rem;
}

.cover-banda2 .cover-text {
    line-height: 1.35;
    font-style: italic;
    text-align: left;
    padding-left: 7rem;
    padding-right: 30rem;

    /* 1) font che si adatta allo spazio */
    font-size: clamp(1.2rem, 1.8vw, 2.1rem);

    /* 2) massimo due righe */
    max-height: calc(1.35em * 2);

    /* 3) niente overflow nascosto, niente ellissi */
    overflow: visible;
    white-space: normal;
}


/* Banda 3: vuota (desktop) */
.cover-banda3 {
    height: 22%;
    background: var(--viola-profondo);
}

/* Foto desktop */
.cover img {
    position: absolute;
    right: 10rem;
    top: 50%;
    transform: translateY(-50%);
    width: 260px;
    height: 260px;
    object-fit: cover;
    border-radius: 50%;
    z-index: 10;
}

/* ===== MOBILE — BIOGRAFIA ===== */
@media (max-width: 800px) {

    .cover {
        height: 45dvh;
    }


    /* nuove proporzioni bande in mobile */
    .cover-banda1 {
        height: 18%;
        padding: 0 1.5rem;
    }

    .cover-banda2 {
        height: 50%;
        padding-left: 1.5rem;
    }

    .cover-banda3 {
        height: 25%;
    }

    .cover img {
        left: 50%;
        right: auto;
        top: 43%;
        transform: translate(-50%, -50%);
        width: min(38vw, 180px);
        height: min(38vw, 180px);
    }


    /* Nascondo la citazione in banda 2 in mobile */
    .cover-banda2 .cover-text {
        display: none;
    }

    /* Citazione spostata e centrata in banda 3 */
    .cover-banda3 {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0 1.5rem;
        text-align: center;
    }

    .cover-banda3::before {
        content: "Non c'è sollievo più grande del chiudere un libro sapendo che il mostro era solo inchiostro";
        font-style: italic;
        font-size: 1.1rem;
        max-width: 90%;
        color: var(--bianco-crema);
    }
}



/* Media nelle notizie: immagini e video */
   #notizie img,
   #notizie video {
    max-width: 700px;  /* limite orizzontale */
    max-height: 800px; /* limite verticale */
    width: 100%;
    height: auto;
    object-fit: contain; /* evita distorsioni */
    display: block;
    margin: 1.5rem auto; /* centrato e con respiro */
    border-radius: 6px; /* opzionale: estetica */
}


.contenuto-articolo p, 
.contenuto-articolo li {
    font-size: clamp(1.1rem, 1.2vw + 0.5rem, 1.3rem); 
    line-height: 1.7;
    text-align: justify;

    /* Sillabazione */
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;

    /* Gestione parole lunghe */
    overflow-wrap: break-word;
    word-break: normal;
}

/* Blockquote dentro gli articoli */
.contenuto-articolo blockquote {
    font-size: inherit;              /* stessa dimensione dei paragrafi */
    line-height: inherit;            /* stessa interlinea */
    text-align: justify;             /* giustificato */
    hyphens: auto;                   /* sillabazione */
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    overflow-wrap: break-word;

    margin-left: 2rem;               /* rientro sinistro */
    margin-right: 2rem;              /* rientro destro */
    padding-left: 1rem;
    padding-right: 1rem;
    border-left: 4px solid var(--grigio-viola);
    border-right: 4px solid var(--grigio-viola);
}





/* questo blocco di codice assicura che il modello di box-sizing sia coerente in tutti i browser */
*,
*:before,
*:after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
