/* archetype.boo — spectral library aesthetic */

:root {
    --binding-dark: #2a2118;
    --parchment: #e8dfd0;
    --leather: #3a2e28;
    --foxed-gold: #b5a08a;
    --gilt: #c4a265;
    --ghost-cyan: #7db8b4;
    --tobacco: #5c4033;
    --ivory: #f4ede1;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--binding-dark);
    color: var(--parchment);
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    filter: url(#noise-texture);
    pointer-events: none;
    z-index: 1000;
    opacity: 0.6;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Spine — vertical rule on right edge */
.spine {
    position: fixed;
    top: 0;
    right: 24px;
    width: 1px;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--foxed-gold) 20%,
        var(--gilt) 50%,
        var(--foxed-gold) 80%,
        transparent
    );
    opacity: 0.4;
    z-index: 100;
}

/* Book / Main container */
.book {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Chapters */
.chapter {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 6rem 0;
    position: relative;
}

.chapter-numeral {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 700;
    color: var(--gilt);
    opacity: 0;
    position: absolute;
    left: -4rem;
    top: 50%;
    transform: translateY(-50%) translateX(-20px);
    transition: opacity 1.2s ease, transform 1.2s ease;
    letter-spacing: 0.04em;
    line-height: 1;
    text-shadow: 0 0 40px rgba(196, 162, 101, 0.3);
}

.chapter.visible .chapter-numeral {
    opacity: 0.15;
    transform: translateY(-50%) translateX(0);
}

.chapter-content {
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
}

.chapter.visible .chapter-content {
    opacity: 1;
    transform: translateY(0);
}

/* Typography */
.display-title {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(3rem, 7vw, 6.5rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.1;
    color: var(--ivory);
    margin-bottom: 1rem;
}

.subtitle {
    font-family: 'IM Fell English', serif;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    font-style: italic;
    color: var(--foxed-gold);
    margin-bottom: 2rem;
    opacity: 0.8;
}

.section-title {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.1;
    color: var(--ivory);
    margin-bottom: 2rem;
}

.body-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    font-weight: 300;
    line-height: 1.8;
    color: var(--parchment);
    max-width: 60ch;
    margin-bottom: 1.5rem;
}

/* Folio line */
.folio-line {
    width: 80px;
    height: 1px;
    background: linear-gradient(to right, var(--gilt), transparent);
    margin: 2rem 0;
    opacity: 0.6;
}

/* Pull quote */
.pull-quote {
    font-family: 'IM Fell English', serif;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-style: italic;
    color: var(--ghost-cyan);
    padding: 2rem 0 2rem 2rem;
    border-left: 2px solid var(--ghost-cyan);
    opacity: 0.85;
    margin: 2rem 0;
    position: relative;
}

.quote-mark {
    font-size: 2em;
    line-height: 0;
    vertical-align: -0.3em;
    opacity: 0.5;
}

/* Spectral divider */
.spectral-divider {
    text-align: center;
    margin: 3rem 0;
    opacity: 0.5;
}

.divider-ornament {
    font-size: 1.5rem;
    color: var(--gilt);
}

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    width: 100%;
}

.archetype-card {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    min-height: 280px;
    cursor: pointer;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.archetype-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.card-marble {
    position: absolute;
    inset: 0;
    opacity: 0.7;
}

.card-warm .card-marble {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(196, 162, 101, 0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(181, 160, 138, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, var(--ivory) 0%, var(--parchment) 100%);
    filter: url(#marble-warm);
}

.card-cool .card-marble {
    background:
        radial-gradient(ellipse at 40% 30%, rgba(125, 184, 180, 0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 60% 70%, rgba(232, 223, 208, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, #d8e4e3 0%, #c5d4d3 100%);
    filter: url(#marble-cool);
}

.card-dark .card-marble {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(196, 162, 101, 0.2) 0%, transparent 60%),
        linear-gradient(135deg, var(--leather) 0%, var(--binding-dark) 100%);
    filter: url(#marble-dark);
}

.card-inner {
    position: relative;
    z-index: 2;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: flex-end;
    background: linear-gradient(to top, rgba(42, 33, 24, 0.8) 0%, transparent 100%);
}

.card-numeral {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    color: var(--gilt);
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ivory);
    margin-bottom: 0.5rem;
}

.card-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: var(--parchment);
    opacity: 0.8;
    line-height: 1.5;
}

/* Colophon */
.colophon-text {
    font-style: italic;
    opacity: 0.7;
}

.closing-mark {
    font-family: 'IM Fell English', serif;
    color: var(--gilt);
    text-align: center;
    margin-top: 3rem;
    font-size: 1.1rem;
    letter-spacing: 0.2em;
    opacity: 0.6;
}

/* Glitch animation — spectral, not cyberpunk */
@keyframes spectral-glitch {
    0%, 95%, 100% {
        transform: none;
        opacity: 1;
        text-shadow: none;
    }
    96% {
        transform: translateX(-2px) skewX(-0.5deg);
        opacity: 0.8;
        text-shadow:
            2px 0 var(--ghost-cyan),
            -2px 0 var(--gilt);
    }
    97% {
        transform: translateX(2px) skewX(0.3deg);
        opacity: 0.9;
        text-shadow:
            -1px 0 var(--ghost-cyan),
            1px 0 var(--gilt);
    }
    98% {
        transform: translateX(-1px);
        opacity: 0.85;
        text-shadow:
            1px 0 var(--ghost-cyan),
            -1px 0 rgba(196, 162, 101, 0.5);
    }
}

.glitch-target {
    animation: spectral-glitch 8s infinite;
}

.glitch-target:nth-of-type(2) { animation-delay: -3s; }
.glitch-target:nth-of-type(3) { animation-delay: -5s; }

/* Responsive */
@media (max-width: 768px) {
    .book {
        padding: 0 1.5rem;
    }

    .chapter-numeral {
        left: -1rem;
        font-size: clamp(3rem, 8vw, 5rem);
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .spine {
        right: 12px;
    }
}
