/* ============================================================
   gabs.wiki - Art Deco Literary Salon
   Color Palette: Deep Burgundy
   Typography: Slab-Serif System
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #2E0A1A;
    --bg-secondary: #4A0E2E;
    --bg-accent: #5C2434;
    --accent-gold: #C9A84C;
    --accent-brass: #8B6914;
    --text-cream: #F5ECD7;
    --text-ivory: #EDE3CE;
    --surface-vellum: #F8F2E4;
    --emphasis-claret: #6B1D3B;
    --ink-deep: #3A0A1F;

    --muted-gold: #A8924A;
    --bg-deepest: #1A0610;
    --gold-warm: #D4A843;

    --bg-current: #2E0A1A;
    --gold-current: #C9A84C;

    --font-display: 'Zilla Slab', 'Roboto Slab', Georgia, serif;
    --font-secondary: 'Roboto Slab', Georgia, serif;
    --font-body: 'Lora', Georgia, 'Times New Roman', serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-current);
    color: var(--text-cream);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    position: relative;
    font-display: swap;
}

/* Leather texture via CSS gradients */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-radial-gradient(
            ellipse at 20% 50%,
            transparent 0,
            transparent 1px,
            rgba(201, 168, 76, 0.015) 1px,
            transparent 2px
        ),
        repeating-radial-gradient(
            ellipse at 80% 30%,
            transparent 0,
            transparent 1.5px,
            rgba(0, 0, 0, 0.02) 1.5px,
            transparent 3px
        ),
        repeating-radial-gradient(
            ellipse at 50% 80%,
            transparent 0,
            transparent 0.8px,
            rgba(139, 105, 20, 0.012) 0.8px,
            transparent 1.6px
        );
    background-size: 4px 4px, 6px 6px, 3px 3px;
}

/* --- Header Band --- */
#header-band {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    z-index: 100;
    background-color: #2E0A1A;
    background-image:
        repeating-radial-gradient(
            ellipse at 30% 50%,
            transparent 0,
            transparent 1px,
            rgba(201, 168, 76, 0.02) 1px,
            transparent 2px
        ),
        repeating-radial-gradient(
            ellipse at 70% 40%,
            transparent 0,
            transparent 1.5px,
            rgba(0, 0, 0, 0.03) 1.5px,
            transparent 3px
        );
    background-size: 4px 4px, 5px 5px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.2);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-gold);
    text-shadow:
        0 -1px 0 rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(201, 168, 76, 0.15);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-ornament {
    display: block;
    width: 6px;
    height: 6px;
    background: var(--accent-gold);
    opacity: 0.4;
    transform: rotate(45deg);
}

.nav-link {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-brass);
    opacity: 0.7;
    text-decoration: none;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.nav-link:hover {
    color: var(--accent-gold);
    opacity: 1;
}

/* --- Mobile Drawer --- */
#drawer-toggle {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 110;
    width: 40px;
    height: 40px;
    background: var(--bg-accent);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 4px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3), inset -1px -1px 2px rgba(201, 168, 76, 0.1);
}

.drawer-tab-line {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--accent-gold);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#drawer-toggle.active .drawer-tab-line:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}
#drawer-toggle.active .drawer-tab-line:nth-child(2) {
    opacity: 0;
}
#drawer-toggle.active .drawer-tab-line:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

#mobile-drawer {
    display: none;
    position: fixed;
    top: 0;
    right: -260px;
    width: 260px;
    height: 100vh;
    z-index: 105;
    background: var(--bg-secondary);
    border-left: 1px solid rgba(201, 168, 76, 0.2);
    padding: 80px 30px 40px;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

#mobile-drawer.open {
    right: 0;
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drawer-link {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 16px;
    color: var(--text-ivory);
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 1px solid rgba(201, 168, 76, 0.15);
    transition: color 0.3s ease;
}

.drawer-link:hover {
    color: var(--accent-gold);
}

/* --- Book Spine --- */
#book-spine {
    position: fixed;
    top: 64px;
    left: 38%;
    width: 1px;
    height: calc(100vh - 64px);
    z-index: 10;
    pointer-events: none;
}

.spine-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background: var(--accent-brass);
    opacity: 0.4;
}

.spine-ornament {
    position: absolute;
    left: -12px;
    width: 24px;
    height: 24px;
    transition: filter 0.3s ease;
}

.spine-ornament[data-spine="1"] { top: 15%; }
.spine-ornament[data-spine="2"] { top: 30%; }
.spine-ornament[data-spine="3"] { top: 50%; }
.spine-ornament[data-spine="4"] { top: 70%; }
.spine-ornament[data-spine="5"] { top: 85%; }

.spine-ornament.glowing svg path {
    filter: drop-shadow(0 0 4px rgba(201, 168, 76, 0.3));
}

/* --- Main Content --- */
#book-content {
    position: relative;
    z-index: 1;
    padding-top: 64px;
}

/* --- Book Section --- */
.book-section {
    min-height: 80vh;
    padding: 60px 40px;
    position: relative;
}

.section-frame {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 60px 50px;
    /* Triple-line Art Deco border */
    border: 2px solid var(--accent-gold);
    box-shadow:
        inset 0 0 0 6px transparent,
        inset 0 0 0 7px rgba(201, 168, 76, 0.35),
        inset 0 0 0 12px transparent,
        inset 0 0 0 13px var(--accent-brass);
    /* Paper texture background */
    background:
        repeating-radial-gradient(
            circle at 50% 50%,
            transparent 0,
            transparent 0.5px,
            rgba(201, 168, 76, 0.008) 0.5px,
            transparent 1px
        ),
        linear-gradient(135deg, rgba(0, 0, 0, 0.02), transparent 50%);
    background-size: 3px 3px, 100% 100%;
    background-color: rgba(46, 10, 26, 0.4);
}

/* Frame Corners */
.frame-corner {
    position: absolute;
    width: 24px;
    height: 24px;
}

.frame-corner::before,
.frame-corner::after {
    content: '';
    position: absolute;
    background: var(--accent-gold);
}

.frame-corner-tl {
    top: -1px;
    left: -1px;
}
.frame-corner-tl::before {
    top: 0;
    left: 0;
    width: 24px;
    height: 3px;
}
.frame-corner-tl::after {
    top: 0;
    left: 0;
    width: 3px;
    height: 24px;
}

.frame-corner-tr {
    top: -1px;
    right: -1px;
}
.frame-corner-tr::before {
    top: 0;
    right: 0;
    width: 24px;
    height: 3px;
}
.frame-corner-tr::after {
    top: 0;
    right: 0;
    width: 3px;
    height: 24px;
}

.frame-corner-bl {
    bottom: -1px;
    left: -1px;
}
.frame-corner-bl::before {
    bottom: 0;
    left: 0;
    width: 24px;
    height: 3px;
}
.frame-corner-bl::after {
    bottom: 0;
    left: 0;
    width: 3px;
    height: 24px;
}

.frame-corner-br {
    bottom: -1px;
    right: -1px;
}
.frame-corner-br::before {
    bottom: 0;
    right: 0;
    width: 24px;
    height: 3px;
}
.frame-corner-br::after {
    bottom: 0;
    right: 0;
    width: 3px;
    height: 24px;
}

/* --- Two-Column Layout (Verso / Recto) --- */
.section-inner {
    display: grid;
    grid-template-columns: 38% 58%;
    gap: 4%;
}

.verso-column {
    padding-top: 40px; /* Deliberate stagger offset */
}

.verso-content {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.verso-content.revealed {
    opacity: 1;
    transform: translateX(0);
}

.recto-content {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.recto-content.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* --- Marginal Notes (Verso) --- */
.marginal-note {
    display: block;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #A8924A;
    opacity: 0.7;
    margin-bottom: 12px;
}

.marginal-date,
.marginal-ref {
    display: block;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 13px;
    color: #A8924A;
    opacity: 0.5;
    margin-bottom: 20px;
}

.verso-annotation {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-style: italic;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-ivory);
    opacity: 0.65;
    padding-left: 12px;
    border-left: 1px solid rgba(201, 168, 76, 0.25);
}

/* --- Botanical Marginalia --- */
.botanical-marginalia {
    margin-top: 40px;
    opacity: 0.9;
}

/* --- Typography --- */
.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 52px;
    letter-spacing: 0.04em;
    line-height: 1.1;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-bottom: 8px;
}

.title-underscore {
    display: block;
    margin-bottom: 36px;
    overflow: visible;
}

.title-underscore path {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    transition: stroke-dashoffset 1.2s ease;
}

.revealed .title-underscore path {
    stroke-dashoffset: 0;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    letter-spacing: 0.005em;
    color: var(--text-cream);
    margin-bottom: 24px;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* --- Pull Quotes --- */
.pull-quote {
    margin: 36px 0;
    padding: 28px 32px;
    position: relative;
}

.pull-quote p {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-style: italic;
    font-size: 22px;
    line-height: 1.4;
    letter-spacing: 0.02em;
    color: var(--text-ivory);
}

/* --- Ziggurat (Stepped) Frame --- */
.ziggurat-frame {
    position: relative;
    background: rgba(74, 14, 46, 0.35);
    border: 1px solid rgba(201, 168, 76, 0.25);
    box-shadow:
        4px 4px 0 0 rgba(74, 14, 46, 0.3),
        8px 8px 0 0 rgba(74, 14, 46, 0.2),
        12px 12px 0 0 rgba(74, 14, 46, 0.1);
    padding: 24px 28px;
    margin-bottom: 28px;
}

.ziggurat-frame:last-child {
    margin-bottom: 0;
}

/* --- Content Cards --- */
.content-card {
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

.content-card:hover {
    background: rgba(92, 36, 52, 0.4);
    box-shadow:
        4px 4px 0 0 rgba(74, 14, 46, 0.35),
        8px 8px 0 0 rgba(74, 14, 46, 0.25),
        12px 12px 0 0 rgba(74, 14, 46, 0.15),
        inset 1px 1px 2px rgba(0, 0, 0, 0.3),
        inset -1px -1px 2px rgba(201, 168, 76, 0.2);
}

.card-heading {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 20px;
    letter-spacing: 0.02em;
    color: var(--text-ivory);
    margin-bottom: 12px;
}

/* --- Light Surface Section --- */
.section-light .section-frame {
    background-color: var(--surface-vellum);
    background-image:
        repeating-radial-gradient(
            circle at 50% 50%,
            transparent 0,
            transparent 0.5px,
            rgba(139, 105, 20, 0.015) 0.5px,
            transparent 1px
        );
    background-size: 3px 3px;
}

.light-heading {
    color: var(--ink-deep);
}

.light-body {
    color: var(--ink-deep);
}

.light-text {
    color: var(--ink-deep);
    opacity: 0.6;
}

.section-light .verso-annotation {
    color: var(--emphasis-claret);
    border-left-color: rgba(74, 14, 46, 0.3);
}

.section-light .marginal-note {
    color: var(--ink-deep);
}

.section-light .marginal-ref {
    color: var(--emphasis-claret);
}

/* --- Reading Room Grid --- */
.reading-room-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-top: 36px;
}

.room-feature {
    text-align: center;
    padding: 24px 16px;
    border: 1px solid rgba(74, 14, 46, 0.2);
    background: rgba(248, 242, 228, 0.5);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(30px);
}

.room-feature.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

.room-feature:hover {
    border-color: rgba(74, 14, 46, 0.4);
    box-shadow: 0 4px 16px rgba(58, 10, 31, 0.1);
}

.feature-icon {
    margin-bottom: 16px;
}

.feature-title {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 17px;
    color: var(--ink-deep);
    margin-bottom: 10px;
}

.feature-text {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--emphasis-claret);
}

/* --- Sunburst Divider --- */
.sunburst-divider {
    text-align: center;
    padding: 60px 0;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.sunburst-divider.revealed {
    opacity: 1;
    transform: scale(1);
}

/* --- Colophon Mark --- */
.colophon-mark {
    text-align: center;
    margin-top: 48px;
    padding-top: 36px;
    border-top: 1px solid rgba(201, 168, 76, 0.2);
}

.colophon-text {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-gold);
    opacity: 0.6;
    margin-top: 12px;
}

/* --- Footer --- */
#book-footer {
    padding: 60px 40px 40px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer-ornament {
    margin-bottom: 20px;
}

.footer-text {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--accent-brass);
    opacity: 0.5;
}

/* --- Reveal Animation Classes --- */
[data-reveal] {
    opacity: 0;
}

[data-reveal="left"] {
    transform: translateX(-40px);
}

[data-reveal="right"] {
    transform: translateX(60px);
}

[data-reveal="up"] {
    transform: translateY(30px);
}

[data-reveal="fade"] {
    transform: scale(0.85);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
}

/* Transition for all reveal elements */
[data-reveal] {
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Scroll-Linked Ambient Endpoints --- */
.book-section:last-child .section-frame {
    border-color: #D4A843;
}

.book-section:last-child {
    background-color: #1A0610;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .section-title {
        font-size: 40px;
    }

    .section-frame {
        padding: 40px 36px;
    }

    .reading-room-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .header-nav {
        display: none;
    }

    #drawer-toggle {
        display: flex;
    }

    #mobile-drawer {
        display: block;
    }

    #book-spine {
        display: none;
    }

    .section-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .verso-column {
        padding-top: 0;
        padding-bottom: 0;
        border-bottom: 1px solid rgba(201, 168, 76, 0.2);
        padding-bottom: 24px;
        margin-bottom: 8px;
    }

    .book-section {
        padding: 40px 20px;
    }

    .section-frame {
        padding: 32px 24px;
        box-shadow:
            inset 0 0 0 4px transparent,
            inset 0 0 0 5px rgba(201, 168, 76, 0.25);
        border-width: 1px;
    }

    .section-title {
        font-size: 32px;
    }

    .pull-quote p {
        font-size: 18px;
    }

    .reading-room-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        padding: 0 20px;
    }

    /* Mobile sunburst as horizontal rule */
    .sunburst-divider {
        padding: 40px 0;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 26px;
    }

    body {
        font-size: 16px;
    }

    .body-text {
        font-size: 16px;
    }

    .section-frame {
        padding: 24px 18px;
    }

    .ziggurat-frame {
        box-shadow:
            3px 3px 0 0 rgba(74, 14, 46, 0.3),
            6px 6px 0 0 rgba(74, 14, 46, 0.15);
    }
}
