body { 
    font-family: 'Times New Roman', Times, Georgia, serif; 
    margin: 0;
    padding: 0;
    background-color: #fcfbf9;
    color: #111111; 
    line-height: 1.7;
    overflow-x: hidden; 
}

/* Background Canvas Layer */
#canvas-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.12;
    pointer-events: none;
}

/* Header Bar */
.top-controls {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fcfbf9;
    border-bottom: 1px solid #e2e8f0;
    z-index: 50;
}

.logo-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: 8px;
}

.logo-btn .home {
    max-width: 36px;
    height: auto;
    display: block;
}

.feature {
    background: transparent;
    border: none;
    color: #475569;
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s ease;
}

.feature:hover {
    color: #111111;
}

.feature.active {
    color: #991b1b;
    border-bottom: 2px solid #991b1b;
}

/* Main Display Flow */
main {
    padding-top: 90px;
    padding-bottom: 80px;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
}

main > section {
    display: none;
    width: 100%;
    opacity: 0;
}

main > section.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Open Document Flow (No Containers) */
.content-flow {
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

h1, h2, h3, h4 {
    font-family: 'Times New Roman', Times, serif;
    color: #111111;
    margin-top: 0;
    font-weight: 700;
}

p {
    font-size: 1.1rem;
    color: #222222;
    margin-bottom: 1.25rem;
}

.open-grid-item {
    padding-bottom: 16px;
    border-bottom: 1px dashed #cbd5e1;
}

.text-link {
    display: inline-block;
    color: #991b1b;
    font-weight: 700;
    text-decoration: underline;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
}

.text-link:hover {
    color: #111111;
}

/* Screenplay Formatting */
.script-flow {
    font-family: 'Courier Prime', 'Courier New', Courier, monospace !important;
    max-width: 720px;
    margin: 0 auto;
    color: #000000;
    line-height: 1.45;
}

.script-scene-heading {
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid #111111;
    padding-bottom: 4px;
    margin-bottom: 18px;
}

.script-character {
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    margin-top: 16px;
    color: #991b1b;
}

.script-parenthetical {
    font-style: italic;
    text-align: center;
    color: #444444;
    font-size: 0.9rem;
}

.script-dialogue {
    max-width: 68%;
    margin: 0 auto 16px auto;
    text-align: left;
}

.script-action {
    color: #111111;
    margin-bottom: 16px;
}

/* Sidebar Navigation Drawer */
.hamburger-btn {
    position: fixed; 
    top: 16px; 
    right: 24px; 
    z-index: 100;
    display: flex; 
    flex-direction: column; 
    justify-content: space-around;
    width: 28px; 
    height: 22px; 
    background: transparent; 
    border: 1px solid #111111; 
    padding: 3px 4px;
    cursor: pointer;
}

.hamburger-btn span {
    width: 100%; 
    height: 2px; 
    background: #111111; 
}

.nav-sidebar {
    position: fixed; 
    right: -320px; 
    top: 0; 
    height: 100vh; 
    width: 280px;
    background: #fcfbf9; 
    border-left: 2px solid #111111;
    display: flex; 
    flex-direction: column; 
    padding: 28px 20px;
    box-sizing: border-box;
    transition: right 0.25s ease-in-out; 
    z-index: 90;
}

.nav-sidebar.open { 
    right: 0; 
}

.nav-header {
    padding-bottom: 10px;
    border-bottom: 2px solid #111111;
    margin-bottom: 16px;
}

.nav-subtitle {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #991b1b;
}

.nav-title {
    margin: 2px 0 0 0;
    font-size: 1.15rem;
    font-weight: 700;
    font-family: 'Times New Roman', Times, serif;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px; 
    color: #222222; 
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer; 
    transition: all 0.15s ease;
    font-family: 'Times New Roman', Times, serif;
}

.nav-item:hover { 
    background: #f1f1ec; 
    color: #991b1b;
    padding-left: 14px;
}

.nav-item.active { 
    color: #991b1b; 
    border-left: 3px solid #991b1b;
    font-weight: 700;
}

/* -------------------------------------------------------------------------
   Mobile Responsiveness & Hamburger Menu Display
   ------------------------------------------------------------------------- */

@media (max-width: 768px) {
    /* Hide top text navigation buttons to make room for logo and hamburger button */
    .top-controls .feature {
        display: none;
    }

    /* Adjust top header padding and logo spacing */
    .top-controls {
        padding: 0 16px;
        justify-content: space-between;
    }

    /* Keep hamburger menu fixed and vertically centered on mobile */
    .hamburger-btn {
        position: fixed;
        top: 18px;
        right: 16px;
        z-index: 100;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 32px;
        height: 24px;
        background: #fcfbf9;
        border: 1px solid #111111;
        padding: 4px;
        border-radius: 3px;
    }

    /* Ensure sidebar drawer takes up appropriate width on phones */
    .nav-sidebar {
        width: 85vw;
        max-width: 300px;
        right: -100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-sidebar.open {
        right: 0;
    }
}