/* ==========================================================================
   1. CONFIGURAZIONE GLOBALE & SFONDO
   ========================================================================== */

/* Sfondo generale e stile corpo pagina */
body.storybook-body {
    background-color: #1a1816; /* Tono torba/legno antico di riserva */
    color: #3b5332; 
    font-family: 'EB Garamond', serif;
    margin: 0;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    
    /* Sfumatura scura in sovrapposizione e immagine di sfondo con il tema paesaggistico */
    background-image: linear-gradient(
        rgba(18, 22, 26, 0.85), 
        rgba(18, 22, 26, 0.85)
    ), url('img/eulalia-copertina-estesa.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* Cornice principale tipo "pagina di libro antica o diario" */
.page-frame {
    background-color: #f4efe6; /* Carta pergamena calda e chiara */
    color: #3b5332;
    max-width: 1100px;
    width: 100%;
    padding: 3rem 4rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 40px rgba(139, 115, 85, 0.15);
    border: 1px solid #d3c5b4;
    position: relative;
}

@media(max-width: 768px) {
    .page-frame {
        padding: 1.5rem;
    }
}


/* ==========================================================================
   2. INTESTAZIONE E NAVIGAZIONE (HEADER)
   ========================================================================== */

.story-header {
    text-align: center;
    border-bottom: 2px double #8c7853;
    padding-bottom: 2rem;
    margin-bottom: 3rem;
}

.ornament {
    color: #8c7853;
    font-size: 1.2rem;
    letter-spacing: 0.5rem;
}

.story-header h1 {
    font-family: 'IM Fell English SC', serif;
    font-size: 3rem;
    font-weight: bold;
    margin: 0.5rem 0 0.2rem 0;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
    letter-spacing: 0.05em;
}

.tagline {
    font-style: italic;
    color: #5c5046;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Navigazione interna dell'header */
.story-nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.story-nav a {
    color: #5c5046;
    text-decoration: none;
    font-family: 'IM Fell English SC', serif;
    font-size: 1rem;
    transition: color 0.2s;
}

.story-nav a:hover {
    color: #8c2626; /* Tono rosso scuro/mattone autunnale */
    text-decoration: underline;
}


/* ==========================================================================
   3. TIPOGRAFIA E CONTENUTI GENERALI
   ========================================================================== */

.chapter-section {
    margin-bottom: 4rem;
}

.chapter-section h2 {
    font-family: 'IM Fell English SC', serif;
    font-size: 2rem;
    font-weight: bold;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
    border-bottom: 1px solid #d3c5b4;
    padding-bottom: 0.3rem;
    margin-bottom: 1.5rem;
}

.chapter-section p {
    font-size: 1.15rem;
    line-height: 1.8;
    text-align: justify;
}

/* Capolettera in stile antico */
.drop-cap {
    float: left;
    font-family: 'IM Fell English SC', serif;
    font-size: 3.5rem;
    line-height: 0.8;
    padding-top: 4px;
    padding-right: 8px;
    padding-bottom: 2px;
    color: #8c2626;
}

.edition-tag {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8c2626;
    font-weight: 600;
}

.story-btn {
    display: inline-block;
    margin-top: 1rem;
    color: #8c2626;
    text-decoration: none;
    font-family: 'IM Fell English SC', serif;
    font-size: 1.1rem;
    border-bottom: 1px solid #8c2626;
    padding-bottom: 2px;
}

.story-btn:hover {
    color: #2b2621;
    border-color: #2b2621;
}


/* ==========================================================================
   4. HOME PAGE: SCHEDE OPERA E CAROSELLO
   ========================================================================== */

.book-card-featured {
    display: flex;
    background: #eae2d0;
    border: 1px solid #c8b9a6;
    padding: 2rem;
    gap: 2rem;
    align-items: center;
    border-radius: 2px;
}

@media(max-width: 600px) {
    .book-card-featured {
        flex-direction: column;
        text-align: center;
    }
}

.book-illustration-placeholder {
    min-width: 220px;
    height: 310px;
    background: #dfd4be;
    border: 1px dashed #a8967e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
}

.sketch-tag {
    font-size: 0.8rem;
    color: #7a6a53;
    font-style: italic;
}

.book-title-tag {
    font-family: 'IM Fell English SC', serif;
    font-size: 0.95rem;
    font-weight: bold;
    margin-top: 0.5rem;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
}

.book-details h3 {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0.3rem 0;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
}

/* Stili del Carosello Copertine */
.book-carousel-section {
    margin-bottom: 4rem;
    text-align: center;
}

.carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    background: #eae2d0;
    border: 1px solid #c8b9a6;
    border-radius: 2px;
    padding: 1.5rem 3rem;
    overflow: hidden;
}

.carousel-track-wrapper {
    overflow: hidden;
    width: 100%;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    width: 100%;
}

.carousel-slide {
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    box-sizing: border-box;
    padding: 1rem;
}

@media(max-width: 600px) {
    .carousel-slide {
        flex-direction: column;
        text-align: center;
    }
    .carousel-container {
        padding: 1rem;
    }
}

.carousel-cover-box {
    min-width: 140px;
    height: 190px;
    background: #dfd4be;
    border: 1px dashed #a8967e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
}

.carousel-info {
    text-align: left;
}

@media(max-width: 600px) {
    .carousel-info {
        text-align: center;
    }
}

.carousel-info h3 {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.6rem;
    font-weight: bold;
    margin: 0.2rem 0;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
}

.carousel-info p {
    font-size: 1.05rem;
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

/* Pulsanti di navigazione carosello */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: #f4efe6;
    border: 1px solid #c8b9a6;
    color: #5c5046;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    z-index: 10;
    transition: all 0.2s;
}

.carousel-btn:hover {
    background-color: #8c2626;
    color: #fff;
    border-color: #8c2626;
}

.prev-btn { left: 10px; }
.next-btn { right: 10px; }


/* ==========================================================================
   5. GRIGLIA NOTE / DIARI
   ========================================================================== */

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.note-card {
    background: #eae2d0;
    border: 1px solid #c8b9a6;
    padding: 1.5rem;
    position: relative;
}

.note-date {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #8c2626;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.note-card h4 {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0.5rem 0;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
}

.note-link {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #5c5046;
    text-decoration: none;
    font-style: italic;
}

.note-link:hover {
    color: #8c2626;
}


/* ==========================================================================
   6. PAGINA DI DETTAGLIO LIBRO (`dettaglio.php`)
   ========================================================================== */

.book-detail-section {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

@media(max-width: 768px) {
    .book-detail-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

.book-detail-sidebar {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.book-detail-cover-box {
    width: 100%;
    min-height: 420px;
    background: #dfd4be;
    border: 1px dashed #a8967e;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.book-detail-img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

/* Griglia pulsanti store */
.store-buttons-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.store-btn {
    display: block;
    background-color: #2b2621;
    color: #f4efe6;
    text-align: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    font-family: 'IM Fell English SC', serif;
    font-size: 1rem;
    letter-spacing: 0.05em;
    border-radius: 2px;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.store-btn:hover {
    background-color: #8c2626;
    color: #fff;
    transform: translateY(-2px);
}

.book-detail-content {
    flex: 1;
}

.book-detail-content h2 {
    font-family: 'IM Fell English SC', serif;
    font-size: 2.5rem;
    font-weight: bold;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
    margin: 0.2rem 0 1rem 0;
    border-bottom: none;
    padding-bottom: 0;
}

.author-divider {
    width: 60px;
    height: 1px;
    background-color: #8c7853;
    margin-bottom: 1.5rem;
}

@media(max-width: 768px) {
    .author-divider {
        margin-left: auto;
        margin-right: auto;
    }
}

.book-synopsis h3 {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.4rem;
    font-weight: bold;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
    margin-bottom: 0.8rem;
}

.book-synopsis p {
    font-size: 1.15rem;
    line-height: 1.8;
    text-align: justify;
    color: #3b5332;
    margin-bottom: 1.2rem;
}

/* Box retroscena e note autore */
.book-backstage-box {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background-color: #f0e6d2;
    border-left: 4px solid #8c7853;
    border-radius: 2px;
}

.book-backstage-box h3 {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.3rem;
    font-weight: bold;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
    margin-bottom: 0.8rem;
}

.book-backstage-box p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #3b5332;
    margin-bottom: 0.6rem;
}

.book-backstage-box p strong {
    color: #8c2626;
}

/* Sezione frammenti originali e manoscritto */
.book-fragments-section {
    margin-top: 2.5rem;
}

.book-fragments-section h3 {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.3rem;
    font-weight: bold;
    /* Titoli in verde inchiostro e grassetto */
    color: #3b5332;
    margin-bottom: 1rem;
}

.manuscript-preview-card {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    background-color: #f7f3eb;
    border: 1px dashed #a8967e;
    padding: 1.2rem;
    border-radius: 2px;
    margin-top: 1rem;
}

@media(max-width: 768px) {
    .manuscript-preview-card {
        flex-direction: column;
    }
}

.manuscript-img-wrapper {
    flex: 0 0 200px;
    text-align: center;
    background: #fff;
    padding: 0.50rem;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    border: 1px solid #d9cebc;
}

.manuscript-scan-img {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: cover;
    filter: sepia(0.2);
}

.manuscript-caption {
    display: block;
    font-family: 'IM Fell English', serif;
    font-size: 0.85rem;
    color: #665c51;
    margin-top: 0.4rem;
    font-style: italic;
}

.manuscript-text-wrapper {
    flex: 1;
}

.manuscript-quote {
    margin: 0;
    padding: 0;
    background-color: transparent;
    border-left: none;
    font-style: italic;
    font-size: 1.15rem;
    color: #3b5332;
    line-height: 1.7;
    font-family: 'IM Fell English', serif;
}


/* ==========================================================================
   7. ELEMENTI GRAFICI DI SUPPORTO, LOGHI & FOOTER
   ========================================================================== */

.book-logo-wrapper {
    background: #e6ded0 !important;
    border: 1px solid #bfae96 !important;
    padding: 0.8rem !important;
}

.book-logo-img {
    max-width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.15));
    margin-bottom: 0.4rem;
}

.footer-logo-container {
    margin-bottom: 0.8rem;
}

.footer-logo-symbol {
    width: 42px;
    height: auto;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.footer-logo-symbol:hover {
    opacity: 1;
}

.story-footer {
    text-align: center;
    border-top: 2px double #8c7853;
    padding-top: 2rem;
    margin-top: 4rem;
    font-size: 0.9rem;
    color: #5c5046;
}