/* ============================================================
   CONSTITUTIO ITALICA — Wall CSS
   v1: masonry CSS columns
   v2: CSS Grid dense, attivo via wall_livello >= 2
   ============================================================ */

@font-face {
    font-family: 'Magister';
    src: url('../fonts/Magister-Regular.woff2') format('woff2'),
         url('../fonts/Magister-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Magister';
    src: url('../fonts/Magister-Italic.woff2') format('woff2'),
         url('../fonts/Magister-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    background: #fff;
    color: #1a1a1a;
    font-family: 'Magister', Georgia, serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   WALL CONTAINER
   ============================================================ */

.wall-wrap {
    width: 100%;
    padding: 0;
}


/* ============================================================
   WALL V1 — MASONRY (CSS columns)
   ============================================================ */

.wall-v1 {
    position: relative;
}

.wall-sizer        { width: calc(20% - 1px); }
.wall-sizer-gutter { width: 1px; }

.wall-v1 .wall-cell {
    width: calc(20% - 1px);
    margin-bottom: 1px;
    margin-right: 1px;
}


/* ============================================================
   WALL V2 — CSS GRID
   Colonne: 6 desktop · 4 tablet · 2 mobile
   Row unit = metà larghezza colonna
   ============================================================ */

.wall-v2 {
    --wall-cols: 6;
    --wall-gap: 1px;
    --col-w: calc((100vw - (var(--wall-cols) - 1) * var(--wall-gap)) / var(--wall-cols));
    --row-h: calc(var(--col-w) / 2);

    display: grid;
    grid-template-columns: repeat(var(--wall-cols), 1fr);
    grid-auto-rows: var(--row-h);
    grid-auto-flow: dense;
    gap: var(--wall-gap);
}

/* Taglie celle v2 */
.wall-v2 .wall-cell.v2-small  { grid-column: span 1; grid-row: span 3; }
.wall-v2 .wall-cell.v2-medium { grid-column: span 2; grid-row: span 6; }
.wall-v2 .wall-cell.v2-large  { grid-column: span 3; grid-row: span 9; }

/* Fallback: cella senza taglia assegnata */
.wall-v2 .wall-cell:not(.v2-small):not(.v2-medium):not(.v2-large) {
    grid-column: span 1;
    grid-row: span 3;
}


/* ============================================================
   WALL CELL — BASE
   ============================================================ */

.wall-cell {
    position: relative;
    background: #fff;
    overflow: hidden;
    /* usato per il tabindex del non_assegnato senza link */
    cursor: default;
}

/* Cella con link */
.wall-cell.has-link {
    cursor: pointer;
}

/* Cella con link: cursor pointer direttamente sul div (richiesto da iOS) */
.wall-cell.has-link .cell-inner {
    cursor: pointer;
}

/* cell-inner: riempie la cella, gestisce overflow */
.cell-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* ============================================================
   CONTENUTO TESTUALE
   ============================================================ */

.cell-body {
    flex: 1;
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    z-index: 1;
}

/* Testo articolo (tavola artistica) */
.cell-text-articolo {
    font-size: 12px;
    line-height: 1.7;
    letter-spacing: 0.01em;
    font-style: normal;
}

/* Frontespizio: "Art. XX" */
.cell-text-frontespizio {
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1;
    letter-spacing: -0.02em;
}

/* Sezione speciale: titolo */
.cell-text-sezione {
    font-size: clamp(18px, 2.5vw, 30px);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

/* ============================================================
   STATO ABROGATO
   ============================================================ */

.wall-cell.abrogato .cell-text-articolo,
.wall-cell.abrogato .cell-text-frontespizio {
    text-decoration: line-through;
    opacity: 0.38;
}


/* ============================================================
   STATO MODIFICATO
   ============================================================ */

.cell-nota-modificato {
    display: block;
    background: #e8dcc8 !important;
    color: #1a1a1a !important;
    font-size: 9px;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 1px 5px;
    margin-top: 10px;
    width: fit-content;
}

/* ============================================================
   IMMAGINE CELLA
   ============================================================ */

.cell-image {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.cell-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Quando c'è l'immagine (v2 livello=2), il body si nasconde */
.wall-cell.has-image .cell-body {
    display: none;
}


/* ============================================================
   OVERLAY (hover desktop · tap non_assegnato)
   ============================================================ */

.cell-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 26, 0.88);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 18px 20px;
    opacity: 0;
    transition: opacity 0.18s ease;
    z-index: 10;
    pointer-events: none;
}

.cell-overlay .overlay-stato {
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0.65;
    margin-bottom: 4px;
}

.cell-overlay .overlay-autore {
    font-size: 15px;
    font-style: italic;
    line-height: 1.2;
}

/* Desktop hover → mostra overlay (tutti gli stati tranne consegnato che ha badge) */
@media (hover: hover) {
    .wall-cell:hover .cell-overlay {
        opacity: 1;
    }
}

/* Tap su non_assegnato (gestito via JS con classe .overlay-aperto) */
.wall-cell.overlay-aperto .cell-overlay {
    opacity: 1;
}

/* Celle assegnate: overlay beige chiaro invece di nero */
.wall-cell:not(.stato-non-assegnato) .cell-overlay {
    background: rgba(245, 241, 233, 0.85);
    color: #1a1a1a;
}
.wall-cell:not(.stato-non-assegnato) .cell-overlay .overlay-stato {
    opacity: 0.5;
}


/* ============================================================
   BADGE FISSO (etichetta stato sempre visibile)
   ============================================================ */

.cell-badge {
    position: absolute;
    bottom: 12px;
    left: 14px;
    z-index: 5;
    display: none; /* mostrato selettivamente */
    align-items: center;
    gap: 5px;
    background: #1a1a1a;
    color: #fff;
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 4px 8px;
    pointer-events: none;
    line-height: 1;
}

.cell-badge .badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Consegnato/Realizzata: badge su tutti i dispositivi */
.wall-cell.stato-consegnato .cell-badge {
    display: flex;
    background: #1a1a1a;
}

/* Pubblicato (livello 2): badge con colore distinto */
.wall-cell.livello-2 .cell-badge {
    background: #1a1a1a;
}

/* ============================================================
   STATO CONSEGNATO — fondo diverso
   ============================================================ */

.wall-cell.stato-consegnato {
    background: #f7f5f2;
}

/* Con immagine: fondo neutro che scompare sotto l'img */
.wall-cell.stato-consegnato.has-image {
    background: #1a1a1a;
}


/* ============================================================
   STATO ASSEGNATO — badge su touch/tablet
   (hover: none copre touch devices)
   ============================================================ */

@media (hover: none) {
    .wall-cell.stato-attivo .cell-badge {
        display: flex;
    }
}


/* ============================================================
   TAVOLA TIPOGRAFICA — solo immagine (sempre consegnata)
   ============================================================ */


/* ============================================================
   DIFFERENZIAZIONE TIPOLOGICA
   ============================================================ */

/* Tavole artistiche — nessun trattamento aggiuntivo */

.wall-cell.tipo-calligrafo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    height: 1px;
    background: #999;
    z-index: 3;
}

/* Bordo superiore per separazione celle adiacenti */
.wall-cell.tipo-artista {
    border-top: 1px solid #efefef;
}

/* Sezioni speciali — fondo nero, testo bianco */
.wall-cell.tipo-calligrafo-speciale {
    background: #1a1a1a;
    border-top: 2px solid #fff;
    border-left: none;
}

.wall-cell.tipo-calligrafo-speciale .cell-text-sezione {
    color: #fff;
}

.wall-cell.tipo-calligrafo-speciale .cell-label {
    display: none;
}

.wall-cell.tipo-calligrafo-speciale .cell-overlay {
    background: rgba(26, 26, 26, 0.88);
}
.wall-cell.tipo-calligrafo-speciale:not(.stato-non-assegnato) .cell-overlay {
    background: rgba(245, 241, 233, 0.85);
    color: #1a1a1a;
}

.wall-cell.tipo-calligrafo-speciale.stato-consegnato {
    background: #1a1a1a;
}


/* ============================================================
   CERCA — barra orizzontale overlay
   ============================================================ */

/* ── Pill cerca ── */
#btn-cerca {
    position: fixed;
    top: 72px;
    right: 18px;
    z-index: 200;
    height: 40px;
    width: 40px;
    border-radius: 20px;
    background: #1a1a1a;
    color: #fff;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: width .35s cubic-bezier(.4,0,.2,1),
                border-radius .35s ease;
}

#btn-cerca.aperta {
    width: 264px;
}

#search-trigger {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#search-trigger svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'Magister', Georgia, serif;
    font-size: 13px;
    letter-spacing: .06em;
    outline: none;
    height: 40px;
    min-width: 0;
    padding: 0 80px 0 16px;
    opacity: 0;
    transition: opacity .2s ease .15s;
}

#btn-cerca.aperta #search-input { opacity: 1; padding-right: 120px; }

#search-input::-webkit-search-cancel-button,
#search-input::-webkit-search-decoration,
#search-input::-webkit-search-results-button,
#search-input::-webkit-search-results-decoration {
    display: none;
    -webkit-appearance: none;
    appearance: none;
}

#search-input::placeholder {
    color: rgba(255,255,255,.45);
    font-style: italic;
    text-transform: lowercase;
    letter-spacing: .12em;
}

#search-count {
    position: absolute;
    right: 110px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    letter-spacing: .06em;
    color: rgba(255,255,255,.55);
    white-space: nowrap;
    pointer-events: none;
}

#search-nav-up,
#search-nav-down {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,.45);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 20px;
    font-size: 11px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color .12s;
}
#search-nav-up   { right: 88px; }
#search-nav-down { right: 70px; }
#search-nav-up:hover,
#search-nav-down:hover { color: #fff; }

#btn-cerca.search-has-results #search-nav-up,
#btn-cerca.search-has-results #search-nav-down { display: flex; }

#search-clear {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,.55);
    cursor: pointer;
    padding: 4px;
    font-size: 15px;
    line-height: 1;
    transition: color .12s;
    display: none;
}

#search-clear.visibile { display: block; }
#search-clear:hover { color: #fff; }


/* Cella nascosta dal filtro/ricerca */
.wall-cell.nascosta {
    display: none !important;
}


/* ============================================================
   FILTRA — desktop: menu a raggera (left center)
             mobile: panel dal basso (bottom right)
   ============================================================ */

#btn-filtra {
    position: fixed;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    flex-shrink: 0;
    box-shadow: 0 0 0 1.5px #e0e0e0;
}

#btn-filtra:hover {
    background: #333;
    box-shadow: 0 0 0 1.5px #e0e0e0;
}

#btn-filtra.attivo {
    background: #fff;
    color: #1a1a1a;
    box-shadow: 0 0 0 1.5px #1a1a1a;
}

#btn-filtra:not(.attivo):hover {
    transform: translateY(-50%) scale(1.06);
}

#btn-filtra .filtra-icona {
    font-size: 20px;
    line-height: 1;
    color: #fff;
    pointer-events: none;
    display: block;
}

#btn-filtra .filtra-icona-chiudi {
    font-size: 24px;
    line-height: 1;
    color: #000000;
    pointer-events: none;
    display: none;
}

#btn-filtra.attivo .filtra-icona {
    display: none;
}

#btn-filtra.attivo .filtra-icona-chiudi {
    display: block;
    font-size: 24px;
    line-height: 1;
    color: #1a1a1a;
    pointer-events: none;
}

/* Filtri attivi: indicatore */
#btn-filtra .filtri-count {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    color: #1a1a1a;
    font-size: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    letter-spacing: 0;
    box-shadow: 0 0 0 1px #1a1a1a;
}

#btn-filtra.ha-filtri .filtri-count {
    display: flex;
}

/* ── Menu filtri (desktop ≥ 900px) ── */

.filter-menu {
    position: fixed;
    left: 58px;
    top: 50%;
    z-index: 199;
    pointer-events: none;
    display: block;
    opacity: 0;
    transition: opacity .22s ease, transform .25s cubic-bezier(.4,0,.2,1);
    transform: translateY(-50%) translateX(-120%);
}

.filter-menu.aperto {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}


.filter-item {
    position: absolute;
    top: 20px;
    left: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    --tx: 0px;
    --ty: 0px;
    transform: translate(-50%, -50%);
}

.filter-menu.aperto .filter-item {
    opacity: 1;
    pointer-events: none;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)));
    transition-delay: calc(var(--i, 0) * 0.05s);
}

.filter-menu.aperto .filter-btn {
    pointer-events: auto;
}

.filter-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 286px; /* larghezza "Tavole tipografiche" + 30% */
    height: 36px;
    gap: 16px;
    background: #fff;
    border: none;
    font-family: 'Magister', Georgia, serif;
    font-size: 13px;
    letter-spacing: .08em;
    cursor: pointer;
    white-space: nowrap;
    color: #1a1a1a;
    padding: 0 10px;
    transition: background .12s, color .12s;
    text-align: right;
    box-sizing: border-box;
}

.filter-btn span:not(.filter-simbolo) {
    flex: 1;
    text-align: right;
}

.filter-btn:hover {
    background: #f0f0f0;
}

.filter-btn.attivo {
    background: #1a1a1a;
    color: #fff;
    position: relative;
    overflow: visible;
}

.filter-btn.attivo::after {
    content: '☞';
    position: absolute;
    right: -36px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: #1a1a1a;
    pointer-events: none;
}

.filter-simbolo {
    font-size: 19.5px;
    line-height: 1;
    flex-shrink: 0;
    order: -1;
    transition: none;
}

/* -------------------------------------------------------
   Panel dal basso (mobile/tablet ≤ 899px)
   ------------------------------------------------------- */

.filter-panel {
    display: none; /* visibile solo su mobile/tablet */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 210;
    background: #fff;
    border-top: 1px solid #1a1a1a;
    padding: 20px 20px 32px;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.filter-panel.aperto {
    transform: translateY(0);
}

.filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.filter-panel-title {
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0.5;
}

.filter-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #1a1a1a;
    padding: 4px;
    opacity: 0.5;
    transition: opacity 0.12s;
}

.filter-panel-close:hover {
    opacity: 1;
}

.filter-panel-group {
    margin-bottom: 20px;
}

.filter-panel-group-label {
    font-size: 9px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0.35;
    margin-bottom: 10px;
}

.filter-panel-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-panel-btn {
    padding: 7px 14px;
    border: 1px solid #1a1a1a;
    background: #fff;
    color: #1a1a1a;
    font-family: 'Magister', Georgia, serif;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    line-height: 1;
}

.filter-panel-btn.attivo {
    background: #1a1a1a;
    color: #fff;
}

.filter-panel-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.filter-panel-reset {
    flex: 1;
    padding: 10px;
    background: none;
    border: 1px solid #e0e0e0;
    font-family: 'Magister', Georgia, serif;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    color: #1a1a1a;
    opacity: 0.5;
    transition: opacity 0.12s, border-color 0.12s;
}

.filter-panel-reset:hover {
    opacity: 1;
    border-color: #1a1a1a;
}

.filter-panel-apply {
    flex: 2;
    padding: 10px;
    background: #1a1a1a;
    border: none;
    font-family: 'Magister', Georgia, serif;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    color: #fff;
    transition: background 0.12s;
}

.filter-panel-apply:hover {
    background: #333;
}

/* Overlay backdrop per panel mobile */
.filter-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26,26,26,0.4);
    z-index: 205;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
}

.filter-backdrop.aperto {
    opacity: 1;
    pointer-events: auto;
}


/* ============================================================
   RESPONSIVE — V1 MASONRY
   ============================================================ */

/* Tablet orizzontale fino a 1280px: rimane 5 colonne */

@media (max-width: 1023px) and (orientation: portrait),
       (max-width: 767px) and (orientation: landscape) {
    .wall-v1 .wall-cell {
        width: calc(33.333% - 1px);
    }
    .wall-sizer { width: calc(33.333% - 1px); }
}

@media (max-width: 599px) and (orientation: portrait) {
    .wall-v1 .wall-cell {
        width: calc(50% - 1px);
    }
    .wall-sizer { width: calc(50% - 1px); }
}


/* ============================================================
   RESPONSIVE — V2 GRID
   ============================================================ */

/* Tablet verticale → 4 colonne, taglie small + medium (large → medium) */
@media (max-width: 1023px) and (orientation: portrait) {
    .wall-v2 {
        --wall-cols: 4;
    }
    /* Large decade a medium (4 col non reggono span 3) */
    .wall-v2 .wall-cell.v2-large {
        grid-column: span 2;
        grid-row: span 6;
    }
}

/* Mobile verticale → 2 colonne */
@media (max-width: 599px) and (orientation: portrait) {
    .wall-v2 {
        --wall-cols: 2;
    }
    .wall-v2 .wall-cell.v2-large {
        grid-column: span 2;
        grid-row: span 6;
    }
    .wall-v2 .wall-cell.v2-medium {
        grid-column: span 2;
        grid-row: span 6;
    }
}

/* Mobile orizzontale → 4 colonne */
@media (max-width: 767px) and (orientation: landscape) {
    .wall-v2 {
        --wall-cols: 4;
    }
    .wall-v2 .wall-cell.v2-large {
        grid-column: span 2;
        grid-row: span 6;
    }
}


/* ============================================================
   RESPONSIVE — CONTROLLI FLOTTANTI
   ============================================================ */

/* Mobile/tablet: filtra → bottom right, panel invece di raggera */
@media (max-width: 899px) {
    #btn-filtra {
        left: auto;
        right: 18px;
        top: auto;
        bottom: 18px;
        transform: none;
    }

    #btn-filtra:not(.attivo):hover {
        transform: scale(1.06);
    }

    /* Sposta cerca sotto la barra di navigazione */
    #btn-cerca {
        bottom: auto;
        top: 68px;
    }

    .filter-menu {
        display: none !important;
    }

    .filter-panel {
        display: block;
    }

    .filter-backdrop {
        display: block;
    }
}


/* ============================================================
   NESSUN RISULTATO
   ============================================================ */

.wall-empty-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.35;
    pointer-events: none;
    display: none;
    text-align: center;
    line-height: 1.8;
}


/* ============================================================
   ETICHETTA TIPO CELLA
   ============================================================ */

.cell-label {
    position: absolute;
    top: 12px;
    left: 14px;
    font-size: 8px;
    letter-spacing: .18em;
    text-transform: uppercase;
    opacity: .3;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
}

.wall-empty-msg.visibile {
    display: block;
}


/* ============================================================
   FOCUS ACCESSIBILITY
   ============================================================ */

.cell-inner:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: -2px;
}

.filter-btn:focus-visible,
.filter-panel-btn:focus-visible,
#btn-cerca:focus-visible,
#btn-filtra:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* ============================================================
   BARRA DI NAVIGAZIONE
   ============================================================ */

.site-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

.site-bar.visibile {
    opacity: 1;
    pointer-events: auto;
}

.site-bar-title {
    font-family: 'Magister', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: -.01em;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    font-family: 'Magister', Georgia, serif;
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #1a1a1a;
    text-decoration: none;
    opacity: .5;
    transition: opacity .15s;
    white-space: nowrap;
}

.nav-link:hover { opacity: 1; }

/* Quando la barra è visibile, sposta il wall sotto */
body.banner-chiuso .wall-wrap {
    padding-top: 56px;
}

/* ============================================================
   BANNER OVERLAY
   ============================================================ */

.banner-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    transition: opacity .4s ease, visibility .4s ease;
}

.banner-overlay.nascosto {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.banner-inner {
    max-width: 640px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.banner-title {
    font-family: 'Magister', Georgia, serif;
    font-size: clamp(52px, 10vw, 96px);
    font-weight: 400;
    line-height: .9;
    letter-spacing: -.02em;
    color: #1a1a1a;
}

.banner-abstract {
    font-family: 'Magister', Georgia, serif;
    font-size: clamp(14px, 1.8vw, 18px);
    font-weight: 400;
    font-style: italic;
    line-height: 1.6;
    color: #1a1a1a;
    opacity: .7;
    max-width: 480px;
}

.banner-countdown {
    font-family: 'Magister', Georgia, serif;
    font-size: 13px;
    letter-spacing: .12em;
    opacity: .45;
    line-height: 1.8;
    font-variant-numeric: tabular-nums;
}

.banner-cta {
    font-family: 'Magister', Georgia, serif;
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: #1a1a1a;
    background: transparent;
    border: 1px solid #1a1a1a;
    padding: 12px 36px;
    cursor: pointer;
    transition: background .2s, color .2s;
    margin-top: 8px;
}

.banner-cta:hover {
    background: #1a1a1a;
    color: #fff;
}

/* ============================================================
   COUNTDOWN FISSO
   ============================================================ */

.fixed-countdown {
    position: fixed;
    bottom: 28px;
    right: 0;
    z-index: 150;
    font-family: 'Magister', Georgia, serif;
    font-size: 12px;
    letter-spacing: .1em;
    opacity: 0;
    pointer-events: none;
    text-align: right;
    line-height: 1.7;
    font-variant-numeric: tabular-nums;
    transition: opacity .4s ease .2s;
    background: rgba(255, 255, 255, .82);
    padding: 10px 14px 10px 18px;
}

.fixed-countdown.visibile {
    opacity: 1;
}

.fixed-countdown-label,
.fixed-countdown-unit {
    display: block;
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    opacity: .55;
}

.fixed-countdown-value {
    display: block;
    font-size: 14px;
    letter-spacing: .12em;
    opacity: .55;
}

/* ============================================================
   "Sai dove sei?" — ancoraggio fisso + dondolio
   ============================================================ */

@keyframes fixed-help-rock {
    0%   { transform: translateY(0px)    rotate(-2.5deg); }
    18%  { transform: translateY(-9px)   rotate(2deg);   }
    36%  { transform: translateY(-4px)   rotate(-1.5deg); }
    54%  { transform: translateY(-11px)  rotate(2.5deg); }
    72%  { transform: translateY(-6px)   rotate(-2deg);  }
    90%  { transform: translateY(-8px)   rotate(1.5deg); }
    100% { transform: translateY(0px)    rotate(-2.5deg); }
}

.fixed-help-wrap {
    position: fixed;
    left: 33.333vw;
    bottom: 33.333vh;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s ease .2s;
    transform-origin: center bottom;
}

.fixed-help-wrap.visibile {
    opacity: 1;
    pointer-events: auto;
    animation: fixed-help-rock 7s ease-in-out infinite;
}

.fixed-help {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1a1a1a;
    font-family: 'Magister', Georgia, serif;
}

.fixed-help-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .85);
    border: 1px solid rgba(26, 26, 26, .2);
    box-shadow: 0 6px 22px rgba(26, 26, 26, .14);
    font-size: 40px;
    font-style: italic;
    letter-spacing: 0;
    transition: border-color .15s, box-shadow .15s;
}

.fixed-help:hover .fixed-help-icon {
    border-color: #1a1a1a;
    box-shadow: 0 8px 28px rgba(26, 26, 26, .22);
}

.fixed-help-label {
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, .85);
    padding: 6px 10px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .2s ease, transform .2s ease;
    white-space: nowrap;
    pointer-events: none;
}

.fixed-help:hover .fixed-help-label {
    opacity: 1;
    transform: translateX(0);
}

.fixed-help-close {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
    padding: 0;
}

.fixed-help-wrap:hover .fixed-help-close {
    opacity: 1;
}

/* ============================================================
   TOUCH DEVICES — fix interazioni
   ============================================================ */

@media (hover: none) {
    /* Bottone × invisibile non deve intercettare tap sull'icona ? */
    .fixed-help-close {
        pointer-events: none;
    }
    /* Animazione disabilitata: su iOS l'elemento animato con transform
       ha hit-box sfasato rispetto alla posizione visiva */
    .fixed-help-wrap.visibile {
        animation: none;
    }
}

/* ============================================================
   RESPONSIVE — banner/barra/countdown
   ============================================================ */

@media (max-width: 600px) {
    .site-bar { padding: 0 16px; }
    .site-nav { gap: 16px; }
    .nav-link { font-size: 10px; letter-spacing: .12em; }
    .banner-overlay { padding: 24px 20px; }
    .fixed-countdown { bottom: 16px; right: auto; left: 0; text-align: left; padding: 10px 18px 10px 14px; }
    .ci-bang { display: none; }
}


/* Respiro aggiuntivo celle calligrafo */
.wall-v1 .tipo-calligrafo .cell-body,
.wall-v1 .tipo-calligrafo-speciale .cell-body {
    padding: 36px 24px 32px;
}

/* ============================================================
   INDICATORE STATO — bordo sinistro centrato verticalmente
   ============================================================ */

.wall-cell::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 80px;
    z-index: 4;
    pointer-events: none;
}

/* Non assegnato */
.wall-cell.scat-vuoto::after {
    background: #ccc;
}

/* Assegnato / Riassegnato */
.wall-cell.stato-assegnato::after,
.wall-cell.stato-riassegnato::after {
    background: #2d9e5f;
}

/* In lavorazione */
.wall-cell.stato-in-lavorazione::after {
    background: #e8a020;
}

/* In riassegnazione */
.wall-cell.stato-in-riassegnazione::after {
    background: #ccc;
}

/* Consegnato */
.wall-cell.stato-consegnato::after {
    background: #2a6db0;
}

/* Ritirato */
.wall-cell.stato-ritirato::after {
    background: #9a1a1a;
}

/* Sezioni speciali — indicatore bianco su fondo nero */
.wall-cell.tipo-calligrafo-speciale::after {
    background: rgba(255, 255, 255, .3);
}

.wall-cell.tipo-calligrafo-speciale.stato-assegnato::after,
.wall-cell.tipo-calligrafo-speciale.stato-riassegnato::after {
    background: #2d9e5f;
}

.wall-cell.tipo-calligrafo-speciale.stato-consegnato::after {
    background: #2a6db0;
}

/* Evidenziazione ricerca */
mark.search-hl {
    background: #e8ff00;
    color: #1a1a1a;
    padding: 0 2px;
    border-radius: 2px;
}

.wall-cell.tipo-calligrafo-speciale mark.search-hl {
    background: #e8ff00;
    color: #1a1a1a;
}

mark.search-hl-active,
.wall-cell.tipo-calligrafo-speciale mark.search-hl-active {
    background: #3399ff !important;
    color: #fff !important;
}

/* ── Overlay backdrop menu filtri desktop ── */
#filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(240, 240, 240, .65);
    z-index: 198;
    opacity: 0;
    transition: opacity .25s ease;
}

#filter-overlay.aperto {
    opacity: 1;
}

/* ============================================================
   FOOTER UNIVERSALE
   ============================================================ */

.site-footer-global {
    border-top: 1px solid #efefef;
    padding: 32px 40px;
    font-family: 'Magister', Georgia, serif;
    font-size: 11px;
    letter-spacing: .12em;
    color: #1a1a1a;
}

.site-footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.site-footer-copy {
    opacity: .4;
}

.site-footer-copy a {
    color: #1a1a1a;
    text-decoration: none;
    transition: opacity .15s;
}

.site-footer-copy a:hover { opacity: .8; }

.site-footer-links {
    display: flex;
    gap: 24px;
}

.site-footer-links a {
    color: #1a1a1a;
    text-decoration: none;
    opacity: .4;
    transition: opacity .15s;
}

.site-footer-links a:hover { opacity: 1; }

.site-footer-credits {
    opacity: .4;
}

.site-footer-credits a {
    color: #1a1a1a;
    text-decoration: none;
    transition: opacity .15s;
}

.site-footer-credits a:hover { opacity: .8; }

@media (max-width: 860px) {
    .site-footer-global {
        padding: 24px 32px;
    }
    .site-footer-inner {
        gap: 16px;
        justify-content: flex-start;
    }
    .site-footer-credits {
        flex-basis: 100%;
    }
}

@media (max-width: 600px) {
    .site-footer-global {
        padding: 24px 20px;
    }
    .site-footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .site-footer-credits {
        flex-basis: auto;
    }
}

/* ── Overlay curiosità / appuntamenti ─────────────────────── */

.ci-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 320px;
    transform: translateY(100%);
    transition: transform .7s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 900;
    pointer-events: none;
}

.ci-overlay.visibile {
    transform: translateY(0);
    pointer-events: auto;
}

.ci-bang {
    position: absolute;
    top: -56px;
    left: -18px;
    font-family: 'Magister', Georgia, serif;
    font-size: 80px;
    font-style: italic;
    line-height: 1;
    color: #1a1a1a;
    animation: ci-bounce 0.55s ease-in-out infinite alternate;
    user-select: none;
    opacity: 0;
    transition: opacity .3s .4s;
}

.ci-overlay.visibile .ci-bang {
    opacity: 1;
}

@keyframes ci-bounce {
    from { transform: translateY(0); }
    to   { transform: translateY(-14px); }
}

.ci-box {
    width: 100%;
    min-height: 320px;
    background: rgba(245, 245, 245, 0.92);
    padding: 28px 28px 24px;
    box-sizing: border-box;
    position: relative;
}

.ci-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #1a1a1a;
    opacity: .45;
    padding: 4px 6px;
    transition: opacity .15s;
}

.ci-close:hover { opacity: 1; }

.ci-titolo {
    font-family: 'Magister', Georgia, serif;
    font-size: 22px;
    font-style: italic;
    color: #1a1a1a;
    margin: 0 0 16px;
    padding-right: 32px;
}

.ci-testo {
    font-family: 'Magister', Georgia, serif;
    font-size: 15px;
    line-height: 1.55;
    color: #1a1a1a;
    margin: 0 0 20px;
}

.ci-fonte {
    font-family: 'Magister', Georgia, serif;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: #1a1a1a;
    opacity: .5;
    margin: 0;
}
