/* ============================================================================
   508 Ministry & Alongside+ Unified Full-Screen Studio & Post Lightbox
   Single shared component imported by Alongside+ Studio, Compass & Dove Social
   Feed, Member Profile Posts, and Share Library.
   Self-hosted Cormorant + Figtree fonts. Zero external CDN dependencies.
   ============================================================================ */

body.m508-spl-lock {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.m508-spl-lock #m508-chat-host,
body.m508-spl-lock #m508-clara-host,
body.m508-spl-lock .m508-clara-float,
body.m508-spl-lock .m508-chat-launcher,
body.m508-spl-lock #m508-totop,
body.m508-spl-lock .fc-pc-stage {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.m508-spl-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483647 !important;
  background: rgba(4, 15, 29, 0.90);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  box-sizing: border-box;
  font-family: 'Figtree', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #0E1F3A;
  -webkit-font-smoothing: antialiased;
}

.m508-spl-backdrop.open {
  display: flex;
}

.m508-spl-backdrop[hidden] {
  display: none !important;
}

.m508-spl-backdrop *,
.m508-spl-backdrop *::before,
.m508-spl-backdrop *::after {
  box-sizing: border-box;
}

/* Safe-area-aware 48px Close X — always visible above media and rail */
.m508-spl-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 25;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #E2B859;
  background: rgba(8, 22, 44, 0.94);
  color: #FFFFFF;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  transition: background 0.14s ease, color 0.14s ease, transform 0.12s ease;
  -webkit-appearance: none;
  appearance: none;
}

.m508-spl-close:hover,
.m508-spl-close:focus-visible {
  background: #E8B85B;
  color: #071B30;
  outline: 2px solid #FFF7CC;
  outline-offset: 2px;
  transform: scale(1.04);
}

.m508-spl-shell {
  position: relative;
  width: min(1220px, calc(100vw - 28px));
  max-width: 100%;
  height: min(880px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 420px);
  border-radius: 20px;
  border: 1.5px solid rgba(212, 168, 75, 0.72);
  background: #FFFFFF;
  color: #0E1F3A;
  overflow: hidden;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.6);
  will-change: transform;
  transition: transform 0.18s ease-out;
}

.m508-spl-shell.is-dragging {
  transition: none;
}

.m508-spl-drag-handle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px 0 4px;
  background: #061526;
  flex-shrink: 0;
  touch-action: none;
}

.m508-spl-drag-pill {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 240, 186, 0.45);
}

/* LEFT COLUMN: Full-bleed dark sanctuary media stage */
.m508-spl-stage {
  position: relative;
  background: #061526;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 16px 20px 20px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Top gleaming golden-yellow dismissible commission hop-link banner */
.m508-spl-hop-banner {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 13px;
  background: linear-gradient(135deg, #FFF7CC 0%, #FDE073 48%, #EFC042 100%);
  border: 1.5px solid #D49B1A;
  color: #0B1F3A;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  text-align: left;
}

.m508-spl-hop-banner[hidden] {
  display: none !important;
}

.m508-spl-hop-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.m508-spl-hop-headline {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
  color: #08182E;
}

.m508-spl-hop-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border-radius: 999px;
  background: #0B1F3A;
  color: #FDE073;
  font-size: 12px;
  flex-shrink: 0;
}

.m508-spl-hop-sub {
  margin: 0;
  font-size: 12.2px;
  line-height: 1.4;
  font-weight: 500;
  color: #162B49;
}

.m508-spl-hop-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
}

.m508-spl-hop-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(11, 31, 58, 0.11);
  border: 1px solid rgba(11, 31, 58, 0.24);
  color: #0B1F3A;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  max-width: 100%;
  word-break: break-all;
}

.m508-spl-hop-chip.is-active {
  background: #0F5132;
  border-color: #0A3B24;
  color: #ECFDF5;
}

.m508-spl-hop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11.8px;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  border: 1.5px solid #0B1F3A;
  background: rgba(255, 255, 255, 0.85);
  color: #0B1F3A;
  transition: transform 0.12s ease, background 0.14s ease;
}

.m508-spl-hop-btn:hover {
  background: #FFFFFF;
  transform: translateY(-1px);
}

.m508-spl-hop-btn.is-vault {
  background: #0B1F3A;
  color: #FDE073;
}

.m508-spl-hop-btn.is-vault:hover {
  background: #14325B;
  color: #FFF7CC;
}

.m508-spl-hop-btn[hidden] {
  display: none !important;
}

.m508-spl-hop-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1.5px solid rgba(11, 31, 58, 0.32);
  background: rgba(255, 255, 255, 0.55);
  color: #0B1F3A;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.m508-spl-hop-close:hover {
  background: #0B1F3A;
  color: #FDE073;
}

.m508-spl-media-wrap {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.m508-spl-media-wrap img,
.m508-spl-media-wrap video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  display: block;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.5);
  user-select: none;
  -webkit-user-drag: none;
}

.m508-spl-media-wrap video {
  background: #000000;
}

.m508-spl-audio-stage {
  width: 100%;
  max-width: 480px;
  padding: 26px 22px;
  border-radius: 16px;
  border: 1.5px solid rgba(232, 188, 103, 0.45);
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
  text-align: center;
}

.m508-spl-audio-stage audio {
  width: 100%;
  margin-top: 14px;
}

/* RIGHT COLUMN: Full Member Action Rail */
.m508-spl-panel {
  min-width: 0;
  max-width: 100%;
  padding: 14px 18px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  height: 100%;
  border-left: 1px solid #DCE5F2;
  background: #FBF9F4;
  color: #0E1F3A;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-gutter: stable;
}

.m508-spl-head {
  padding-right: 30px;
}

.m508-spl-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #9A6B16;
}

.m508-spl-title {
  margin: 2px 0 0;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  color: #0E1F3A;
  word-break: break-word;
}

.m508-spl-post-author {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.m508-spl-post-author[hidden] {
  display: none !important;
}

.m508-spl-post-author img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #D4A84B;
  background: #141C38;
  flex-shrink: 0;
}

.m508-spl-post-author-meta {
  min-width: 0;
  font-size: 12.2px;
  line-height: 1.3;
  color: #42536F;
}

.m508-spl-post-author-meta strong {
  color: #0E1F3A;
  font-weight: 800;
}

/* Member Identity & Connected Handles Card */
.m508-spl-member-card {
  padding: 12px;
  border-radius: 13px;
  background: linear-gradient(145deg, #0E1F3A 0%, #17305A 100%);
  border: 1.5px solid #D4A84B;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: 0 8px 20px rgba(14, 31, 58, 0.16);
}

.m508-spl-member-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.m508-spl-member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #F6DA8B;
  background: #0B1930;
  flex-shrink: 0;
}

.m508-spl-member-info {
  min-width: 0;
  flex: 1 1 auto;
}

.m508-spl-member-name {
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m508-spl-member-handle {
  font-size: 12px;
  font-weight: 600;
  color: #F6DA8B;
  margin-top: 2px;
  word-break: break-word;
}

.m508-spl-member-ref {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(246, 218, 139, 0.16);
  border: 1px solid rgba(246, 218, 139, 0.55);
  color: #FFF4CC;
  font-size: 11px;
  font-weight: 700;
  max-width: 100%;
  word-break: break-all;
}

.m508-spl-handles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.m508-spl-handle-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #E8F1FD;
  font-size: 11.2px;
  font-weight: 700;
}

.m508-spl-handle-pill.is-live {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(110, 231, 183, 0.5);
  color: #D1FAE5;
}

.m508-spl-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.m508-spl-section[hidden] {
  display: none !important;
}

.m508-spl-sec-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4D607D;
}

.m508-spl-mini-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #D4A84B;
  background: #FFF9E6;
  color: #0E1F3A;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.m508-spl-mini-btn:hover {
  background: #F7E4A6;
}

.m508-spl-caption-box {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #DCE5F2;
  background: #FFFFFF;
  color: #1E2E4A;
  font-size: 12.5px;
  line-height: 1.42;
  max-height: 74px;
  overflow-y: auto;
  word-break: break-word;
}

/* Share Box */
.m508-spl-share-box {
  padding: 10px 11px;
  border-radius: 13px;
  border: 1.5px solid #D4A84B;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.m508-spl-share-everywhere {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1.5px solid #C5962C;
  background: linear-gradient(135deg, #FFF0BA 0%, #E8BC58 55%, #D4A036 100%);
  color: #0B1F3A;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 5px 14px rgba(212, 168, 75, 0.28);
  transition: transform 0.12s ease, filter 0.14s ease;
}

.m508-spl-share-everywhere:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.m508-spl-se-status {
  padding: 9px 11px;
  border-radius: 10px;
  background: #EEF6FF;
  border: 1px solid #BFD7F7;
  color: #0E2A52;
  font-size: 12.2px;
  font-weight: 600;
  line-height: 1.4;
}

.m508-spl-se-status.is-ok {
  background: #ECFDF5;
  border-color: #86EFAC;
  color: #0F5132;
}

.m508-spl-se-status[hidden] {
  display: none !important;
}

.m508-spl-url-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.m508-spl-url-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  color: #1E293B;
  font: 600 11.8px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.m508-spl-copy-btn {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1.5px solid #0E1F3A;
  background: #0E1F3A;
  color: #FFF4CC;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.m508-spl-copy-btn:hover {
  background: #1B3664;
}

.m508-spl-share-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.m508-spl-plat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 34px;
  padding: 6px 7px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: #FFFFFF !important;
  font-family: inherit;
  font-size: 11.6px;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.14s ease;
}

.m508-spl-plat-btn:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.m508-spl-plat-btn.is-wide {
  grid-column: 1 / -1;
}

.m508-spl-ref-note {
  font-size: 11.8px;
  font-weight: 700;
  color: #7D560A;
  line-height: 1.38;
  word-break: break-word;
}

/* Member Command Hub (Connectors, Commissions, Royalties, Analytics) */
.m508-spl-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.m508-spl-hub-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 11px;
  border-radius: 11px;
  border: 1.5px solid #D5E0EE;
  background: #FFFFFF;
  color: #0E1F3A !important;
  text-decoration: none;
  min-height: 62px;
  transition: border-color 0.14s ease, transform 0.12s ease, box-shadow 0.14s ease;
}

.m508-spl-hub-card:hover {
  border-color: #D4A84B;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 31, 58, 0.08);
}

.m508-spl-hub-card.is-primary {
  background: linear-gradient(155deg, #FFFDF5 0%, #FFF3CE 100%);
  border-color: #D4A84B;
}

.m508-spl-hub-title {
  font-size: 12.8px;
  font-weight: 800;
  color: #0E1F3A;
  line-height: 1.25;
}

.m508-spl-hub-sub {
  font-size: 11.2px;
  font-weight: 600;
  color: #4C607E;
  line-height: 1.3;
}

/* Studio Creation Tools Section */
.m508-spl-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.m508-spl-meta-cell {
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid #DCE5F2;
  background: #FFFFFF;
}

.m508-spl-meta-lbl {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5C6F8C;
}

.m508-spl-meta-val {
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 700;
  color: #0E1F3A;
  word-break: break-word;
}

.m508-spl-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.m508-spl-action-btn {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: #0E1F3A !important;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-align: center;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.m508-spl-action-btn:hover {
  background: #F4F7FC;
  border-color: #D4A84B;
}

.m508-spl-action-btn.is-gold {
  background: linear-gradient(135deg, #FFF0BA, #D4A84B);
  border-color: #C5962C;
  color: #0E1F3A !important;
  font-weight: 800;
}

.m508-spl-action-btn.is-navy {
  background: #142244;
  border-color: #142244;
  color: #FFFFFF !important;
}

.m508-spl-action-btn.is-danger {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #991B1B !important;
}

.m508-spl-action-btn.is-danger.is-confirm {
  background: #B91C1C;
  border-color: #991B1B;
  color: #FFFFFF !important;
}

.m508-spl-action-btn[hidden] {
  display: none !important;
}

.m508-spl-inline-status {
  font-size: 12px;
  font-weight: 600;
  color: #3B5273;
  line-height: 1.4;
}

.m508-spl-royalty-foot {
  margin: 0;
  font-size: 11.6px;
  line-height: 1.44;
  color: #42536F;
}

/* Mobile & Tablet Responsive (< 900px) */
@media (max-width: 900px) {
  .m508-spl-backdrop {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .m508-spl-shell {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .m508-spl-drag-handle {
    display: flex;
    padding: max(12px, env(safe-area-inset-top)) 0 6px;
    min-height: 36px;
  }

  .m508-spl-stage {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 28px 12px 14px;
    gap: 10px;
    overflow: visible;
  }

  .m508-spl-hop-banner {
    padding: 9px 11px;
  }

  .m508-spl-hop-headline {
    font-size: 15.5px;
  }

  .m508-spl-hop-sub {
    font-size: 11.5px;
  }

  .m508-spl-media-wrap {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .m508-spl-media-wrap img,
  .m508-spl-media-wrap video {
    width: auto;
    max-width: 100%;
    max-height: 44dvh;
  }

  .m508-spl-panel {
    flex: 1 0 auto;
    height: auto;
    overflow: visible;
    border-left: 0;
    border-top: 2px solid #D4A84B;
    padding: 16px 14px max(28px, env(safe-area-inset-bottom));
  }

  .m508-spl-head {
    padding-right: 0;
  }

  .m508-spl-title {
    font-size: 22px;
  }
}

@media (max-width: 420px) {
  .m508-spl-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .m508-spl-share-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
}

/* Clickable image cursor hint on supported containers */
img[data-lb-open],
.m508-person-card-img,
.m508-guide-drop-cover,
.m508-lib-thumb,
.scard-img-wrap img {
  cursor: zoom-in;
}

/* Hide top-left yellow royalty hop-link notice on mobile viewports per owner request */
@media (max-width: 900px) {
  .spl-hop-banner,
  .spl-hoplink-banner,
  .spl-royalty-banner,
  .hf-lb-hoplink-banner,
  [class*="hoplink-banner"],
  [class*="hop-banner"] {
    display: none !important;
  }
}
