/* General Setup & Fonts */
:root {
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Source Serif 4', serif;
    --color-bg: #f9f9f9;
    --color-text: #1a1a1a;
    --color-border: #ddd;
    --color-accent: #007bff;
    --color-shadow: rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout */
.container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    padding: 20px 0;
    flex-grow: 1;
}

header {
    text-align: center;
    padding: 20px 0 30px 0;
}

header h1 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 2.2rem;
    color: var(--color-text);
}

footer {
    text-align: center;
    padding: 15px 0;
    border-top: 1px solid var(--color-border);
    margin-top: 30px;
    font-size: 0.9rem;
    color: #777;
}

/* Editor Area */
.editor-area {
    display: flex;
    gap: 30px;
    height: 70vh; /* Set a fixed height for the main interaction area */
}

.input-section, .preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--color-shadow);
    overflow: hidden; /* Ensures children respect border radius */
}

.input-section h2, .preview-section h2 {
    font-family: var(--font-sans);
    font-weight: 600;
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.2rem;
}

/* Textarea Styling */
#markdown-input {
    flex-grow: 1;
    padding: 20px;
    border: none;
    resize: none;
    font-family: var(--font-sans); /* Using sans-serif for input */
    font-size: 1rem;
    line-height: 1.7;
    outline: none;
    background-color: transparent;
}

/* Preview Styling (Applying Serif font for readability) */
.preview-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto; /* Scrollable content */
    font-family: var(--font-serif); /* Serifs for reading content */
    font-size: 1.05rem;
}

/* Markdown Specific Styling (Minimalistic) */
.preview-content h1, .preview-content h2, .preview-content h3 {
    font-family: var(--font-serif);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.2;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 5px;
}

.preview-content h1 { font-size: 2em; }
.preview-content h2 { font-size: 1.75em; }
.preview-content h3 { font-size: 1.4em; }

.preview-content p {
    margin-bottom: 1em;
}

.preview-content pre {
    background-color: #f4f4f4;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
    overflow-x: auto;
    font-family: monospace;
}

.preview-content code {
    font-family: monospace;
}

.preview-content ul, .preview-content ol {
    margin-left: 20px;
    margin-bottom: 1em;
}

.preview-content blockquote {
    border-left: 4px solid var(--color-accent);
    padding-left: 15px;
    margin: 15px 0;
    color: #666;
    font-style: italic;
}


/* Responsive Adjustments */
@media (max-width: 950px) {
    .editor-area {
        flex-direction: column;
        height: auto; /* Allow content to dictate height on smaller screens */
        min-height: 80vh;
    }
    
    .input-section, .preview-section {
        min-height: 40vh;
    }

    header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 600px) {
    .container {
        width: 100%;
        padding: 10px;
    }
    
    .input-section h2, .preview-section h2 {
        padding: 10px 15px;
        font-size: 1.1rem;
    }

    .preview-content, #markdown-input {
        padding: 15px;
    }
}