/* ===========================
   1. LAYOUT & FORM
   =========================== */
.compose-layout-wrapper {
    display: grid;
    grid-template-columns: 220px 1fr 1.2fr;
    gap: 30px;
    max-width: 1600px;
    margin: 100px auto 40px;
    padding: 0 20px;
}

.markup-key {
    background: white;
    padding: 20px;
    border-radius: 18px;
    border: 1px solid rgba(37, 99, 235, 0.1);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.markup-key h3 {
    color: var(--blue-deep);
    margin-bottom: 15px;
    font-size: 1rem;
    border-bottom: 2px solid rgba(37, 99, 235, 0.05);
    padding-bottom: 10px;
}

.markup-key ul { list-style: none; padding: 0; }
.markup-key li {
    font-size: 0.8rem;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    color: var(--blue-soft);
}

.markup-key span {
    font-family: monospace;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    color: #475569;
    margin-top: 4px;
    width: fit-content;
}

.compose-container h1 {
    color: var(--blue-deep);
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.form-group { margin-bottom: 20px; }

.compose-input, .compose-textarea {
    width: 100%;
    border: 1px solid rgba(37, 99, 235, 0.1);
    border-radius: 14px;
    padding: 15px;
    font-family: 'Varela Round', sans-serif;
    font-size: 1rem;
    background: white;
    outline: none;
}

.compose-textarea {
    height: 500px;
    line-height: 1.7;
    resize: vertical;
}

#submit-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 50px;
    background: var(--blue-primary);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* =========================================
   2. THE PREVIEW BOX (BULLETPROOF)
   ========================================= */

.preview-container {
    position: sticky;
    top: 100px;
    height: calc(100vh - 140px);
}

/* Forces the "Live Preview" label to stay small */
.preview-container h3 {
    all: initial; /* Resets everything */
    display: block;
    color: var(--blue-soft) !important;
    font-size: 0.8rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    margin-bottom: 15px !important;
    font-family: 'Varela Round', sans-serif !important;
}

.preview-box {
    background: white;
    border: 1px solid rgba(37, 99, 235, 0.1);
    border-radius: 18px;
    padding: 40px;
    height: 100%;
    overflow-y: auto;
    max-width: 740px; 
}

/* --- THE ARTICLE SYNC OVERRIDES --- */

/* Title: Forced no-caps and correct sizing */
#article-content #preview-title {
    all: initial;
    display: block !important;
    color: var(--blue-deep) !important;
    font-size: 2.5rem !important;
    margin-bottom: 10px !important;
    line-height: 1.2 !important;
    font-family: 'Varela Round', sans-serif !important;
    text-transform: none !important;
    font-weight: 900 !important;
}

/* Body container reset */
#article-content #article-body {
    all: initial;
    display: block !important;
    font-size: 1.1rem !important;
    line-height: 1.8 !important;
    color: #000000 !important;
    margin-top: 20px !important;
    font-family: 'Varela Round', sans-serif !important;
}

/* Sub-headers (#): Forced no-caps and correct sizing */
#article-content #article-body h3 {
    all: revert; /* Revert to basic block behavior but keep our styles */
    display: block !important;
    color: #000000 !important;
    font-size: 1.3rem !important;
    margin-top: 25px !important;
    margin-bottom: 10px !important;
    font-weight: 700 !important;
    font-family: 'Varela Round', sans-serif !important;
    text-transform: none !important;
}

/* Bold/Strong text inside preview */
#article-content #article-body strong { 
    color: var(--blue-deep) !important;
    font-weight: 700 !important;
}

/* Line break management */
#article-content #article-body br {
    display: block !important;
    content: "" !important;
    margin-bottom: 10px !important;
}

/* ===========================
   3. RESPONSIVE
   =========================== */
@media (max-width: 1200px) {
    .compose-layout-wrapper {
        grid-template-columns: 200px 1fr;
    }
    .preview-container {
        grid-column: 1 / span 2;
        position: static;
        height: auto;
    }
    .preview-box { height: 500px; max-width: 100%; }
}

@media (max-width: 800px) {
    .compose-layout-wrapper { grid-template-columns: 1fr; }
    .markup-key { order: 3; }
    .preview-container { order: 2; }
}