/* NPC v1.1.14 — Keep mobile/tablet captions out of ePix's overflow-hidden
   .title-wrap and .gridimg-wrap. No entrance animation or theme delay. */
@media screen and (max-width: 767px) and (orientation: portrait),
       screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait),
       screen and (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (orientation: portrait) {
  body .post-gallery-wrap.stage .stage-slider.npc-caption-portaled .caption-wrap.caption-hover {
    visibility: hidden !important;
    pointer-events: none !important;
  }
  body .npc-stage-caption-portal {
    position: fixed !important;
    top: auto !important;
    bottom: 60px !important;
    left: auto !important;
    right: 16px !important;
    width: 60vw !important;
    max-width: calc(100vw - 32px) !important;
    height: auto !important;
    z-index: 500 !important; /* Above gallery (100), below ePix menu (998). */
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
    transform: translate3d(0,0,0);
    transition: none;
  }
  body .npc-stage-caption-portal[hidden] { display: none !important; }
  body .npc-stage-caption-portal .caption-wrap,
  body .npc-stage-caption-portal .caption-wrap .caption {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
    transition-delay: 0s !important;
    margin: 0 !important;
  }
  body .npc-stage-caption-portal .title.caption,
  body .npc-stage-caption-portal .content.caption {
    background: #f7f7f7 !important;
    text-align: right;
  }
  body .npc-stage-caption-portal .title.caption h3 {
    margin: 0 !important;
  }
  body .npc-stage-caption-portal.npc-caption-dismissed {
    transform: translate3d(calc(100% + 24px), 0, 0) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: transform 320ms ease-in, opacity 320ms ease-in,
                visibility 0s linear 320ms !important;
  }
}
@media screen and (max-width: 767px) and (orientation: portrait) {
  body .npc-stage-caption-portal .title.caption { padding: 8px 12px 2px !important; }
  body .npc-stage-caption-portal .title.caption h3 {
    font-size: 20px !important; line-height: 1.2 !important;
    padding: 0 !important;
  }
  body .npc-stage-caption-portal .content.caption {
    font-size: 8px !important;
    line-height: 1.3 !important;
    padding: 0 12px 10px !important;
  }
}
@media screen and (min-width: 768px) and (max-width: 1024px),
       screen and (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) {
  body .npc-stage-caption-portal .title.caption,
  body .npc-stage-caption-portal .content.caption {
    padding: 8px 16px !important;
  }
}
@media screen and (min-width: 1367px),
       screen and (max-width: 767px) and (orientation: landscape) {
  body .npc-stage-caption-portal { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  body .npc-stage-caption-portal.npc-caption-dismissed { transition: none !important; }
}

/* Keep the flydown navigation over the body-level caption portal.
   ePix horizontal layouts otherwise lower #header-wrap to z-index: 3. */
@media screen and (max-width: 1366px) {
  body #header-wrap:has(#nv-tabs.show) {
    z-index: 1200 !important;
  }
}

/* v1.1.21/134 — Tablet caption copy: right alignment and tight heading/body join.
   Restrict to the independent caption portal; leave original slide captions
   and phone portrait styling unchanged. */
@media screen and (min-width: 768px) and (max-width: 1024px),
       screen and (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) {
  body .npc-stage-caption-portal .title.caption,
  body .npc-stage-caption-portal .content.caption,
  body .npc-stage-caption-portal .title.caption *,
  body .npc-stage-caption-portal .content.caption * {
    text-align: right !important;
  }
  body .npc-stage-caption-portal .title.caption {
    padding: 8px 16px 2px !important;
  }
  body .npc-stage-caption-portal .content.caption {
    padding: 0 16px 10px !important;
  }
  body .npc-stage-caption-portal .title.caption h3,
  body .npc-stage-caption-portal .content.caption p {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
}

/* v1.1.46 — Hide Stage captions in tablet landscape, including the
   body-level caption portal. Preserve phone/tablet portrait captions and
   desktop hover captions. any-pointer catches touch tablets with a mouse. */
@media screen and (orientation: landscape)
       and (min-width: 768px) and (max-width: 1024px) and (any-pointer: coarse),
       screen and (orientation: landscape)
       and (min-width: 1025px) and (max-width: 1366px) and (any-pointer: coarse) {
  body .post-gallery-wrap.stage .stage-slider > .panel.current .caption-wrap.caption-hover,
  body .npc-stage-caption-portal {
    display: none !important;
  }
}

/* v1.1.130/132 — Portrait phones and tablets: extend only the caption fill to the viewport edge.
   The fixed caption portal remains 16px inset, so text, alignment, width,
   and its existing touch-dismiss motion are unaffected. */
@media screen and (max-width: 767px) and (orientation: portrait),
       screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait),
       screen and (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (orientation: portrait) {
  body .npc-stage-caption-portal .title.caption::after,
  body .npc-stage-caption-portal .content.caption::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: calc(100% - 1px) !important;
    right: auto !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 17px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: inherit !important;
    border: 0 !important;
    box-shadow: none !important;
    pointer-events: none !important;
  }
}

/* v1.1.131/132 — Portrait phones and tablets: replay the right-to-left entrance
   every time the current Stage slide changes. Move only the fixed portal:
   the text, background bleed, and tablet layout remain unchanged. */
@media screen and (max-width: 767px) and (orientation: portrait),
       screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait),
       screen and (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (orientation: portrait) {
  body .npc-stage-caption-portal.npc-caption-enter-ready:not(.npc-caption-dismissed) {
    transition: transform 900ms cubic-bezier(.25,.8,.25,1) !important;
  }
  /* Reset offscreen instantly on each slide, including while a previous entrance is active. */
  body .npc-stage-caption-portal.npc-caption-enter-ready.npc-caption-preenter:not(.npc-caption-dismissed) {
    transition: none !important;
  }
  body .npc-stage-caption-portal.npc-caption-enter-ready.npc-caption-preenter:not(.npc-caption-dismissed) {
    transform: translate3d(calc(100% + 24px), 0, 0) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  body .npc-stage-caption-portal.npc-caption-enter-ready {
    transition: none !important;
  }
}

/* v1.1.133 — Tablet portrait: align the heading against the RIGHT inner
   edge of the paragraph frame. Do not reposition either frame or change
   paragraph alignment, spacing, portal width, or entrance/exit behavior. */
@media screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait),
       screen and (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (orientation: portrait) {
  body .npc-stage-caption-portal .title.caption,
  body .npc-stage-caption-portal .title.caption h3,
  body .npc-stage-caption-portal .title.caption h3 * {
    text-align: right !important;
  }
}

/* v1.1.134 — Consistent right-aligned caption text throughout the
   mobile/tablet portal, including nested paragraphs and headings.
   No changes to dimensions, padding, background bleed or motion. */
body .npc-stage-caption-portal .title.caption,
body .npc-stage-caption-portal .content.caption,
body .npc-stage-caption-portal .title.caption *,
body .npc-stage-caption-portal .content.caption * {
  text-align: right !important;
}

/* v1.1.136 — Portrait tablets: make heading and paragraph one aligned frame.
   The heading and body each occupy the same full portal width, with identical
   right insets. This does not reposition the portal or affect slide motion. */
@media screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait),
       screen and (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (orientation: portrait) {
  body .npc-stage-caption-portal .caption-wrap.caption-hover {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  body .npc-stage-caption-portal .caption-wrap.caption-hover > .title.caption,
  body .npc-stage-caption-portal .caption-wrap.caption-hover > .content.caption {
    display: block !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    left: auto !important;
    right: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: right !important;
    box-sizing: border-box !important;
  }
  body .npc-stage-caption-portal .caption-wrap.caption-hover > .title.caption h3 {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: right !important;
    box-sizing: border-box !important;
    background: transparent !important;
  }
}

/* v1.1.138 — Portrait tablet only: raise the complete caption portal 20px.
   Changing bottom (not transform) keeps entrance and dismissal animations intact. */
@media screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait),
       screen and (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (orientation: portrait) {
  body .npc-stage-caption-portal {
    bottom: 80px !important;
  }
}
