/* bability.pro — Design Language Styles */
/* Sepia Nostalgic Palette / Editorial Broken-Grid / Mysterious-Moody */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    background-color: #f5edd6;
}

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    color: #3d3227;
    background-color: #f5edd6;
    overflow-x: hidden;
    line-height: 1.85;
}

/* ===== SVG FILTERS (hidden) ===== */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ===== OPENING OVERLAY ===== */
#opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #2a2218;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 1.2s ease-out;
}

#opening-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#title-cipher {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: 8vw;
    color: #d4a35a;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: flex;
    gap: 0.02em;
}

#title-cipher span {
    display: inline-block;
    min-width: 0.6em;
    text-align: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}

#title-cipher span.visible {
    opacity: 1;
}

.subtitle-line {
    font-family: 'Inconsolata', monospace;
    font-size: 1.2rem;
    color: #6b5d4f;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.8s ease 0.3s;
}

.subtitle-line.visible {
    opacity: 1;
}

/* ===== NAVIGATION RAIL ===== */
#nav-rail {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#nav-rail.visible {
    opacity: 1;
}

.nav-numeral {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.85rem;
    color: #6b5d4f;
    opacity: 0.5;
    cursor: pointer;
    transition: color 0.4s ease, opacity 0.4s ease;
    letter-spacing: 0.02em;
}

.nav-numeral.active {
    color: #d4a35a;
    opacity: 1;
}

/* ===== MAIN CONTENT ===== */
#main-content {
    padding-left: 48px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#main-content.visible {
    opacity: 1;
}

/* ===== CHAPTERS ===== */
.chapter {
    min-height: 100vh;
    padding: 80px 24px 40px;
    position: relative;
}

.dark-section {
    background-color: #2a2218;
    color: #e8dcc4;
}

/* ===== CHAPTER GRID (broken-grid: 12-col) ===== */
.chapter-grid {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) minmax(300px, 3fr) minmax(60px, 0.5fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* ===== GUTTER MARGIN (cols 1-4) ===== */
.gutter-margin {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 20px;
    position: relative;
}

.chapter-numeral {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 6rem;
    line-height: 1;
    color: #6b5d4f;
    opacity: 0.3;
    display: block;
}

.dark-section .chapter-numeral {
    color: #6b5d4f;
    opacity: 0.25;
}

.marginalia {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #a89074;
    display: block;
}

.dark-section .marginalia {
    color: #6b5d4f;
}

/* ===== PRIMARY CONTENT (cols 5-10) ===== */
.primary-content {
    position: relative;
    max-width: 38em;
}

.chapter-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.8rem);
    letter-spacing: 0.03em;
    margin-bottom: 2rem;
    color: #3d3227;
}

.dark-section .chapter-title {
    color: #e8dcc4;
}

.body-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    max-width: 38em;
    margin-bottom: 1.5rem;
    color: #3d3227;
}

.body-text.on-dark {
    color: #e8dcc4;
}

/* ===== SIDE COLUMN (cols 11-12) ===== */
.side-column {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pull-quote-rotated {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.9rem;
    color: #a87d4e;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.04em;
    opacity: 0.7;
    white-space: nowrap;
}

.vertical-rule {
    width: 1px;
    height: 200px;
    background-color: #6b5d4f;
    opacity: 0.4;
}

.vertical-rule.on-dark {
    background-color: #6b5d4f;
    opacity: 0.3;
}

/* ===== SECTION DIVIDERS ===== */
.section-divider {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background-color: #6b5d4f;
    opacity: 0.4;
}

.dark-divider::before {
    background-color: #6b5d4f;
    opacity: 0.25;
}

.divider-glyph {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 2rem;
    color: #a89074;
}

.dark-divider .divider-glyph {
    color: #6b5d4f;
}

/* ===== IMAGE FRAMES (vintage double-border) ===== */
.image-frame {
    margin: 2rem 0;
    padding: 4px;
    border: 1px solid #6b5d4f;
    position: relative;
}

.image-frame::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 1px solid #d4a35a;
    pointer-events: none;
}

.vintage-image {
    position: relative;
    overflow: hidden;
}

.vintage-image svg {
    display: block;
    width: 100%;
    height: auto;
    filter: sepia(30%) contrast(1.1) saturate(0.7);
}

.wide-image {
    max-width: 100%;
}

/* ===== DISPLACED BLOCKS (broken-grid animation) ===== */
.displaced-block {
    transition: transform 0.5s ease-out;
}

.displaced-block.aligned {
    transform: translate(0, 0) rotate(0deg) !important;
}

/* ===== CIRCUIT UNDERLAY ===== */
.circuit-underlay {
    position: absolute;
    top: 0;
    left: -20px;
    right: -20px;
    bottom: 0;
    pointer-events: none;
    opacity: 0.5;
    z-index: -1;
}

.circuit-underlay svg {
    width: 100%;
    height: 100%;
}

/* ===== REDACTED TEXT ===== */
.redacted {
    position: relative;
    cursor: help;
    display: inline;
}

.redacted::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -3px;
    right: -3px;
    bottom: -2px;
    background-color: #3d3227;
    filter: blur(0.5px);
    transition: opacity 1.2s ease-in-out;
    z-index: 1;
}

.redacted.on-dark::after {
    background-color: #e8dcc4;
}

.redacted:hover::after {
    opacity: 0;
}

.redacted .hidden-text {
    color: transparent;
    transition: color 1.2s ease-in-out;
}

.redacted:hover .hidden-text {
    color: #3d3227;
}

.redacted.on-dark:hover .hidden-text {
    color: #e8dcc4;
}

/* ===== COUNTER NUMBERS ===== */
.counter-num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
}

.counter-num.on-dark {
    color: #e8dcc4;
}

/* ===== DISPLACED TEXT BLOCK ===== */
.displaced-text-block {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-left: 2px solid #d4a35a;
    background: rgba(212, 163, 90, 0.04);
}

.dark-section .displaced-text-block {
    border-left-color: #a87d4e;
    background: rgba(168, 125, 78, 0.06);
}

/* ===== AMBER FLICKER ANIMATION ===== */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    25% { opacity: 0.92; }
    50% { opacity: 0.88; }
    62% { opacity: 0.95; }
    75% { opacity: 0.85; }
    87% { opacity: 0.97; }
}

.chapter-title,
.nav-numeral.active,
#title-cipher span,
.divider-glyph {
    animation: flicker 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== COLOPHON ===== */
#colophon {
    padding: 60px 24px 80px;
    padding-left: 72px;
}

.colophon-content {
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.colophon-line {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #a89074;
    display: block;
    line-height: 1.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #nav-rail {
        display: none;
    }

    #main-content {
        padding-left: 16px;
    }

    .chapter-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .gutter-margin {
        flex-direction: row;
        align-items: baseline;
        gap: 12px;
        padding-top: 0;
    }

    .chapter-numeral {
        font-size: 3rem;
    }

    .side-column {
        display: none;
    }

    .chapter {
        padding: 40px 16px;
    }

    #title-cipher {
        font-size: 12vw;
    }

    .pull-quote-rotated {
        writing-mode: horizontal-tb;
    }

    #colophon {
        padding-left: 16px;
    }

    .image-frame {
        transform: none !important;
    }

    .displaced-text-block {
        transform: none !important;
    }
}

@media (max-width: 480px) {
    .chapter-title {
        font-size: 1.4rem;
    }

    .body-text {
        font-size: 0.95rem;
    }

    #title-cipher {
        font-size: 14vw;
    }
}

/* ===== DEEP UMBER SHADOW ===== */
.dark-section {
    box-shadow: inset 0 0 120px rgba(26, 21, 14, 0.5);
}

.chapter-numeral {
    text-shadow: 2px 4px 8px #1a150e;
}

/* ===== AMBER GLOW HOVER ===== */
.nav-numeral:hover {
    color: #e8c078;
    opacity: 1;
}

.chapter-title:hover {
    color: #e8c078;
    transition: color 0.3s ease;
}

.dark-section .chapter-title:hover {
    color: #e8c078;
}

.colophon-line a,
.pull-quote-rotated:hover {
    color: #e8c078;
}

.redacted:hover {
    cursor: help;
}

/* Additional shadow depth */
#opening-overlay {
    box-shadow: inset 0 0 200px #1a150e;
}
