/* layer-2.id - Generative Neoclassicism */
/* Colors: #0d0b08 #1a1610 #c9a84c #a08930 #e8d5a3 #e2d8c8 #8a8070 #6b2d3e */
/* Fonts: Libre Baskerville, DM Sans, Cormorant Garamond */

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

:root {
    --bg-obsidian: #0d0b08;
    --bg-umber: #1a1610;
    --gold-primary: #c9a84c;
    --gold-secondary: #a08930;
    --gold-pale: #e8d5a3;
    --text-parchment: #e2d8c8;
    --text-stone: #8a8070;
    --accent-carmine: #6b2d3e;
    --phi: 1.618rem;
    --phi-2: 3.236rem;
    --phi-4: 6.472rem;
    --marble-opacity: 0.08;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-obsidian);
    color: var(--text-parchment);
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-size: clamp(1.05rem, 1.2vw, 1.2rem);
    font-weight: 400;
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Generative Marble Background */
#marble-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: var(--marble-opacity);
}

/* Hash Scroll Band */
.hash-band {
    position: fixed;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(100px, 15vw, 200px);
    font-weight: 400;
    color: var(--gold-primary);
    opacity: 0.03;
    white-space: nowrap;
    z-index: 1;
    pointer-events: none;
    line-height: 1;
    overflow: hidden;
}

/* Domain Mark */
.domain-mark {
    position: fixed;
    top: 2rem;
    left: clamp(2rem, 8vw, 10rem);
    font-family: 'Libre Baskerville', serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-parchment);
    z-index: 100;
    opacity: 0;
    transition: color 0.4s ease;
}

.domain-mark:hover {
    color: var(--gold-primary);
}

/* Folio Base */
.folio {
    position: relative;
    z-index: 10;
    padding: 0 clamp(2rem, 8vw, 10rem);
}

.folio-inner {
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
}

/* Layout Modes */
.verso {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 1.5rem;
}

.verso > .text-block {
    grid-column: 1 / 8;
}

.verso > .chapter-label {
    grid-column: 9 / 13;
    grid-row: 1;
}

.verso > .lissajous-ornament {
    grid-column: 9 / 13;
    grid-row: 1;
    justify-self: center;
    align-self: center;
}

.recto {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 1.5rem;
}

.recto > .chapter-label {
    grid-column: 1 / 4;
    grid-row: 1;
}

.recto > .text-block {
    grid-column: 4 / 13;
}

.full-spread {
    max-width: 1100px;
    margin: 0 auto;
}

.centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Folio I - The Threshold */
.folio-threshold {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.folio-threshold .folio-inner {
    text-align: center;
}

.hero-phrase {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(2.2rem, 5vw, 4rem);
    color: var(--gold-primary);
    letter-spacing: 0.01em;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 1.5s forwards;
}

.hero-phrase em {
    font-style: italic;
}

/* Gold Rules */
.gold-rule {
    width: 40vw;
    max-width: 500px;
    height: 1px;
    background: var(--gold-primary);
    margin: var(--phi-4) auto;
    animation: pulse 4s ease-in-out infinite;
}

.gold-rule-draw {
    width: 0;
    animation: drawRule 2s cubic-bezier(0.16, 1, 0.3, 1) 2.3s forwards, pulse 4s ease-in-out 4.3s infinite;
    margin-top: var(--phi-2);
}

/* Chapter Labels */
.chapter-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-primary);
    padding-top: 0.5rem;
}

.verso-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    justify-self: center;
    padding-top: 2rem;
}

.recto-label {
    text-align: right;
    padding-right: 2rem;
}

/* Text Blocks */
.text-block {
    padding: var(--phi-2) 0;
}

.text-block p {
    max-width: 38em;
    margin-bottom: var(--phi);
    color: var(--gold-pale);
}

.gold-term {
    color: var(--gold-primary);
}

/* Definition List */
.definition-list {
    margin-top: var(--phi);
}

.definition-list dt {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-primary);
    margin-top: var(--phi);
    margin-bottom: 0.5rem;
}

.definition-list dd {
    border-left: 2px solid var(--gold-primary);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: var(--phi);
    max-width: 38em;
    color: var(--gold-pale);
}

/* Folio II - The Foundation */
.folio-foundation {
    padding-top: var(--phi-4);
    padding-bottom: var(--phi-4);
}

/* Folio III - The Mechanism */
.folio-mechanism {
    padding-top: var(--phi-4);
    padding-bottom: var(--phi-4);
}

/* Folio IV - The Artifact */
.folio-artifact {
    padding-top: clamp(4rem, 10vh, 8rem);
    padding-bottom: clamp(4rem, 10vh, 8rem);
}

.large-ornament {
    margin-bottom: var(--phi-2);
}

.artifact-quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    color: var(--gold-primary);
    letter-spacing: 0.01em;
    line-height: 1.35;
    max-width: 800px;
    margin-bottom: var(--phi-2);
}

.artifact-text {
    max-width: 38em;
    color: var(--gold-pale);
    text-align: left;
    margin-top: var(--phi-2);
}

/* Folio V - The Seal */
.folio-seal {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.seal-domain {
    font-family: 'Libre Baskerville', serif;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: var(--gold-primary);
    text-shadow: 0 0 30px rgba(201, 168, 76, 0.15);
    animation: pulseGlow 4s ease-in-out infinite;
    margin-bottom: var(--phi);
}

.seal-date {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.16em;
    color: var(--text-stone);
}

/* Lissajous Ornaments */
.lissajous-ornament {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lissajous-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.lissajous-draw.animate {
    animation: drawLissajous 4s ease-in-out forwards;
}

/* Animations */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

@keyframes pulseGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(201, 168, 76, 0.08); }
    50% { text-shadow: 0 0 30px rgba(201, 168, 76, 0.25); }
}

@keyframes drawRule {
    to {
        width: 40vw;
        max-width: 500px;
    }
}

@keyframes drawLissajous {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes domainFadeIn {
    to {
        opacity: 1;
    }
}

/* Scroll-linked section visibility */
.folio-foundation,
.folio-mechanism,
.folio-artifact {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.folio-foundation.visible,
.folio-mechanism.visible,
.folio-artifact.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Elevated elements - gold candlelight glow */
.definition-list dd {
    box-shadow: 0 2px 40px rgba(201, 168, 76, 0.04);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .verso,
    .recto {
        display: block;
    }

    .chapter-label {
        writing-mode: horizontal-tb;
        text-orientation: initial;
        margin-bottom: var(--phi);
    }

    .verso-label {
        writing-mode: horizontal-tb;
        padding-top: 0;
    }

    .recto-label {
        text-align: left;
        padding-right: 0;
    }

    .folio {
        padding: 0 clamp(1.5rem, 5vw, 3rem);
    }

    .domain-mark {
        left: 1.5rem;
    }

    .lissajous-ornament {
        margin-top: var(--phi-2);
    }
}
