/* ============================================================
   OROSEIMETEO · WEBCAM
   Pagina indipendente dai vecchi home-v3 / additions.
   ============================================================ */

.webcam-page-head {
    background: #fff;
    border-bottom: 1px solid var(--om-line-strong, #d9e0e4);
}

.webcam-page-head-inner {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
    padding-top: 54px;
    padding-bottom: 54px;
}

.webcam-page-head-copy {
    min-width: 0;
}

.webcam-kicker {
    display: block;
    color: var(--om-blue, #147fa8);
    font-size: 14px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.webcam-page-head h1 {
    margin: 8px 0 0;
    color: var(--om-blue-dark, #163f58);
    font-size: clamp(44px, 5vw, 62px);
    line-height: 1.02;
    letter-spacing: -.8px;
    font-weight: 700;
}

.webcam-page-head p {
    max-width: 760px;
    margin: 15px 0 0;
    color: var(--om-muted, #6e7f88);
    font-size: 19px;
    line-height: 1.55;
}

.webcam-section-nav {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.webcam-section-nav a {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border: 1px solid var(--om-line-strong, #d9e0e4);
    border-radius: 4px;
    background: #fff;
    color: #4b606b;
    font-size: 15px;
    line-height: 1.2;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.webcam-section-nav a:hover {
    border-color: #9fb5c0;
    background: #f7f7f7;
}

.webcam-section-nav a.is-active {
    border-color: var(--om-blue, #147fa8);
    background: var(--om-blue, #147fa8);
    color: #fff;
}

.webcam-live-section {
    padding: 54px 0 64px;
    background: #fff;
}

.webcam-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 26px;
}

.webcam-section-heading h2 {
    margin: 6px 0 0;
    color: var(--om-blue-dark, #163f58);
    font-size: clamp(34px, 4vw, 48px);
    line-height: 1.04;
    letter-spacing: -.5px;
    font-weight: 700;
}

.webcam-section-heading > p {
    max-width: 520px;
    margin: 0;
    color: var(--om-muted, #6e7f88);
    font-size: 17px;
    line-height: 1.5;
    text-align: right;
}

.webcam-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.webcam-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--om-line, #e1e5e8);
    border-radius: 4px;
    background: #fff;
}

.webcam-card-head {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--om-line, #e1e5e8);
}

.webcam-card-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.webcam-card-title > div {
    min-width: 0;
}

.webcam-card-title strong {
    display: block;
    color: var(--om-blue-dark, #163f58);
    font-size: 22px;
    line-height: 1.15;
    font-weight: 700;
}

.webcam-card-title small {
    display: block;
    margin-top: 4px;
    color: var(--om-muted, #6e7f88);
    font-size: 14px;
    line-height: 1.3;
}

.webcam-status-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: #9aa4aa;
}

.webcam-status-dot.is-live {
    background: #45ab6a;
    box-shadow: 0 0 0 5px rgba(69, 171, 106, .11);
}

.webcam-status-dot.is-maintenance {
    background: #d59a2f;
    box-shadow: 0 0 0 5px rgba(213, 154, 47, .11);
}

.webcam-status {
    flex: 0 0 auto;
    color: var(--om-muted-2, #87949b);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: .045em;
}

.webcam-status.is-live {
    color: #328757;
}

.webcam-status.is-maintenance {
    color: #9b6b11;
}

.webcam-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #edf1f3;
}

.webcam-media img,
.webcam-media iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.webcam-media img {
    object-fit: cover;
    transition: opacity .2s ease;
}

.webcam-media img.is-refreshing {
    opacity: .72;
}

.webcam-media-clickable {
    cursor: zoom-in;
}

.webcam-media-clickable:focus-visible {
    outline: 3px solid var(--om-blue, #147fa8);
    outline-offset: -3px;
}

.webcam-card-head-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.webcam-stream-open {
    padding: 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    color: var(--om-blue, #147fa8);
    font: inherit;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
    cursor: pointer;
}

.webcam-stream-open:hover {
    color: var(--om-blue-dark, #163f58);
}

.webcam-stream-open:focus-visible {
    outline: 2px solid var(--om-blue, #147fa8);
    outline-offset: 4px;
}

.webcam-maintenance-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 7px;
    padding: 28px;
    background: rgba(18,29,35,.66);
    color: #fff;
    text-align: center;
    pointer-events: none;
}

.webcam-maintenance-overlay strong {
    font-size: 24px;
    line-height: 1.15;
    font-weight: 700;
}

.webcam-maintenance-overlay span {
    max-width: 430px;
    font-size: 15px;
    line-height: 1.45;
    color: rgba(255,255,255,.88);
}

.webcam-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--om-line, #e1e5e8);
}

.webcam-card-actions a {
    min-width: 0;
    display: block;
    padding: 17px 20px 18px;
    color: inherit;
    text-decoration: none;
}

.webcam-card-actions a + a {
    border-left: 1px solid var(--om-line, #e1e5e8);
}

.webcam-card-actions a:hover {
    background: #f7f7f7;
}

.webcam-card-actions span {
    display: block;
    color: var(--om-blue-dark, #163f58);
    font-size: 16px;
    line-height: 1.25;
    font-weight: 700;
}

.webcam-card-actions small {
    display: block;
    margin-top: 4px;
    color: var(--om-muted, #6e7f88);
    font-size: 13px;
    line-height: 1.35;
}

/* ============================================================
   LIGHTBOX / FULLSCREEN
   Desktop: viewer grande.
   Mobile: viewer a tutto schermo; in verticale viene ruotato
   per sfruttare il display come una vista orizzontale 16:9.
   ============================================================ */

.webcam-lightbox {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: #05090b;
    transition: opacity .18s ease, visibility .18s ease;
    overscroll-behavior: none;
}

.webcam-lightbox[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.webcam-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 9, 11, .94);
    cursor: zoom-out;
}

.webcam-lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(1600px, calc(100vw - 40px));
    max-height: calc(100dvh - 40px);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 4px;
    background: #05090b;
    box-shadow: 0 28px 90px rgba(0,0,0,.5);
}

.webcam-lightbox-head {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 12px 0 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    color: #fff;
    background: #0b1216;
}

.webcam-lightbox-head strong {
    min-width: 0;
    overflow: hidden;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webcam-lightbox-head button {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.webcam-lightbox-media {
    min-height: 300px;
    display: grid;
    place-items: center;
    background: #000;
}

.webcam-lightbox-media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 96px);
    object-fit: contain;
}

.webcam-lightbox-media iframe {
    display: block;
    width: 100%;
    height: min(82dvh, 56.25vw);
    max-height: calc(100dvh - 96px);
    border: 0;
    background: #000;
}

html.webcam-lightbox-open,
html.webcam-lightbox-open body {
    overflow: hidden;
}

/* Fullscreen CSS su tablet/telefono. */
@media (max-width: 900px) {
    .webcam-lightbox {
        padding: 0;
        background: #000;
        touch-action: none;
    }

    .webcam-lightbox-backdrop {
        background: #000;
    }

    .webcam-lightbox-dialog {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: #000;
    }

    .webcam-lightbox-head {
        position: absolute;
        z-index: 5;
        top: 0;
        right: 0;
        left: 0;
        min-height: 0;
        padding: 10px 10px 0;
        border: 0;
        background: transparent;
        pointer-events: none;
    }

    .webcam-lightbox-head strong {
        display: none;
    }

    .webcam-lightbox-head button {
        margin-left: auto;
        width: 42px;
        height: 42px;
        flex-basis: 42px;
        border-color: rgba(255,255,255,.42);
        background: rgba(0,0,0,.56);
        pointer-events: auto;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }

    .webcam-lightbox-media {
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    .webcam-lightbox-media img,
    .webcam-lightbox-media iframe {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: contain;
        background: #000;
    }
}

/* Telefono tenuto in verticale:
   NON ruotiamo l'intero dialogo, altrimenti Safari sposta il viewer
   e porta fuori schermo anche il pulsante di chiusura.
   Ruotiamo soltanto l'area media e la centriamo nel viewport. */
@media (max-width: 900px) and (orientation: portrait) {
    .webcam-lightbox-dialog {
        width: 100vw;
        height: 100dvh;
        transform: none;
        overflow: hidden;
    }

    .webcam-lightbox-media {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 100dvh;
        height: 100vw;
        min-height: 0;
        transform: translate(-50%, -50%) rotate(90deg);
        transform-origin: center center;
    }

    .webcam-lightbox-media img,
    .webcam-lightbox-media iframe {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: contain;
    }

    .webcam-lightbox-head {
        z-index: 20;
    }
}

@media (max-width: 980px) {
    .webcam-page-head-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 24px;
    }

    .webcam-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    .webcam-section-heading > p {
        max-width: none;
        text-align: left;
    }

    .webcam-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .webcam-page-head-inner {
        min-height: 0;
        padding-top: 40px;
        padding-bottom: 34px;
    }

    .webcam-page-head h1 {
        font-size: 38px;
        letter-spacing: -.4px;
    }

    .webcam-page-head p {
        font-size: 17px;
        line-height: 1.5;
    }

    .webcam-section-nav {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }

    .webcam-section-nav a {
        min-width: 0;
        padding: 0 9px;
        font-size: 14px;
    }

    .webcam-live-section {
        padding: 42px 0 48px;
    }

    .webcam-section-heading h2 {
        font-size: 33px;
    }

    .webcam-section-heading > p {
        font-size: 16px;
    }

    .webcam-card-head {
        min-height: 0;
        padding: 15px 16px;
    }

    .webcam-card-title strong {
        font-size: 20px;
    }

    .webcam-card-title small {
        font-size: 13px;
    }

    .webcam-status {
        font-size: 11px;
    }

    .webcam-card-head-actions {
        align-items: flex-end;
        flex-direction: column;
        gap: 5px;
    }

    .webcam-stream-open {
        font-size: 11px;
    }

    .webcam-card-actions a {
        padding: 15px 16px;
    }

    .webcam-card-actions span {
        font-size: 15px;
    }

    .webcam-card-actions small {
        font-size: 12px;
    }

    .webcam-maintenance-overlay {
        padding: 20px;
    }

    .webcam-maintenance-overlay strong {
        font-size: 21px;
    }

    .webcam-maintenance-overlay span {
        font-size: 14px;
    }

}

@media (max-width: 470px) {
    .webcam-section-nav {
        grid-template-columns: 1fr;
    }

    .webcam-section-nav a {
        justify-content: flex-start;
        padding-left: 13px;
    }

    .webcam-card-actions {
        grid-template-columns: 1fr;
    }

    .webcam-card-actions a + a {
        border-left: 0;
        border-top: 1px solid var(--om-line, #e1e5e8);
    }
}
