/* Photo Viewer — prohlížeč fotek a videí (www/js/photo-viewer.js). Dialog visí přímo v <body>,
   proto styly nezávisí na stránce, ale musí přebít Bootstrap 3 (p, a, button, img).
   Rozměry v px: Bootstrap 3 nastavuje html { font-size: 10px }. */

.pv {
    --pv-accent: #E47911;
    --pv-muted: #B9BEC5;
    --pv-meta: #9AA0A6;
    --pv-panel: #1A1D20;
    --pv-card: #23272B;
    --pv-card-hover: #2C3135;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    background: #111315;
    color: #FFFFFF;
    font-size: 16px;
    line-height: 1.45;
}

.pv *,
.pv *::before,
.pv *::after {
    box-sizing: border-box;
}

.pv [hidden] {
    display: none !important;
}

.pv[open] {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "head" "stage" "info" "thumbs";
}

.pv:focus {
    outline: none;
}

.pv::backdrop {
    background: #111315;
}

.pv a:focus-visible,
.pv button:focus-visible {
    outline: 3px solid #FFC58A;
    outline-offset: 2px;
}

html.pv-open {
    overflow: hidden;
}

.pv__head {
    grid-area: head;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 6px 6px 6px 16px;
}

.pv__heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pv__eyebrow {
    display: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pv-muted);
}

.pv__title {
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pv__counter-m {
    font-size: 13px;
    color: var(--pv-muted);
}

.pv__close {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #FFFFFF;
    cursor: pointer;
}

.pv__close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.pv__meta {
    display: none;
}

.pv__stage {
    grid-area: stage;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    touch-action: pan-y;
    container-type: size;
}

.pv__img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
}

.pv__video {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 16 : 9 co největší, aby se vešlo do scény na šířku i na výšku */
.pv__video iframe {
    display: block;
    width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    width: min(100cqw, 100cqh * 16 / 9);
    height: auto;
    border: 0;
    background: #000000;
}

.pv__counter {
    display: none;
}

.pv__nav {
    position: absolute;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(17, 19, 21, 0.62);
    color: #FFFFFF;
    cursor: pointer;
}

.pv__nav:hover {
    background: rgba(255, 255, 255, 0.22);
}

.pv__nav--prev {
    left: 8px;
}

.pv__nav--next {
    right: 8px;
}

.pv__info {
    grid-area: info;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 12px;
}

.pv__of {
    display: none;
    margin: 0;
    font-size: 13px;
    color: var(--pv-muted);
}

.pv__caption {
    min-height: 46px;
    margin: 0;
    font-size: 16px;
    line-height: 1.45;
    color: #FFFFFF;
}

.pv__caption b {
    font-weight: 700;
}

.pv__caption a {
    color: #FFC58A;
    text-decoration: underline;
}

.pv__caption a:hover,
.pv__caption a:focus {
    color: #FFFFFF;
}

.pv__card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--pv-card);
    color: #FFFFFF;
    text-decoration: none;
}

.pv__card:hover,
.pv__card:focus {
    background: var(--pv-card-hover);
    color: #FFFFFF;
    text-decoration: none;
}

.pv__card.is-empty {
    visibility: hidden;
}

.pv__card-label {
    display: block;
    font-size: 12px;
    color: var(--pv-meta);
}

.pv__card-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.pv__card svg {
    flex: 0 0 auto;
}

.pv__thumbs {
    grid-area: thumbs;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 16px 18px;
    scrollbar-width: none;
}

.pv__thumb {
    position: relative;
    flex: 0 0 auto;
    width: 52px;
    height: 68px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--pv-card);
    opacity: 0.55;
    cursor: pointer;
}

.pv__thumb:hover {
    opacity: 0.85;
}

.pv__thumb[aria-current="true"] {
    opacity: 1;
    outline: 2px solid var(--pv-accent);
    outline-offset: 2px;
}

.pv__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

.pv__thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pv__thumb-play svg {
    display: block;
}

.pv__hint {
    display: none;
}

/* desktop: fotka vlevo, panel s popisem a náhledy vpravo */
@media (min-width: 900px) {
    .pv[open] {
        grid-template-columns: minmax(0, 1fr) 360px;
        grid-template-rows: auto auto auto minmax(0, 1fr) auto;
        grid-template-areas: "stage head" "stage meta" "stage info" "stage thumbs" "stage hint";
        background: linear-gradient(to right, #111315 calc(100% - 360px), var(--pv-panel) calc(100% - 360px));
    }

    .pv__head {
        align-items: flex-start;
        padding: 24px 24px 0 28px;
    }

    .pv__eyebrow {
        display: block;
    }

    .pv__title {
        font-size: 24px;
        font-weight: 800;
        line-height: 1.2;
        white-space: normal;
    }

    .pv__counter-m {
        display: none;
    }

    .pv__close {
        background: rgba(255, 255, 255, 0.08);
    }

    .pv__meta {
        grid-area: meta;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
        margin: 0 24px 0 28px;
        padding: 18px 0;
        border-bottom: 1px solid var(--pv-card-hover);
    }

    .pv__date {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 10px;
        border-radius: 999px;
        background: #3A2A1A;
        color: #FFC58A;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.2;
    }

    .pv__number {
        font-size: 14px;
        color: var(--pv-meta);
    }

    .pv__stage {
        padding: 32px 92px;
    }

    .pv__counter {
        position: absolute;
        left: 24px;
        top: 24px;
        display: block;
        padding: 6px 12px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.12);
        font-size: 14px;
        font-weight: 600;
        line-height: 1.2;
    }

    .pv__nav {
        width: 52px;
        height: 52px;
        margin-top: -26px;
        background: rgba(255, 255, 255, 0.12);
    }

    .pv__nav--prev {
        left: 20px;
    }

    .pv__nav--next {
        right: 20px;
    }

    .pv__info {
        gap: 10px;
        padding: 18px 24px 18px 28px;
    }

    .pv__of {
        display: block;
    }

    .pv__caption {
        min-height: 52px;
        font-size: 18px;
    }

    .pv__card {
        min-height: 60px;
        padding: 10px 14px;
    }

    .pv__thumbs {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-auto-rows: 92px;
        align-content: start;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 4px 24px 4px 28px;
        scrollbar-width: thin;
    }

    .pv__thumb {
        width: 100%;
        height: 92px;
    }

    .pv__hint {
        grid-area: hint;
        display: block;
        margin: 0;
        padding: 12px 24px 20px 28px;
        font-size: 13px;
        color: var(--pv-meta);
    }
}
