/* photo_overlay.css - #109: the in-page overlay/modal that shows a
   photo's detail on top of the results grid it was opened from.
   Loaded site-wide (layout.html) since any results page can opt in via
   photoOverlay.js. .photo-detail-card's own theming (light + the
   raceface dark theme, see photo_detail.css) is reused for the dialog. */

.photo-overlay-root {
    position: fixed;
    inset: 0;
    z-index: 10500; /* above the navbar (1030) and any in-page overlay (max 9999) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.photo-overlay-root[hidden] {
    display: none;
}

body.photo-overlay-open {
    overflow: hidden;
}

.photo-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 15, 0.72);
}

.photo-overlay-dialog {
    position: relative;
    max-width: 900px;
    max-height: 90vh;
    width: 100%;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.photo-overlay-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.08);
    color: #374151;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.photo-overlay-close:hover {
    background: rgba(17, 24, 39, 0.15);
}

/* Lets people click the left/right portion of the photo itself to go
   prev/next, not just hit the small arrow icon (added by photoOverlay.js,
   scoped to .photo-frame so it can never sit over the action buttons or
   the assign-by-email field below the image). The click target is the
   full zone; the visible arrow is just a small icon centered on it,
   styled like the full-res magnifying-glass button in the photo's other
   corner - not a big button spanning the page edge. */
/* The stage is the full-width block around the photo (see addPhotoSideControls): the zones are a fixed
   share of it, so they are the same size for vertical and horizontal photos. */
.photo-stage {
    position: relative;
}
.photo-stage .photo-overlay-hotzone {
    bottom: 2rem;          /* the photo frame's bottom margin */
}
/* Choosing a person on the photo needs clicks on the photo, not navigation. */
.photo-stage:has(.photo-frame.is-picking) .photo-overlay-hotzone {
    display: none;
}

.photo-overlay-hotzone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    border: none;
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
    z-index: 2;
}

.photo-overlay-hotzone:disabled {
    cursor: default;
}

.photo-overlay-hotzone-prev {
    left: 0;
    justify-content: flex-start;
}

.photo-overlay-hotzone-next {
    right: 0;
    justify-content: flex-end;
    /* Stop short of the full-res button's corner (40px + 12px offset)
       so it stays independently clickable. */
    top: 56px;
}

.photo-overlay-hotzone-icon {
    width: 40px;
    height: 40px;
    margin: 0 0.5rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.15s ease, transform 0.15s ease;
}

/* Two-class selector (not just .photo-overlay-hotzone-icon on its own)
   specifically to out-specificity raceface-theme.css's
   `body.raceface-theme span { color: var(--rf-text-dim) !important }`
   blanket rule - this icon sits in a <span> (for the circular
   background), unlike the full-res button's <i>, which isn't wrapped in
   one and so was never caught by that rule. A single-class selector with
   !important still LOSES to that rule: both important, and CSS breaks
   the tie by specificity, where their one-class-plus-two-elements
   selector already out-specifies a plain one-class selector before
   !important is even considered. Confirmed via computed style: this
   icon rendered as rgb(138,138,138) (--rf-text-dim) instead of white
   without both the extra class and !important together. */
.photo-overlay-hotzone .photo-overlay-hotzone-icon {
    color: white !important;
}

.photo-overlay-hotzone:hover:not(:disabled) .photo-overlay-hotzone-icon {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.08);
}

.photo-overlay-hotzone:disabled .photo-overlay-hotzone-icon {
    opacity: 0.35;
}

.photo-overlay-loading {
    padding: 4rem 2rem;
    text-align: center;
    color: #6B7280;
    font-weight: 600;
}

.photo-action-feedback {
    display: none;
    text-align: center;
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    background: #ECFDF5;
    color: #047857;
}

.photo-action-feedback.is-visible {
    display: block;
}

.photo-action-feedback.is-error {
    background: #FEF2F2;
    color: #B91C1C;
}

body.raceface-theme .photo-overlay-close {
    background: rgba(255, 255, 255, 0.1);
    color: var(--rf-text-primary);
}

body.raceface-theme .photo-overlay-close:hover {
    background: rgba(255, 255, 255, 0.18);
}

body.raceface-theme .photo-action-feedback {
    background: rgba(16, 185, 129, 0.12);
    color: #34D399;
}

body.raceface-theme .photo-action-feedback.is-error {
    background: rgba(239, 68, 68, 0.12);
    color: #F87171;
}

@media (max-width: 768px) {
    .photo-overlay-root {
        padding: 0;
    }

    .photo-overlay-dialog {
        max-height: 100vh;
        border-radius: 0;
    }

    .photo-overlay-hotzone-icon {
        margin: 0 0.375rem;
    }
}

/* #155 feedback: the left/right arrows on the photo must read as buttons - a white ring at rest,
   orange fill on hover (matches the zoom icon in photo_detail.css). */
.photo-overlay-hotzone .photo-overlay-hotzone-icon {
    border: 2px solid rgba(255, 255, 255, 0.85);
}
.photo-overlay-hotzone:hover:not(:disabled) .photo-overlay-hotzone-icon {
    background: #FF6B35;
    border-color: #fff;
    transform: scale(1.15);
}
.photo-overlay-hotzone:focus-visible .photo-overlay-hotzone-icon {
    outline: 3px solid #FF6B35;
    outline-offset: 2px;
}
