/* =============================================================================
   3. LAYOUT STRUCTURE — BULLETPROOF WORKSPACE & GLASSMORPHISM
   ============================================================================= */

/* ─── Header ─── */
.header {
    height: var(--header-h);
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(var(--glass-blur));
    -webkit-backdrop-filter: saturate(180%) blur(var(--glass-blur));
    box-shadow: inset 0 -1px 0 0 var(--color-border);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    transition: background-color var(--dur-norm) var(--ease-out), box-shadow var(--dur-norm) var(--ease-out);
    user-select: none;
}

[data-theme="dark"] .header {
    box-shadow: inset 0 -1px 0 0 rgba(255, 255, 255, 0.08);
}

/* ─── Workspace Container ─── */
.workspace {
    display: flex;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    overflow: hidden;
    position: relative;
}

/* ─── Editor Sidebar Panel ─── */
.editor {
    width: var(--sidebar-w); 
    min-width: 320px;
    max-width: 540px;
    background: var(--color-bg-panel);
    box-shadow: 1px 0 0 0 var(--color-border);
    border-right: none;
    overflow-y: auto;
    scrollbar-gutter: stable; 
    overflow-x: hidden;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: background-color var(--dur-norm) var(--ease-out);
    z-index: var(--z-above); 
    overscroll-behavior: contain;
    container-type: inline-size;
    container-name: editor;

    scrollbar-width: thin;
    scrollbar-color: var(--slate-300) transparent;
}

.editor:hover {
    scrollbar-color: var(--slate-400) transparent;
}

[data-theme="dark"] .editor {
    box-shadow: 1px 0 0 0 rgba(255, 255, 255, 0.08);
    scrollbar-color: var(--slate-600) transparent;
}

.editor::-webkit-scrollbar {
    width: 6px;
}

.editor::-webkit-scrollbar-track {
    background: transparent;
}

.editor::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: content-box;
}

.editor:hover::-webkit-scrollbar-thumb {
    background-color: var(--slate-300);
}

[data-theme="dark"] .editor:hover::-webkit-scrollbar-thumb {
    background-color: var(--slate-600);
}

/* ─── Preview Panel ─── */
.preview {
    flex: 1;
    background: var(--color-bg-app);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 2rem;
    overflow-y: auto;
    scrollbar-gutter: stable;
    overflow-x: hidden;
    position: relative;
    overscroll-behavior: contain;
    container-type: inline-size;
    container-name: preview;
    
    background-image: radial-gradient(var(--slate-200) 1.5px, transparent 1.5px);
    background-size: 20px 20px; 
    perspective: 1000px;
}

[data-theme="dark"] .preview {
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1.5px, transparent 1.5px);
}

/* ─── Spacer ─── */
.spacer {
    height: 80px; 
    flex-shrink: 0;
    width: 100%;
}
