/**
 * Accommodation gallery lightbox
 *
 * Stonehenge Child Theme
 * Version: 1.0.0
 *
 * Replaces Elementor Pro's global lightbox, which left with the plugin — see the
 * long note at the top of assets/js/sc-lightbox.js for what the visitor was
 * actually getting instead (the browser's raw-image view, with no close).
 *
 * 🔴 SCOPED, per ATEN rule 4. Every selector here starts with .sc-lb, and the file
 *    is enqueued only on a singular mphb_room_type. Nothing leaks to another page.
 *
 * 🔑 Colours are CSS custom properties with main-site fallbacks, so riat.css
 *    restyles this for free: .sc-riat-chrome already redefines --ink, --gold,
 *    --paper and --muted, and the overlay follows the page it was opened from
 *    without a second copy of these rules.
 */

.sc-lb {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    background: rgba(8, 4, 20, .92);
    backdrop-filter: blur(3px);
}

.sc-lb.is-open {
    display: flex;
}

/* Stop the page scrolling behind the overlay. */
.sc-lb-locked,
.sc-lb-locked body {
    overflow: hidden;
}

.sc-lb__stage {
    margin: 0;
    max-width: min(1100px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.sc-lb__img {
    display: block;
    max-width: 100%;
    /* 128px leaves room for the caption and the counter at the bottom. */
    max-height: calc(100vh - 128px);
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}

.sc-lb__cap {
    margin: 0;
    font-family: "Lato", system-ui, sans-serif;
    font-size: 14px;
    color: var(--muted, rgba(255, 255, 255, .72));
    text-align: center;
}

.sc-lb__count {
    position: absolute;
    bottom: 18px;
    left: 0;
    right: 0;
    margin: 0;
    text-align: center;
    font-family: "Lato", system-ui, sans-serif;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted, rgba(255, 255, 255, .6));
}

/* ── controls ───────────────────────────────────────────────────────────────
   🔴 44x44 minimum. These are the controls whose absence Mark reported; a 24px
      hit area on a phone is barely better than not having them. */
.sc-lb__close,
.sc-lb__nav {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    cursor: pointer;
    transition: background .18s, border-color .18s, transform .18s;
}

/* 🔴 :focus IS LISTED HERE ON PURPOSE, AND SO IS THE box-shadow RESET.
   assets/css/base.css — the Hello Elementor reset this theme absorbed in step 6 —
   styles EVERY bare <button> on the site:

       button:hover, button:focus { background-color: #c36 }      ← a pink
       button:focus-visible      { box-shadow: 0 0 0 4px #fff;
                                   outline: 2px solid #000 }

   The lightbox gives the close button focus the moment it opens, so it rendered
   as a PINK circle inside a violet overlay with a white halo round it. Nothing in
   this file said pink; it came from a global reset three files away.

   🔑 Found by asking the browser which rules matched the element, after a
      screenshot showed a colour that appears in no rule of mine. Grepping for
      "close" found nothing, because the rule does not mention close — or
      lightbox, or anything else about this component. */
.sc-lb__close:hover,
.sc-lb__close:focus,
.sc-lb__nav:hover,
.sc-lb__nav:focus {
    background: var(--gold, #e8a020);
    border-color: var(--gold, #e8a020);
    color: var(--ink, #111);
    box-shadow: none;
    outline: none;
}

/* Keyboard users still get a ring — just this one, not the reset's. */
.sc-lb__close:focus-visible,
.sc-lb__nav:focus-visible {
    outline: 2px solid var(--gold, #e8a020);
    outline-offset: 3px;
    box-shadow: none;
}

.sc-lb__close {
    position: absolute;
    top: 18px;
    right: 18px;
}

.sc-lb__nav[hidden] {
    display: none;
}

@media (max-width: 720px) {
    .sc-lb {
        padding: 12px;
        gap: 4px;
    }

    .sc-lb__close,
    .sc-lb__nav {
        width: 44px;
        height: 44px;
    }

    /* On a phone the arrows sit over the image rather than beside it — there is
       no room for three columns at 375px. */
    .sc-lb__nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    .sc-lb__prev {
        left: 10px;
    }

    .sc-lb__next {
        right: 10px;
    }

    .sc-lb__img {
        max-height: calc(100vh - 150px);
    }
}
