/* ── Today's Completely Solvable Problems ── */
/* Literary satire / screenplay aesthetic */

:root {
    --bg: #faf8f2;
    --page: #fffef9;
    --ink: #1a1714;
    --muted: #6b6358;
    --line: #d4cbbf;
    --red: #8b2500;
    --accent: #2d5a3b;
    --direction: #8b7355;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Georgia', 'Iowan Old Style', 'Palatino Linotype', serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.7;
    font-size: 1.1rem;
}

/* ── Grain texture ── */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
}

/* ── Masthead ── */
.masthead {
    position: relative;
    z-index: 1;
    background: linear-gradient(175deg, #1a1714 0%, #2a2520 40%, #3a3328 100%);
    color: #efe6d5;
    padding: 64px 24px 56px;
    text-align: center;
    border-bottom: 4px solid var(--red);
}

.series-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    opacity: 0.7;
    margin: 0 0 8px;
    font-weight: normal;
}

.episode-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--red);
    margin: 0 0 4px;
}

.episode-title {
    font-size: clamp(1.6rem, 5vw, 2.6rem);
    font-style: italic;
    font-weight: normal;
    margin: 8px 0 0;
    line-height: 1.3;
}

/* ── Script body ── */
.script {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 48px auto 64px;
    padding: 0 24px;
}

/* ── Character name ── */
.character {
    font-variant: small-caps;
    font-weight: bold;
    letter-spacing: 0.06em;
    font-size: 0.82rem;
    color: var(--ink);
}

/* ── Narration ── */
.narration {
    margin: 0 0 1.1em;
    text-indent: 1.5em;
}

/* ── Dialogue ── */
.dialogue {
    margin: 0.2em 0 0.8em 1.5em;
    max-width: 480px;
}

.dialogue .character {
    color: var(--ink);
}

/* ── Stage directions ── */
.direction {
    margin: 0.5em 0;
    color: var(--direction);
    font-size: 0.95rem;
    font-style: italic;
    text-align: center;
}

.direction .character {
    color: var(--direction);
    font-style: normal;
}

/* ── Scene break ── */
.scene-break {
    text-align: center;
    color: var(--line);
    margin: 36px 0;
    letter-spacing: 0.5em;
    font-size: 1.2rem;
}

/* ── Research asides ── */
.aside {
    margin: 20px 0 24px;
    padding: 16px 20px;
    border-left: 3px solid var(--red);
    background: #f5f0e8;
    border-radius: 0 8px 8px 0;
    font-size: 0.95rem;
    color: #4a3f32;
}

.aside p {
    margin: 0 0 0.6em;
}

.aside p:last-child {
    margin-bottom: 0;
}

/* ── Footer ── */
.page-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 32px 24px 48px;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--line);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .script {
        padding: 0 16px;
        margin: 32px auto 48px;
    }
    .dialogue {
        margin-left: 0.5em;
    }
    .masthead {
        padding: 40px 16px 36px;
    }
}

/* Print */
@media print {
    .grain { display: none; }
    body { font-size: 12pt; }
    .aside { background: none; border: none; border-left: 2px solid #999; padding-left: 12px; }
}
