/* =====================================================
   WHAT?studio v2 — Embed Vimeo + Lightbox
   Griglia lavori cliccabili -> player in overlay.
   Un solo <iframe> vivo alla volta (leggero).
   ===================================================== */

/* ---------- Card lavoro come <button> ---------- */
button.work {
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    background: var(--bg-elevated);
    -webkit-appearance: none;
    appearance: none;
}
button.work:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 3px;
}

/* ---------- Anteprima video al passaggio del mouse ---------- */
.work__player {
    position: absolute;
    inset: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
    pointer-events: none;
}
.work.is-previewing .work__player { opacity: 1; }
.work.is-previewing img { opacity: 0.9; }   /* la cover sotto smette di essere solo un fondo scuro */
.work__player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    /* il background player Vimeo è 16:9: scala per coprire il box 16:10 senza bande */
    transform: scale(1.18);
}

/* ---------- Embed responsivo inline (background loop / player fisso) ---------- */
.embed {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}
.embed::before {
    content: "";
    display: block;
    padding-top: 56.25%;           /* 16:9 default */
}
.embed[data-ratio="9-16"]::before { padding-top: 177.78%; }
.embed[data-ratio="1-1"]::before  { padding-top: 100%; }
.embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------- Lightbox ---------- */
.vlx {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: var(--gutter);
}
.vlx__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 6, 10, 0.86);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: vlx-fade var(--dur) var(--ease) both;
}
.vlx__dialog {
    position: relative;
    width: fit-content;
    max-width: min(1180px, 94vw);
    max-height: 92vh;
    animation: vlx-rise var(--dur-slow) var(--ease-out) both;
}
.vlx__frame {
    position: relative;
    width: min(1180px, 94vw);
    margin-inline: auto;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.55);
}
.vlx__frame::before {
    content: "";
    display: block;
    padding-top: 56.25%;
}
.vlx__frame.is-9-16 {
    width: auto;
    height: min(84vh, 780px);
    aspect-ratio: 9 / 16;
}
.vlx__frame.is-9-16::before { display: none; }
.vlx__frame.is-1-1 { width: min(84vh, 780px); }
.vlx__frame.is-1-1::before { padding-top: 100%; }
.vlx__frame iframe,
.vlx__frame video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}
.vlx__close {
    position: absolute;
    top: -3.25rem;
    right: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    line-height: 1;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background var(--dur) var(--ease);
}
.vlx__close:hover { background: rgba(255, 255, 255, 0.16); }
.vlx__close:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

@media (max-width: 560px) {
    .vlx__close { top: auto; bottom: -3.25rem; right: 50%; transform: translateX(50%); }
}

@keyframes vlx-fade { from { opacity: 0; } }
@keyframes vlx-rise { from { opacity: 0; transform: translateY(18px); } }

@media (prefers-reduced-motion: reduce) {
    .vlx__backdrop, .vlx__dialog { animation: none; }
}
