/* ============================================================================
 * NStar 3D Inline Embed — Lightweight Interactive 3D Canvas for Blog Posts
 * Scoped strictly to .nstar-3d-embed (Dark Mode + Light Mode + Responsive)
 * ============================================================================ */

.nstar-3d-embed {
    --emb-bg: #0b0d12;
    --emb-bar: #12151e;
    --emb-border: rgba(255, 255, 255, 0.10);
    --emb-border-strong: rgba(255, 255, 255, 0.20);
    --emb-text: #f1f5f9;
    --emb-muted: #94a3b8;
    --emb-btn-bg: rgba(15, 18, 26, 0.78);
    --emb-btn-hover: rgba(30, 36, 52, 0.92);

    margin: 2rem 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--emb-border);
    background: var(--emb-bg);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    position: relative;
}

.nstar-3d-embed:fullscreen {
    margin: 0;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.nstar-3d-embed:fullscreen .nstar-3d-embed-stage {
    flex: 1;
    height: auto !important;
}

.nstar-3d-embed-stage {
    position: relative;
    width: 100%;
    min-height: 320px;
    background: radial-gradient(circle at 50% 42%, #1d212b 0%, #0b0d12 76%);
    overflow: hidden;
}

.nstar-3d-embed-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.nstar-3d-embed-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 2;
    cursor: grab;
    touch-action: none;
}

.nstar-3d-embed-canvas:active {
    cursor: grabbing;
}

/* Floating Camera & Quick Controls */
.nstar-3d-embed-hud-top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
    pointer-events: none;
    z-index: 6;
}

.nstar-3d-embed-hud-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    pointer-events: auto;
    background: var(--emb-btn-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--emb-border);
    border-radius: 9px;
    padding: 4px;
}

.nstar-3d-embed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--emb-text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.nstar-3d-embed-btn:hover {
    background: var(--emb-btn-hover);
    border-color: var(--emb-border-strong);
}

.nstar-3d-embed-btn.is-active {
    background: rgba(56, 189, 248, 0.22);
    border-color: rgba(56, 189, 248, 0.65);
    color: #bae6fd;
}

.nstar-3d-embed-hint {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 6;
    pointer-events: none;
    font-size: 10.5px;
    color: var(--emb-muted);
    background: var(--emb-btn-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--emb-border);
    padding: 4px 9px;
    border-radius: 7px;
}

/* Loading Overlay */
.nstar-3d-embed-loader {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(10, 12, 17, 0.72);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 12px;
    color: #cbd5e1;
    transition: opacity 0.25s ease;
}

.nstar-3d-embed-loader.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.nstar-3d-embed-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(56, 189, 248, 0.22);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: nstar3dEmbedSpin 0.8s linear infinite;
}

@keyframes nstar3dEmbedSpin {
    to { transform: rotate(360deg); }
}

/* Optional Sleek Footer Bar with CTA to Full 3D Viewer/Studio */
.nstar-3d-embed-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 11px 16px;
    background: var(--emb-bar);
    border-top: 1px solid var(--emb-border);
}

.nstar-3d-embed-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.nstar-3d-embed-pill {
    font-family: 'Orbitron', sans-serif;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 5px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.36);
    color: #7dd3fc;
    flex-shrink: 0;
}

.nstar-3d-embed-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--emb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nstar-3d-embed-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none !important;
    color: #ffffff !important;
    background: linear-gradient(135deg, #0284c7, #7c3aed);
    border: 1px solid rgba(125, 211, 252, 0.42);
    transition: transform 0.15s ease, filter 0.15s ease;
    white-space: nowrap;
}

.nstar-3d-embed-cta:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

/* ============================================================================
 * LIGHT MODE OVERRIDES
 * ============================================================================ */
html[data-theme="light"] .nstar-3d-embed,
html[data-bs-theme="light"] .nstar-3d-embed {
    --emb-bg: #eef2f6;
    --emb-bar: #ffffff;
    --emb-border: rgba(15, 23, 42, 0.13);
    --emb-border-strong: rgba(15, 23, 42, 0.25);
    --emb-text: #0f172a;
    --emb-muted: #475569;
    --emb-btn-bg: rgba(255, 255, 255, 0.86);
    --emb-btn-hover: #f1f5f9;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.09);
}

html[data-theme="light"] .nstar-3d-embed-stage,
html[data-bs-theme="light"] .nstar-3d-embed-stage {
    background: radial-gradient(circle at 50% 40%, #f1f5f9 0%, #cfd8e3 82%);
}

html[data-theme="light"] .nstar-3d-embed-btn,
html[data-bs-theme="light"] .nstar-3d-embed-btn {
    background: rgba(15, 23, 42, 0.04);
    color: #1e293b;
}

html[data-theme="light"] .nstar-3d-embed-btn.is-active,
html[data-bs-theme="light"] .nstar-3d-embed-btn.is-active {
    background: rgba(2, 132, 199, 0.14);
    border-color: rgba(2, 132, 199, 0.55);
    color: #0369a1;
}

html[data-theme="light"] .nstar-3d-embed-pill,
html[data-bs-theme="light"] .nstar-3d-embed-pill {
    background: rgba(2, 132, 199, 0.12);
    border-color: rgba(2, 132, 199, 0.34);
    color: #0369a1;
}

html[data-theme="light"] .nstar-3d-embed-cta,
html[data-bs-theme="light"] .nstar-3d-embed-cta {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    border-color: rgba(2, 132, 199, 0.55);
}

html[data-theme="light"] .nstar-3d-embed-loader,
html[data-bs-theme="light"] .nstar-3d-embed-loader {
    background: rgba(241, 245, 249, 0.84);
    color: #1e293b;
}

@media (max-width: 640px) {
    .nstar-3d-embed-stage {
        height: 360px !important;
    }
    .nstar-3d-embed-hint {
        display: none;
    }
}
