/* mores.quest — Cyberpunk Archaeology Stylesheet */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --charred-earth: #1a0f0a;
    --kiln-terracotta: #c4653a;
    --sunbaked-clay: #d4956a;
    --excavated-cream: #e8d5c4;
    --amber-haze: #e8a84c;
    --burnt-umber: #3d1f12;
    --oxidized-copper: #4a8c7a;
    --deep-brown: #5a2e18;
    --muted-clay: #8a6e5a;
    --ease-settle: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--charred-earth);
    color: var(--excavated-cream);
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== GRAIN OVERLAY ===== */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 60;
    pointer-events: none;
    opacity: 0.3;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ===== DEPTH INDICATOR ===== */
#depth-indicator {
    position: fixed;
    left: 10px;
    top: 10vh;
    height: 80vh;
    width: 2px;
    z-index: 55;
    pointer-events: none;
}

#depth-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: var(--muted-clay);
    opacity: 0.3;
}

#depth-dot {
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--kiln-terracotta);
    transition: top 0.3s var(--ease-settle);
}

/* ===== WIREFRAME OVERLAY (Layer 0, z:50) ===== */
#wireframe-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s var(--ease-settle);
}

#wireframe-overlay.visible {
    opacity: 1;
}

/* ===== PARTICLE CANVAS (Layer 3, z:0) ===== */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

/* ===== CIRCUIT TRACES ===== */
#circuit-traces {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
    opacity: 0.2;
}

.circuit-path {
    fill: none;
    stroke: var(--oxidized-copper);
    stroke-width: 1.2;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 3s var(--ease-settle);
}

.circuit-path.drawn {
    stroke-dashoffset: 0;
}

/* ===== TYPOGRAPHY ===== */
.display-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(3rem, 9vw, 7.5rem);
    letter-spacing: 0.08em;
    line-height: 0.92;
    color: var(--kiln-terracotta);
    opacity: 0;
}

.display-title.visible {
    opacity: 1;
}

.display-heading {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(2rem, 6vw, 5rem);
    letter-spacing: 0.08em;
    line-height: 0.92;
    color: var(--kiln-terracotta);
    margin-bottom: 1rem;
}

.display-heading.secondary {
    color: var(--sunbaked-clay);
    font-size: clamp(1.8rem, 4.5vw, 3.5rem);
}

.display-heading.core-text {
    color: var(--charred-earth);
    font-size: clamp(2rem, 5vw, 4rem);
}

.core-display {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(5rem, 12vw, 12rem);
    letter-spacing: 0.08em;
    line-height: 0.92;
    color: var(--charred-earth);
    text-align: center;
}

.mono-label {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-weight: 300;
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted-clay);
    display: block;
    margin-bottom: 0.5rem;
}

.body-text {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--excavated-cream);
    max-width: 42ch;
}

/* ===== STRATA / SECTIONS ===== */
.stratum {
    position: relative;
    z-index: 10;
    min-height: 100vh;
}

#layer-surface {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-left: 12%;
}

#layer-surface .stratum-content {
    position: relative;
    z-index: 15;
}

#subtitle-text {
    opacity: 0;
    margin-top: 1.5rem;
    transition: opacity 0.8s var(--ease-settle);
}

#subtitle-text.visible {
    opacity: 1;
}

#layer-first-stratum {
    min-height: 150vh;
    padding: 10vh 5%;
}

#layer-deep-strata {
    min-height: 200vh;
    padding: 10vh 5%;
}

#layer-core {
    min-height: 150vh;
    padding: 10vh 5%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--kiln-terracotta);
}

/* ===== TEXT BLOCKS ===== */
.text-block {
    position: relative;
    max-width: 50%;
    margin-bottom: 12vh;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s var(--ease-settle), transform 1.2s var(--ease-settle);
}

.text-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Grain pseudo-element for text blocks */
.text-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 128 128' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 128px 128px;
    mix-blend-mode: overlay;
    opacity: 0.15;
    pointer-events: none;
    z-index: 1;
}

/* ===== TORN CONTAINERS ===== */
.torn-container {
    padding: 2rem 2.5rem;
    background: rgba(26, 15, 10, 0.4);
    clip-path: polygon(
        0% 4%, 7% 0%, 15% 3%, 22% 1%, 30% 5%, 38% 0%, 45% 2%, 53% 0%, 60% 4%, 68% 1%, 75% 3%, 83% 0%, 90% 2%, 100% 4%,
        100% 96%, 93% 100%, 85% 97%, 78% 100%, 70% 96%, 62% 100%, 55% 98%, 47% 100%, 40% 96%, 32% 99%, 25% 97%, 17% 100%, 8% 98%, 0% 96%
    );
}

/* ===== STRATUM DIVIDERS ===== */
.stratum-divider {
    position: relative;
    height: 30px;
    background: var(--burnt-umber);
    z-index: 10;
    clip-path: polygon(
        0% 20%, 3% 45%, 6% 15%, 10% 55%, 14% 30%, 18% 60%, 22% 25%, 26% 50%, 30% 10%, 34% 45%, 38% 30%, 42% 65%, 46% 20%, 50% 50%, 54% 15%, 58% 55%, 62% 35%, 66% 60%, 70% 20%, 74% 45%, 78% 30%, 82% 65%, 86% 15%, 90% 50%, 94% 25%, 97% 55%, 100% 30%,
        100% 80%, 97% 55%, 94% 85%, 90% 50%, 86% 75%, 82% 45%, 78% 80%, 74% 55%, 70% 90%, 66% 55%, 62% 75%, 58% 45%, 54% 80%, 50% 50%, 46% 85%, 42% 55%, 38% 70%, 34% 45%, 30% 80%, 26% 55%, 22% 85%, 18% 50%, 14% 75%, 10% 45%, 6% 80%, 3% 55%, 0% 75%
    );
}

/* ===== CORE SECTION ===== */
.core-block {
    max-width: 60%;
    margin-bottom: 8vh;
}

#core-word {
    text-align: center;
    margin: 10vh auto;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 2s var(--ease-settle), transform 2s var(--ease-settle);
}

#core-word.revealed {
    opacity: 1;
    transform: translateY(0);
}

#footer-mark {
    position: relative;
    text-align: right;
    padding-right: 5%;
    margin-top: 10vh;
}

#footer-mark .mono-label {
    color: var(--burnt-umber);
}

/* ===== SVG FILTERS ===== */
#svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .text-block {
        max-width: 85%;
        margin-left: 7% !important;
    }

    #layer-surface {
        padding-left: 7%;
    }

    .torn-container {
        padding: 1.5rem;
    }

    .core-block {
        max-width: 90%;
    }
}
