:root {
    --bg-void: #070708;
    --bg-room: #0d0e10;
    --border-beam: #222328;
    --text-primary: #d9d6ce;
    --text-dim: #85827a;
    --accent-tone: #d49b27; /* Default: Six's Raincoat Ochre */

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Spectral', Georgia, serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

/* Chapter-specific atmospheric shifts */
body[data-chapter="part1"] {
    --bg-void: #070807;
    --bg-room: #0e100d;
    --border-beam: #252922;
    --accent-tone: #d49b27; /* Raincoat Ochre & Brass Lighter */
}

body[data-chapter="part2"] {
    --bg-void: #06080c;
    --bg-room: #0b0f16;
    --border-beam: #1e2836;
    --accent-tone: #7aa2c4; /* Cathode-Ray Static Blue */
    background-image: repeating-linear-gradient(
        0deg,
        rgba(122, 162, 196, 0.015) 0px,
        rgba(122, 162, 196, 0.015) 1px,
        transparent 1px,
        transparent 3px
    );
}

body[data-chapter="part3"] {
    --bg-void: #0a0706;
    --bg-room: #130d0b;
    --border-beam: #2e211b;
    --accent-tone: #c87a41; /* Necropolis Rust & Sand */
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-void);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    /* Vignette like peering into a dark dollhouse room */
    box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.9);
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    color: #efece6;
    line-height: 1.12;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* Navigation Bar */
.navbar {
    background-color: var(--bg-void);
    border-bottom: 1px solid var(--border-beam);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1060px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #efece6;
}

.logo span {
    color: var(--accent-tone);
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-dim);
    padding-bottom: 4px;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: #efece6;
    border-bottom-color: var(--accent-tone);
}

.steam-mark {
    border: 1px solid var(--border-beam) !important;
    padding: 4px 10px !important;
    background-color: var(--bg-room);
}

.steam-mark:hover {
    border-color: var(--accent-tone) !important;
}

/* Tags & Labels */
.room-tag {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-tone);
    margin-bottom: 10px;
}

/* Hub Masthead */
.masthead {
    padding: 72px 0 52px;
    border-bottom: 1px solid var(--border-beam);
}

.masthead-box h1 {
    font-size: clamp(2.4rem, 4.8vw, 3.8rem);
    max-width: 18ch;
    margin-bottom: 18px;
}

.masthead-box p {
    font-size: 1.12rem;
    color: var(--text-dim);
    max-width: 62ch;
}

/* Dollhouse Cross-Section Stack (Home Page) */
.dollhouse-stack {
    margin: 56px 0 80px;
    border: 2px solid var(--border-beam);
    background-color: var(--bg-room);
}

.diorama-room {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    border-bottom: 2px solid var(--border-beam);
}

.diorama-room:last-child {
    border-bottom: none;
}

.diorama-room:nth-child(even) {
    grid-template-columns: 1fr 1.15fr;
}

.diorama-room:nth-child(even) .room-visual {
    order: 2;
    border-right: none;
    border-left: 2px solid var(--border-beam);
}

.room-maw { --accent-tone: #d49b27; }
.room-pale { --accent-tone: #7aa2c4; }
.room-spiral { --accent-tone: #c87a41; }

.room-visual {
    position: relative;
    background-color: #040405;
    border-right: 2px solid var(--border-beam);
    min-height: 340px;
    overflow: hidden;
}

.room-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.84) contrast(1.08) saturate(0.88);
    transition: filter 0.4s ease;
}

.diorama-room:hover .room-visual img {
    filter: brightness(0.96) contrast(1.05) saturate(1);
}

.room-depth {
    position: absolute;
    bottom: 12px;
    left: 14px;
    z-index: 2;
    background-color: rgba(7, 7, 8, 0.88);
    border: 1px solid var(--border-beam);
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    color: var(--text-dim);
}

.room-notes {
    padding: 44px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.room-notes h2 {
    font-size: 2.1rem;
    margin-bottom: 14px;
}

.room-notes p {
    font-size: 1rem;
    color: #bdb9b0;
    margin-bottom: 24px;
}

.diorama-link {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #efece6;
    padding: 10px 18px;
    border: 1px solid var(--accent-tone);
    background-color: rgba(0, 0, 0, 0.35);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.diorama-link:hover {
    background-color: var(--accent-tone);
    color: #070708;
}

/* Chapter Detail Pages */
.chapter-banner {
    padding: 68px 0 44px;
    border-bottom: 1px solid var(--border-beam);
    background: radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.02) 0%, transparent 60%);
}

.chapter-banner h1 {
    font-size: clamp(2.3rem, 4.4vw, 3.4rem);
    margin-bottom: 12px;
}

.chapter-sub {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-dim);
    max-width: 60ch;
}

.chapter-body {
    padding: 56px 24px 80px;
}

.stage-wing {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    gap: 48px;
    align-items: start;
    padding-bottom: 56px;
    margin-bottom: 56px;
    border-bottom: 1px solid var(--border-beam);
}

.stage-wing:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.wing-prose h2 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.wing-prose p {
    font-size: 1.03rem;
    color: #c7c3ba;
    margin-bottom: 18px;
}

.wing-frame {
    background-color: var(--bg-room);
    border: 1px solid var(--border-beam);
    padding: 10px;
}

.wing-frame img {
    width: 100%;
    height: 340px;
    object-fit: cover;
    border: 1px solid #16171a;
    filter: brightness(0.88) contrast(1.06);
}

.wing-frame figcaption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    padding: 10px 4px 2px;
}

/* Specimen Ledger (Replaces AI bullet points) */
.specimen-ledger {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 20px;
}

.specimen-entry {
    border-left: 2px solid var(--accent-tone);
    padding-left: 16px;
}

.specimen-entry h3 {
    font-size: 1.25rem;
    color: #efece6;
    margin-bottom: 4px;
}

.specimen-entry p {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 0;
}

/* 404 Lost Room */
.lost-room {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
}

.static-screen {
    max-width: 540px;
    background-color: var(--bg-room);
    border: 1px solid var(--border-beam);
    padding: 44px;
}

.static-screen h1 {
    font-size: 2.5rem;
    margin-bottom: 14px;
}

.static-screen p {
    color: var(--text-dim);
    margin-bottom: 28px;
}

/* Footer */
footer {
    margin-top: auto;
    background-color: #040405;
    border-top: 1px solid var(--border-beam);
    padding: 34px 24px;
}

.footer-inner {
    max-width: 1060px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-whisper {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--accent-tone);
}

.copyright {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
}

.copyright a {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 840px) {
    .diorama-room,
    .diorama-room:nth-child(even) {
        grid-template-columns: 1fr;
    }
    .diorama-room:nth-child(even) .room-visual {
        order: 0;
        border-left: none;
    }
    .room-visual {
        border-right: none;
        border-bottom: 2px solid var(--border-beam);
        min-height: 240px;
    }
    .room-notes {
        padding: 28px 24px;
    }
    .stage-wing {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}
