/* =============================================================
   Una barca di libri — design system
   Approccio: editoriale museale caldo, accent petrolio (l'Arno),
   tipografia colta (Cormorant + Inter), motion sobria.
   ============================================================= */

:root {
    /* Palette */
    --c-bg:          #faf6ec;
    --c-bg-deep:     #f0e9d4;
    --c-surface:     #ffffff;
    --c-ink:         #1a1410;
    --c-ink-soft:    #5a4a36;
    --c-line:        #e6d8b8;
    --c-line-soft:   #f0e6cc;
    --c-accent:      #1f5e6c;     /* petrolio — l'acqua dell'Arno */
    --c-accent-deep: #144450;
    --c-accent-soft: #4a8a98;
    --c-warm:        #8b4513;     /* legno scuro */
    --c-warm-soft:   #c8a560;     /* legno chiaro / dorato */
    --c-cream:       #fdfaf2;

    /* Tipografia */
    --f-display: 'Cormorant Garamond', 'Garamond', 'Georgia', serif;
    --f-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spazi */
    --s-1:  0.5rem;
    --s-2:  1rem;
    --s-3:  1.5rem;
    --s-4:  2.5rem;
    --s-5:  4rem;
    --s-6:  6rem;
    --s-7:  9rem;

    /* Radii */
    --r-sm: 4px;
    --r-md: 10px;
    --r-lg: 18px;

    /* Shadows */
    --sh-sm: 0 1px 2px rgba(26, 20, 16, 0.06), 0 2px 6px rgba(26, 20, 16, 0.05);
    --sh-md: 0 6px 20px rgba(26, 20, 16, 0.10);
    --sh-lg: 0 24px 64px rgba(26, 20, 16, 0.18);

    /* Transizioni */
    --tr-fast:   180ms cubic-bezier(0.4, 0, 0.2, 1);
    --tr-medium: 360ms cubic-bezier(0.22, 1, 0.36, 1);

    /* Layout */
    --content-max:  1080px;
    --reading-max:  680px;
    --nav-height:   84px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    /* Guardia anti scroll-orizzontale a livello html: applicata qui
       (e non su body) cosi' body resta "non scroll container" e
       position: sticky della .site-nav funziona anche su iOS Safari. */
    overflow-x: clip;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    font-family: var(--f-sans);
    font-size: 17px;
    line-height: 1.6;
    background: var(--c-bg);
    color: var(--c-ink);
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;   /* niente auto-resize iOS in landscape */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* === Accessibility: focus-visible globale =======================
   Stile uniforme per la navigazione tastiera. Non interferisce con
   il click del mouse (focus-visible scatta solo su tab/keyboard). */
:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
    border-radius: 3px;
}
/* Eccezione: bottoni rotondi e CTA gia' gestiscono la propria pillola */
.hero-cta:focus-visible,
.btn-cta-primary:focus-visible,
.slider-arrow:focus-visible {
    outline-offset: 3px;
}

/* === Reading progress bar (#racconto) ========================= */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 80;
    pointer-events: none;
    opacity: 0;
    background: rgba(31, 94, 108, 0.08);
    transition: opacity 360ms ease;
}
.reading-progress.is-visible { opacity: 1; }
.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--c-accent) 0%, var(--c-accent-soft) 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 80ms linear;
    will-change: transform;
}

/* === Patroni strip (sotto la hero) =============================
   Logo wall a due gruppi: "Con il sostegno di" (istituzionali) +
   "In collaborazione con" (partner operativi/curatoriali).
   Ogni logo e' affiancato da un'etichetta visibile col nome del
   partner: anche se l'utente non riconosce il logo, capisce chi e'. */
.patroni-strip {
    background: var(--c-bg-deep);
    border-bottom: 1px solid var(--c-line);
    padding: 1.6rem clamp(1rem, 3vw, 2rem);
    display: flex;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 1.5rem clamp(1.5rem, 4vw, 3rem);
    font-family: var(--f-sans);
}
.patroni-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    flex: 0 1 auto;
}
.patroni-items {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(1.1rem, 2.4vw, 2rem);
    flex-wrap: wrap;
}
.patroni-divider {
    width: 1px;
    align-self: stretch;
    background: var(--c-line);
    flex-shrink: 0;
}
.patroni-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--c-ink-soft);
    font-weight: 500;
    white-space: nowrap;
}

.patroni-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    margin: 0;
    max-width: 130px;
}
.patroni-logo {
    height: 64px;
    width: auto;
    max-width: 110px;
    object-fit: contain;
    mix-blend-mode: multiply;
    opacity: 0.92;
    transition: opacity var(--tr-fast), transform var(--tr-fast);
}
.patroni-item:hover .patroni-logo {
    opacity: 1;
    transform: translateY(-1px);
}
/* Il timbro dei "Santi Bevitori" è un disegno B/N: niente blend
   per non perdere contrasto, e leggermente piu' grande */
.patroni-logo-stamp {
    mix-blend-mode: normal;
    height: 76px;
    max-width: 100px;
}

.patroni-name {
    font-family: var(--f-sans);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--c-ink);
    letter-spacing: 0.01em;
}
.patroni-meta {
    display: inline-block;
    margin-top: 0.15rem;
    font-weight: 400;
    font-size: 0.68rem;
    color: var(--c-ink-soft);
}

@media (max-width: 760px) {
    .patroni-divider { display: none; }
    .patroni-strip {
        padding: 1.4rem 1rem;
        gap: 1.4rem;
    }
    .patroni-items { gap: 1rem; }
    .patroni-logo { height: 54px; max-width: 90px; }
    .patroni-logo-stamp { height: 64px; max-width: 84px; }
    .patroni-item { max-width: 110px; }
    .patroni-name { font-size: 0.7rem; }
    .patroni-meta { font-size: 0.62rem; }
}
@media (max-width: 480px) {
    .patroni-strip { padding: 1.2rem 0.8rem; gap: 1rem; }
    .patroni-items { gap: 0.8rem; }
    .patroni-logo { height: 44px; max-width: 76px; }
    .patroni-logo-stamp { height: 54px; max-width: 70px; }
    .patroni-item { max-width: 96px; gap: 0.35rem; }
    .patroni-label {
        font-size: 0.66rem;
        letter-spacing: 0.12em;
        white-space: normal;
        text-align: center;
    }
}

/* === Sticky nav =============================================== */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.4rem;
    background: rgba(250, 246, 236, 0.85);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.site-nav.scrolled {
    border-bottom-color: var(--c-line);
    box-shadow: var(--sh-sm);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
/* Logo SVG ufficiale: l'altezza definisce la dimensione (ratio 1.41:1) */
.nav-brand-logo {
    height: 64px;
    width: auto;
    display: block;
}
@media (max-width: 600px) {
    .nav-brand-logo { height: 52px; }
}
/* Default (.page-boat e .page-home.scrolled): mostra solo il nero */
.nav-brand-logo-light { display: none; }
.nav-brand-logo-dark  { display: block; }
/* Sopra hero della home (nav trasparente): inverti */
.page-home .site-nav:not(.scrolled) .nav-brand-logo-dark  { display: none; }
.page-home .site-nav:not(.scrolled) .nav-brand-logo-light { display: block; }
@media (max-width: 760px) {
    /* Quando il menu mobile e' aperto sopra l'hero, la nav e' chiara
       quindi tornare al logo nero. */
    .page-home .site-nav:has(.nav-list.is-open) .nav-brand-logo-dark  { display: block; }
    .page-home .site-nav:has(.nav-list.is-open) .nav-brand-logo-light { display: none; }
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.nav-list a {
    font-family: var(--f-sans);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--c-ink-soft);
    padding: 0.45rem 0.85rem;
    border-radius: var(--r-sm);
    position: relative;
    transition: color var(--tr-fast), background var(--tr-fast);
}
.nav-list a:hover {
    color: var(--c-ink);
    background: var(--c-line-soft);
}
.nav-list a.is-active {
    color: var(--c-accent);
}
.nav-list a.is-active::after {
    content: "";
    position: absolute;
    left: 0.85rem;
    right: 0.85rem;
    bottom: 0.2rem;
    height: 2px;
    background: var(--c-accent);
    border-radius: 1px;
}

.nav-toggle { display: none; }

@media (max-width: 760px) {
    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        gap: 4px;
        width: 44px;
        height: 44px;
        padding: 10px 8px;
        background: transparent;
        border: 0;
        cursor: pointer;
        align-items: center;
        justify-content: center;
    }
    .nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--c-ink);
        transition: transform var(--tr-fast), opacity var(--tr-fast);
        transform-origin: center;
    }
    .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
    .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    .nav-list {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        /* Padding orizzontale sempre, padding verticale e border-bottom
           solo quando aperto: cosi' nello stato chiuso non c'e' nessuna
           "striscia" residua sotto l'header anche se il browser non
           comprime perfettamente padding/border con max-height: 0. */
        padding: 0 clamp(1rem, 4vw, 1.6rem);
        background: var(--c-bg);
        border-bottom: 0 solid var(--c-line);
        max-height: 0;
        overflow: hidden;
        transition: max-height 460ms cubic-bezier(0.22, 1, 0.36, 1),
                    box-shadow 360ms ease;
        /* Counter per numerare le voci 01, 02, 03... in stile editoriale,
           coerente con i numeri delle offer-card della sezione "Sperimenta". */
        counter-reset: nav-i;
    }
    .nav-list.is-open {
        max-height: 640px;
        padding-top: 0.5rem;
        padding-bottom: 1.1rem;
        border-bottom-width: 1px;
        box-shadow: 0 18px 36px rgba(26, 20, 16, 0.12);
    }
    .nav-list li {
        counter-increment: nav-i;
        border-bottom: 1px solid var(--c-line-soft);
        opacity: 0;
        transform: translateY(-6px);
    }
    .nav-list li:last-child { border-bottom: 0; }
    .nav-list.is-open li {
        animation: navItemIn 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }
    .nav-list.is-open li:nth-child(1) { animation-delay:  70ms; }
    .nav-list.is-open li:nth-child(2) { animation-delay: 120ms; }
    .nav-list.is-open li:nth-child(3) { animation-delay: 170ms; }
    .nav-list.is-open li:nth-child(4) { animation-delay: 220ms; }
    .nav-list.is-open li:nth-child(5) { animation-delay: 270ms; }
    .nav-list.is-open li:nth-child(6) { animation-delay: 320ms; }
    .nav-list.is-open li:nth-child(n+7) { animation-delay: 360ms; }

    .nav-list a {
        display: flex;
        align-items: baseline;
        gap: 1rem;
        padding: 0.95rem 0.3rem;
        border-radius: 0;
        font-family: var(--f-display);
        font-weight: 500;
        font-size: 1.32rem;
        line-height: 1.1;
        letter-spacing: 0.005em;
        color: var(--c-ink);
        position: relative;
        transition: color var(--tr-fast), padding-left var(--tr-fast);
    }
    /* Numero progressivo in piccolo accanto a ogni voce: tipografia
       sans-serif e colore accent (petrolio dell'Arno) per dare il
       tono "indice di capitolo". */
    .nav-list a::before {
        content: counter(nav-i, decimal-leading-zero);
        flex: 0 0 auto;
        min-width: 1.8em;
        font-family: var(--f-sans);
        font-size: 0.68rem;
        font-weight: 600;
        letter-spacing: 0.2em;
        color: var(--c-accent);
        opacity: 0.7;
        transform: translateY(-1px);
        transition: opacity var(--tr-fast), color var(--tr-fast);
    }
    /* Freccia di chiusura/azione, allineata a destra. Invisibile
       di default, scivola dentro su hover/focus o per la voce attiva. */
    .nav-list a::after {
        content: "→";
        margin-left: auto;
        font-family: var(--f-sans);
        font-size: 0.95rem;
        line-height: 1;
        color: var(--c-ink-soft);
        opacity: 0;
        transform: translateX(-8px);
        transition: opacity var(--tr-fast), transform var(--tr-fast),
                    color var(--tr-fast);
    }
    .nav-list a:hover,
    .nav-list a:focus-visible {
        color: var(--c-accent);
        background: transparent;
        padding-left: 0.7rem;
    }
    .nav-list a:hover::before,
    .nav-list a:focus-visible::before {
        opacity: 1;
    }
    .nav-list a:hover::after,
    .nav-list a:focus-visible::after {
        opacity: 1;
        transform: translateX(0);
        color: var(--c-accent);
    }
    .nav-list a:active { color: var(--c-accent-deep); }
    .nav-list a.is-active {
        color: var(--c-accent);
        padding-left: 0.7rem;
    }
    .nav-list a.is-active::before {
        opacity: 1;
        color: var(--c-accent);
    }
    .nav-list a.is-active::after {
        opacity: 1;
        transform: translateX(0);
        color: var(--c-accent);
    }
}

@keyframes navItemIn {
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .nav-list li { opacity: 1; transform: none; }
    .nav-list.is-open li { animation: none; }
}

/* === Reveal motion ============================================
   Progressive enhancement: di default i .reveal sono visibili.
   JS aggiunge .reveal-init per attivare il fade-in, e poi
   .is-visible quando l'elemento entra in viewport. Cosi' se JS
   non gira o crasha, la pagina rimane navigabile. */
.reveal.reveal-init {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 700ms ease, transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.reveal-init.is-visible {
    opacity: 1;
    transform: none;
}
@media (prefers-reduced-motion: reduce) {
    .reveal.reveal-init { opacity: 1; transform: none; transition: none; }
}

/* === Eyebrow / section title ================================== */
.eyebrow {
    font-family: var(--f-sans);
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--c-accent);
    margin-bottom: 1.2rem;
}
.section-title {
    font-family: var(--f-display);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.005em;
    font-size: clamp(2rem, 4.6vw, 3.4rem);
    color: var(--c-ink);
    margin-bottom: 2rem;
}

/* === Hero — full-bleed cinematica =============================
   Foto a tutto schermo (100vh / 100svh su mobile), titolo serif
   gigantesco allineato in basso a sinistra, scroll cue a destra.
   La nav, sopra l'hero, e' trasparente con testo cream; appena
   scorri (.scrolled) torna alla skin chiara backdrop-blur.
   ============================================================ */
.hero-cinematic {
    position: relative;
    width: 100%;
    /* Subito sotto la sticky nav: facciamo entrare l'hero anche
       sotto la nav, per un effetto "foto a tutto schermo". */
    margin-top: calc(var(--nav-height) * -1);
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    color: var(--c-cream);

    /* Foto come background cover: fisso al centro, copertura piena.
       Niente <img>: così evitiamo zoom-Ken-Burns e tearing su mobile.
       Le var --hero-mx/--hero-my sono aggiornate da JS sul movimento del
       mouse per un parallax 3D molto sottile (1-1.5%). Default 0 = niente
       offset se JS non gira o se prefers-reduced-motion. */
    --hero-mx: 0px;
    --hero-my: 0px;
    background-color: #0d0a08;
    /* path relativo al CSS (sta in /css/), risale di un livello */
    background-image: url('../BarcaConArno.jpg');
    background-size: cover;
    background-position: calc(50% + var(--hero-mx)) calc(38% + var(--hero-my));
    background-repeat: no-repeat;
}

/* Overlay multi-strato per rendere il testo leggibile in ogni
   condizione di luce della foto:
   - linear bottom->top scuro forte (titolo in basso)
   - linear left->right scuro su sinistra (zona del testo)
   - lieve vignettatura radiale globale */
.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(to top,
            rgba(8, 6, 4, 0.92) 0%,
            rgba(8, 6, 4, 0.78) 18%,
            rgba(8, 6, 4, 0.45) 42%,
            rgba(8, 6, 4, 0.18) 70%,
            rgba(8, 6, 4, 0.55) 100%),
        linear-gradient(to right,
            rgba(8, 6, 4, 0.55) 0%,
            rgba(8, 6, 4, 0.18) 38%,
            rgba(8, 6, 4, 0)    62%),
        radial-gradient(ellipse at center,
            rgba(8, 6, 4, 0)    0%,
            rgba(8, 6, 4, 0)    50%,
            rgba(8, 6, 4, 0.3)  100%);
}

.hero-stage {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(1.4rem, 5vw, 4rem) clamp(3rem, 8vh, 5.5rem);
}

.hero-cinematic .hero-eyebrow {
    color: var(--c-warm-soft);
    margin-bottom: 0.4rem;
}

.hero-cinematic .hero-title {
    font-family: var(--f-display);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.025em;
    /* Clamp scalato: parte da 1.9rem su mobile (~32px) per evitare
       overflow su 320px senza nowrap. Su mobile permettiamo il wrap. */
    font-size: clamp(1.9rem, 6.6vw, 7.5rem);
    color: var(--c-cream);
    margin: 0.7rem 0 1.6rem;
    text-shadow:
        0 2px 18px rgba(0, 0, 0, 0.55),
        0 1px 3px  rgba(0, 0, 0, 0.45);
    /* Bilancia il wrap visivamente (browser supportati: ignorato altrove) */
    text-wrap: balance;
}
.hero-cinematic .hero-title em {
    font-style: italic;
    font-weight: 400;
    color: var(--c-cream);
    opacity: 0.92;
}

.hero-cinematic .hero-lead {
    max-width: 560px;
    margin: 0 0 2.2rem;
    font-size: clamp(1.04rem, 1.4vw, 1.22rem);
    line-height: 1.55;
    color: rgba(253, 250, 242, 0.94);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.hero-cinematic .hero-cta-row {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.hero-cinematic .hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--f-sans);
    font-weight: 500;
    font-size: 0.95rem;
    background: var(--c-cream);
    color: var(--c-ink);
    padding: 0.8rem 1.6rem;
    border: 1px solid var(--c-cream);
    border-radius: 999px;
    text-decoration: none;
    transition: background var(--tr-fast), color var(--tr-fast),
                border-color var(--tr-fast), transform var(--tr-fast);
}
.hero-cinematic .hero-cta:hover {
    background: var(--c-accent);
    color: var(--c-cream);
    border-color: var(--c-accent);
    transform: translateY(-2px);
}
.hero-cinematic .hero-cta-ghost {
    background: transparent;
    color: var(--c-cream);
    border-color: rgba(253, 250, 242, 0.55);
}
.hero-cinematic .hero-cta-ghost:hover {
    background: rgba(253, 250, 242, 0.12);
    border-color: var(--c-cream);
    color: var(--c-cream);
    transform: translateY(-2px);
}

/* Scroll cue a destra: linea sottile che pulsa in basso */
.hero-scroll {
    position: absolute;
    z-index: 2;
    right: clamp(1.4rem, 5vw, 4rem);
    bottom: clamp(1.6rem, 5vh, 3rem);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--f-sans);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: rgba(253, 250, 242, 0.72);
    text-decoration: none;
    transition: color var(--tr-fast);
}
.hero-scroll:hover { color: var(--c-cream); }
.hero-scroll-line {
    display: block;
    width: 1px;
    height: 56px;
    background: linear-gradient(to bottom, transparent, rgba(253, 250, 242, 0.7));
    transform-origin: top;
}
@media (prefers-reduced-motion: no-preference) {
    .hero-scroll-line {
        animation: scrollLineDrop 2.4s ease-in-out infinite;
    }
}
@keyframes scrollLineDrop {
    0%, 100% { transform: scaleY(0.55); }
    50%      { transform: scaleY(1); }
}

/* Photo credit in piccolo: corsivo, basso a sinistra, opzionale */
.hero-credit {
    position: absolute;
    z-index: 2;
    left: clamp(1.4rem, 5vw, 4rem);
    bottom: 1.1rem;
    margin: 0;
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.78rem;
    color: rgba(253, 250, 242, 0.5);
    letter-spacing: 0.02em;
}

@media (max-width: 700px) {
    .hero-cinematic { min-height: 92svh; }
    .hero-credit { display: none; }
    .hero-scroll {
        right: 50%;
        transform: translateX(50%);
        bottom: 1rem;
    }
    .hero-scroll-line { height: 36px; }
    .hero-cinematic .hero-cta-row { width: 100%; }
    .hero-cinematic .hero-cta {
        flex: 1 1 auto;
        justify-content: center;
        padding: 0.85rem 1.2rem;
        min-height: 44px;
    }
}
@media (max-width: 480px) {
    .hero-cinematic { min-height: 88svh; }
    .hero-stage { padding-bottom: clamp(2.4rem, 6vh, 4rem); }
    .hero-cinematic .hero-title {
        font-size: clamp(1.8rem, 9vw, 2.6rem);
        line-height: 1.08;
        margin: 0.5rem 0 1.1rem;
    }
    .hero-cinematic .hero-lead {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 1.6rem;
    }
}

/* === Nav: skin trasparente sopra l'hero cinematica =============
   Solo sulla home (.page-home), e solo finche' non c'e' .scrolled.
   La nav esiste sopra l'hero (l'hero ha margin-top negativo). */
.page-home .site-nav {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom-color: transparent;
}
.page-home .site-nav .nav-brand,
.page-home .site-nav .nav-list a {
    color: var(--c-cream);
}
.page-home .site-nav .nav-list a:hover {
    color: var(--c-cream);
    background: rgba(253, 250, 242, 0.14);
}
.page-home .site-nav .nav-toggle span {
    background: var(--c-cream);
}
/* Una volta scrollati: la nav ritorna alla skin chiara */
.page-home .site-nav.scrolled {
    background: rgba(250, 246, 236, 0.92);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom-color: var(--c-line);
    box-shadow: var(--sh-sm);
}
.page-home .site-nav.scrolled .nav-brand,
.page-home .site-nav.scrolled .nav-list a {
    color: var(--c-ink-soft);
}
.page-home .site-nav.scrolled .nav-brand { color: var(--c-ink); }
.page-home .site-nav.scrolled .nav-list a:hover {
    color: var(--c-ink);
    background: var(--c-line-soft);
}
.page-home .site-nav.scrolled .nav-list a.is-active { color: var(--c-accent); }
.page-home .site-nav.scrolled .nav-toggle span { background: var(--c-ink); }
@media (max-width: 760px) {
    /* Quando il menu mobile e' aperto sopra l'hero, lo sfondo
       trasparente sarebbe illeggibile -> diamogli skin chiara */
    .page-home .site-nav:has(.nav-list.is-open) {
        background: rgba(250, 246, 236, 0.96);
        backdrop-filter: saturate(140%) blur(10px);
        -webkit-backdrop-filter: saturate(140%) blur(10px);
    }
    .page-home .site-nav:has(.nav-list.is-open) .nav-brand,
    .page-home .site-nav:has(.nav-list.is-open) .nav-toggle span {
        color: var(--c-ink);
        background: var(--c-ink);
    }
    .page-home .site-nav:has(.nav-list.is-open) .nav-brand { background: transparent; }
    /* Quando il menu mobile e' aperto sopra l'hero, le voci di menu
       devono essere leggibili sul fondo crema del dropdown: forziamo
       il colore inchiostro (altrimenti restano cream-su-cream). */
    .page-home .site-nav:has(.nav-list.is-open) .nav-list a {
        color: var(--c-ink);
    }
    .page-home .site-nav:has(.nav-list.is-open) .nav-list a:hover,
    .page-home .site-nav:has(.nav-list.is-open) .nav-list a:focus-visible {
        color: var(--c-accent);
        background: transparent;
    }
    .page-home .site-nav:has(.nav-list.is-open) .nav-list a.is-active {
        color: var(--c-accent);
    }
}

/* Anchor offset (per la sticky nav) */
section[id] { scroll-margin-top: calc(var(--nav-height) + 16px); }

/* === Sezione barche: slider sulla homepage ==================== */
.boats-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-5) 1.4rem var(--s-6);
}
.boats-intro {
    text-align: center;
    max-width: 720px;
    margin: 0 auto var(--s-4);
}
.boats-intro .section-title { margin-bottom: 1.2rem; }

/* === Sezione "Scopri le altre barche" sulla pagina barca ========
   Stesso layout della .boats-section della home, con un divisore
   sopra per staccarla dal contenuto della barca corrente. */
.other-boats-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-5) 1.4rem var(--s-6);
    border-top: 1px solid var(--c-line);
}
.other-boats-intro {
    text-align: center;
    max-width: 720px;
    margin: 0 auto var(--s-4);
}
.other-boats-intro .section-title { margin-bottom: 1rem; }
.other-boats-intro .section-lead {
    font-size: 1.02rem;
    color: var(--c-ink-soft);
}

.boats-slider-wrap {
    position: relative;
    margin-top: 1.5rem;
}
.boats-slider {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 1.4rem;
    padding: 0.6rem 1.4rem 1.6rem;
    margin: 0 -1.4rem;
    scrollbar-width: thin;
}
.boats-slider::-webkit-scrollbar { height: 6px; }
.boats-slider::-webkit-scrollbar-thumb {
    background: var(--c-line);
    border-radius: 3px;
}

.boat-card-public {
    flex: 0 0 min(360px, 80vw);
    scroll-snap-align: start;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 280ms ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}
.boat-card-public:hover {
    transform: translateY(-6px);
    box-shadow: var(--sh-md);
}
.boat-card-public-photo {
    aspect-ratio: 16 / 10;
    background-color: var(--c-bg-deep);
    background-size: cover;
    background-position: center;
}
.boat-card-public-photo.is-empty {
    background: linear-gradient(135deg, var(--c-bg-deep) 0%, var(--c-line) 100%);
}
.boat-card-public-body {
    padding: 1.2rem 1.3rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}
.boat-card-public-eyebrow {
    font-family: var(--f-sans);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-accent);
    margin: 0;
}
.boat-card-public-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.5rem;
    line-height: 1.15;
    color: var(--c-ink);
    margin: 0;
}
.boat-card-public-desc {
    font-size: 0.9rem;
    color: var(--c-ink-soft);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.boat-card-public-stats {
    font-family: var(--f-sans);
    font-size: 0.78rem;
    color: var(--c-ink-soft);
    margin: 0.2rem 0 0;
    padding-top: 0.6rem;
    border-top: 1px solid var(--c-line);
}
.boat-card-public-cta {
    margin-top: auto;
    font-family: var(--f-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--c-accent);
    align-self: flex-start;
    padding-top: 0.4rem;
}
.boat-card-public:hover .boat-card-public-cta {
    color: var(--c-accent-deep);
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--c-line);
    background: var(--c-surface);
    color: var(--c-accent);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--sh-sm);
    transition: background 0.18s ease, transform 0.18s ease;
    z-index: 2;
}
.slider-arrow:hover:not(:disabled) {
    background: var(--c-accent);
    color: var(--c-cream);
}
.slider-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.slider-arrow-prev { left: -10px; }
.slider-arrow-next { right: -10px; }
@media (max-width: 700px) {
    .slider-arrow { display: none; }
}

/* === Curator intro (sezione "video del curatore") =============
   Layout 2 colonne: video aspect-ratio 16/9 a sx, blocco curatore
   a dx con eyebrow, nome, ruolo, blurb. Fondo bg-deep per staccare
   dal resto del flusso. Su mobile (<=860px) si impila. */
.curator-intro {
    background: var(--c-bg-deep);
    border-top: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
    margin: clamp(2rem, 4vw, 3.5rem) 0 0;
    padding: clamp(2rem, 5vw, 3.5rem) 0;
}
.curator-intro-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 1.4rem;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
}
@media (max-width: 860px) {
    .curator-intro-inner {
        grid-template-columns: 1fr;
        gap: 1.6rem;
    }
}

.curator-video-wrap {
    margin: 0;
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-md);
    background: #0d0a08;
}
.curator-video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #0d0a08;
}
.curator-video-iframe,
.curator-video-file {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    object-fit: cover;
}

.curator-intro-text {
    font-family: var(--f-sans);
}
.curator-intro-text .eyebrow {
    margin-bottom: 0.6rem;
}
.curator-name {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.1;
    color: var(--c-ink);
    margin: 0 0 0.4rem;
}
.curator-role {
    font-family: var(--f-sans);
    font-size: 0.86rem;
    color: var(--c-ink-soft);
    text-transform: none;
    letter-spacing: 0.01em;
    margin: 0 0 1.2rem;
}
.curator-blurb {
    font-family: var(--f-display);
    font-style: italic;
    font-size: clamp(1.05rem, 1.4vw, 1.2rem);
    line-height: 1.55;
    color: var(--c-ink);
    margin: 0;
    /* Trattino-citazione visivo davanti */
    border-left: 2px solid var(--c-accent);
    padding-left: 1rem;
}

/* === Riga condivisione (barca.html) =========================== */
.boat-share {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 1.4rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.9rem;
    margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}
.boat-share-label {
    font-family: var(--f-sans);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-ink-soft);
    font-weight: 500;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.95rem 0.5rem 0.7rem;
    border-radius: 999px;
    font-family: var(--f-sans);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.18s ease;
    white-space: nowrap;
}
.share-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.share-btn-wa {
    background: #25d366;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.25);
}
.share-btn-wa:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.40);
    filter: brightness(1.05);
}
.share-btn-wa:focus-visible {
    outline: 2px solid #128c7e;
    outline-offset: 3px;
}

/* Esportazione bibliografia: stessa pillola del WhatsApp,
   palette piu' sobria (legno scuro per PDF, petrolio per CSV) */
.share-btn-pdf {
    background: var(--c-warm);
    color: var(--c-cream);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.22);
}
.share-btn-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.35);
    filter: brightness(1.05);
}
.share-btn-csv {
    background: var(--c-accent);
    color: var(--c-cream);
    box-shadow: 0 2px 8px rgba(31, 94, 108, 0.22);
}
.share-btn-csv:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(31, 94, 108, 0.35);
    filter: brightness(1.05);
}
.share-btn-pdf .share-btn-icon,
.share-btn-csv .share-btn-icon {
    width: auto;
    height: auto;
    font-size: 1rem;
    line-height: 1;
}

@media (max-width: 600px) {
    .boat-share {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.6rem;
    }
    .boat-share-label { width: 100%; text-align: center; margin-bottom: 0.2rem; }
    .share-btn {
        flex: 1 1 calc(33.333% - 0.6rem);
        justify-content: center;
        padding: 0.6rem 0.7rem;
        font-size: 0.82rem;
        min-height: 40px;
    }
}
@media (max-width: 380px) {
    .share-btn { flex: 1 1 100%; }
}

/* === Boat hero (barca.html) =================================== */
.boat-hero {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4rem) 1.4rem clamp(2rem, 5vw, 4rem);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}
@media (max-width: 820px) {
    .boat-hero {
        grid-template-columns: 1fr;
        text-align: left;
    }
}
.boat-hero-text { display: flex; flex-direction: column; gap: 0.7rem; }
.boat-hero-eyebrow:empty { display: none; }
.boat-hero-title {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    margin: 0.3rem 0 0.5rem;
}
.boat-hero-subtitle {
    font-family: var(--f-display);
    font-style: italic;
    font-size: clamp(1.05rem, 1.8vw, 1.3rem);
    color: var(--c-ink-soft);
    margin: 0;
}
.boat-hero-subtitle:empty { display: none; }
.boat-hero-description {
    font-size: clamp(1rem, 1.3vw, 1.1rem);
    line-height: 1.55;
    color: var(--c-ink-soft);
    margin-top: 0.8rem;
}
.boat-hero-description:empty { display: none; }
.boat-hero-photo {
    margin: 0;
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-lg);
}
.boat-hero-photo img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* === Sezione video (barca.html) =============================== */
.videos-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-5) 1.4rem var(--s-6);
    text-align: center;
}
.videos-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
    gap: 1.6rem;
    margin-top: 1.5rem;
    text-align: left;
}
.video-item {
    margin: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-sm);
}
.video-item iframe,
.video-item video {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    border: 0;
    background: #000;
}
.video-item figcaption {
    padding: 0.8rem 1rem;
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--c-ink-soft);
    border-top: 1px solid var(--c-line);
}

/* === Sezione scaffale: layout editoriale =====================
   Mappa-timone sticky a sx + griglia di libri raggruppati per
   ripiano a dx. Su mobile si stacka verticalmente.
================================================================ */
.bookshelf-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-5) 1.4rem var(--s-6);
}
.bookshelf-intro {
    text-align: center;
    max-width: 720px;
    margin: 0 auto var(--s-4);
}
.bookshelf-intro .section-title {
    margin-bottom: 1.2rem;
}
.section-lead {
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.05rem;
    color: var(--c-ink-soft);
    line-height: 1.55;
}

/* === Search + filter sopra lo scaffale ========================
   Input ricerca live + select ripiano + counter risultati.
   Le card che non matchano ricevono .is-muted (opacity ridotta). */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.bookshelf-search {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1rem;
    align-items: center;
    margin: 0 auto var(--s-4);
    max-width: 760px;
}
.bookshelf-search-field {
    position: relative;
    flex: 1 1 240px;
    display: flex;
    align-items: center;
}
.bookshelf-search-icon {
    position: absolute;
    left: 0.85rem;
    pointer-events: none;
    color: var(--c-ink-soft);
    font-size: 1.05rem;
}
.bookshelf-search input[type="search"] {
    width: 100%;
    font-family: var(--f-sans);
    font-size: 0.95rem;
    padding: 0.62rem 2.2rem 0.62rem 2.2rem;
    border: 1px solid var(--c-line);
    border-radius: 999px;
    background: var(--c-surface);
    color: var(--c-ink);
    transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.bookshelf-search input[type="search"]:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(31, 94, 108, 0.12);
}
.bookshelf-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.bookshelf-search-clear {
    position: absolute;
    right: 0.6rem;
    width: 22px; height: 22px;
    border: 0;
    background: var(--c-line);
    color: var(--c-ink);
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bookshelf-search-clear:hover { background: var(--c-accent); color: var(--c-cream); }

.bookshelf-search-shelf select {
    font-family: var(--f-sans);
    font-size: 0.92rem;
    padding: 0.62rem 2.2rem 0.62rem 1rem;
    border: 1px solid var(--c-line);
    border-radius: 999px;
    background: var(--c-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%235a4a36' d='M0 0l5 6 5-6z'/></svg>") right 0.95rem center no-repeat;
    background-size: 10px 6px;
    color: var(--c-ink);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.bookshelf-search-shelf select:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(31, 94, 108, 0.12);
}

.bookshelf-search-count {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    font-style: italic;
    flex-basis: 100%;
    margin: 0;
    min-height: 1.2em;
}
.bookshelf-search-count.is-active {
    color: var(--c-accent);
    font-weight: 500;
}

/* Card opacata se non matcha la ricerca */
.book-card.is-muted {
    opacity: 0.18;
    pointer-events: none;
    filter: grayscale(0.6);
    transition: opacity var(--tr-medium), filter var(--tr-medium);
}
.book-card { transition: opacity var(--tr-medium), filter var(--tr-medium); }

/* === Cascade reveal libri (single-shot all'arrivo nello scaffale) ====
   I libri partono invisibili + leggermente sotto la posizione finale,
   poi atterrano con stagger ms (delay calcolato in JS). Animazione
   one-shot via @keyframes + animation-fill-mode forwards: lo stato
   finale resta locked, e i transition di hover/mute funzionano dopo. */
.book-card.book-card-reveal {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
}
.bookshelf-section.is-revealed .book-card.book-card-reveal {
    animation: bookCardLand 720ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: var(--reveal-delay, 0ms);
}
@keyframes bookCardLand {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@media (prefers-reduced-motion: reduce) {
    .book-card.book-card-reveal {
        opacity: 1;
        transform: none;
        animation: none !important;
    }
}

.bookshelf-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
}
@media (max-width: 820px) {
    .bookshelf-layout { grid-template-columns: 1fr; gap: var(--s-4); }
}

/* === Mappa-timone (aside sticky) ============================== */
.rudder-map {
    position: sticky;
    top: calc(var(--nav-height) + 1.5rem);
    text-align: center;
}
@media (max-width: 820px) {
    .rudder-map {
        position: static;
        max-width: 240px;
        margin: 0 auto;
    }
}

/* Foto originale dell'esposizione (sopra la mappa interattiva).
   Cliccabile -> apre il lightbox a piena schermata. */
.exhibit-photo {
    margin: 0 0 1.4rem;
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(26, 20, 16, 0.16);
    cursor: zoom-in;
    transition: transform 280ms ease, box-shadow 280ms ease;
    background: var(--c-bg-deep);
}
.exhibit-photo:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(26, 20, 16, 0.22);
}
.exhibit-photo img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 3660 / 3708;
    object-fit: cover;
}
.exhibit-photo figcaption {
    padding: 0.5rem 0.7rem 0.6rem;
    background: var(--c-cream);
    border-top: 1px solid var(--c-line);
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.78rem;
    color: var(--c-ink-soft);
    text-align: center;
    line-height: 1.3;
}

.aside-section-label {
    font-family: var(--f-sans);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--c-accent);
    margin-bottom: 0.6rem;
    text-align: center;
}

.rudder-mini {
    width: 100%;
    height: auto;
    max-width: 240px;
    display: block;
    margin: 0 auto 1rem;
}
.mini-shelf-line {
    stroke: var(--c-accent);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke 220ms ease, stroke-width 220ms ease, filter 220ms ease;
    pointer-events: none;
}
.mini-shelf-hit {
    stroke: transparent;
    stroke-width: 14;
    cursor: pointer;
}
.mini-shelf-line.is-hover {
    stroke: var(--c-accent-deep);
    stroke-width: 5;
}
/* Stato attivo (scroll-spy): ripiano corrente piu' marcato + alone */
.mini-shelf-line.is-active {
    stroke: var(--c-warm-soft);
    stroke-width: 6;
    filter: drop-shadow(0 0 6px rgba(200, 165, 96, 0.55));
}
@media (prefers-reduced-motion: no-preference) {
    .mini-shelf-line.is-active {
        animation: miniShelfPulse 2s ease-in-out infinite;
    }
}
@keyframes miniShelfPulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(200, 165, 96, 0.55)); }
    50%      { filter: drop-shadow(0 0 12px rgba(200, 165, 96, 0.85)); }
}
.map-meta {
    font-family: var(--f-sans);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-ink-soft);
}
.map-meta strong {
    color: var(--c-accent);
    font-weight: 600;
}

/* === Griglia dei libri ======================================== */
.books-grid {
    display: flex;
    flex-direction: column;
    gap: clamp(2.4rem, 4vw, 3.2rem);
}
.shelf-group {
    scroll-margin-top: calc(var(--nav-height) + 1.5rem);
}
.shelf-heading {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    color: var(--c-ink);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--c-line);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}
.shelf-heading .shelf-num {
    font-family: var(--f-sans);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-accent);
}

/* Singola riga per ripiano, con esattamente --book-count colonne
   (impostata da JS in base al numero di libri del ripiano).
   Cap 110px per card: dimensione coerente con i ripiani 4-5
   (dove i libri sono naturalmente piu' stretti). Sui ripiani 1-3
   con pochi libri, le card non si gonfiano oltre il cap → tutti
   i libri appaiono della stessa taglia.
   Allineamento a sinistra: i ripiani con meno libri lasciano lo
   spazio vuoto a destra, mimando la diagonale del timone reale. */
.shelf-cards {
    display: grid;
    grid-template-columns: repeat(var(--book-count, 5), minmax(0, 90px));
    gap: clamp(0.5rem, 1.2vw, 1rem);
    justify-content: start;
    align-items: end;
}

/* Su schermi stretti i ripiani non ci stanno tutti su una riga.
   Switch a flex orizzontale scrollabile con snap, 1 riga sempre. */
@media (max-width: 700px) {
    .shelf-cards {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 0.8rem;
        padding-bottom: 0.6rem;
        margin-right: -1.4rem;
        padding-right: 1.4rem;
        scrollbar-width: thin;
    }
    .shelf-cards .book-card {
        flex: 0 0 108px;
        scroll-snap-align: start;
    }
}

/* === Card del libro =========================================== */
.book-card {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.book-card:hover { transform: translateY(-4px); }
.book-card:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 4px;
    border-radius: var(--r-sm);
}

.book-card-cover {
    aspect-ratio: 2 / 3;
    background-color: var(--c, var(--c-warm));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 3px 5px 4px 3px;
    box-shadow:
        inset -3px 0 6px rgba(0, 0, 0, 0.18),
        inset 3px 0 4px rgba(0, 0, 0, 0.14),
        0 6px 14px rgba(26, 20, 16, 0.14);
    transition: box-shadow 280ms ease;
    position: relative;
    overflow: hidden;
}
.book-card:hover .book-card-cover {
    box-shadow:
        inset -3px 0 6px rgba(0, 0, 0, 0.18),
        inset 3px 0 4px rgba(0, 0, 0, 0.14),
        0 18px 32px rgba(26, 20, 16, 0.22);
}
/* Striscia decorativa per i placeholder (libri senza cover reale) */
.book-card-cover:not(.has-cover)::after {
    content: "";
    position: absolute;
    inset: 22% 16% auto 16%;
    height: 6%;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 1px;
}

.book-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.book-card-title {
    font-family: var(--f-display);
    font-size: 0.98rem;
    line-height: 1.25;
    color: var(--c-ink);
    font-weight: 500;
}
.book-card-title.is-empty {
    color: var(--c-ink-soft);
    font-style: italic;
    font-weight: 400;
}
.book-card-author {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    line-height: 1.3;
    color: var(--c-ink-soft);
}

/* === Sezione "Il progetto" — layout editoriale ================ */
.prose-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-6) 1.4rem var(--s-5);
}
.prose-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
}
@media (max-width: 820px) {
    .prose-grid { grid-template-columns: 1fr; gap: 2.4rem; }
}

.prose-col-main p {
    font-family: var(--f-display);
    font-size: 1.15rem;
    line-height: 1.65;
    color: var(--c-ink);
    margin-bottom: 1.1rem;
    text-align: left;
}
.prose-col-main .lead-paragraph {
    font-size: 1.32rem;
    line-height: 1.55;
    color: var(--c-ink);
    margin-bottom: 1.6rem;
}
.prose-col-main strong { font-weight: 600; }
.prose-col-main em { color: var(--c-accent-deep); }

.prose-col-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: calc(var(--nav-height) + 1.5rem);
}
.info-card {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-left: 3px solid var(--c-accent);
    border-radius: var(--r-md);
    padding: 1.1rem 1.2rem;
}
.info-label {
    font-family: var(--f-sans);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-accent);
    margin-bottom: 0.4rem;
}
.info-value {
    font-family: var(--f-display);
    font-size: 1.1rem;
    line-height: 1.4;
    color: var(--c-ink);
    margin-bottom: 0.3rem;
}
.info-value:last-child { margin-bottom: 0; }
.info-meta {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    font-style: normal;
}

/* === Sezione offerta: scaffale-timone in prestito ============
   Background petrolio scuro per staccare nettamente dal resto;
   3 card chiare a contrasto; CTA grande e prominente. */
.offer-section {
    background: linear-gradient(160deg, var(--c-accent-deep) 0%, var(--c-accent) 100%);
    color: var(--c-cream);
    margin: clamp(2rem, 5vw, 4rem) 0 0;
    padding: clamp(3.5rem, 7vw, 5.5rem) 1.4rem;
    position: relative;
    overflow: hidden;
}
.offer-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.offer-intro {
    text-align: center;
    max-width: 720px;
    margin: 0 auto var(--s-4);
}
.eyebrow-light { color: var(--c-warm-soft) !important; }
.section-title-light { color: var(--c-cream); margin-bottom: 1rem; }
.section-lead-light {
    color: rgba(253, 250, 242, 0.82);
    font-size: 1.05rem;
    line-height: 1.6;
}

.offer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.4rem;
    margin: clamp(2rem, 4vw, 3rem) 0;
}
.offer-card {
    background: var(--c-cream);
    color: var(--c-ink);
    border-radius: var(--r-md);
    padding: 1.6rem 1.5rem 1.7rem;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    border-top: 3px solid var(--c-warm-soft);
}
.offer-card-num {
    font-family: var(--f-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-accent);
    letter-spacing: 0.18em;
    margin-bottom: 0.5rem;
}
.offer-card h3 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.4rem;
    margin: 0 0 1rem;
    color: var(--c-ink);
}
.offer-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.offer-card li {
    font-size: 0.92rem;
    line-height: 1.4;
    color: var(--c-ink-soft);
    padding-left: 1.1rem;
    position: relative;
}
.offer-card li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: var(--c-accent);
    font-weight: 700;
    font-size: 1.4rem;
    line-height: 1;
    top: 0.05rem;
}

.offer-cta-block {
    text-align: center;
    margin-top: clamp(1.5rem, 3vw, 2.5rem);
}
.btn-cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2.2rem;
    background: var(--c-cream);
    color: var(--c-accent-deep);
    border-radius: 999px;
    font-family: var(--f-sans);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    transition: transform var(--tr-fast), box-shadow var(--tr-fast), background var(--tr-fast);
}
.btn-cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    background: #ffffff;
}
.btn-cta-primary::after {
    content: "→";
    font-size: 1.15rem;
    transition: transform var(--tr-fast);
}
.btn-cta-primary:hover::after { transform: translateX(3px); }

.offer-contact {
    margin-top: 1.4rem;
    font-family: var(--f-sans);
    font-size: 0.85rem;
    line-height: 1.55;
    color: rgba(253, 250, 242, 0.7);
}
.offer-contact em {
    color: rgba(253, 250, 242, 0.9);
    font-style: italic;
}

/* === Banner CTA compatto (su barca.html) ==================== */
.offer-banner {
    background: linear-gradient(135deg, var(--c-accent-deep) 0%, var(--c-accent) 100%);
    color: var(--c-cream);
    padding: clamp(2.4rem, 5vw, 3.6rem) 1.4rem;
    margin-top: clamp(2rem, 5vw, 4rem);
}
.offer-banner-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}
@media (max-width: 720px) {
    .offer-banner-inner { grid-template-columns: 1fr; gap: 1.4rem; }
}
.offer-banner-text h2 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    line-height: 1.15;
    margin: 0.4rem 0 0.6rem;
    color: var(--c-cream);
}
.offer-banner-lead {
    color: rgba(253, 250, 242, 0.78);
    font-size: 0.98rem;
    line-height: 1.5;
}

/* === Modale di contatto ====================================== */
.contact-modal .contact-modal-card {
    grid-template-columns: 1fr;   /* override del modal-card del libro */
    max-width: 640px;
    width: calc(100% - 2rem);
    margin: 4vh auto;
    padding: 0;
    overflow-y: auto;
    max-height: 90vh;
}
.contact-modal-body {
    padding: 1.8rem 2rem 2rem;
}
.contact-modal-body h2 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.7rem;
    margin: 0.2rem 0 0.6rem;
    color: var(--c-ink);
    line-height: 1.15;
}
.contact-intro {
    color: var(--c-ink-soft);
    font-size: 0.92rem;
    margin-bottom: 1.4rem;
    line-height: 1.5;
}

.contact-form .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    margin-bottom: 0.6rem;
}
@media (max-width: 540px) {
    .contact-form .grid-2 { grid-template-columns: 1fr; }
}
.contact-form .field {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
    margin-bottom: 0.6rem;
}
.contact-form .field > span {
    font-family: var(--f-sans);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--c-ink-soft);
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    background: var(--c-bg);
    border: 1px solid var(--c-line);
    border-radius: var(--r-sm);
    padding: 0.7rem 0.85rem;
    font-family: var(--f-sans);
    /* 16px minimo: iOS Safari fa zoom automatico al focus se < 16px */
    font-size: 16px;
    color: var(--c-ink);
    width: 100%;
    min-height: 44px;
    transition: border-color 0.18s ease, background 0.18s ease;
}
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--c-accent);
    background: var(--c-surface);
}
.contact-form textarea {
    resize: vertical;
    min-height: 100px;
}

/* Honeypot anti-bot: nascosto agli umani */
.honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.contact-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.contact-form-footer .btn-cta-primary {
    margin-left: auto;
    padding: 0.75rem 1.6rem;
    font-size: 0.95rem;
    background: var(--c-accent);
    color: var(--c-cream);
    box-shadow: 0 4px 12px rgba(31, 94, 108, 0.25);
    min-height: 44px;
}
@media (max-width: 540px) {
    .contact-modal-body { padding: 1.4rem 1.2rem 1.6rem; }
    .contact-modal-body h2 { font-size: 1.4rem; }
    .contact-form-footer .btn-cta-primary {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
}
.contact-form-footer .btn-cta-primary:hover {
    background: var(--c-accent-deep);
    color: var(--c-cream);
}
.contact-form-footer .btn-cta-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.contact-status {
    font-family: var(--f-sans);
    font-size: 0.88rem;
    line-height: 1.4;
    flex: 1;
    min-width: 200px;
    margin: 0;
}
.contact-status.is-info    { color: var(--c-ink-soft); }
.contact-status.is-success { color: #4f8454; font-weight: 500; }
.contact-status.is-error   { color: #c8443c; font-weight: 500; }

/* === Sezione "Il racconto" ==================================== */
.story-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-6) 1.4rem var(--s-7);
    background:
        linear-gradient(180deg, transparent 0%, var(--c-bg-deep) 100%);
    border-top: 1px solid var(--c-line);
    text-align: center;
}
.story-body {
    max-width: var(--reading-max);
    margin: 0 auto;
    text-align: left;
}
.story-body p {
    font-family: var(--f-display);
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--c-ink);
    margin-bottom: 1.2rem;
    text-align: justify;
    hyphens: auto;
}
.story-body em { color: var(--c-accent-deep); font-weight: 500; }
.story-body strong { font-weight: 600; }

.story-lead { font-size: 1.22rem !important; }
.dropcap {
    float: left;
    font-family: var(--f-display);
    font-size: 4.5rem;
    line-height: 0.85;
    padding: 0.35rem 0.6rem 0 0;
    color: var(--c-accent);
    font-weight: 500;
}

.pull-quote {
    margin: 2.4rem -1rem;
    padding: 2rem 1rem;
    border-top: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
    text-align: center;
    position: relative;
}
.pull-quote::before {
    content: "\201C";   /* doppio apice tipografico " */
    position: absolute;
    top: -0.4rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--c-bg-deep);
    color: var(--c-accent);
    font-family: var(--f-display);
    font-size: 2.6rem;
    line-height: 1;
    padding: 0 0.6rem;
}
.pull-quote p {
    font-family: var(--f-display) !important;
    font-style: italic;
    font-size: clamp(1.4rem, 2.6vw, 1.9rem) !important;
    line-height: 1.35 !important;
    color: var(--c-accent-deep);
    text-align: center !important;
    margin: 0 !important;
}

.story-closing {
    text-align: center !important;
    font-style: italic;
    margin-top: 2rem !important;
    color: var(--c-ink-soft);
    font-size: 1.2rem !important;
}
.story-signature {
    text-align: right !important;
    margin-top: 2.5rem !important;
    color: var(--c-ink-soft);
    font-size: 1rem !important;
    line-height: 1.5;
    font-style: italic;
}
.signature-meta {
    font-size: 0.85em;
    opacity: 0.85;
}

/* === Galleria ================================================= */
.gallery-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-5) 1.4rem var(--s-6);
    text-align: center;
}
.gallery-grid {
    margin-top: 1.4rem;
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1.2rem;
    aspect-ratio: 16 / 10;
    text-align: left;
}
.gallery-item-hero { grid-row: 1 / 3; }

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-md);
    margin: 0;
    cursor: zoom-in;
    background: var(--c-bg-deep);
    box-shadow: var(--sh-sm);
    transition: box-shadow var(--tr-medium), transform var(--tr-medium);
}
.gallery-item:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gallery-item:hover img { transform: scale(1.04); }

.gallery-item figcaption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 2.4rem 1.2rem 1rem;
    color: var(--c-cream);
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.4;
    background: linear-gradient(180deg,
        rgba(20, 16, 12, 0)   0%,
        rgba(20, 16, 12, 0.78) 100%);
    pointer-events: none;
}

@media (max-width: 760px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        aspect-ratio: auto;
    }
    .gallery-item-hero { grid-row: auto; }
    .gallery-item { aspect-ratio: 16 / 10; }
}

/* === Lightbox ================================================= */
.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 110;
}
.lightbox.is-open { display: block; }
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 6, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 240ms ease;
}
.lightbox-close {
    position: absolute;
    top: 1.2rem;
    right: 1.4rem;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--c-cream);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background var(--tr-fast), transform var(--tr-fast);
}
.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: rotate(90deg);
}

/* Frecce navigazione galleria */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--c-cream);
    font-size: 1.9rem;
    line-height: 1;
    font-family: var(--f-sans);
    cursor: pointer;
    z-index: 2;
    transition: background var(--tr-fast), transform var(--tr-fast),
                opacity var(--tr-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-nav:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.24);
    transform: translateY(-50%) scale(1.08);
}
.lightbox-nav:disabled {
    opacity: 0.18;
    cursor: not-allowed;
    pointer-events: none;
}
.lightbox-nav-prev { left: clamp(0.6rem, 2.5vw, 2rem); }
.lightbox-nav-next { right: clamp(0.6rem, 2.5vw, 2rem); }

/* Counter "X di Y" in alto a sinistra */
.lightbox-counter {
    position: absolute;
    top: 1.4rem;
    left: 1.6rem;
    margin: 0;
    font-family: var(--f-sans);
    font-size: 0.84rem;
    font-weight: 500;
    color: rgba(250, 246, 236, 0.72);
    letter-spacing: 0.05em;
    z-index: 2;
}
@media (max-width: 700px) {
    .lightbox-nav { width: 48px; height: 48px; font-size: 1.6rem; }
    .lightbox-counter { font-size: 0.78rem; top: 1.1rem; left: 1.1rem; }
}
@media (max-width: 480px) {
    .lightbox-nav-prev { left: 0.5rem; }
    .lightbox-nav-next { right: 0.5rem; }
    .lightbox-figure { width: calc(100% - 1.4rem); }
}

.lightbox-figure {
    position: relative;
    width: calc(100% - 4rem);
    max-width: 1100px;
    height: calc(100% - 6rem);
    margin: 3rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    animation: modalIn 360ms cubic-bezier(0.22, 1, 0.36, 1);
}
.lightbox-image {
    max-width: 100%;
    max-height: calc(100% - 3rem);
    object-fit: contain;
    border-radius: var(--r-sm);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
}
.lightbox-caption {
    color: rgba(250, 246, 236, 0.85);
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.95rem;
    text-align: center;
    max-width: 720px;
}

/* === Errore caricamento JSON ================================== */
.load-error {
    position: absolute;
    inset: auto 1rem 1rem;
    text-align: center;
    background: #fff3f0;
    border: 1px solid #d99;
    color: #933;
    padding: 0.6rem;
    font-family: var(--f-sans);
    font-size: 0.85rem;
    border-radius: var(--r-sm);
}

/* === Modale ==================================================== */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 100;
}
.modal.is-open { display: block; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 16, 12, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 220ms ease;
}
.modal-card {
    position: relative;
    margin: 6vh auto;
    max-width: 580px;
    width: calc(100% - 2rem);
    background: var(--c-cream);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-lg);
    overflow: hidden;
    display: grid;
    grid-template-columns: 180px 1fr;
    animation: modalIn 360ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-cover {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--c-warm);
    min-height: 240px;
}
.modal-body { padding: 1.6rem 1.7rem 1.8rem; }
.modal-body h2 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.6rem;
    line-height: 1.15;
    margin-bottom: 0.5rem;
    color: var(--c-ink);
}
.modal-shelf {
    font-family: var(--f-sans);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--c-accent);
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.modal-original-title {
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.85rem;
    color: var(--c-ink-soft);
    opacity: 0.78;
    margin: 0 0 0.3rem;
}
.modal-author {
    font-family: var(--f-display);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--c-ink-soft);
}
.modal-meta-line {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    margin-top: 0.4rem;
    letter-spacing: 0.01em;
}
.modal-shelf:empty,
.modal-original-title:empty,
.modal-author:empty,
.modal-meta-line:empty { display: none; }

.modal-subjects {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1rem 0 0;
    padding: 0;
}
.modal-subjects:empty { display: none; }
.modal-subjects li {
    font-family: var(--f-sans);
    font-size: 0.72rem;
    background: var(--c-bg-deep);
    color: var(--c-accent-deep);
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--c-line);
    letter-spacing: 0.01em;
}

.modal-isbn {
    font-family: var(--f-sans);
    font-size: 0.7rem;
    color: var(--c-ink-soft);
    margin-top: 0.9rem;
    opacity: 0.55;
    letter-spacing: 0.04em;
}
.modal-isbn:empty { display: none; }

.modal-description {
    font-family: var(--f-sans);
    margin-top: 1rem;
    line-height: 1.55;
    color: var(--c-ink);
    font-size: 0.95rem;
}

.modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.7rem;
    width: 40px;
    height: 40px;
    border: 0;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--c-ink);
    z-index: 2;
    transition: background var(--tr-fast), transform var(--tr-fast);
    box-shadow: var(--sh-sm);
}
.modal-close:hover {
    background: #fff;
    transform: rotate(90deg);
}

/* === Frecce prev/next del modal libro ============================
   Posizionate ai lati della modal-card, fluttuano sopra il backdrop.
   Sparisce su prima/ultima posizione (disabled). */
.modal-nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: 0;
    background: rgba(253, 250, 242, 0.92);
    color: var(--c-ink);
    border-radius: 50%;
    font-size: 1.7rem;
    line-height: 1;
    font-family: var(--f-sans);
    cursor: pointer;
    z-index: 3;
    box-shadow: var(--sh-md);
    display: none;          /* visibili solo quando il modal e' aperto */
    transition: background var(--tr-fast), transform var(--tr-fast),
                opacity var(--tr-fast);
}
.modal.is-open .modal-nav-arrow { display: flex; align-items: center; justify-content: center; }
.modal-nav-arrow:hover:not(:disabled) {
    background: var(--c-cream);
    transform: translateY(-50%) scale(1.08);
}
.modal-nav-arrow:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}
.modal-nav-prev { left: clamp(0.4rem, 2vw, 1.4rem); }
.modal-nav-next { right: clamp(0.4rem, 2vw, 1.4rem); }
@media (max-width: 700px) {
    .modal-nav-arrow {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
}
@media (max-width: 480px) {
    .modal-nav-prev { left: 0.4rem; }
    .modal-nav-next { right: 0.4rem; }
}

/* Indicatore posizione "Libro N di M · Ripiano K" */
.modal-position {
    margin-top: 1.4rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--c-line);
    font-family: var(--f-sans);
    font-size: 0.78rem;
    color: var(--c-ink-soft);
    letter-spacing: 0.04em;
    font-weight: 500;
}

@media (max-width: 560px) {
    .modal-card { grid-template-columns: 1fr; margin: 4vh auto; }
    .modal-cover { min-height: 200px; }
}
@media (max-width: 480px) {
    .modal-card {
        margin: 2vh auto 1vh;
        width: calc(100% - 1rem);
        max-height: 96vh;
        overflow-y: auto;
    }
    .modal-cover { min-height: 160px; }
    .modal-body { padding: 1.2rem 1.2rem 1.4rem; }
    .modal-body h2 { font-size: 1.4rem; }
    .modal-close {
        width: 44px;
        height: 44px;
    }
}

/* === Footer =================================================== */
.site-footer {
    background: var(--c-ink);
    color: var(--c-bg);
    margin-top: 0;
    border-top: 4px solid var(--c-accent);
}
.footer-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 3.2rem 1.4rem 1.6rem;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2.5rem;
}
@media (max-width: 760px) {
    .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
}

.footer-brand .footer-brand-logo {
    height: 64px;
    width: auto;
    display: block;
    margin: 0 0 0.8rem;
}
@media (max-width: 760px) {
    .footer-brand .footer-brand-logo { height: 52px; }
}
.footer-brand .footer-tag {
    font-family: var(--f-sans);
    font-size: 0.92rem;
    color: rgba(250, 246, 236, 0.55);
    line-height: 1.5;
    max-width: 240px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.6rem 1.6rem;
    font-family: var(--f-sans);
    font-size: 0.88rem;
    line-height: 1.55;
}
.footer-col p { color: rgba(250, 246, 236, 0.78); margin-bottom: 0.25rem; }
.footer-label {
    font-size: 0.7rem !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--c-warm-soft) !important;
    margin-bottom: 0.6rem !important;
}
.footer-meta {
    font-size: 0.78rem;
    color: rgba(250, 246, 236, 0.45);
    font-style: italic;
}

/* Logo wall: i loghi reali, su badge crema per stagliarsi sul fondo scuro */
.footer-logos {
    border-top: 1px solid rgba(250, 246, 236, 0.10);
    padding: 1.6rem 1.4rem;
    background: rgba(255, 250, 240, 0.03);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 1.6rem 3.5rem;
}
.footer-logo-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}
.footer-logo-label {
    font-family: var(--f-sans);
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--c-warm-soft);
    margin: 0;
}
.footer-logo-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    justify-content: center;
}
.footer-logo {
    height: 46px;
    width: auto;
    max-width: 130px;
    object-fit: contain;
    background: var(--c-cream);
    border-radius: 4px;
    padding: 5px 9px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.footer-logo:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}
/* Il timbro dei "Santi Bevitori" è circolare e B/N: padding minimo, leggermente più alto */
.footer-logo-stamp {
    height: 54px;
    padding: 3px;
}

@media (max-width: 600px) {
    .footer-logos { gap: 1.2rem 1.4rem; padding: 1.2rem 1rem; }
    .footer-logo { height: 38px; padding: 4px 7px; }
    .footer-logo-stamp { height: 44px; }
}

.footer-bottom {
    border-top: 1px solid rgba(250, 246, 236, 0.1);
    padding: 1.2rem 1.4rem;
    text-align: center;
    font-family: var(--f-sans);
    font-size: 0.78rem;
    color: rgba(250, 246, 236, 0.4);
}

/* ===============================================================
   RICERCA GLOBALE
   - .nav-search-toggle: icona lente nell'header
   - #search-modal: modale full-screen per la ricerca live
   - .search-page-*: stili pagina dedicata cerca.php
   - .book-card-pulse: highlight transitorio quando si arriva da
     cerca.php su barca.php?id=...&q=Titolo
   =============================================================== */

/* --- Icona lente nell'header --- */
.nav-search-toggle {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--c-ink-soft);
    cursor: pointer;
    border-radius: 50%;
    transition: background var(--tr-fast), color var(--tr-fast), transform var(--tr-fast);
}
.nav-search-toggle:hover {
    color: var(--c-accent);
    background: var(--c-line-soft);
    transform: scale(1.05);
}
.nav-search-toggle:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
}
.nav-search-icon {
    width: 20px;
    height: 20px;
    display: block;
}
/* Sopra hero della home (nav trasparente): icona bianca */
.page-home .site-nav:not(.scrolled) .nav-search-toggle { color: #fff; }
.page-home .site-nav:not(.scrolled) .nav-search-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}
@media (max-width: 760px) {
    .nav-search-toggle {
        width: 36px;
        height: 36px;
        margin-left: auto;
        margin-right: 0.2rem;
    }
    .nav-search-icon { width: 18px; height: 18px; }
    /* Quando il menu mobile e' aperto sopra l'hero, l'header diventa cream
       quindi torniamo all'icona scura */
    .page-home .site-nav:has(.nav-list.is-open) .nav-search-toggle { color: var(--c-ink-soft); }
}

/* --- Modale ricerca full-screen --- */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: none;
}
.search-modal.is-open { display: block; }
body.search-open { overflow: hidden; }

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 16, 12, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 240ms ease;
    cursor: pointer;
}
.search-modal-panel {
    position: relative;
    max-width: 760px;
    width: calc(100% - 2rem);
    margin: 7vh auto 4vh;
    background: var(--c-cream);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-lg);
    padding: 2.2rem 2rem 1.4rem;
    animation: modalIn 380ms cubic-bezier(0.22, 1, 0.36, 1);
    max-height: calc(100vh - 9vh);
    overflow-y: auto;
}
.search-modal-close {
    position: absolute;
    top: 0.8rem;
    right: 0.9rem;
    width: 38px;
    height: 38px;
    border: 0;
    background: transparent;
    color: var(--c-ink-soft);
    font-size: 1.8rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--tr-fast), color var(--tr-fast);
}
.search-modal-close:hover { background: var(--c-line-soft); color: var(--c-ink); }

.search-modal-head { margin-bottom: 1.2rem; }
.search-modal-head h2 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.8rem;
    line-height: 1.15;
    color: var(--c-ink);
    margin: 0.2rem 0 0.5rem;
}
.search-modal-lead {
    font-family: var(--f-sans);
    font-size: 0.92rem;
    color: var(--c-ink-soft);
    line-height: 1.5;
    margin: 0;
}

.search-modal-form {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.7rem;
    background: #fff;
    border: 1.5px solid var(--c-line);
    border-radius: var(--r-md);
    padding: 0.65rem 0.9rem;
    transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.search-modal-form:focus-within {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 18%, transparent);
}
.search-modal-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    color: var(--c-accent);
}
.search-modal-icon svg { width: 100%; height: 100%; display: block; }
.search-modal-form input[type="search"] {
    border: 0;
    background: transparent;
    font-family: var(--f-display);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--c-ink);
    outline: none;
    padding: 0.4rem 0;
    width: 100%;
}
.search-modal-form input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-modal-form input[type="search"]::placeholder { color: var(--c-ink-soft); opacity: 0.55; }
.search-modal-submit {
    border: 0;
    background: var(--c-accent);
    color: var(--c-cream);
    font-family: var(--f-sans);
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
    padding: 0.55rem 1.1rem;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--tr-fast), transform var(--tr-fast);
}
.search-modal-submit:hover {
    background: var(--c-accent-deep);
    transform: translateY(-1px);
}

.search-modal-hint {
    font-family: var(--f-sans);
    font-size: 0.78rem;
    color: var(--c-ink-soft);
    margin: 0.6rem 0.2rem 1rem;
}
.search-modal-hint kbd {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    font-family: var(--f-sans);
    font-size: 0.72rem;
    background: var(--c-line-soft);
    border: 1px solid var(--c-line);
    border-radius: 4px;
    color: var(--c-ink);
}

.search-modal-results {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--c-line);
}
.search-modal-state,
.search-modal-state-label {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    margin: 0.6rem 0.2rem;
}
.search-modal-state em { color: var(--c-ink); font-style: normal; font-weight: 600; }
.search-modal-state-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    color: var(--c-accent);
    margin-bottom: 0.3rem;
}

.search-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 0.9rem;
    align-items: center;
    padding: 0.7rem 0.6rem;
    border-radius: var(--r-sm);
    transition: background var(--tr-fast), transform var(--tr-fast);
    text-decoration: none;
    color: inherit;
}
.search-row:hover {
    background: var(--c-line-soft);
    transform: translateX(2px);
}
.search-row-cover {
    width: 56px;
    height: 80px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: var(--c-warm);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}
.search-row-cover.is-empty {
    background: linear-gradient(135deg, var(--c-warm), var(--c-line));
}
.search-row-body { min-width: 0; }
.search-row-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--c-ink);
    margin: 0 0 0.15rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.search-row-author {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-row-meta {
    font-family: var(--f-sans);
    font-size: 0.74rem;
    color: var(--c-ink-soft);
    opacity: 0.75;
    margin: 0.1rem 0 0;
}
.search-row-badge {
    font-family: var(--f-sans);
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--c-accent);
    background: color-mix(in srgb, var(--c-accent) 12%, var(--c-cream));
    padding: 0.3rem 0.55rem;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-modal-more {
    display: inline-block;
    margin: 0.6rem 0.2rem 0.2rem;
    font-family: var(--f-sans);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--c-accent);
    text-decoration: none;
    padding: 0.4rem 0;
    transition: color var(--tr-fast), transform var(--tr-fast);
}
.search-modal-more:hover {
    color: var(--c-accent-deep);
    transform: translateX(3px);
}

@media (max-width: 600px) {
    .search-modal-panel { padding: 1.6rem 1.2rem 1rem; margin: 5vh auto 3vh; }
    .search-modal-head h2 { font-size: 1.45rem; }
    .search-modal-form { grid-template-columns: auto 1fr; padding: 0.5rem 0.7rem; }
    .search-modal-form input[type="search"] { font-size: 1.1rem; }
    .search-modal-submit { grid-column: 1 / -1; padding: 0.55rem; }
    .search-row { grid-template-columns: 48px 1fr; gap: 0.7rem; padding: 0.55rem 0.4rem; }
    .search-row-cover { width: 48px; height: 68px; }
    .search-row-badge { grid-column: 2; justify-self: start; margin-top: 0.2rem; }
}

/* --- Pagina cerca.php --- */
.page-search { background: var(--c-bg); }
.search-page-hero {
    max-width: 920px;
    margin: 3rem auto 2.4rem;
    padding: 0 1.4rem;
}
.search-page-hero .section-title em {
    font-style: italic;
    color: var(--c-accent);
    font-weight: 500;
}
.search-page-form {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.7rem;
    background: #fff;
    border: 1.5px solid var(--c-line);
    border-radius: var(--r-md);
    padding: 0.7rem 0.9rem;
    margin: 1.4rem 0 1rem;
    transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.search-page-form:focus-within {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 18%, transparent);
}
.search-page-form-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    color: var(--c-accent);
}
.search-page-form-icon svg { width: 100%; height: 100%; display: block; }
.search-page-form input[type="search"] {
    border: 0;
    background: transparent;
    font-family: var(--f-display);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--c-ink);
    outline: none;
    padding: 0.3rem 0;
    width: 100%;
}
.search-page-form input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-page-summary {
    font-family: var(--f-sans);
    font-size: 0.95rem;
    color: var(--c-ink-soft);
    margin: 0;
}
.search-page-summary strong { color: var(--c-ink); }

.search-page-results {
    max-width: 920px;
    margin: 0 auto 4rem;
    padding: 0 1.4rem;
}
.search-results-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0;
    margin: 0;
}
.search-result-card {
    display: grid;
    grid-template-columns: 100px 1fr 240px;
    gap: 1.4rem;
    padding: 1.2rem;
    background: var(--c-cream);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    transition: border-color var(--tr-fast), box-shadow var(--tr-fast), transform var(--tr-fast);
}
.search-result-card:hover {
    border-color: var(--c-accent);
    box-shadow: var(--sh-sm);
    transform: translateY(-1px);
}
.search-result-cover {
    width: 100px;
    height: 145px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: var(--c-warm);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}
.search-result-cover.is-empty {
    background: linear-gradient(135deg, var(--c-warm), var(--c-line));
}
.search-result-body { min-width: 0; }
.search-result-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.4rem;
    line-height: 1.2;
    color: var(--c-ink);
    margin: 0 0 0.25rem;
}
.search-result-author {
    font-family: var(--f-sans);
    font-size: 0.95rem;
    color: var(--c-ink);
    margin: 0 0 0.15rem;
}
.search-result-meta {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    margin: 0 0 0.5rem;
}
.search-result-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.6rem;
    padding: 0;
}
.search-result-tags li {
    font-family: var(--f-sans);
    font-size: 0.72rem;
    color: var(--c-ink-soft);
    background: var(--c-line-soft);
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
}
.search-result-desc {
    font-family: var(--f-display);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--c-ink-soft);
    margin: 0;
}
.search-result-boats {
    border-left: 1px solid var(--c-line);
    padding-left: 1.2rem;
}
.search-result-badge {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--c-accent);
    background: color-mix(in srgb, var(--c-accent) 12%, var(--c-cream));
    padding: 0.4rem 0.7rem;
    border-radius: 100px;
    display: inline-block;
    margin: 0 0 0.7rem;
}
.search-result-badge strong { font-weight: 700; }
.search-result-boat-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.search-result-boat-list a {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0.5rem 0.7rem;
    background: #fff;
    border: 1px solid var(--c-line);
    border-radius: var(--r-sm);
    transition: border-color var(--tr-fast), background var(--tr-fast), transform var(--tr-fast);
}
.search-result-boat-list a:hover {
    border-color: var(--c-accent);
    background: color-mix(in srgb, var(--c-accent) 5%, #fff);
    transform: translateX(2px);
}
.search-result-boat-title {
    display: block;
    font-family: var(--f-sans);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--c-ink);
    line-height: 1.25;
}
.search-result-boat-shelf {
    display: block;
    font-family: var(--f-sans);
    font-size: 0.72rem;
    color: var(--c-ink-soft);
    margin-top: 0.1rem;
}

@media (max-width: 760px) {
    .search-result-card {
        grid-template-columns: 80px 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    .search-result-cover { width: 80px; height: 116px; }
    .search-result-boats {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 1px solid var(--c-line);
        padding-left: 0;
        padding-top: 1rem;
        margin-top: 0.4rem;
    }
    .search-result-title { font-size: 1.2rem; }
}
@media (max-width: 480px) {
    .search-result-card {
        grid-template-columns: 64px 1fr;
        gap: 0.8rem;
        padding: 0.85rem;
    }
    .search-result-cover { width: 64px; height: 92px; }
    .search-result-title { font-size: 1.05rem; }
    .search-result-author, .search-result-meta { font-size: 0.85rem; }
    .search-result-desc { font-size: 0.88rem; }
    .search-result-boat-list a { padding: 0.7rem 0.8rem; min-height: 44px; }
    .search-page-form {
        grid-template-columns: auto 1fr;
        padding: 0.55rem 0.7rem;
    }
    .search-page-form input[type="search"] { font-size: 1.05rem; }
    .search-page-form .btn-cta-primary {
        grid-column: 1 / -1;
        width: 100%;
        text-align: center;
    }
}

/* --- Highlight da deep-link su barca.php --- */
@keyframes bookCardPulse {
    0%   { box-shadow: 0 0 0 0   color-mix(in srgb, var(--c-accent) 60%, transparent); }
    50%  { box-shadow: 0 0 0 14px color-mix(in srgb, var(--c-accent)  0%, transparent); }
    100% { box-shadow: 0 0 0 0   color-mix(in srgb, var(--c-accent)  0%, transparent); }
}
.book-card-pulse {
    animation: bookCardPulse 1.6s ease-out 0s 2;
    border-radius: 6px;
}

/* ===============================================================
   STILI MARKDOWN-RENDERED
   I campi description / longText / blurb / book.description sono
   passati per marked + DOMPurify e iniettati come HTML. Aggiungo
   stili coerenti per <p>, <h2>, <ul>, <blockquote>, <a>, <code>
   nei contenitori dove possono apparire.
   =============================================================== */

/* Long text (Note di curatela) - block-level pieno */
.boat-longtext-body p {
    font-family: var(--f-display);
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--c-ink);
    margin: 0 0 1.1rem;
    text-align: left;
}
.boat-longtext-body p:last-child { margin-bottom: 0; }
.boat-longtext-body h2 {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    line-height: 1.2;
    color: var(--c-ink);
    margin: 1.6rem 0 0.7rem;
    letter-spacing: -0.005em;
}
.boat-longtext-body h2:first-child { margin-top: 0; }
.boat-longtext-body h3 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.2rem;
    margin: 1.2rem 0 0.5rem;
    color: var(--c-ink);
}
.boat-longtext-body ul,
.boat-longtext-body ol {
    margin: 0 0 1.1rem 1.4rem;
    padding: 0;
    font-family: var(--f-display);
    font-size: 1.1rem;
    line-height: 1.6;
}
.boat-longtext-body li { margin-bottom: 0.35rem; }
.boat-longtext-body blockquote {
    margin: 1.1rem 0;
    padding: 0.6rem 0 0.6rem 1.4rem;
    border-left: 3px solid var(--c-accent);
    color: var(--c-ink-soft);
    font-family: var(--f-display);
    font-style: italic;
    font-size: 1.18rem;
    line-height: 1.55;
}
.boat-longtext-body a {
    color: var(--c-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--tr-fast);
}
.boat-longtext-body a:hover { color: var(--c-accent-deep); }
.boat-longtext-body code {
    background: var(--c-line-soft);
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.92em;
}

/* Boat hero description (inline-only): bold/italic/link */
.boat-hero-description strong { font-weight: 600; color: var(--c-ink); }
.boat-hero-description em { font-style: italic; }
.boat-hero-description a {
    color: var(--c-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.boat-hero-description a:hover { color: var(--c-accent-deep); }

/* Curator blurb (inline-only) */
.curator-blurb strong { font-weight: 600; }
.curator-blurb em { font-style: italic; }
.curator-blurb a {
    color: var(--c-accent);
    text-decoration: underline;
}

/* Modal book description (block) */
.modal-description p:first-child { margin-top: 0; }
.modal-description p:last-child { margin-bottom: 0; }
.modal-description p {
    margin: 0 0 0.7rem;
    line-height: 1.55;
    color: var(--c-ink-soft);
}
.modal-description strong { color: var(--c-ink); font-weight: 600; }
.modal-description em { font-style: italic; }
.modal-description ul,
.modal-description ol {
    margin: 0 0 0.7rem 1.2rem;
    padding: 0;
}
.modal-description li { margin-bottom: 0.25rem; }
.modal-description blockquote {
    margin: 0.7rem 0;
    padding: 0.3rem 0 0.3rem 0.9rem;
    border-left: 3px solid var(--c-accent);
    color: var(--c-ink-soft);
    font-style: italic;
}
.modal-description a {
    color: var(--c-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.modal-description a:hover { color: var(--c-accent-deep); }
.modal-description code {
    background: var(--c-line-soft);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    font-size: 0.92em;
}

/* ===============================================================
   TIMESTRIP — slider cronologico (sezione "Cronologia" su barca.php)
   Carosello scroll-snap di card grandi ordinate per anno + barra
   temporale sotto con tick per secolo cliccabili e thumb dinamico.
   =============================================================== */
.timestrip-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-5) 1.4rem var(--s-6);
    text-align: center;
}
.timestrip-intro {
    max-width: 720px;
    margin: 0 auto 2.4rem;
}
.timestrip-intro .section-title em {
    font-style: italic;
    color: var(--c-accent);
    font-weight: 500;
}

.timestrip-stage {
    position: relative;
    padding-bottom: 4.2rem;     /* spazio per la barra temporale */
}

/* Track scrollabile con snap per card */
.timestrip-track {
    display: flex;
    gap: 1.4rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 50%;
    padding: 0.6rem clamp(1rem, 8vw, 6rem) 1.6rem;
    margin: 0 calc(-1 * clamp(1rem, 8vw, 6rem));
    scrollbar-width: thin;
    scrollbar-color: var(--c-line) transparent;
}
.timestrip-track::-webkit-scrollbar { height: 6px; }
.timestrip-track::-webkit-scrollbar-thumb {
    background: var(--c-line);
    border-radius: 3px;
}

/* Card singola */
.timestrip-card {
    --c: var(--c-accent);
    flex: 0 0 clamp(280px, 40vw, 380px);
    scroll-snap-align: center;
    display: grid;
    grid-template-columns: 130px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "year   year"
        "cover  body";
    column-gap: 1rem;
    row-gap: 0.7rem;
    padding: 1.3rem 1.3rem 1.4rem;
    background: var(--c-cream);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-sm);
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
    position: relative;
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow var(--tr-medium),
                border-color var(--tr-medium),
                opacity var(--tr-medium);
    opacity: 0.55;
    overflow: hidden;
}
.timestrip-card.is-active {
    opacity: 1;
    transform: translateY(-6px);
    box-shadow: var(--sh-md);
    border-color: var(--c);
}
.timestrip-card:hover { opacity: 1; }
.timestrip-card::before {
    /* Linea decorativa colorata in alto, larghezza piena */
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--c);
    opacity: 0.85;
}
.timestrip-card-year {
    grid-area: year;
    font-family: var(--f-display);
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1;
    color: var(--c);
    letter-spacing: -0.02em;
    margin-top: 0.2rem;
}
.timestrip-card-cover {
    grid-area: cover;
    width: 130px;
    height: 190px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: var(--c-warm);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.timestrip-card-cover.is-empty {
    background: linear-gradient(135deg, var(--c-warm), var(--c-line));
}
.timestrip-card-body {
    grid-area: body;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}
.timestrip-card-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.15rem;
    line-height: 1.2;
    color: var(--c-ink);
    margin: 0;
}
.timestrip-card-author {
    font-family: var(--f-sans);
    font-size: 0.85rem;
    color: var(--c-ink);
    margin: 0;
}
.timestrip-card-desc {
    font-family: var(--f-display);
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--c-ink-soft);
    margin: 0.2rem 0 0;
}
.timestrip-card-cta {
    display: inline-block;
    margin-top: auto;
    padding-top: 0.55rem;
    font-family: var(--f-sans);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--c);
    letter-spacing: 0.02em;
}

/* Frecce prev/next */
.timestrip-arrow {
    position: absolute;
    top: 30%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: 1px solid var(--c-line);
    background: var(--c-surface);
    color: var(--c-accent);
    font-size: 1.7rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--sh-sm);
    z-index: 3;
    transition: background var(--tr-fast), color var(--tr-fast),
                transform var(--tr-fast), opacity var(--tr-fast);
}
.timestrip-arrow:hover:not(:disabled) {
    background: var(--c-accent);
    color: var(--c-cream);
    transform: translateY(-50%) scale(1.06);
}
.timestrip-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
.timestrip-arrow-prev { left: 0.4rem; }
.timestrip-arrow-next { right: 0.4rem; }

/* Barra temporale sotto */
.timestrip-axis {
    position: absolute;
    left: clamp(1rem, 5vw, 3rem);
    right: clamp(1rem, 5vw, 3rem);
    bottom: 0.8rem;
    height: 36px;
}
.timestrip-axis-line {
    position: absolute;
    top: 17px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--c-line);
    border-radius: 1px;
}
.timestrip-axis-fill {
    position: absolute;
    top: 17px;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, var(--c-accent-soft), var(--c-accent));
    border-radius: 1px;
    transition: width 220ms ease;
}
.timestrip-axis-thumb {
    position: absolute;
    top: 11px;
    left: 0%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    background: var(--c-accent);
    border: 2px solid var(--c-cream);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
    transition: left 220ms ease;
    pointer-events: none;
    z-index: 2;
}
.timestrip-axis-thumb::after {
    /* Etichetta anno sopra il thumb */
    content: attr(data-year);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--f-sans);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--c-accent-deep);
    background: var(--c-cream);
    border: 1px solid var(--c-line);
    border-radius: 100px;
    padding: 0.1rem 0.5rem;
    white-space: nowrap;
}
.timestrip-axis-ticks {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
}
.timestrip-axis-tick {
    position: absolute;
    top: 12px;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.timestrip-axis-tick::before {
    /* Marker piccolo */
    content: "";
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--c-line);
    border-radius: 50%;
    transition: background var(--tr-fast), transform var(--tr-fast);
}
.timestrip-axis-tick.is-century::before {
    width: 6px;
    height: 6px;
    background: var(--c-accent);
    top: 3px;
}
.timestrip-axis-tick:hover::before {
    background: var(--c-accent-deep);
    transform: translateX(-50%) scale(1.4);
}
.timestrip-axis-tick-label {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--f-sans);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--c-ink-soft);
    letter-spacing: 0.04em;
}

@media (max-width: 760px) {
    .timestrip-stage { padding-bottom: 3.6rem; }
    .timestrip-track {
        scroll-padding: 1rem;
        padding: 0.4rem 1rem 1.2rem;
        margin: 0 -1rem;
    }
    .timestrip-card {
        flex: 0 0 86vw;
        grid-template-columns: 100px 1fr;
        padding: 1rem;
    }
    .timestrip-card-cover { width: 100px; height: 145px; }
    .timestrip-card-year { font-size: 1.8rem; }
    .timestrip-arrow { display: none; }
    .timestrip-axis { left: 0.6rem; right: 0.6rem; }
    .timestrip-axis-tick-label { font-size: 0.6rem; }
}

/* ===============================================================
   MAPPA GEOGRAFICA (sezione "Geografia" su barca.php)
   Container Leaflet con altezza fissa e popup personalizzati.
   =============================================================== */
.map-section {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--s-5) 1.4rem var(--s-6);
    text-align: center;
}
.map-intro {
    max-width: 720px;
    margin: 0 auto 2.4rem;
}
.map-intro .section-title em {
    font-style: italic;
    color: var(--c-accent);
    font-weight: 500;
}

.map-stage {
    height: clamp(360px, 60vh, 520px);
    width: 100%;
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-md);
    border: 1px solid var(--c-line);
    background: var(--c-bg-deep);
}

/* Override Leaflet popup look per coerenza editoriale */
.boat-map-popup .leaflet-popup-content-wrapper {
    border-radius: var(--r-md);
    background: var(--c-cream);
    box-shadow: var(--sh-md);
    padding: 0;
}
.boat-map-popup .leaflet-popup-content {
    margin: 0;
    width: 260px !important;
    font-family: var(--f-sans);
}
.boat-map-popup .leaflet-popup-tip { background: var(--c-cream); }

.boat-map-popup-inner {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    text-align: left;
}
.boat-map-popup-cover {
    width: 78px;
    height: 110px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: var(--c-warm);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}
.boat-map-popup-cover.is-empty {
    background: linear-gradient(135deg, var(--c-warm), var(--c-line));
}
.boat-map-popup-place {
    font-family: var(--f-sans);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-accent);
    margin: 0 0 0.15rem;
}
.boat-map-popup-body h3 {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.2;
    color: var(--c-ink);
    margin: 0 0 0.15rem;
}
.boat-map-popup-author,
.boat-map-popup-year {
    font-family: var(--f-sans);
    font-size: 0.78rem;
    color: var(--c-ink-soft);
    margin: 0 0 0.1rem;
}
.boat-map-popup-cta {
    margin-top: 0.5rem;
    border: 0;
    background: var(--c-accent);
    color: var(--c-cream);
    font-family: var(--f-sans);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.45rem 0.7rem;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--tr-fast);
}
.boat-map-popup-cta:hover { background: var(--c-accent-deep); }

@media (max-width: 600px) {
    .map-stage { height: 380px; }
    .boat-map-popup .leaflet-popup-content { width: 220px !important; }
    .boat-map-popup-inner { grid-template-columns: 64px 1fr; }
    .boat-map-popup-cover { width: 64px; height: 90px; }
}

/* ===============================================================
   PAGINA INDICE PER TEMI (indice.php)
   - Hero compatto + cloud di pillole-tema con font scalato per
     popolarita' (tag cloud editoriale)
   - Sezioni dettagliate sotto, ciascuna con la griglia dei libri
     che condividono quel tema
   =============================================================== */
.page-index { background: var(--c-bg); }

.index-hero {
    max-width: 920px;
    margin: 3rem auto 1.6rem;
    padding: 0 1.4rem;
    text-align: center;
}
.index-hero .section-title em {
    font-style: italic;
    color: var(--c-accent);
    font-weight: 500;
}
.index-hero .section-lead { max-width: 640px; margin: 0 auto; }

.index-empty {
    max-width: 720px;
    margin: 4rem auto;
    text-align: center;
    padding: 0 1.4rem;
}
.index-empty p { margin-bottom: 1rem; }

/* Cloud: pillole sticky-friendly cliccabili */
.theme-cloud {
    max-width: 920px;
    margin: 0 auto 3rem;
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.6rem;
    justify-content: center;
    align-items: baseline;
    border-top: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
    background: var(--c-bg-deep);
}
.theme-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.85rem 0.32rem;
    background: var(--c-cream);
    color: var(--c-ink);
    border: 1px solid var(--c-line);
    border-radius: 100px;
    font-family: var(--f-display);
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: background var(--tr-fast), color var(--tr-fast),
                border-color var(--tr-fast), transform var(--tr-fast);
}
.theme-pill:hover {
    background: var(--c-accent);
    color: var(--c-cream);
    border-color: var(--c-accent);
    transform: translateY(-1px);
}
.theme-pill-count {
    font-family: var(--f-sans);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--c-accent);
    background: color-mix(in srgb, var(--c-accent) 12%, transparent);
    padding: 0.08rem 0.45rem;
    border-radius: 100px;
    min-width: 1.6em;
    text-align: center;
    transition: background var(--tr-fast), color var(--tr-fast);
}
.theme-pill:hover .theme-pill-count {
    background: rgba(253, 250, 242, 0.22);
    color: var(--c-cream);
}

/* Sezioni di dettaglio */
.theme-sections {
    max-width: 1100px;
    margin: 0 auto 4rem;
    padding: 0 1.4rem;
}
.theme-block {
    margin-bottom: 3.2rem;
    /* Compensa la nav sticky quando si clicca un'ancora dal cloud */
    scroll-margin-top: calc(var(--nav-height) + 1.4rem);
}
.theme-block-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--c-line);
    padding-bottom: 0.8rem;
    margin-bottom: 1.4rem;
}
.theme-block-title {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    color: var(--c-ink);
    margin: 0;
    letter-spacing: -0.005em;
}
.theme-block-meta {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--c-accent);
    font-weight: 600;
    margin: 0;
}

.theme-book-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.4rem 1.2rem;
}
.theme-book-link {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    text-decoration: none;
    color: inherit;
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.theme-book-link:hover { transform: translateY(-3px); }

.theme-book-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    background-size: cover;
    background-position: center;
    background-color: var(--c-warm);
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    transition: box-shadow var(--tr-medium);
}
.theme-book-link:hover .theme-book-cover {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}
.theme-book-cover.is-empty {
    background: linear-gradient(135deg, var(--c-warm), var(--c-line));
}
.theme-book-media-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 16, 12, 0.82);
    color: var(--c-cream);
    border-radius: 50%;
    font-size: 0.78rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.theme-book-info { display: flex; flex-direction: column; gap: 0.15rem; }
.theme-book-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.25;
    color: var(--c-ink);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.theme-book-author {
    font-family: var(--f-sans);
    font-size: 0.82rem;
    color: var(--c-ink);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.theme-book-boat {
    font-family: var(--f-sans);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-accent);
    margin: 0.15rem 0 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .theme-cloud { padding: 1rem 1rem; gap: 0.45rem 0.5rem; }
    .theme-pill { padding: 0.28rem 0.7rem; }
    .theme-sections { padding: 0 1rem; }
    .theme-book-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem 0.9rem;
    }
    .theme-book-cover { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14); }
}

/* ===============================================================
   OGGETTI NON-LIBRO (video/audio): badge sulla card + player nel
   modale. Il json puo' avere book.media = { type, url, label }.
   =============================================================== */

/* Card: badge ▶ in alto a destra sulla cover */
.book-card.has-media .book-card-cover {
    position: relative;
}
.book-card-media-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem 0.2rem 0.4rem;
    background: rgba(20, 16, 12, 0.82);
    color: var(--c-cream);
    font-family: var(--f-sans);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 100px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}
.book-card-media-icon {
    font-size: 0.78rem;
    line-height: 1;
    color: var(--c-warm-soft);
}
.book-card.is-media-audio .book-card-media-icon {
    color: #f4c87a;
}

/* Modale: cover sostituita da iframe/video/audio */
.modal-cover.has-media {
    min-height: 240px;
    background: #0d0a08 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.modal-media-frame {
    width: 100%;
    height: 100%;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.modal-media-frame iframe,
.modal-media-frame video {
    width: 100%;
    height: 100%;
    min-height: 240px;
    aspect-ratio: 16 / 9;
    border: 0;
    display: block;
    background: #000;
}
.modal-media-frame audio {
    width: 100%;
    margin: 0 1rem;
}
.modal-media-link {
    color: var(--c-cream);
    font-family: var(--f-sans);
    font-weight: 600;
    text-decoration: underline;
    padding: 0.6rem 1rem;
}

@media (max-width: 560px) {
    .modal-cover.has-media,
    .modal-media-frame,
    .modal-media-frame iframe,
    .modal-media-frame video {
        min-height: 200px;
    }
}

/* ===============================================================
   OTTIMIZZAZIONI MOBILE GLOBALI
   - Tipografia titoli ridotta sotto 480px (overflow-safe)
   - Padding sezioni ridotti (s-6 troppo grandi su mobile)
   - Tap-highlight color uniforme
   - Form input min 16px font-size (no zoom auto iOS)
   =============================================================== */

/* Tap highlight: petrolio molto trasparente (no flash blu default) */
@media (max-width: 760px) {
    a, button, [role="button"], input, select, textarea, [data-open] {
        -webkit-tap-highlight-color: rgba(31, 94, 108, 0.15);
    }
    /* Evita zoom auto iOS Safari sui campi search/text che fossero
       sotto 16px in qualche viewport. */
    input[type="search"],
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select,
    textarea {
        font-size: max(16px, 1em);
    }
}

@media (max-width: 600px) {
    /* Sezioni: dimezzo i padding verticali (s-5 ≈ 64px, s-6 ≈ 96px) */
    .bookshelf-section,
    .gallery-section,
    .videos-section,
    .story-section,
    .prose-section,
    .offer-section {
        padding-top: 2.4rem;
        padding-bottom: 2.4rem;
    }
    .boats-section { padding: 2.4rem 1rem; }
    .other-boats-section { padding-top: 2.4rem; padding-bottom: 2.4rem; }

    /* Section title: clamp meno aggressivo su mobile */
    .section-title { font-size: clamp(1.55rem, 5.4vw, 2.2rem); margin-bottom: 1.2rem; }
    .section-lead  { font-size: 0.98rem; }
    .eyebrow { font-size: 0.7rem; letter-spacing: 0.16em; margin-bottom: 0.9rem; }

    /* Riduco padding orizzontale 1.4rem → 1rem per guadagnare spazio */
    .bookshelf-section,
    .gallery-section,
    .videos-section,
    .story-section { padding-left: 1rem; padding-right: 1rem; }

    /* Boat-hero spaziatura piu' compatta */
    .boat-hero { padding: 1.6rem 1rem 1.2rem; gap: 1.2rem; }

    /* Story-section: testo letterario su mobile leggibile */
    .story-body p { font-size: 1.02rem; line-height: 1.6; }
    .story-lead   { font-size: 1.08rem !important; }
    .pull-quote   { font-size: 1.1rem !important; }

    /* Boats-intro: riduco margine fra titolo e slider */
    .boats-intro { margin-bottom: 1.4rem; }
}

@media (max-width: 380px) {
    /* Schermi molto piccoli (iPhone SE, Galaxy S5): margini essenziali */
    .bookshelf-section,
    .gallery-section,
    .videos-section,
    .story-section,
    .boat-hero,
    .prose-section,
    .offer-section {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
    .section-title { font-size: 1.45rem; }
    .hero-cinematic .hero-cta-row { gap: 0.5rem; }
    .hero-cinematic .hero-cta { font-size: 0.88rem; padding: 0.75rem 1rem; }
}

