/*
 * Photo viewer — redesigned immersive chrome (Phase 1 of the photos redesign).
 * Dark, full-bleed stage with a translucent top bar (title + position + actions),
 * large overlay nav arrows, and a restyled thumbnail rail. Keyboard-native:
 * arrows navigate; d/f/s = download/fullscreen/share.
 *
 * TEMPORARY standalone stylesheet loaded by athletes/photos.twig. When styles.css is
 * next rebuilt, fold these rules into www/css/milesplit/components/_modals.scss under
 * `.modal.photo` using the real $blue / Roboto-Condensed tokens, and drop this file.
 */

.modal.photo {
    --pv-stage: #0e0e12;
    --pv-bar: rgba(18, 18, 22, 0.92);
    --pv-line: rgba(255, 255, 255, 0.14);
    --pv-text: #ffffff;
    --pv-muted: #a9a9b3;
    --pv-navy: #000062;
}

.modal.photo .photo-sr-only {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Immersive dialog: near-fullscreen, dark. */
.modal.photo .modal-dialog {
    margin: 0 auto;
    max-width: none;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
}

.modal.photo .modal-content {
    background: var(--pv-stage);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: var(--pv-text);
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    width: 100%;
}

/* Top bar */
.modal.photo .modal-content .modal-header {
    align-items: center;
    background: var(--pv-bar);
    border-bottom: 1px solid var(--pv-line);
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 16px;
    padding: 12px 20px;
    position: relative;
    z-index: 3;
}

.modal.photo .modal-content .modal-header .modal-title-container {
    align-items: flex-start;
    flex-direction: column;
    min-width: 0;
}

.modal.photo .modal-content .modal-header .modal-title,
.modal.photo .modal-content .modal-header .modal-title a {
    color: var(--pv-text);
    font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin: 0;
    max-width: 46vw;
    overflow: hidden;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal.photo .modal-title-container .photo-meta {
    line-height: 1.4;
    margin: 3px 0 0;
}

.modal.photo .modal-title-container .photo-position,
.modal.photo .modal-title-container .photo-quality {
    color: var(--pv-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.modal.photo .modal-title-container .photo-quality:not(:empty)::before {
    content: " · ";
}

.modal.photo .modal-title-container .photo-quality.is-pending::after {
    animation: photo-quality-spin 0.8s linear infinite;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 50%;
    border-top-color: #fff;
    content: "";
    display: inline-block;
    height: 8px;
    margin-left: 5px;
    vertical-align: 1px;
    width: 8px;
}

@keyframes photo-quality-spin { to { transform: rotate(360deg); } }

/* Action toolbar */
.modal.photo .photo-actions {
    align-items: center;
    display: flex;
    gap: 8px;
    margin-left: auto;
    margin-right: 40px; /* clear the header close button */
}

.modal.photo .photo-actions .photo-action {
    align-items: center;
    background: transparent;
    border: 1px solid var(--pv-line);
    border-radius: 999px;
    color: var(--pv-text);
    cursor: pointer;
    display: inline-flex;
    font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
    font-size: 13px;
    font-weight: 700;
    gap: 7px;
    letter-spacing: 0.3px;
    line-height: 1;
    padding: 9px 15px;
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
    white-space: nowrap;
}

.modal.photo .photo-actions .photo-action:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
}

.modal.photo .photo-actions .photo-action svg {
    height: 16px;
    width: 16px;
}

/* Download is the primary action — high-contrast so it pops on the dark bar. */
.modal.photo .photo-actions .photo-action.photo-download {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--pv-navy);
}

.modal.photo .photo-actions .photo-action.photo-download:hover {
    background: #e7e7ef;
    border-color: #e7e7ef;
}

.modal.photo .photo-actions .photo-action:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Close button (injected by the modal base) — white, top-right. */
.modal.photo .modal-content .modal-header .close {
    color: var(--pv-text);
    margin: 0;
    opacity: 0.85;
    position: absolute;
    right: 16px;
    top: 14px;
}
.modal.photo .modal-content .modal-header .close svg { fill: var(--pv-text); }
.modal.photo .modal-content .modal-header .close:hover { opacity: 1; }

/* Stage */
.modal.photo .modal-content .modal-body {
    background: var(--pv-stage);
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
}

.modal.photo .modal-content .body-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.modal.photo .modal-content .owl-carousel {
    border: 0;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.modal.photo .modal-content .owl-carousel .owl-stage-outer,
.modal.photo .modal-content .owl-carousel .owl-stage,
.modal.photo .modal-content .owl-carousel .owl-item,
.modal.photo .modal-content .owl-carousel .item,
.modal.photo .modal-content .owl-carousel .item-container {
    height: 100%;
}

.modal.photo .modal-content .owl-carousel .item-hero {
    align-items: center;
    background: var(--pv-stage);
    display: flex;
    height: 100%;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
    position: relative;
}

.modal.photo .modal-content .owl-carousel .item-hero img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}

.modal.photo .photo-image-notice,
.modal.photo .photo-image-error {
    background: rgba(18, 18, 22, 0.88);
    border: 1px solid var(--pv-line);
    border-radius: 6px;
    bottom: 56px;
    color: var(--pv-text);
    font-size: 13px;
    left: 50%;
    margin: 0;
    max-width: 520px;
    padding: 9px 12px;
    pointer-events: none;
    position: absolute;
    text-align: center;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    z-index: 3;
}

.modal.photo .photo-image-error {
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Caption / credit — subtle, over the bottom of the stage. */
.modal.photo .modal-content .owl-carousel .item-info {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
    bottom: 0;
    color: var(--pv-text);
    font-size: 13px;
    left: 0;
    letter-spacing: 0.2px;
    line-height: 1.5;
    min-height: 0;
    padding: 28px 20px 14px;
    position: absolute;
    right: 0;
    z-index: 2;
}

/* Overlay nav arrows */
.modal.photo .modal-content .owl-carousel .owl-nav {
    margin: 0;
}

.modal.photo .modal-content .owl-carousel .owl-nav button.owl-prev,
.modal.photo .modal-content .owl-carousel .owl-nav button.owl-next {
    align-items: center;
    background: rgba(20, 20, 24, 0.55);
    border-radius: 50%;
    display: flex;
    height: 48px;
    justify-content: center;
    margin: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: background-color 0.14s ease;
    width: 48px;
    z-index: 2;
}
.modal.photo .modal-content .owl-carousel .owl-nav button.owl-prev { left: 16px; }
.modal.photo .modal-content .owl-carousel .owl-nav button.owl-next { right: 16px; }
.modal.photo .modal-content .owl-carousel .owl-nav button:hover { background: rgba(0, 0, 0, 0.85); }
.modal.photo .modal-content .owl-carousel .owl-nav button img { height: 18px; width: 18px; }

/* Thumbnail rail */
.modal.photo .modal-content .owl-thumbs-responsive {
    background: var(--pv-bar);
    border-top: 1px solid var(--pv-line);
    flex: 0 0 auto;
    height: auto;
    padding: 12px 16px;
}

.modal.photo .modal-content .owl-thumbs-responsive .owl-thumbs-container {
    left: 0;
    position: relative;
    top: 0;
}

.modal.photo .modal-content .owl-thumbs .owl-thumb-item {
    border: 2px solid transparent;
    border-radius: 4px;
    height: 60px;
    margin: 0 6px 0 0;
    opacity: 0.5;
    overflow: hidden;
    padding: 0;
    transition: opacity 0.14s ease, border-color 0.14s ease;
    width: 106px;
}
.modal.photo .modal-content .owl-thumbs .owl-thumb-item:hover { opacity: 0.85; }
.modal.photo .modal-content .owl-thumbs .owl-thumb-item.active {
    border-color: #ffffff;
    opacity: 1;
}
.modal.photo .modal-content .owl-thumbs .owl-thumb-item img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

/* Mobile: icon-only Download + Share (fullscreen dropped — native gestures cover it),
   so everything clears the close button. */
@media (max-width: 767px) {
    .modal.photo .modal-content .modal-header { gap: 8px; padding: 10px 12px; }
    .modal.photo .modal-content .modal-header .modal-title,
    .modal.photo .modal-content .modal-header .modal-title a {
        font-size: 15px;
        line-height: 1.15;
        max-width: 42vw;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }
    .modal.photo .photo-actions { margin-right: 42px; gap: 8px; }
    .modal.photo .photo-actions .photo-action { padding: 9px; border-radius: 50%; }
    .modal.photo .photo-actions .photo-action span { display: none; }
    .modal.photo .photo-actions .photo-fullscreen { display: none; }
    .modal.photo .modal-content .owl-thumbs .owl-thumb-item { height: 48px; width: 84px; }
}
