.section--portfolio {
    background: var(--bg);
    padding: clamp(120px, 18vh, 200px) var(--gutter);
}

.portfolio__head {
    margin: 0 auto clamp(48px, 8vh, 88px);
    text-align: center;
}

.portfolio__title {
    font-family: var(--serif);
    font-weight: 600;
    /* Match the Partners heading scale for visual consistency. */
    font-size: clamp(22px, calc((100vw - 4rem) / 22), 58px);
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.portfolio__group + .portfolio__group {
    margin-top: clamp(72px, 12vh, 120px);
}

.portfolio__group-title {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 28px;
    padding-bottom: 16px;
}

.portfolio__row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.piece {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.piece__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-muted);
    transition: transform 0.6s var(--ease);
}

.piece__media:hover {
    transform: translateY(-4px);
}

.piece__media--video {
    /* Wrap relativo para posicionar facade, iframe y controles encima. */
    position: relative;
    background: #000;
    transform: none !important;
}

.vplayer__iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* ── FACADE (estado pre-click) ────────────────────── */
.vfacade {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

.vfacade__poster,
.vfacade__placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--bg-muted);
}

.vfacade__placeholder {
    background:
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.06), transparent 60%),
        linear-gradient(135deg, #2a2a2a 0%, #0a0a0a 100%);
}

/* Vignette sutil para legibilidad del título + play. */
.vfacade__shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,0.55) 100%),
        radial-gradient(circle at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.35) 100%);
    transition: background 0.3s ease;
}

.vfacade:hover .vfacade__shade {
    background:
        linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.65) 100%),
        radial-gradient(circle at center, rgba(0,0,0,0) 30%, rgba(0,0,0,0.45) 100%);
}

/* Botón de play grande, centrado. */
.vfacade__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.25s ease, transform 0.3s var(--ease), opacity 0.25s ease;
    opacity: 0.92;
}

.vfacade__play svg {
    margin-left: 4px; /* optical alignment for play triangle */
}

.vfacade:hover .vfacade__play {
    background: rgba(0, 0, 0, 0.70);
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 1;
}

.vfacade__play:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

/* ── CUSTOM CONTROLS BAR (estado post-click) ──────── */
.vctrl {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%);
    color: #fff;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s var(--ease);
    pointer-events: none;
}

.piece__media--video.is-active:hover .vctrl,
.piece__media--video.is-active:focus-within .vctrl,
.vctrl[data-state="paused"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* The YT modal stage needs position:relative so the .vctrl + mask anchor to it. */
.yt-modal__stage {
    position: relative;
}

/* Voz-en-off YT modal: keep custom controls visible while the modal is open
 * and mask the YouTube watermark cluster in the bottom-right corner. */
.yt-modal.is-open .vctrl {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.95);
}

.yt-modal__stage {
    overflow: hidden;
}

.yt-modal__stage::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32%;
    height: 24%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(135deg,
        transparent 0%, transparent 38%,
        rgba(0, 0, 0, 0.9) 65%,
        rgba(0, 0, 0, 0.98) 100%);
}

.vctrl__btn {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    opacity: 0.85;
    border-radius: 4px;
    transition: opacity 0.2s ease, background 0.2s ease;
}
.vctrl__btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }
.vctrl__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; opacity: 1; }

/* Play/Pause icon toggle por state. */
.vctrl__ico { display: none; line-height: 0; }
.vctrl[data-state="paused"] .vctrl__ico--play { display: inline-flex; }
.vctrl[data-state="playing"] .vctrl__ico--pause { display: inline-flex; }
.vctrl[data-muted="0"] .vctrl__ico--vol { display: inline-flex; }
.vctrl[data-muted="1"] .vctrl__ico--mute { display: inline-flex; }

/* Scrubber */
.vctrl__scrubber {
    position: relative;
    flex: 1;
    height: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.vctrl__track {
    position: absolute;
    left: 0; right: 0;
    height: 3px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
}
.vctrl__progress {
    position: absolute;
    left: 0;
    height: 3px;
    width: 0;
    background: #fff;
    border-radius: 2px;
    transition: width 0.08s linear;
}
.vctrl__thumb {
    position: absolute;
    left: 0;
    width: 11px;
    height: 11px;
    background: #fff;
    border-radius: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.vctrl__scrubber:hover .vctrl__thumb,
.vctrl__scrubber:focus-visible .vctrl__thumb { opacity: 1; }

.vctrl__time {
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.85);
    font-variant-numeric: tabular-nums;
    min-width: 80px;
    text-align: center;
}

/* Mobile: botones más grandes para tap, controles siempre visibles. */
@media (max-width: 700px) {
    .vfacade__play { width: 60px; height: 60px; }
    .vctrl {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
        padding: 8px 10px;
        gap: 6px;
    }
    .vctrl__btn { width: 36px; height: 36px; }
    .vctrl__time { min-width: 70px; font-size: 10px; }
}

.piece__placeholder {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.06), transparent 60%),
        linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

.piece__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 26px;
    transition: transform 0.3s var(--ease), color 0.2s;
}
.piece__media:hover .piece__play {
    transform: scale(1.15);
    color: #fff;
}

.piece__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-family: var(--sans);
    font-size: 12.5px;
    letter-spacing: 0.06em;
    color: var(--ink-mute);
}

.piece__brand {
    color: var(--ink);
    font-weight: 600;
}

.piece__sep {
    color: var(--ink-faint);
}

.portfolio__note {
    margin-top: clamp(64px, 10vh, 96px);
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-mute);
    text-align: center;
}

@media (max-width: 980px) {
    .portfolio__row { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}
@media (max-width: 600px) {
    .portfolio__row { grid-template-columns: 1fr; gap: 32px; }
}
