/* ===================================
   alth.ing - Tectonic Parliament
   Design System: Dark-Academia / Grainy-Textured
   =================================== */

/* --- CSS Custom Properties --- */
:root {
    --basalt-black: #0f0e0d;
    --obsidian-grey: #1c1a18;
    --vellum-cream: #e8dcc8;
    --lichen-grey: #8a8578;
    --tallow-amber: #c4903a;
    --glacial-blue: #4a7a8c;
    --iron-oxide: #8b3a2a;
    --aurora-green: #5a9e6f;

    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Alegreya', serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background: var(--basalt-black);
}

body {
    font-family: var(--font-body);
    color: var(--vellum-cream);
    background: var(--basalt-black);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Volcanic Noise Canvas --- */
#noise-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.06;
    mix-blend-mode: overlay;
}

/* --- Depth Gauge --- */
#depth-gauge {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    height: 60vh;
}

.gauge-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100%;
    background: var(--lichen-grey);
    opacity: 0.3;
}

.gauge-tick {
    position: relative;
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.gauge-tick::before {
    content: '';
    display: block;
    width: 8px;
    height: 1px;
    background: var(--lichen-grey);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.gauge-tick:hover::before {
    width: 16px;
    background: var(--tallow-amber);
    opacity: 1;
}

.tick-label {
    position: absolute;
    right: 16px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--lichen-grey);
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    font-feature-settings: "tnum";
}

.gauge-tick:hover .tick-label {
    opacity: 1;
}

.gauge-marker {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tallow-amber);
    transition: top 0.3s ease;
    top: 0;
    z-index: 2;
}

/* --- Sections Base --- */
.section {
    position: relative;
    overflow: hidden;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 6rem);
    letter-spacing: 0.08em;
    color: var(--vellum-cream);
    text-align: center;
    margin-bottom: 0.25em;
}

.section-heading-sub {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    color: var(--lichen-grey);
    text-align: center;
    margin-bottom: 2em;
    line-height: 1.75;
}

/* =============================== */
/* SECTION 1: The Sky Layer        */
/* =============================== */
.section-sky {
    height: 100vh;
    background: linear-gradient(
        180deg,
        #0a0908 0%,
        #0f0e0d 30%,
        #1c1a18 60%,
        #0f0e0d 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sky-atmosphere {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse 80% 50% at 50% 20%,
        rgba(74, 122, 140, 0.06) 0%,
        transparent 70%
    );
    pointer-events: none;
}

.sky-content {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-top: 10vh;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 8vw, 10rem);
    letter-spacing: 0.08em;
    color: var(--vellum-cream);
    line-height: 1;
    margin-bottom: 0.5em;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    animation: chisel-in 0.6s ease forwards;
}

.hero-title .letter.dot {
    color: var(--tallow-amber);
}

@keyframes chisel-in {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(1.1);
        text-shadow: 0 0 20px rgba(196, 144, 58, 0.5);
    }
    60% {
        text-shadow: 0 0 10px rgba(196, 144, 58, 0.3);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        text-shadow: none;
    }
}

.hero-title .letter[data-delay="0"] { animation-delay: 0.3s; }
.hero-title .letter[data-delay="1"] { animation-delay: 0.5s; }
.hero-title .letter[data-delay="2"] { animation-delay: 0.7s; }
.hero-title .letter[data-delay="3"] { animation-delay: 0.9s; }
.hero-title .letter[data-delay="4"] { animation-delay: 1.1s; }
.hero-title .letter[data-delay="5"] { animation-delay: 1.3s; }
.hero-title .letter[data-delay="6"] { animation-delay: 1.5s; }
.hero-title .letter[data-delay="7"] { animation-delay: 1.7s; }

.sky-subtitle {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: var(--lichen-grey);
    letter-spacing: 0.15em;
    opacity: 0;
    animation: fade-in 1s ease 2.2s forwards;
    font-feature-settings: "tnum";
}

@keyframes fade-in {
    to { opacity: 1; }
}

.initial-crack {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 30vh;
    opacity: 0;
    animation: crack-appear 1.5s ease 2.5s forwards;
}

.initial-crack svg {
    width: 100%;
    height: 100%;
}

@keyframes crack-appear {
    0% {
        opacity: 0;
        clip-path: inset(0 0 100% 0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0 0 0% 0);
    }
}

/* =============================== */
/* SECTION 2: The Law Rock         */
/* =============================== */
.section-lawrock {
    min-height: 120vh;
    background: var(--obsidian-grey);
    padding: 8vh 0;
    position: relative;
}

.plate-container {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 80vh;
    overflow: hidden;
}

.plate-left,
.plate-right {
    flex: 1;
    padding: 4vh 5vw;
    will-change: transform;
    transition: transform 0.05s linear;
    position: relative;
    z-index: 2;
}

.plate-left {
    background: var(--obsidian-grey);
    border-right: 1px solid rgba(196, 144, 58, 0.1);
}

.plate-right {
    background: var(--obsidian-grey);
    border-left: 1px solid rgba(196, 144, 58, 0.1);
}

.plate-content {
    max-width: 480px;
    margin: 0 auto;
}

.plate-left .plate-content {
    margin-left: auto;
    margin-right: 2vw;
    text-align: right;
}

.plate-right .plate-content {
    margin-right: auto;
    margin-left: 2vw;
    text-align: left;
}

.old-norse {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
    color: var(--lichen-grey);
    font-style: italic;
    line-height: 1.8;
    margin-bottom: 3em;
    letter-spacing: 0.04em;
    border: none;
    padding: 0;
}

.english-meaning {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    color: var(--vellum-cream);
    line-height: 1.75;
    margin-bottom: 3em;
    border: none;
    padding: 0;
}

.rift-gap {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 0;
    height: 100%;
    background: var(--basalt-black);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: width 0.05s linear;
}

.rift-deep-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
    white-space: nowrap;
    opacity: 0.15;
}

.deep-text-line {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(0.7rem, 0.9vw, 0.9rem);
    color: var(--vellum-cream);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-feature-settings: "tnum";
}

/* =============================== */
/* SECTION 3: The Assembly         */
/* =============================== */
.section-assembly {
    min-height: 150vh;
    background: var(--basalt-black);
    padding: 8vh 0;
    position: relative;
}

.assembly-panorama {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--lichen-grey) var(--basalt-black);
}

.assembly-panorama::-webkit-scrollbar {
    height: 4px;
}
.assembly-panorama::-webkit-scrollbar-track {
    background: var(--basalt-black);
}
.assembly-panorama::-webkit-scrollbar-thumb {
    background: var(--lichen-grey);
    border-radius: 2px;
}

.assembly-scroll-container {
    position: relative;
    width: 200vw;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.assembly-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(
        0deg,
        var(--obsidian-grey) 0%,
        var(--basalt-black) 100%
    );
    opacity: 0.6;
}

.chieftains-arc {
    position: relative;
    width: 160vw;
    height: 50vh;
    margin: 0 auto;
}

.chieftain-figure {
    position: absolute;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.5;
}

.chieftain-figure:hover {
    transform: scale(1.1) !important;
    opacity: 0.9;
}

.chieftain-figure svg {
    width: 100%;
    height: 100%;
}

.chieftain-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--obsidian-grey);
    color: var(--tallow-amber);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 2px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border: 1px solid rgba(196, 144, 58, 0.3);
    font-feature-settings: "tnum";
}

.chieftain-figure:hover .chieftain-tooltip {
    opacity: 1;
}

.assembly-caption {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin: 4vh auto 0;
    text-align: center;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    color: var(--lichen-grey);
    line-height: 1.75;
    padding: 0 2rem;
}

/* =============================== */
/* SECTION 4: The Rift             */
/* =============================== */
.section-rift {
    min-height: 100vh;
    background: var(--basalt-black);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rift-walls {
    position: absolute;
    top: 0;
    height: 100%;
    width: 30%;
    z-index: 1;
}

.rift-wall-left {
    left: 0;
    background: linear-gradient(
        90deg,
        var(--obsidian-grey) 0%,
        var(--basalt-black) 100%
    );
}

.rift-wall-right {
    right: 0;
    background: linear-gradient(
        -90deg,
        var(--obsidian-grey) 0%,
        var(--basalt-black) 100%
    );
}

.rift-content {
    position: relative;
    z-index: 2;
    width: 40%;
    max-width: 500px;
    text-align: center;
    padding: 8vh 0;
}

.rift-heading {
    font-size: clamp(2rem, 4vw, 4rem);
}

.century-stones {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5vh;
    margin-top: 4vh;
}

.century-stone {
    padding: 0.6em 1.5em;
    background: rgba(28, 26, 24, 0.8);
    border: 1px solid rgba(196, 144, 58, 0.15);
    border-radius: 3px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.century-stone.visible {
    opacity: 1;
    transform: translateY(0);
}

.century-year {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: var(--tallow-amber);
    letter-spacing: 0.15em;
    font-feature-settings: "tnum";
}

/* =============================== */
/* SECTION 5: The Living Parliament */
/* =============================== */
.section-parliament {
    min-height: 80vh;
    background: linear-gradient(
        180deg,
        var(--basalt-black) 0%,
        #111519 30%,
        #0f1316 70%,
        var(--basalt-black) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.parliament-content {
    text-align: center;
    z-index: 2;
    position: relative;
    padding: 4vh 2rem;
}

.year-counter-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2em;
}

.year-counter {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(6rem, 12vw, 14rem);
    color: var(--tallow-amber);
    line-height: 1;
    font-feature-settings: "tnum";
    letter-spacing: 0.02em;
}

.year-counter-label {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: var(--lichen-grey);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-top: 0.5em;
    font-feature-settings: "tnum";
}

.parliament-caption {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 2.5vw, 2.5rem);
    color: var(--vellum-cream);
    letter-spacing: 0.04em;
    margin-bottom: 0.75em;
    line-height: 1.4;
}

.parliament-subcaption {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    color: var(--lichen-grey);
    line-height: 1.75;
    max-width: 500px;
    margin: 0 auto;
}

/* =============================== */
/* Fracture Dividers               */
/* =============================== */
.fracture-divider {
    position: relative;
    height: 100px;
    z-index: 10;
    margin: -50px 0;
    pointer-events: none;
}

.fracture-divider svg {
    width: 100%;
    height: 100%;
    display: block;
}

.fracture-path {
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* =============================== */
/* Runic Watermarks                */
/* =============================== */
.rune-watermark {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0.07;
}

.rune-svg {
    width: 60px;
    height: 90px;
}

.rune-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease-out;
}

.rune-watermark.drawn .rune-path {
    stroke-dashoffset: 0;
}

.rune-1 { top: 20%; left: 8%; }
.rune-2 { top: 15%; right: 10%; }
.rune-3 { bottom: 20%; left: 6%; }
.rune-4 { top: 30%; right: 12%; }
.rune-5 { bottom: 25%; left: 8%; }
.rune-6 { top: 20%; right: 8%; }

/* =============================== */
/* Responsive                      */
/* =============================== */
@media (max-width: 768px) {
    #depth-gauge {
        right: 8px;
    }

    .tick-label {
        font-size: 0.5rem;
        right: 12px;
    }

    .rift-content {
        width: 70%;
    }

    .rift-walls {
        width: 15%;
    }

    .plate-left .plate-content,
    .plate-right .plate-content {
        margin: 0 auto;
        text-align: center;
        padding: 0 1rem;
    }

    .assembly-scroll-container {
        width: 300vw;
    }

    .chieftains-arc {
        width: 260vw;
    }

    .rune-watermark {
        opacity: 0.04;
    }

    .rune-svg {
        width: 40px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .section-heading {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .year-counter {
        font-size: clamp(4rem, 16vw, 8rem);
    }

    .rift-content {
        width: 85%;
    }

    .rift-walls {
        width: 7.5%;
    }
}
