299 lines
6.8 KiB
CSS
299 lines
6.8 KiB
CSS
/* ===============================
|
||
MODAL OVERLAY
|
||
=============================== */
|
||
|
||
.modal {
|
||
position: fixed;
|
||
inset: 0; /* top:0 right:0 bottom:0 left:0 */
|
||
background: rgba(0,0,0,0.8);
|
||
display: none; /* chiuso di default */
|
||
align-items: center;
|
||
justify-content: center;
|
||
z-index: 9999; /* sopra a qualunque overlay/sheet */
|
||
overflow: hidden; /* evita scroll sullo sfondo */
|
||
/* Animazione di fade */
|
||
opacity: 0;
|
||
transition: opacity 160ms ease-out;
|
||
}
|
||
|
||
.modal.open {
|
||
display: flex;
|
||
opacity: 1;
|
||
}
|
||
|
||
/* effetto vetro opzionale dove supportato */
|
||
@supports (backdrop-filter: blur(4px)) {
|
||
.modal {
|
||
backdrop-filter: blur(4px);
|
||
}
|
||
}
|
||
|
||
/* ===============================
|
||
CONTENITORE CONTENUTI
|
||
=============================== */
|
||
|
||
.modal-content {
|
||
width: 90vw;
|
||
height: 90vh;
|
||
max-width: 1200px;
|
||
max-height: 90vh;
|
||
position: relative;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
|
||
/* Animazione di scale-in */
|
||
transform: scale(0.98);
|
||
transition: transform 160ms ease-out;
|
||
}
|
||
|
||
.modal.open .modal-content {
|
||
transform: scale(1);
|
||
}
|
||
|
||
/* Ridimensionamento su mobile */
|
||
@media (max-width: 768px) {
|
||
.modal-content {
|
||
width: 100vw;
|
||
height: 100vh;
|
||
}
|
||
}
|
||
|
||
/* Contenitore del media */
|
||
#modalMediaContainer {
|
||
width: 100%;
|
||
height: 100%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
/* Evita che clic sul media “passino” al layer sotto */
|
||
position: relative;
|
||
z-index: 1;
|
||
}
|
||
|
||
/* Immagini e video si adattano all’area */
|
||
#modalMediaContainer img,
|
||
#modalMediaContainer video {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: contain;
|
||
display: block;
|
||
background: #000; /* evita flash bianco */
|
||
position: relative; /* crea contesto */
|
||
z-index: 1; /* sotto ai pulsanti */
|
||
}
|
||
|
||
/* ===============================
|
||
PULSANTE CHIUSURA (X)
|
||
=============================== */
|
||
|
||
/* FISSO sopra al video, con safe-area per iPhone */
|
||
.modal-close {
|
||
position: fixed; /* <-- chiave: resta sopra al video anche con stacking strani */
|
||
top: calc(8px + env(safe-area-inset-top));
|
||
right: calc(12px + env(safe-area-inset-right));
|
||
z-index: 10001; /* il modal è 9999 */
|
||
|
||
background: rgba(0,0,0,0.35);
|
||
color: #fff;
|
||
border-radius: 22px;
|
||
min-width: 44px; /* target minimo consigliato */
|
||
height: 44px;
|
||
padding: 0 10px;
|
||
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
cursor: pointer;
|
||
font-weight: 700;
|
||
border: 1px solid rgba(255,255,255,0.25);
|
||
box-shadow: 0 2px 8px rgba(0,0,0,0.4);
|
||
user-select: none;
|
||
line-height: 1;
|
||
}
|
||
|
||
/* area di hit più ampia senza cambiare il look */
|
||
.modal-close::after {
|
||
content: "";
|
||
position: absolute;
|
||
inset: -8px; /* allarga di 8px tutt’intorno */
|
||
}
|
||
|
||
.modal-close:hover {
|
||
background: rgba(0,0,0,0.5);
|
||
}
|
||
|
||
.modal-close:active {
|
||
transform: translateY(1px);
|
||
}
|
||
|
||
.modal-close:focus-visible {
|
||
outline: 2px solid #4c9ffe;
|
||
outline-offset: 2px;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
/* ===============================
|
||
PULSANTE INFO (ℹ️)
|
||
=============================== */
|
||
|
||
.modal-info-btn {
|
||
position: absolute;
|
||
bottom: 12px;
|
||
right: 16px;
|
||
|
||
background: #fff;
|
||
border-radius: 50%;
|
||
width: 40px;
|
||
height: 40px;
|
||
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
cursor: pointer;
|
||
border: 1px solid #d0d0d0;
|
||
font-size: 20px;
|
||
z-index: 10000; /* sopra al media, sotto alla X */
|
||
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
||
|
||
/* 🔒 Disattiva selezione e popup dizionario */
|
||
user-select: none;
|
||
-webkit-user-select: none;
|
||
-webkit-touch-callout: none;
|
||
-webkit-tap-highlight-color: transparent;
|
||
}
|
||
|
||
.modal-info-btn:hover {
|
||
background: #f7f7f7;
|
||
}
|
||
|
||
.modal-info-btn:active {
|
||
transform: scale(0.95);
|
||
}
|
||
|
||
.modal-info-btn:focus-visible {
|
||
outline: 2px solid #4c9ffe;
|
||
outline-offset: 2px;
|
||
}
|
||
|
||
|
||
/* ℹ️ evidenziato quando il pannello info è aperto */
|
||
.modal-info-btn.active {
|
||
background: #f7f7f7;
|
||
border-color: #cfcfcf;
|
||
box-shadow: 0 2px 8px rgba(0,0,0,0.25);
|
||
transform: none;
|
||
}
|
||
|
||
/* ===============================
|
||
(OPZIONALE) LINK "APRI ORIGINALE ↗"
|
||
=============================== */
|
||
|
||
.modal-open-original {
|
||
position: absolute;
|
||
top: 8px;
|
||
right: 56px; /* lascia spazio alla X */
|
||
background: rgba(255,255,255,0.95);
|
||
color: #000;
|
||
border-radius: 16px;
|
||
height: 32px;
|
||
padding: 0 10px;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
cursor: pointer;
|
||
border: 1px solid #d0d0d0;
|
||
font-size: 13px;
|
||
z-index: 10000; /* sopra al media */
|
||
text-decoration: none;
|
||
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
||
}
|
||
|
||
.modal-open-original:hover {
|
||
background: #fff;
|
||
}
|
||
|
||
.modal-open-original:focus-visible {
|
||
outline: 2px solid #4c9ffe;
|
||
outline-offset: 2px;
|
||
border-radius: 6px;
|
||
}
|
||
|
||
/* ===============================
|
||
MODAL STATE UTILI
|
||
=============================== */
|
||
|
||
body.no-scroll {
|
||
overflow: hidden;
|
||
}
|
||
|
||
/* High contrast / accessibility (opzionale) */
|
||
@media (prefers-contrast: more) {
|
||
.modal {
|
||
background: rgba(0,0,0,0.9);
|
||
}
|
||
.modal-close,
|
||
.modal-info-btn,
|
||
.modal-open-original {
|
||
border-color: #000;
|
||
box-shadow: none;
|
||
}
|
||
}
|
||
|
||
/* Riduci animazioni se l’utente lo preferisce */
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.modal,
|
||
.modal-content {
|
||
transition: none !important;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/* ===============================
|
||
FRECCE DI NAVIGAZIONE < >
|
||
=============================== */
|
||
|
||
.modal-nav-btn {
|
||
position: fixed; /* fisso: resta sopra a video/immagine */
|
||
top: calc(50% + env(safe-area-inset-top));
|
||
transform: translateY(-50%);
|
||
z-index: 10000; /* sopra al media, sotto alla X (10001) */
|
||
|
||
width: 44px;
|
||
height: 44px;
|
||
border-radius: 22px;
|
||
border: 1px solid rgba(255,255,255,0.25);
|
||
background: rgba(0,0,0,0.35);
|
||
color: #fff;
|
||
font-size: 22px;
|
||
line-height: 1;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
|
||
user-select: none;
|
||
-webkit-user-select: none;
|
||
-webkit-tap-highlight-color: transparent;
|
||
box-shadow: 0 2px 8px rgba(0,0,0,0.4);
|
||
|
||
transition: background-color .15s ease, transform .05s ease;
|
||
}
|
||
|
||
.modal-nav-btn:hover { background: rgba(0,0,0,0.5); }
|
||
.modal-nav-btn:active { transform: translateY(-50%) translateY(1px); }
|
||
.modal-nav-btn:focus-visible {
|
||
outline: 2px solid #4c9ffe;
|
||
outline-offset: 2px;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.modal-nav-btn.prev { left: calc(12px + env(safe-area-inset-left)); }
|
||
.modal-nav-btn.next { right: calc(12px + env(safe-area-inset-right)); }
|
||
|
||
/* Nascondi automaticamente se c'è un solo elemento */
|
||
.modal-nav-btn.hidden { display: none !important; }
|