/* Trigger button — colours driven by CSS variables set inline by PHP */
.stoned-vis-wrapper { margin: 14px 0; }
.stoned-vis-context-listing { margin: 8px 0 0; }

.stoned-vis-trigger {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 22px; cursor: pointer;
    font-size: 13px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; line-height: 1;
    border: 1px solid transparent;
    background: var(--stoned-vis-bg, #C9A961);
    color: var(--stoned-vis-text, #0E0E0F);
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
    text-align: center;
}
.stoned-vis-trigger:hover,
.stoned-vis-trigger:focus-visible {
    background: var(--stoned-vis-hover-bg, #E5D29A);
    color: var(--stoned-vis-hover-text, #0E0E0F);
}
.stoned-vis-trigger:active { transform: translateY(1px); }
.stoned-vis-trigger:focus-visible { outline: 2px solid var(--stoned-vis-bg); outline-offset: 2px; }

.stoned-vis-trigger .stoned-vis-icon {
    font-size: 16px; line-height: 1; opacity: .9;
}

/* "FREE" pill — sits flush to the right of the button label */
.stoned-vis-badge {
    display: inline-flex; align-items: center;
    margin-left: 6px;
    padding: 4px 9px;
    background: var(--stoned-vis-badge-bg, #1E3A8A);
    color: var(--stoned-vis-badge-text, #FFFFFF);
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
    line-height: 1;
    border-radius: 999px;
    text-transform: uppercase;
}
.stoned-vis-context-listing .stoned-vis-badge {
    padding: 3px 7px; font-size: 9px;
}

/* Compact button in listings */
.stoned-vis-context-listing .stoned-vis-trigger {
    width: 100%;
    padding: 10px 14px;
    font-size: 11px;
    letter-spacing: 0.08em;
}

/* Modal */
.stoned-vis-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.stoned-vis-modal.is-open { display: flex; }
.stoned-vis-backdrop {
    position: absolute; inset: 0;
    background: rgba(14, 14, 15, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.stoned-vis-dialog {
    position: relative; z-index: 1;
    width: 100%; max-width: 1180px; height: 92vh; max-height: 920px;
    background: #0E0E0F; color: #F4F1EC;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    display: flex; flex-direction: column;
}
.stoned-vis-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 16px 24px; border-bottom: 1px solid #2A2A2E;
    flex-shrink: 0;
}
.stoned-vis-title {
    font-family: "Cormorant Garamond", "Times New Roman", serif;
    font-size: 22px; letter-spacing: -0.01em; color: #F4F1EC;
}
.stoned-vis-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    background: rgba(244, 241, 236, 0.08);
    border: 1px solid #3A3A3E;
    border-radius: 999px;
    color: #F4F1EC;
    font-size: 22px; line-height: 1; cursor: pointer;
    padding: 0;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
    flex-shrink: 0;
}
.stoned-vis-close:hover {
    background: var(--stoned-vis-bg, #C9A961);
    border-color: var(--stoned-vis-bg, #C9A961);
    color: var(--stoned-vis-text, #0E0E0F);
}
.stoned-vis-close:active { transform: scale(0.96); }
.stoned-vis-close::before { content: "×"; font-weight: 300; font-size: 28px; line-height: 0; margin-top: -2px; }
.stoned-vis-close span,
.stoned-vis-close > * { display: none; } /* hide any inner content; we use ::before */
.stoned-vis-stage {
    position: relative;
    flex: 1 1 auto;
    background: #0E0E0F;
    min-height: 0;
}
.stoned-vis-iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%; border: 0;
    background: #0E0E0F;
    display: block;
    z-index: 1;
}

/* Loading / fallback overlay always sits on TOP of the iframe so the
   spinner + fallback link are visible regardless of iframe load state.
   pointer-events: none lets clicks pass through to the iframe once it's
   actually rendered; the fallback link re-enables pointer-events on
   itself for timeout/error states. */
.stoned-vis-state {
    position: absolute; inset: 0; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; text-align: center;
    color: #F4F1EC;
    background: #0E0E0F;
    pointer-events: none;
    transition: opacity .25s ease;
}
.stoned-vis-state[data-state="ready"] { opacity: 0; pointer-events: none; }
.stoned-vis-state[data-state="ready"] * { pointer-events: none; }
.stoned-vis-state-loading, .stoned-vis-state-fallback { max-width: 360px; }
.stoned-vis-state-loading { display: block; }
.stoned-vis-state-fallback { display: none; }
.stoned-vis-state[data-state="timeout"] .stoned-vis-state-loading,
.stoned-vis-state[data-state="error"]   .stoned-vis-state-loading { display: none; }
.stoned-vis-state[data-state="timeout"] .stoned-vis-state-fallback,
.stoned-vis-state[data-state="error"]   .stoned-vis-state-fallback { display: block; }
.stoned-vis-state[data-state="timeout"] .stoned-vis-fallback-link,
.stoned-vis-state[data-state="error"]   .stoned-vis-fallback-link { pointer-events: auto; }

.stoned-vis-state-title {
    font-family: "Cormorant Garamond", "Times New Roman", serif;
    font-size: 22px; line-height: 1.2; margin-bottom: 6px;
}
.stoned-vis-state-sub { font-size: 13px; color: rgba(244,241,236,0.65); margin-bottom: 16px; }

.stoned-vis-spinner {
    width: 36px; height: 36px;
    border: 2px solid rgba(244,241,236,0.18);
    border-top-color: var(--stoned-vis-bg, #C9A961);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: stoned-vis-spin 0.9s linear infinite;
}
@keyframes stoned-vis-spin { to { transform: rotate(360deg); } }

.stoned-vis-fallback-link {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 22px; text-decoration: none;
    background: var(--stoned-vis-bg, #C9A961);
    color: var(--stoned-vis-text, #0E0E0F);
    font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 12px;
    transition: background .15s ease;
}
.stoned-vis-fallback-link:hover {
    background: var(--stoned-vis-hover-bg, #E5D29A);
    color: var(--stoned-vis-hover-text, #0E0E0F);
}

body.stoned-vis-locked { overflow: hidden; }

@media (max-width: 640px) {
    .stoned-vis-modal { padding: 0; }
    .stoned-vis-dialog { height: 100vh; max-height: none; }
    .stoned-vis-title { font-size: 18px; }
    .stoned-vis-trigger { width: 100%; }
}
