/* =========================================================
   showa.boo — A midnight observatory perched on a Japanese
   mountainside during the Showa era. Split-screen diptych.
   ========================================================= */

:root {
    --c-obsidian-walnut: #0D0B0A;
    --c-aged-leather:    #1A1610;
    --c-dark-umber:      #2A2318;
    --c-warm-parchment:  #E8D5B0;
    --c-faded-manuscript:#B8A88A;
    --c-aged-honey:      #C9A96E;
    --c-tarnished-brass: #7A6F5E;
    --c-stellar-white:   #F5EDE0;
    --c-night-indigo:    #2C3A5C;

    --ease-settle: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    --font-display: 'Playfair Display', 'Lora', Georgia, serif;
    --font-body:    'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-mono:    'DM Mono', 'IBM Plex Mono', 'Courier New', monospace;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: #000000;
    color: var(--c-faded-manuscript);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--c-obsidian-walnut);
}

/* ---------- GRAIN OVERLAY ---------- */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.78 0 0 0 0 0.66 0 0 0 0 0.43 0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-repeat: repeat;
    mix-blend-mode: overlay;
    transition: opacity 1.5s var(--ease-settle);
}
.grain-overlay.is-visible { opacity: 0.04; }
.grain-overlay.is-deepening { opacity: 0.08; }

/* ---------- DIPTYCH SHELL ---------- */
.diptych {
    position: relative;
    display: grid;
    grid-template-columns: 40vw 60vw;
    height: 100vh;
    width: 100vw;
    background: var(--c-obsidian-walnut);
}

/* =========================================================
   LEFT PANEL — THE OBSERVATORY
   ========================================================= */
.observatory {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 60% at 30% 10%, rgba(201,169,110,0.05), transparent 60%),
        radial-gradient(ellipse 60% 50% at 70% 90%, rgba(44,58,92,0.08), transparent 65%),
        var(--c-obsidian-walnut);
    color: var(--c-warm-parchment);
    padding: 4rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* star field */
.starfield {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
.starfield .star {
    position: absolute;
    border-radius: 50%;
    background: var(--c-warm-parchment);
    opacity: 0;
    animation: star-fade-in 1.6s var(--ease-settle) forwards;
}
.starfield .star.bright {
    box-shadow: 0 0 6px 2px rgba(201,169,110,0.3);
    animation: star-fade-in 1.6s var(--ease-settle) forwards,
               stellar-pulse 4.5s ease-in-out infinite alternate 2s;
}
@keyframes star-fade-in {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: var(--star-opacity, 0.4); transform: scale(1); }
}
@keyframes stellar-pulse {
    from { opacity: 0.3; }
    to   { opacity: 0.85; filter: brightness(1.3); }
}

/* drifting constellations */
.constellation-drift {
    position: absolute;
    width: 220px;
    height: 220px;
    top: 12%;
    left: 18%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.6;
    animation: drift-slow 180s linear infinite;
}
.constellation-secondary {
    top: auto;
    bottom: 18%;
    left: auto;
    right: 8%;
    width: 180px;
    height: 180px;
    animation-duration: 220s;
    animation-direction: reverse;
    opacity: 0.45;
}
.constellation-drift path {
    fill: none;
    stroke: var(--c-aged-honey);
    stroke-width: 0.5;
    opacity: 0.3;
}
.constellation-drift circle {
    fill: var(--c-aged-honey);
    opacity: 0.7;
    animation: stellar-pulse 5s ease-in-out infinite alternate;
}
@keyframes drift-slow {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(20px, -15px) rotate(180deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

/* masthead */
.masthead {
    position: relative;
    z-index: 5;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.8s var(--ease-settle) 0.6s,
                transform 0.8s var(--ease-settle) 0.6s;
}
.masthead.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.site-name {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: italic;
    font-size: 1.8rem;
    letter-spacing: 0.15em;
    color: var(--c-aged-honey);
    line-height: 1.1;
}
.site-coords {
    margin-top: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: var(--c-tarnished-brass);
    text-transform: uppercase;
}

/* vertical navigation */
.vertical-nav {
    position: relative;
    z-index: 5;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 1s var(--ease-settle) 1.2s,
                transform 1s var(--ease-settle) 1.2s;
}
.vertical-nav.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}
.nav-item {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    text-decoration: none;
    color: var(--c-aged-honey);
    opacity: 0.6;
    font-family: var(--font-display);
    transition: opacity 400ms var(--ease-settle), color 400ms var(--ease-settle);
}
.nav-item:hover {
    opacity: 1;
    color: var(--c-warm-parchment);
}
.nav-item.is-active {
    opacity: 1;
    color: var(--c-warm-parchment);
}
.nav-item.is-active .nav-numeral {
    color: var(--c-stellar-white);
}
.nav-numeral {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--c-tarnished-brass);
    min-width: 2.5rem;
    border-bottom: 1px solid currentColor;
    padding-bottom: 0.1rem;
    text-transform: uppercase;
    transition: color 400ms var(--ease-settle);
}
.nav-label {
    font-style: italic;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

/* lunar phase indicator */
.lunar-indicator {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    opacity: 0;
    transition: opacity 1s var(--ease-settle) 1.6s;
}
.lunar-indicator.is-visible { opacity: 1; }
.lunar-disc {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--c-warm-parchment);
    border: 1px solid rgba(201, 169, 110, 0.35);
    box-shadow: 0 0 18px 2px rgba(201,169,110,0.12);
    overflow: hidden;
}
.lunar-shadow {
    position: absolute;
    inset: 0;
    background: var(--c-obsidian-walnut);
    border-radius: 50%;
    transform: translateX(-100%);
    transition: transform 600ms var(--ease-settle);
}
.lunar-caption {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: var(--c-tarnished-brass);
    text-transform: uppercase;
}

/* =========================================================
   SEAM (binding gutter)
   ========================================================= */
.seam {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 40vw;
    width: 2px;
    background: var(--c-dark-umber);
    z-index: 50;
    pointer-events: none;
}
.seam-mark {
    position: absolute;
    transform: translateX(-50%);
    left: 50%;
    color: var(--c-aged-honey);
    opacity: 0.18;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: var(--c-obsidian-walnut);
    padding: 0.15rem 0.25rem;
    line-height: 1;
}

/* =========================================================
   RIGHT PANEL — THE JOURNAL
   ========================================================= */
.journal {
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--c-aged-leather);
    height: 100vh;
    scroll-behavior: smooth;
}

/* warm subtle vignette inside the journal */
.journal::before {
    content: "";
    position: fixed;
    top: 0;
    right: 0;
    width: 60vw;
    height: 100vh;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 80% at 50% 50%, transparent 55%, rgba(13,11,10,0.55) 100%);
    z-index: 1;
}

.journal-inner {
    position: relative;
    z-index: 2;
    padding: 8vh 7vw 12vh;
    max-width: 100%;
}

/* CHAPTERS */
.chapter {
    max-width: 65ch;
    margin: 0 auto;
    padding: 6vh 0 4vh;
    position: relative;
}
.chapter-austere {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.chapter-final {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.chapter-meta {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    color: var(--c-tarnished-brass);
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.chapter-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--c-warm-parchment);
    margin-bottom: 1.2rem;
}

.chapter-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--c-faded-manuscript);
    margin-bottom: 3rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--c-faded-manuscript);
    margin-bottom: 1.5rem;
    text-align: left;
}
.body-text em { color: var(--c-warm-parchment); font-style: italic; }
.body-text strong { color: var(--c-warm-parchment); font-weight: 600; }

/* sidebar with dot column alongside content */
.content-with-sidebar {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 2.4rem;
    align-items: start;
}
.dot-sidebar {
    position: relative;
    align-self: stretch;
    min-height: 100%;
    background-image: radial-gradient(circle, var(--c-aged-honey) 1px, transparent 1.6px);
    background-size: 6px 12px;
    background-repeat: repeat-y;
    background-position: center top;
    opacity: 0.18;
}
.content-column { min-width: 0; }

/* pull quote */
.pull-quote {
    margin: 3rem 0;
    padding: 1.5rem 2rem 1.5rem 2.5rem;
    border-left: 1px solid var(--c-aged-honey);
    position: relative;
}
.pull-quote::before {
    content: "“";
    position: absolute;
    top: -0.6rem;
    left: 0.4rem;
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--c-aged-honey);
    opacity: 0.4;
    line-height: 1;
}
.pull-quote p {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.4rem, 2vw, 1.7rem);
    line-height: 1.4;
    color: var(--c-warm-parchment);
    letter-spacing: -0.005em;
}
.quote-cite {
    display: block;
    margin-top: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-style: normal;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-tarnished-brass);
}

/* breathing space ornament */
.breathing-space {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2vh 0;
}
.ornament {
    width: 80px;
    height: 80px;
    opacity: 0.7;
}

/* closing block (Chapter V) */
.closing-block {
    margin-top: 4rem;
}
.closing-line {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.4rem;
    letter-spacing: 0.04em;
    color: var(--c-stellar-white);
    margin-bottom: 2rem;
}
.closing-coords {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--c-tarnished-brass);
    line-height: 1.9;
    margin-bottom: 3rem;
}
.closing-mark {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-tarnished-brass);
    opacity: 0.6;
}

/* colophon */
.colophon {
    margin-top: 8vh;
    padding-top: 3rem;
    border-top: 1px solid var(--c-dark-umber);
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
.colophon-line {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    color: var(--c-tarnished-brass);
    line-height: 1.9;
}

/* =========================================================
   FADE-REVEAL (scroll-driven)
   ========================================================= */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms var(--ease-settle), transform 800ms var(--ease-settle);
    will-change: opacity, transform;
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* small initial-load assist for first chapter */
.chapter-austere .reveal {
    transition-delay: 0.2s;
}

/* =========================================================
   SCROLLBAR (subtle)
   ========================================================= */
.journal::-webkit-scrollbar { width: 6px; }
.journal::-webkit-scrollbar-track { background: transparent; }
.journal::-webkit-scrollbar-thumb {
    background: rgba(201, 169, 110, 0.18);
    border-radius: 3px;
}
.journal::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 169, 110, 0.35);
}

/* =========================================================
   MOBILE — collapse split-screen
   ========================================================= */
@media (max-width: 768px) {
    html, body { overflow: auto; }

    .diptych {
        display: block;
        height: auto;
        min-height: 100vh;
    }

    .observatory {
        position: fixed;
        inset: 0;
        z-index: -1;
        padding: 2rem;
        display: block;
    }

    .observatory .masthead,
    .observatory .vertical-nav,
    .observatory .lunar-indicator {
        display: none;
    }

    .seam { display: none; }

    .journal {
        position: relative;
        height: auto;
        min-height: 100vh;
        overflow: visible;
        background: rgba(26, 22, 16, 0.94);
        backdrop-filter: blur(2px);
    }

    .journal::before { display: none; }

    .journal-inner {
        padding: 6vh 5vw 8vh;
    }

    .chapter {
        padding: 4vh 0 3vh;
    }

    .chapter-austere,
    .chapter-final {
        min-height: 80vh;
    }

    .breathing-space { height: 30vh; }

    .content-with-sidebar {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .dot-sidebar { display: none; }
}
