/* ============================================
   alth.ing - The Assembly of Deep Time
   Archival-Geological / Codex-Inspired
   ============================================ */

:root {
    --basalt-black: #1C1917;
    --deep-umber: #2C2418;
    --vellum-cream: #F5F0E8;
    --faded-ink: #8B7355;
    --oxidized-copper: #8B6F47;
    --moss-green: #4A5D3A;
    --warm-copper-glow: #D4A574;
    --geothermal-blue: #4A6B7A;
    --sulfur-gold: #C9A84C;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--basalt-black);
    color: var(--vellum-cream);
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.85;
    overflow-x: hidden;
}

/* Vellum Noise Texture Overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Section 1: The Rift Opening --- */
.rift-opening {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--basalt-black);
}

.fissure-svg {
    position: absolute;
    width: 60px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.fissure-left,
.fissure-right {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawFissure 3s ease-in-out forwards;
}

.fissure-left {
    transform: translateX(-8px);
    animation-delay: 0s;
}

.fissure-right {
    transform: translateX(8px);
    animation-delay: 0.2s;
}

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

.rift-title {
    position: relative;
    z-index: 10;
    text-align: center;
    opacity: 0;
    animation: riftTitleIn 0.8s ease-out 3s forwards;
}

.rift-title h1 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: -0.02em;
    color: var(--vellum-cream);
    line-height: 1;
}

.rift-subtitle {
    font-family: 'IM Fell English', serif;
    font-weight: 400;
    font-size: 16px;
    color: var(--faded-ink);
    margin-top: 1rem;
    letter-spacing: 0.1em;
}

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

/* --- Codex Grid Layout --- */
.codex-grid {
    display: grid;
    grid-template-columns: 1fr minmax(auto, 680px) 1fr;
    gap: 0 40px;
    padding: 0 40px;
}

.codex-section {
    padding: 80px 0;
}

/* --- Margin Left: Timeline --- */
.margin-left {
    display: flex;
    justify-content: flex-end;
    padding-right: 20px;
}

.timeline-axis {
    list-style: none;
    position: sticky;
    top: 50vh;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.timeline-year {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 12px;
    border-right: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.timeline-year.active {
    border-right-color: var(--sulfur-gold);
}

.year-num {
    font-family: 'Libre Bodoni', serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--warm-copper-glow);
    line-height: 1.2;
}

.year-label {
    font-family: 'IM Fell English', serif;
    font-size: 12px;
    color: var(--faded-ink);
}

/* --- Main Column --- */
.main-column {
    max-width: 680px;
}

.codex-text {
    margin-bottom: 1.5rem;
    color: var(--vellum-cream);
}

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

/* --- Margin Right: Annotations --- */
.margin-right {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding-top: 20px;
}

.rune-annotation {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.annotation-fade {
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.annotation-fade.visible {
    opacity: 1;
}

.rune-text {
    font-size: 16px;
    color: var(--faded-ink);
    opacity: 0.6;
    letter-spacing: 0.2em;
}

.annotation-text {
    font-family: 'IM Fell English', serif;
    font-size: 13px;
    color: var(--faded-ink);
}

/* --- Section Headings --- */
.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--vellum-cream);
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

/* --- Knotwork Bands --- */
.knotwork-band {
    width: 100%;
    height: 8px;
    overflow: hidden;
}

.knotwork-svg {
    width: 100%;
    height: 100%;
}

/* --- Assembly Blocks --- */
.assembly-block {
    padding: 60px 0;
}

.assembly-grid .main-column {
    max-width: 680px;
}

.assembly-split {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2rem;
    align-items: start;
}

.assembly-illustration {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 1rem;
}

.geo-cross-section {
    width: 100%;
    max-width: 200px;
    height: auto;
}

/* --- Section 4: The Law Rock --- */
.law-rock {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--basalt-black);
    transition: background-color 2s ease;
    padding: 80px 40px;
}

.law-rock.warm {
    background-color: var(--deep-umber);
}

.law-rock-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(212, 165, 116, 0.08) 0%, transparent 70%);
    pointer-events: none;
    animation: glowPulse 6s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.03); opacity: 0.8; }
}

.lawspeaker-shadow {
    position: absolute;
    width: 120px;
    height: 280px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    background: radial-gradient(ellipse at center bottom, rgba(212, 165, 116, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.law-rock-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 680px;
}

.law-rock-text p {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.6;
    color: var(--vellum-cream);
    letter-spacing: -0.02em;
}

.law-rock-citation {
    display: block;
    margin-top: 2rem;
    font-family: 'IM Fell English', serif;
    font-size: 14px;
    color: var(--faded-ink);
    font-style: normal;
}

/* --- Section 5: Colophon --- */
.colophon {
    padding: 80px 0;
    background: var(--basalt-black);
}

.colophon-border {
    width: 100%;
    height: 8px;
    overflow: hidden;
    margin-bottom: 60px;
}

.colophon-content {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 40px;
    text-align: center;
}

.colophon-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 1.6rem;
    color: var(--vellum-cream);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.colophon-sources {
    list-style: none;
    text-align: left;
    margin-bottom: 3rem;
}

.colophon-sources li {
    font-family: 'IM Fell English', serif;
    font-size: 14px;
    color: var(--faded-ink);
    line-height: 1.8;
    padding: 0.3rem 0;
    border-bottom: 1px dashed rgba(232, 226, 208, 0.15);
}

.colophon-domain {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--vellum-cream);
    letter-spacing: -0.02em;
    margin-top: 2rem;
}

/* --- Mobile Responsive --- */
@media (max-width: 1200px) {
    .codex-grid {
        grid-template-columns: 1fr;
        padding: 0 30px;
    }

    .margin-left,
    .margin-right {
        display: none;
    }

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

    .assembly-split {
        grid-template-columns: 1fr;
    }

    .assembly-illustration {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .rift-title h1 {
        font-size: clamp(2rem, 12vw, 4rem);
    }

    .law-rock-text p {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }

    .codex-grid {
        padding: 0 20px;
    }
}
