/* ==========================================================================
   508 Ministry Shared Block, Card, FAQ & Form Share Affordances
   Reuses the ONE shared window.M508StudioPostLightbox panel across all pages.
   Self-hosted Cormorant + Figtree only. Light + dark surface aware.
   ========================================================================== */

:root {
  --m508bs-navy: #0D1E3A;
  --m508bs-navy-mid: #163059;
  --m508bs-gold: #D4A84B;
  --m508bs-gold-bright: #F3D27A;
  --m508bs-ink: #13223D;
  --m508bs-muted: #4C607E;
  --m508bs-line: rgba(13, 30, 58, 0.14);
}

/* Deep-link scroll offset for fixed header */
details[id],
section[id],
form[id],
[data-m508-share-id] {
  scroll-margin-top: 96px;
}

/* Luminous deep-link arrival highlight */
@keyframes m508DeepPulse {
  0% { box-shadow: 0 0 0 0 rgba(212, 168, 75, 0.72), 0 12px 32px rgba(13, 30, 58, 0.16); }
  55% { box-shadow: 0 0 0 6px rgba(212, 168, 75, 0.28), 0 16px 38px rgba(13, 30, 58, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(212, 168, 75, 0), 0 8px 22px rgba(13, 30, 58, 0.08); }
}

.m508-deep-target-ring,
.m508-deep-target-ring:focus {
  outline: 3px solid #D4A84B !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px rgba(212, 168, 75, 0.34), 0 12px 30px rgba(13, 30, 58, 0.16) !important;
  animation: m508DeepPulse 1.8s ease-out 1;
}

/* --------------------------------------------------------------------------
   1. Expanded FAQ Dropdown Share Strip (ZERO clutter when collapsed!)
   -------------------------------------------------------------------------- */
details:not([open]) .m508-faq-share-bar {
  display: none !important;
}

.m508-faq-share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FBF8F0 0%, #F4EFE1 100%);
  border: 1px solid rgba(212, 168, 75, 0.44);
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  box-shadow: 0 6px 18px rgba(13, 30, 58, 0.06);
}

.m508-faq-share-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #162B4E;
  letter-spacing: 0.01em;
}

.m508-faq-share-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #D4A84B;
  box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.22);
  flex: none;
}

.m508-faq-share-acts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.m508-bs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 999px;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease, border-color 0.14s ease;
  white-space: nowrap;
}

.m508-bs-btn:focus-visible {
  outline: 2.5px solid #D4A84B;
  outline-offset: 2px;
}

.m508-bs-btn:hover {
  transform: translateY(-1px);
}

.m508-bs-btn:active {
  transform: translateY(0);
}

.m508-bs-btn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.m508-bs-btn--gold {
  background: linear-gradient(135deg, #F4D57F 0%, #D4A84B 100%);
  color: #0D1E3A;
  border-color: #C79634;
  box-shadow: 0 4px 12px rgba(212, 168, 75, 0.28);
}

.m508-bs-btn--gold:hover {
  box-shadow: 0 6px 16px rgba(212, 168, 75, 0.38);
}

.m508-bs-btn--ghost {
  background: #FFFFFF;
  color: #162B4E;
  border-color: rgba(13, 30, 58, 0.18);
}

.m508-bs-btn--ghost:hover {
  border-color: #D4A84B;
  background: #FFFDF7;
}

/* --------------------------------------------------------------------------
   2. Quiet Section, Tile, Card & Form Share Controls (Light & Dark Aware)
   -------------------------------------------------------------------------- */
.m508-sec-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 4px;
  position: relative;
  z-index: 3;
}

.m508-sec-share-row--left {
  justify-content: flex-start;
}

.m508-sec-share-row--center {
  justify-content: center;
}

.m508-tile-share-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(13, 30, 58, 0.08);
}

/* Individual Repeating Card Share Row + Interactive-Safe Shell */
.m508-has-card-share {
  display: flex;
  flex-direction: column;
}

.m508-card-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 18px;
  overflow: hidden;
}

.m508-card-shell--demo {
  background: #FFFFFF;
  border: 1.5px solid rgba(147, 197, 253, 0.52);
  box-shadow: 0 14px 36px -18px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.m508-card-shell--demo:hover {
  transform: translateY(-4px);
  border-color: #D4AF37;
  box-shadow: 0 22px 48px -18px rgba(15, 23, 42, 0.24);
}

.m508-card-shell--demo > a.n5-demo {
  flex: 1 1 auto;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.m508-card-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  position: relative;
  z-index: 3;
  box-sizing: border-box;
}

.m508-card-share-row--framed {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(13, 30, 58, 0.1);
}

.m508-card-share-row--compact {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(13, 30, 58, 0.08);
}

.m508-card-share-row--compact.is-dark {
  border-top-color: rgba(240, 205, 120, 0.24);
}

.m508-card-share-row--demo {
  margin-top: 0;
  padding: 10px 18px 14px;
  background: linear-gradient(180deg, #FAFDFF 0%, #F1F7FF 100%);
  border-top: 1px solid rgba(147, 197, 253, 0.36);
}

.m508-card-share-row--figure {
  margin-top: 0;
  padding: 0 16px 14px;
}

/* Ministry-types card footer strip (keeps .sn-chip-btn & .sn-pop 100% intact) */
#ministry-types .n5-mt-chips li.m508-has-chip-share > .sn-chip-btn {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.m508-card-share-row--chip {
  margin-top: 0;
  padding: 7px 12px 9px;
  border-top: 1px solid rgba(147, 197, 253, 0.34);
  background: linear-gradient(180deg, #FAFDFF 0%, #F1F7FF 100%);
  border-radius: 0 0 14px 14px;
}

.m508-card-share-row--chip .m508-card-share-pill,
.m508-card-share-row--compact .m508-card-share-pill {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
}

.m508-sec-share-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 13px;
  border-radius: 999px;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  border: 1px solid rgba(13, 30, 58, 0.18);
  background: rgba(255, 255, 255, 0.94);
  color: #13223D;
  box-shadow: 0 4px 12px rgba(13, 30, 58, 0.07);
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.m508-sec-share-pill:hover {
  transform: translateY(-1px);
  border-color: #D4A84B;
  background: #FFFDF6;
  box-shadow: 0 6px 16px rgba(13, 30, 58, 0.11);
}

.m508-sec-share-pill:focus-visible {
  outline: 2.5px solid #D4A84B;
  outline-offset: 2px;
}

.m508-sec-share-pill svg,
.m508-bs-btn svg {
  width: 14px !important;
  height: 14px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.1 !important;
  flex: none;
  color: #B48422;
}

/* Dark surface sections & dark cards (navy hero, #demos, #web-services) */
.m508-sec-share-row.is-dark .m508-sec-share-pill,
.m508-card-share-row.is-dark .m508-sec-share-pill {
  background: rgba(13, 30, 58, 0.84);
  color: #F8F4EA;
  border-color: rgba(244, 213, 127, 0.5);
  backdrop-filter: blur(8px);
}

.m508-sec-share-row.is-dark .m508-sec-share-pill svg,
.m508-card-share-row.is-dark .m508-sec-share-pill svg {
  color: #F4D57F;
}

.m508-sec-share-row.is-dark .m508-sec-share-pill:hover,
.m508-card-share-row.is-dark .m508-sec-share-pill:hover {
  background: rgba(22, 48, 89, 0.94);
  border-color: #F4D57F;
}

/* Form share bar inside booking & newsletter forms */
.m508-form-share-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 13px;
  background: linear-gradient(135deg, #FBF8F0 0%, #F2ECDC 100%);
  border: 1px solid rgba(212, 168, 75, 0.45);
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
}

.m508-form-share-strip--card {
  margin: 14px 18px 18px;
}

.m508-form-share-copy {
  font-size: 12.5px;
  font-weight: 600;
  color: #1A2F54;
  line-height: 1.38;
  flex: 1 1 190px;
}

.m508-form-share-copy strong {
  color: #0D1E3A;
  font-weight: 800;
}

.m508-form-share-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

/* Dark theme / OS dark color-scheme support (high-contrast navy + gold) */
@media (prefers-color-scheme: dark) {
  .m508-faq-share-bar,
  .m508-form-share-strip {
    background: linear-gradient(135deg, #10213D 0%, #0B172C 100%);
    border-color: rgba(244, 213, 127, 0.48);
    box-shadow: 0 8px 22px rgba(5, 11, 24, 0.28);
  }
  .m508-faq-share-meta,
  .m508-form-share-copy,
  .m508-form-share-copy strong {
    color: #F7F2E6;
  }
  .m508-bs-btn--ghost {
    background: rgba(255, 255, 255, 0.1);
    color: #F7F2E6;
    border-color: rgba(244, 213, 127, 0.34);
  }
  .m508-bs-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: #F4D57F;
  }
  .m508-card-share-row--chip,
  .m508-card-share-row--demo {
    background: linear-gradient(180deg, #132747 0%, #0D1E3A 100%);
    border-top-color: rgba(244, 213, 127, 0.36);
  }
  .m508-card-shell--demo {
    border-color: rgba(244, 213, 127, 0.42);
  }
  .m508-sec-share-pill {
    background: #10213D;
    color: #F7F2E6;
    border-color: rgba(244, 213, 127, 0.48);
    box-shadow: 0 4px 14px rgba(5, 11, 24, 0.25);
  }
  .m508-sec-share-pill svg {
    color: #F4D57F;
  }
  .m508-sec-share-pill:hover {
    background: #17305A;
    border-color: #F4D57F;
  }
}

[data-theme="dark"] .m508-faq-share-bar,
[data-theme="dark"] .m508-form-share-strip {
  background: linear-gradient(135deg, #10213D 0%, #0B172C 100%);
  border-color: rgba(244, 213, 127, 0.48);
}
[data-theme="dark"] .m508-faq-share-meta,
[data-theme="dark"] .m508-form-share-copy,
[data-theme="dark"] .m508-form-share-copy strong {
  color: #F7F2E6;
}
[data-theme="dark"] .m508-bs-btn--ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #F7F2E6;
  border-color: rgba(244, 213, 127, 0.34);
}
[data-theme="dark"] .m508-card-share-row--chip,
[data-theme="dark"] .m508-card-share-row--demo {
  background: linear-gradient(180deg, #132747 0%, #0D1E3A 100%);
  border-top-color: rgba(244, 213, 127, 0.36);
}
[data-theme="dark"] .m508-card-shell--demo {
  border-color: rgba(244, 213, 127, 0.42);
}
[data-theme="dark"] .m508-sec-share-pill {
  background: #10213D;
  color: #F7F2E6;
  border-color: rgba(244, 213, 127, 0.48);
}
[data-theme="dark"] .m508-sec-share-pill svg {
  color: #F4D57F;
}

@media (max-width: 560px) {
  .m508-faq-share-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }
  .m508-faq-share-acts {
    width: 100%;
  }
  .m508-faq-share-acts .m508-bs-btn--gold {
    flex: 1 1 100%;
  }
  .m508-faq-share-acts .m508-bs-btn--ghost {
    flex: 1 1 calc(50% - 4px);
  }
  .m508-form-share-strip {
    flex-direction: column;
    align-items: stretch;
  }
  .m508-form-share-strip--card {
    margin: 12px 12px 16px;
  }
  .m508-form-share-copy {
    flex: 0 0 auto;
  }
  .m508-form-share-btns {
    width: 100%;
  }
  .m508-form-share-btns .m508-bs-btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m508-deep-target-ring {
    animation: none;
  }
  .m508-bs-btn,
  .m508-sec-share-pill,
  .m508-card-shell--demo {
    transition: none;
  }
}

/* ==========================================================================
   5. Share Everything -> Alongside+ Media Voting & Review Controls
      Reuses connectors-hub-508 + m508-block-share design tokens (zero 3rd sheet)
   ========================================================================== */
.m508-vs-pane {
  margin-top: 4px;
}

.m508-vs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
  margin-top: 14px;
}

.m508-vs-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FFFFFF;
  border: 1.5px solid rgba(13, 30, 58, 0.13);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(13, 30, 58, 0.06);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  min-width: 0;
}

.m508-vs-card:hover {
  border-color: rgba(212, 168, 75, 0.72);
  box-shadow: 0 14px 32px rgba(13, 30, 58, 0.1);
}

.m508-vs-card.is-submitted {
  border-color: rgba(5, 150, 105, 0.48);
  background: linear-gradient(180deg, #FFFFFF 0%, #F4FBF8 100%);
}

.m508-vs-card.is-approved {
  border-color: rgba(212, 168, 75, 0.86);
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFBF0 100%);
}

.m508-vs-card.is-rejected {
  border-color: rgba(185, 28, 28, 0.36);
  background: linear-gradient(180deg, #FFFFFF 0%, #FEF6F6 100%);
}

.m508-vs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.m508-vs-author {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.m508-vs-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 15%;
  border: 1.5px solid rgba(212, 168, 75, 0.55);
  background: #F4EFE1;
  flex: none;
}

.m508-vs-author-name {
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #0D1E3A;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m508-vs-author-sub {
  font-size: 11.5px;
  color: #4C607E;
  font-weight: 600;
  line-height: 1.25;
}

.m508-vs-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.m508-vs-kind {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #EEF3FA;
  color: #163059;
  border: 1px solid rgba(22, 48, 89, 0.14);
}

.m508-vs-kind.is-owner {
  background: #FEF3C7;
  color: #92400E;
  border-color: rgba(217, 119, 6, 0.35);
}

.m508-vs-media {
  position: relative;
  border-radius: 13px;
  overflow: hidden;
  background: #0D1E3A;
  border: 1px solid rgba(13, 30, 58, 0.12);
}

.m508-vs-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 290px;
  object-fit: contain;
  background: #0D1E3A;
}

.m508-vs-media video {
  display: block;
  width: 100%;
  max-height: 280px;
  background: #091326;
}

.m508-vs-media audio {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: #102344;
}

.m508-vs-guide-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #FBF8F0 0%, #F1E9D2 100%);
  color: #0D1E3A;
  font-size: 13px;
  font-weight: 700;
}

.m508-vs-title {
  margin: 0;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.22;
  color: #0D1E3A;
  word-break: break-word;
}

.m508-vs-excerpt {
  margin: 0;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.48;
  color: #364B6B;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.m508-vs-bar {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(13, 30, 58, 0.1);
}

.m508-vs-prog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #163059;
}

.m508-vs-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #FBF6E8;
  border: 1px solid rgba(212, 168, 75, 0.48);
  color: #7C5308;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}

.m508-vs-count-pill.is-submitted {
  background: #ECFDF5;
  border-color: rgba(5, 150, 105, 0.42);
  color: #065F46;
}

.m508-vs-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(13, 30, 58, 0.1);
  overflow: hidden;
}

.m508-vs-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #D4A84B 0%, #F2C964 100%);
  transition: width 0.25s ease;
}

.m508-vs-fill.is-submitted {
  background: linear-gradient(90deg, #059669 0%, #10B981 100%);
}

.m508-vs-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.m508-vs-vote-btn {
  flex: 1 1 auto;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 999px;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid #C79634;
  background: linear-gradient(135deg, #F6DC8D 0%, #D4A84B 100%);
  color: #0D1E3A;
  box-shadow: 0 4px 12px rgba(212, 168, 75, 0.24);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.m508-vs-vote-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(212, 168, 75, 0.36);
}

.m508-vs-vote-btn.is-voted {
  background: #0D1E3A;
  color: #F6DC8D;
  border-color: #0D1E3A;
  box-shadow: 0 4px 12px rgba(13, 30, 58, 0.22);
}

.m508-vs-vote-btn.is-submitted {
  background: #ECFDF5;
  color: #065F46;
  border-color: #059669;
  box-shadow: none;
}

.m508-vs-vote-btn.is-owner-locked,
.m508-vs-vote-btn:disabled {
  opacity: 0.78;
  cursor: not-allowed;
  transform: none;
}

.m508-vs-vote-btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.m508-vs-outcome {
  padding: 9px 11px;
  border-radius: 11px;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 12px;
  line-height: 1.42;
  font-weight: 600;
}

.m508-vs-outcome.is-pending {
  background: #ECFDF5;
  border: 1px solid rgba(5, 150, 105, 0.35);
  color: #065F46;
}

.m508-vs-outcome.is-approved {
  background: #FFFBEB;
  border: 1px solid rgba(212, 168, 75, 0.72);
  color: #78350F;
}

.m508-vs-outcome.is-rejected {
  background: #FEF2F2;
  border: 1px solid rgba(185, 28, 28, 0.35);
  color: #991B1B;
}

.m508-vs-inline-msg {
  font-size: 12px;
  font-weight: 700;
  color: #991B1B;
  margin-top: 2px;
}

.m508-vs-admin-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #0D1E3A;
  color: #F6DC8D !important;
  border: 1px solid rgba(246, 220, 141, 0.45);
  font-size: 12.5px;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 640px) {
  .m508-vs-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .m508-vs-card {
    padding: 13px;
  }
  .m508-vs-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .m508-vs-actions .m508-bs-btn,
  .m508-vs-actions .m508-vs-vote-btn {
    width: 100%;
  }
}
