/*
Theme Name: STC Spatial 3D
Theme URI: https://storytimeandconfessions.com/
Author: Storytime & Confessions
Description: Responsive spatial glassmorphic WordPress theme for Storytime & Confessions, with four content pillars, interactive UI, and Adsterra placements.
Version: 3.1.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: stc-spatial-3d
*/

:root {
    --stc-bg: #06070c;
    --stc-panel: rgba(15, 17, 28, 0.78);
    --stc-border: rgba(255, 255, 255, 0.09);
    --stc-text: #f3f4f6;
    --stc-muted: #9ca3af;
    --stc-accent: #8b5cf6;
    --stc-accent-glow: rgba(139, 92, 246, 0.32);
    --stc-font-scale: 1;
    --stc-radius: 18px;
    --stc-shadow: 0 16px 38px -12px var(--stc-accent-glow);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    margin: 0;
    background-color: transparent !important;
    color: var(--stc-text);
    font: 16px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Three.js Background Canvas Layer */
#stc-webgl-canvas {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: -1 !important;
    pointer-events: auto !important;
}

a {
    color: inherit;
}

button, input, select, textarea {
    font: inherit;
}

.stc-site-wrapper {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    isolation: isolate;
}

.stc-container {
    width: min(1260px, calc(100% - 36px));
    margin-inline: auto;
}

.stc-glass {
    background: var(--stc-panel);
    border: 1px solid var(--stc-border);
    box-shadow: var(--stc-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

.stc-glass:hover {
    border-color: var(--stc-accent);
}

/* Header & Admin Bar Offset */
.stc-header {
    position: sticky;
    top: 0.75rem;
    z-index: 100;
    margin: 0.75rem auto 1.5rem;
    border-radius: 18px;
}

body.admin-bar .stc-header {
    top: calc(32px + 0.75rem) !important;
}

.stc-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
}

.stc-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    font-weight: 800;
    white-space: nowrap;
    color: #fff !important;
}

.stc-brand-orb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--stc-accent);
    box-shadow: 0 0 14px var(--stc-accent);
}

.stc-nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.stc-nav-pill, .stc-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.42rem 0.85rem;
    border: 1px solid var(--stc-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--stc-text);
    text-decoration: none !important;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stc-nav-pill:hover, .stc-nav-pill.active, .stc-btn-ghost:hover {
    border-color: var(--stc-accent);
    background: var(--stc-accent);
    color: #fff !important;
    box-shadow: 0 0 16px var(--stc-accent-glow);
}

.stc-hud-controls {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.stc-ticker-bar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    overflow: hidden;
    padding: 0.55rem 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    font-size: 0.8rem;
}

.stc-ticker-label, .stc-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.18);
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
}

.stc-ticker-track {
    display: flex;
    gap: 2rem;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.stc-ticker-track::-webkit-scrollbar {
    display: none;
}

.stc-ticker-track a {
    text-decoration: none;
    color: var(--stc-muted);
}

.stc-ticker-track a:hover {
    color: #fff;
}

.stc-hero-grid {
    display: grid;
    grid-template-columns: 1.35fr 0.85fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stc-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.15rem;
    padding: 1.5rem;
    border-radius: var(--stc-radius);
    min-width: 0;
}

.stc-card-lift {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}

.stc-card-lift:hover {
    transform: translateY(-4px);
    border-color: var(--stc-accent);
}

.stc-card h3 {
    font-size: 1.15rem;
    line-height: 1.35;
    margin: 0 0 0.65rem;
}

.stc-card h3 a {
    color: #fff !important;
    text-decoration: none !important;
}

.stc-card p {
    color: var(--stc-muted);
    font-size: 0.88rem;
    margin: 0 0 1.2rem;
}

.stc-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 0.75rem 1.35rem;
    background: var(--stc-accent);
    color: white !important;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 10px 24px -6px var(--stc-accent-glow);
}

.stc-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 3.25rem 0 1.35rem;
}

.stc-section-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
    color: #fff;
}

.stc-section-sub {
    color: var(--stc-muted);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

.stc-grid-3, .stc-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.35rem;
}

.stc-grid-4 {
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
}

main > section {
    margin: 3.5rem 0;
}

.stc-meta-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-top: 1px solid var(--stc-border);
    padding-top: 0.8rem;
    color: var(--stc-muted);
    font-size: 0.76rem;
}

.stc-reader-wrap {
    max-width: 820px;
    margin: 2rem auto 4rem;
    padding: 2.5rem;
    border-radius: 18px;
}

.stc-reader-content {
    font-size: calc(1.08rem * var(--stc-font-scale));
    line-height: 1.8;
    color: #e5e7eb;
    overflow-wrap: anywhere;
}

.stc-reader-content p {
    margin-bottom: 1.4rem;
}

.stc-reader-content h2, .stc-reader-content h3 {
    color: #fff;
    line-height: 1.3;
    margin: 1.7em 0 0.7em;
}

.stc-reader-content img {
    max-width: 100%;
    height: auto;
    border-radius: 14px;
}

.stc-reader-content blockquote {
    border-left: 3px solid var(--stc-accent);
    margin: 1.5em 0;
    padding: 0.5em 1.2em;
    background: rgba(255, 255, 255, 0.04);
}

.stc-footer {
    margin-top: 5rem;
    padding: 3.5rem 0 2.5rem;
    border-top: 1px solid var(--stc-border);
    background: rgba(6, 7, 12, 0.88);
    backdrop-filter: blur(14px);
}

.stc-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.stc-footer-col h4 {
    color: #fff;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 1rem;
}

.stc-footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stc-footer-col li {
    margin-bottom: 0.55rem;
}

.stc-footer-col a {
    color: var(--stc-muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.stc-footer-col a:hover {
    color: #fff;
}

#stc-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--stc-accent), var(--stc-cyan));
    z-index: 9999;
    box-shadow: 0 0 12px var(--stc-accent);
    transition: width 0.1s linear;
}

.stc-input, .stc-select, .stc-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--stc-border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}

.stc-textarea {
    resize: vertical;
}

.stc-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(4, 5, 10, 0.84);
    backdrop-filter: blur(12px);
}

.stc-modal-backdrop.open {
    display: flex;
}

.stc-modal-backdrop .stc-card {
    max-height: 90vh;
    overflow: auto;
}

/* Adsterra Units & Rails */
.stc-ad-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 1.75rem auto;
    padding: 0.65rem;
    border-radius: 14px;
    background: rgba(15, 17, 28, 0.62);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    max-width: 100%;
    overflow: hidden;
    pointer-events: auto;
}

.stc-ad-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--stc-muted);
    margin-bottom: 0.35rem;
    opacity: 0.7;
}

.stc-ad-desktop-728 {
    display: flex;
}

.stc-ad-mobile-320 {
    display: none;
}

.stc-ad-slot iframe {
    max-width: 100%;
}

.stc-skyscraper-rail {
    position: fixed;
    top: 120px;
    z-index: 40;
    display: none;
    flex-direction: column;
    gap: 1rem;
    pointer-events: auto;
}

.stc-skyscraper-left {
    left: 14px;
}

.stc-skyscraper-right {
    right: 14px;
}

.stc-mobile-sticky-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 990;
    background: rgba(8, 10, 18, 0.94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--stc-border);
    padding: 0.35rem 0.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.stc-mobile-sticky-close {
    position: absolute;
    top: -22px;
    right: 10px;
    background: rgba(15, 17, 28, 0.95);
    color: var(--stc-muted);
    border: 1px solid var(--stc-border);
    border-radius: 6px 6px 0 0;
    font-size: 0.7rem;
    padding: 2px 8px;
    cursor: pointer;
}

.stc-smartlink-btn {
    background: linear-gradient(135deg, #f43f5e, #8b5cf6);
    color: #fff !important;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 0 18px rgba(244, 63, 94, 0.35);
}

.stc-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 30px;
}

.stc-pagination a, .stc-pagination span {
    padding: 8px 13px;
    border: 1px solid var(--stc-border);
    border-radius: 9px;
    text-decoration: none;
}

.stc-empty {
    padding: 30px;
    text-align: center;
}

@media(min-width: 1360px) {
    .stc-skyscraper-rail {
        display: flex;
    }
}

@media(max-width: 1100px) {
    .stc-header-inner {
        flex-wrap: wrap;
    }
    .stc-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stc-nav-links {
        order: 3;
        width: 100%;
    }
}

@media(max-width: 767px) {
    .stc-container {
        width: min(100% - 24px, 600px);
    }
    .stc-header-inner {
        justify-content: center;
    }
    .stc-brand {
        width: 100%;
        justify-content: center;
    }
    .stc-nav-links {
        gap: 5px;
    }
    .stc-nav-pill {
        padding: 7px 9px;
        font-size: 0.72rem;
    }
    .stc-hud-controls {
        justify-content: center;
    }
    .stc-hero-grid {
        grid-template-columns: 1fr;
        margin: 20px 0 38px;
    }
    .stc-grid-3, .stc-grid-4 {
        grid-template-columns: 1fr;
    }
    .stc-section-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .stc-footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stc-ad-desktop-728 {
        display: none !important;
    }
    .stc-ad-mobile-320 {
        display: flex !important;
    }
    .stc-ad-468-wrap {
        transform: scale(0.72);
        transform-origin: center center;
        margin: -8px auto;
    }
    .stc-mobile-sticky-ad {
        display: flex;
    }
    body {
        padding-bottom: 62px;
    }
}

@media(max-width: 420px) {
    .stc-footer-grid {
        grid-template-columns: 1fr;
    }
    .stc-ticker-label {
        display: none;
    }
}