/* ============================================================
   El visor de fotos (photo-viewer.js, _PhotoViewer.cshtml)
   ============================================================
   Teléfono: la foto ocupa la pantalla, flechas sobre ella, el botón abajo al
   alcance del pulgar. Escritorio: un panel sobre la página, flechas grandes
   fuera de la foto y el botón en el pie, a la derecha.

   Por encima de todo (z 1070) salvo los avisos flotantes (.alert--float, 1080):
   "Puedes elegir hasta N fotos" tiene que verse con el visor abierto.
   ============================================================ */

html.psv-lock { overflow: hidden; }

/* Lo que abre el visor desde la grilla. */
[data-viewer-item] { cursor: zoom-in; }
[data-viewer-item]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.psv {
    --psv-bar: 60px;
    --psv-foot: 148px;
    position: fixed; inset: 0; z-index: 1070;
    display: flex; align-items: stretch; justify-content: center;
    background: #0A0A0F; color: var(--white);
}
.psv[hidden] { display: none; }

.psv__panel { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: #0A0A0F; }

.psv__bar { flex: 0 0 var(--psv-bar); display: flex; align-items: center; gap: 12px; padding: 0 8px; border-bottom: 1px solid #1C1C26; }
.psv__close { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--white); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.psv__head { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding-right: 44px; }
.psv__kicker { font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.psv--podium .psv__kicker { color: #C9A962; }
.psv__count { margin: 0; font-family: var(--font-body); font-size: 14px; font-weight: 500; color: #C8C8D4; font-variant-numeric: tabular-nums; }
.psv__keys { display: none; }

.psv__stage { flex: 1 1 auto; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 12px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.psv__frame { position: relative; margin: 0; line-height: 0; }
.psv__img { display: block; max-width: 100vw; max-height: calc(100vh - var(--psv-bar) - var(--psv-foot) - 24px); width: auto; height: auto; object-fit: contain; transition: opacity .15s ease; }
@supports (height: 100dvh) {
    .psv__img { max-height: calc(100dvh - var(--psv-bar) - var(--psv-foot) - 24px); }
}
.psv.is-loading .psv__img { opacity: .45; }
.psv__frame .watermark-overlay::before,
.psv__frame .watermark-overlay::after { font-size: 3rem; color: rgba(255,255,255,.4); }

.psv__badge { position: absolute; top: 10px; left: 10px; z-index: 3; padding: 4px 8px; line-height: 1.3; background: var(--accent); color: var(--black); font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.psv__badge.is-owned { background: rgba(10,10,15,.85); color: var(--accent); }

.psv__nav { position: absolute; top: 50%; z-index: 4; transform: translateY(-50%); width: 44px; height: 44px; padding: 0; border: 0; display: inline-flex; align-items: center; justify-content: center; background: rgba(10,10,15,.72); color: var(--white); cursor: pointer; }
.psv__nav--prev { left: 8px; }
.psv__nav--next { right: 8px; }
.psv__nav:disabled { opacity: .3; cursor: default; }

.psv__foot { flex: 0 0 auto; min-height: var(--psv-foot); box-sizing: border-box; padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; border-top: 1px solid #1C1C26; }
.psv__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.psv__label { margin: 0; font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psv__msg { margin: 0; font-size: 14px; color: #F0A35E; }
.psv__msg:empty { display: none; }
.psv__cart { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--white); text-decoration: none; }
.psv__cart[hidden] { display: none; }
.psv__cart b { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

.psv__acts { order: -1; display: flex; }
.psv__acts > * { flex: 1 1 auto; }
.psv__acts [hidden] { display: none; }
.psv__add, .psv__owned, .psv__incart-label, .psv__remove {
    min-height: 54px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
}
.psv__add { border: 0; padding: 0 24px; background: var(--accent); color: var(--black); cursor: pointer; }
.psv__owned { border: 1px solid var(--accent); padding: 0 24px; color: var(--accent); }
.psv__incart { display: flex; gap: 8px; }
.psv__incart-label { flex: 1 1 auto; padding: 0 16px; background: #18181F; color: var(--accent); }
.psv__remove { flex: 0 0 auto; padding: 0 16px; border: 1px solid var(--border-light); background: none; color: #C8C8D4; font-family: var(--font-body); font-weight: 500; font-size: 14px; letter-spacing: 0; text-transform: none; cursor: pointer; }
.psv__add:disabled, .psv__remove:disabled { opacity: .6; cursor: progress; }

.psv button:focus-visible, .psv a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 900px) {
    .psv { --psv-bar: 64px; --psv-foot: 84px; align-items: center; padding: 24px; background: rgba(5,5,8,.86); }
    .psv__panel { flex: 0 1 1100px; height: min(100%, 920px); background: #111118; border: 1px solid var(--border); }
    .psv__bar { padding: 0 12px 0 24px; gap: 16px; }
    .psv__close { order: 3; }
    .psv__head { flex: 0 1 auto; flex-direction: row; align-items: baseline; gap: 16px; padding-right: 0; }
    .psv__count { font-size: 16px; color: var(--white); }
    .psv__keys { display: block; margin-left: auto; font-size: 13px; color: var(--text-secondary); }

    /* Las flechas van fijas a los bordes del panel, no pegadas a la foto: al lado
       de la imagen se corrían con cada una según fuera vertical u horizontal, y
       el mouse quedaba fuera del botón al pasar de foto. */
    .psv__stage { padding: 20px 104px; }
    .psv__nav { width: 56px; height: 56px; border: 1px solid var(--border-light); background: #18181F; }
    .psv__nav--prev { left: 24px; }
    .psv__nav--next { right: 24px; }
    .psv__nav:hover:not(:disabled) { border-color: var(--accent); }
    .psv__img { max-width: calc(min(100vw - 48px, 1100px) - 210px); max-height: calc(min(100vh - 48px, 920px) - var(--psv-bar) - var(--psv-foot) - 42px); }

    .psv__foot { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; }
    .psv__label { font-size: 15px; color: var(--white); }
    .psv__cart { min-height: 0; justify-content: flex-start; color: var(--text-secondary); }
    .psv__acts { order: 0; flex: 0 0 auto; }
    .psv__acts > * { flex: 0 0 auto; }
}
