/* ============================================================================
   e-pao.net epGallery.asp — mobile overlay (companion to js/epao-responsive-gallery.js)
   Same contract as the index overlay: EVERY rule that changes layout lives
   inside @media (max-width: 1000px); desktop rendering is untouched.

   Mobile design: photo-first immersive viewer. The photo alone fills the
   screen (object-fit:contain on black — landscape shots fill a portrait
   phone's width, centred vertically). Chrome is two thin gradient overlays
   (title + counter on top; Prev / info / share / Next below) that a tap on
   the photo hides/shows. Description, number pills and related links live
   in a slide-up info sheet. Everything is scoped under html.epao-gal2,
   which the JS only adds when a .photo exists — the error page and desktop
   never get it.
   ============================================================================ */

/* Injected chrome stays hidden outside the breakpoint (JS only builds it on
   mobile, but a rotate/resize across 1000px must not reveal it on desktop). */
.epao-gal2-top, .epao-gal2-bar, .epao-gal2-sheet, .epao-gal2-scrim,
.epao-gal2-share { display: none; }

@media (max-width: 1000px) {

  /* ---- The stage: black screen, photo only ---- */
  html.epao-gal2, html.epao-gal2 body {
    height: 100%; overflow: hidden; background: #000;
  }
  .epao-gal2 #header,
  .epao-gal2 #menu,
  .epao-gal2 #commentarea,
  .epao-gal2 #footer,
  .epao-gal2 [id="srcParamId"],
  .epao-gal2 [id="idParam"] { display: none; }

  .epao-gal2 .photo {
    position: fixed; top: 0; left: 0; z-index: 1400;
    width: 100vw !important; height: 100vh !important;
    object-fit: contain; background: #000;
    margin: 0; border: 0; border-radius: 0; display: block;
  }
  @supports (height: 100dvh) {
    /* dvh tracks the browser's collapsing URL bar; vh above is the fallback */
    .epao-gal2 .photo { height: 100dvh !important; }
  }

  /* ---- Top overlay: gallery title + "2 / 14" over a soft gradient ---- */
  .epao-gal2-top {
    display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 1500;
    align-items: flex-start; gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 22px;
    background: linear-gradient(rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
    transition: opacity .25s; pointer-events: none; /* taps fall through to the photo */
  }
  /* the immersive design hides the desktop header, so the viewer carries its
     own way home; pointer-events re-enabled on the button itself */
  .epao-gal2-top__home {
    flex: 0 0 auto; width: 34px; height: 34px; margin-top: -3px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(60, 60, 60, .55); border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 50%; color: #fff !important; pointer-events: auto;
    text-decoration: none !important;
  }
  .epao-gal2-top__title {
    flex: 1 1 auto; min-width: 0;
    color: #fff; font-size: 13.5px; font-weight: bold; line-height: 1.35;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
    display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; overflow: hidden;
  }
  .epao-gal2-top__count {
    flex: 0 0 auto; color: #e6e6e6; font-size: 12.5px; font-weight: bold;
    padding-top: 1px; text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
  }

  /* ---- Bottom bar: Prev | (i) | share | Next over a soft gradient ---- */
  .epao-gal2-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500;
    align-items: center; gap: 9px;
    padding: 30px 12px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .78));
    transition: opacity .25s;
  }
  .epao-gal2-bar__btn {
    flex: 1 1 0; text-align: center; padding: 12px 0;
    background: rgba(60, 60, 60, .55); border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 10px;
    color: #fff !important; font-size: 15px !important; font-weight: bold;
    text-decoration: none !important; line-height: 1;
  }
  .epao-gal2-bar__btn.is-disabled { opacity: .3; pointer-events: none; }
  .epao-gal2-bar__round {
    flex: 0 0 auto; width: 42px; height: 42px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(60, 60, 60, .55); border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 50%; color: #fff; cursor: pointer;
  }
  .epao-gal2-bar__info {
    font: italic bold 17px Georgia, 'Times New Roman', serif; line-height: 1;
  }

  /* ---- Tap the photo: all chrome fades out; tap again brings it back ---- */
  html.epao-gal2-nochrome .epao-gal2-top,
  html.epao-gal2-nochrome .epao-gal2-bar {
    opacity: 0; pointer-events: none;
  }

  /* ---- Scrim shared by the info sheet and the share panel ---- */
  .epao-gal2-scrim {
    display: block; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1600; background: rgba(0, 0, 0, .55);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .epao-gal2-scrim.is-on { opacity: 1; pointer-events: auto; }

  /* ---- Info sheet: description + "See more Photos" pills + related ---- */
  .epao-gal2-sheet {
    display: flex; flex-direction: column;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1601;
    max-height: 76vh;
    background: #1d1d20; border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 28px rgba(0, 0, 0, .6);
    transform: translateY(103%); transition: transform .3s ease;
  }
  .epao-gal2-sheet.is-open { transform: none; }
  .epao-gal2-sheet__head {
    flex: 0 0 auto; display: flex; align-items: center;
    padding: 12px 8px 8px 18px;
  }
  .epao-gal2-sheet__head span {
    flex: 1 1 auto; color: #fff; font-size: 14px; font-weight: bold;
    text-transform: uppercase; letter-spacing: .5px;
  }
  .epao-gal2-sheet__close {
    flex: 0 0 auto; width: 38px; height: 38px; padding: 0;
    background: rgba(255, 255, 255, .1); border: 0; border-radius: 50%;
    color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
  }
  .epao-gal2-sheet__body {
    flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 2px 18px calc(16px + env(safe-area-inset-bottom));
  }

  /* the page's own blocks, restyled for the dark sheet */
  .epao-gal2-sheet #photo_details { width: auto; margin: 0; padding: 0; border: 0; }
  .epao-gal2-sheet #photo_details p {
    margin: 0 0 12px; color: #e9e9e9; font-size: 15px; line-height: 1.6;
  }
  .epao-gal2-sheet #footer_nav {
    width: auto; height: auto; margin: 0; float: none; clear: both;
  }
  .epao-gal2-sheet #footer_control {
    float: none; width: auto; height: auto; margin: 0; padding: 0 0 10px;
    text-align: left; color: #9aa; font-size: 12px;
  }
  .epao-gal2-sheet #footer_counter_text {
    display: block; padding: 2px 0 6px; color: #9aa;
    font-size: 11.5px; font-weight: bold; text-transform: uppercase;
    letter-spacing: .5px;
  }
  .epao-gal2-sheet #footer_control a {
    display: inline-block; padding: 9px 14px; margin: 2px 4px 2px 0;
    background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 9px; color: gold !important;
    font-size: 13px !important; font-weight: bold; line-height: 1;
    text-decoration: none !important;
  }
  .epao-gal2-sheet #related_links { color: #ccc; font-size: 13px; }
  .epao-gal2-sheet #related_links .related-links-top-container { width: auto; margin: 6px 0; }
  .epao-gal2-sheet #related_links a {
    color: gold !important; text-decoration: none;
    display: inline-block; padding: 4px 0;
  }

  /* ---- Share fallback panel (only when navigator.share is missing) ---- */
  .epao-gal2-share {
    display: block; position: fixed; z-index: 1601;
    left: 14px; right: 14px; bottom: calc(86px + env(safe-area-inset-bottom));
    background: #1d1d20; border-radius: 14px;
    box-shadow: 0 6px 28px rgba(0, 0, 0, .6);
    overflow: hidden;
    opacity: 0; pointer-events: none; transform: translateY(10px);
    transition: opacity .2s, transform .2s;
  }
  .epao-gal2-share.is-open { opacity: 1; pointer-events: auto; transform: none; }
  .epao-gal2-share a,
  .epao-gal2-share button {
    display: block; width: 100%; box-sizing: border-box; text-align: left;
    padding: 14px 18px; background: none; border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
    color: #fff !important; font-size: 15px; font-weight: bold;
    text-decoration: none !important; cursor: pointer;
  }
  .epao-gal2-share > :last-child { border-bottom: 0; }
}
