/* Dreams Page Styles
 * Extends æthera branding for the Dream Window viewer
 */

/* ============================================
   Override: Solid black background (no video)
   ============================================ */
.dreams-page ~ .video-bg,
body:has(.dreams-page) .video-bg {
    display: none;
}

body:has(.dreams-page) {
    background: #000;
}

/* Invert header/footer for dreams page */
body:has(.dreams-page) .logo-container {
    filter: invert(1);
}

body:has(.dreams-page) footer {
    filter: invert(1);
}

.dreams-video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    filter: none;
}

/* ============================================
   Page Layout
   ============================================ */
.dreams-page {
    max-width: 1100px;
    margin: 0 auto;
}

.dreams-header {
    text-align: center;
    margin-top: 0;
    margin-bottom: 2rem;
}

.dreams-title {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: #fff;
    margin: 0;
    position: relative;
    display: inline-block;
    padding: 0.5rem 1.5rem;
}

.dreams-title::before {
    content: '';
    position: absolute;
    top: -1rem;
    left: -2rem;
    right: -2rem;
    bottom: -1rem;
    background: radial-gradient(ellipse 65% 60% at center, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.8) 40%, rgba(0,0,0,0.3) 60%, transparent 80%);
    z-index: -1;
}

/* ============================================
   Dream Container
   ============================================ */
.dream-container {
    position: relative;
    width: 100%;
    max-width: 1024px;
    aspect-ratio: 2 / 1;
    margin: 0 auto;
    overflow: visible;
    background: transparent;
}

#dream-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    position: relative;
    z-index: 1;
}

/* ============================================
   Loading Overlay
   ============================================ */
.dream-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 10;
}

.dream-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.dream-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.dream-pulse-container {
    position: relative;
    width: 60px;
    height: 60px;
}

.dream-pulse {
    position: absolute;
    inset: 0;
    border: 2px solid var(--accent);
    border-radius: 0;
    animation: dream-pulse-ring 2s ease-out infinite;
}

.dream-pulse-delayed {
    animation-delay: 0.5s;
}

@keyframes dream-pulse-ring {
    0% {
        transform: scale(0.6);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.dream-status {
    font-family: 'Libertinus Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: lowercase;
    letter-spacing: 0.1em;
}

.dream-progress {
    width: 200px;
    height: 2px;
    background: var(--bg-elevated);
    overflow: hidden;
}

.dream-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    animation: dream-progress-sweep 2.5s ease-in-out infinite;
}

@keyframes dream-progress-sweep {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 35%;
        margin-left: 32%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* ============================================
   Error Overlay
   ============================================ */
.dream-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    z-index: 20;
}

.dream-error.hidden {
    display: none;
}

.dream-error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.dream-error-icon {
    font-size: 2rem;
    color: var(--accent);
}

.dream-error-message {
    font-family: 'Libertinus Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: lowercase;
}

.dream-retry-btn {
    background: var(--accent);
    color: var(--text);
    border: none;
    padding: 0.5rem 1.5rem;
    font-family: 'Libertinus Mono', monospace;
    font-size: 0.85rem;
    text-transform: lowercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dream-retry-btn:hover {
    background: var(--accent-hover);
}

/* ============================================
   Status Bar
   ============================================ */
.dream-status-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.5rem 0;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
}

#status-bar-canvas {
    position: absolute;
    top: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 24rem;
    height: calc(100% + 1rem);
    z-index: -1;
    pointer-events: none;
}

.dream-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dream-stat-label {
    text-transform: lowercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    color: #fff;
}

.dream-stat-value {
    color: #fff;
    font-weight: 600;
}

.dream-stat-indicator {
    width: 8px;
    height: 8px;
    border-radius: 0;
    background: var(--text-muted);
}

.dream-stat-indicator.connected {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.dream-stat-indicator.connecting {
    background: #facc15;
    animation: indicator-pulse 1s ease-in-out infinite;
}

.dream-stat-indicator.error {
    background: var(--accent);
}

@keyframes indicator-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================
   Embed Section
   ============================================ */
.dreams-embed-section {
    max-width: 700px;
    margin: 2rem auto;
    padding: 1rem;
    background: #000;
    border: none;
    border-radius: 0;
}

.dreams-embed-section summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: lowercase;
    letter-spacing: 0.05em;
}

.dreams-embed-section summary:hover {
    color: var(--accent);
}

.dreams-embed-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.dreams-embed-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.dreams-embed-code {
    background: var(--code-bg);
    padding: 1rem;
    border-radius: 0;
    overflow-x: auto;
    font-size: 0.85rem;
}

.dreams-embed-code code {
    background: none;
    padding: 0;
    color: var(--text);
}

.dreams-embed-note {
    font-size: 0.85rem;
    margin-top: 1rem;
}

.dreams-embed-note code {
    font-size: 0.85em;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    .dreams-title {
        font-size: 1.5rem;
    }
    
    .dream-container {
        /* Full width on mobile, maintain aspect ratio */
        max-width: 100%;
    }
    
    .dream-status-bar {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .dreams-description {
        padding: 0 1rem;
    }
    
    .dreams-embed-section {
        margin: 2rem 1rem;
    }
}

/* ============================================
   Embed Mode (minimal chrome)
   ============================================ */
.embed-mode .dreams-header,
.embed-mode .dreams-description,
.embed-mode .dreams-embed-section,
.embed-mode .dream-status-bar {
    display: none;
}

.embed-mode .dreams-page {
    padding: 0;
    max-width: none;
}

.embed-mode .dream-container {
    max-width: none;
    border: none;
    border-radius: 0;
}

/* ============================================
   API Links Section
   ============================================ */
.dreams-api-links {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    font-size: 0.85rem;
}

.dreams-api-links li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.dreams-api-links li:last-child {
    border-bottom: none;
}

.dreams-api-links strong {
    color: var(--text);
    min-width: 80px;
}

.dreams-api-links code {
    color: var(--accent);
    font-size: 0.9em;
}

.dreams-docs-link {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--accent);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
}

.dreams-docs-link:hover {
    background: var(--accent);
    color: var(--text);
}

/* ============================================
   Dreams API Docs - Inverted Post Styling
   ============================================ */
.dreams-api-docs .post-header-standalone {
    color: #fff;
}

.dreams-api-docs .post-header-standalone::before {
    background: radial-gradient(ellipse 65% 60% at center, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.8) 40%, rgba(0,0,0,0.3) 60%, transparent 80%);
}

.dreams-api-docs .post-header-standalone h1 {
    color: #fff;
}

.dreams-api-docs .post-header-standalone .post-meta {
    color: #aaa;
}

.dreams-api-docs .post-header-standalone .post-meta a {
    color: #aaa;
}

.dreams-api-docs .post-header-standalone .post-meta a:hover {
    color: #fff;
}

/* Inverted post body - black fade, white text */
.dreams-api-docs article.post-body.dreams-inverted {
    color: #fff;
}

.dreams-api-docs article.post-body.dreams-inverted .post-content,
.dreams-api-docs article.post-body.dreams-inverted .post-content p,
.dreams-api-docs article.post-body.dreams-inverted .post-content li,
.dreams-api-docs article.post-body.dreams-inverted .post-content h1,
.dreams-api-docs article.post-body.dreams-inverted .post-content h2,
.dreams-api-docs article.post-body.dreams-inverted .post-content h3,
.dreams-api-docs article.post-body.dreams-inverted .post-content h4,
.dreams-api-docs article.post-body.dreams-inverted .post-content strong {
    color: #fff;
}

.dreams-api-docs article.post-body.dreams-inverted .post-content a {
    color: #ccc;
}

.dreams-api-docs article.post-body.dreams-inverted .post-content a:hover {
    color: #fff;
}

.dreams-api-docs article.post-body.dreams-inverted .post-content ul,
.dreams-api-docs article.post-body.dreams-inverted .post-content ol {
    color: #fff;
}

.dreams-api-docs article.post-body.dreams-inverted .post-content li::marker {
    color: #fff;
}

/* Inverted tables */
.dreams-api-docs article.post-body.dreams-inverted table {
    border-color: #444;
}

.dreams-api-docs article.post-body.dreams-inverted th,
.dreams-api-docs article.post-body.dreams-inverted td {
    border-color: #444;
    color: #fff;
}

.dreams-api-docs article.post-body.dreams-inverted th {
    background-color: rgba(255,255,255,0.1);
}

.dreams-api-docs article.post-body.dreams-inverted tr:nth-child(even) {
    background-color: rgba(255,255,255,0.05);
}

/* Inverted blockquotes */
.dreams-api-docs article.post-body.dreams-inverted blockquote {
    color: #aaa;
    border-left-color: #666;
    background: rgba(255,255,255,0.05);
}

/* Inverted segments */
.dreams-api-docs .post-segment {
    color: #fff;
}


