/* ============================================
   luminous.quest - Cyberpunk Geologist's Field Journal
   ============================================ */

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

:root {
    /* Palette: Earth-Tones with Cyberpunk Fluorescence */
    --anthracite: #1C1A1F;
    --basalt-gray: #2A2730;
    --shale: #3A3642;
    --bone: #E8DFD0;
    --clay: #A89888;
    --fluorescent-cyan: #4AEADC;
    --sienna-vein: #C17A4A;
    --amethyst-pulse: #7B5EA7;
    --pyrite-flash: #D4AF37;
    --deep-teal: #1A3A3A;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--anthracite);
    color: var(--bone);
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
.strata-heading {
    font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--bone);
    font-size: clamp(36px, 5vw, 72px);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.cinzel-accent {
    font-family: 'Cinzel', 'Times New Roman', serif;
    font-weight: 700;
    font-size: clamp(72px, 12vw, 144px);
    color: var(--sienna-vein);
    display: block;
    text-align: center;
    line-height: 1;
    letter-spacing: 0.05em;
}

.label-id,
.label-depth,
.readout-key,
.readout-val,
.label-coord,
.label-meta {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-weight: 400;
    font-size: 12px;
    color: var(--fluorescent-cyan);
}

.label-depth,
.label-meta {
    color: var(--clay);
}

.label-coord {
    color: var(--clay);
    font-size: 11px;
}

p {
    color: var(--bone);
    margin-bottom: 1rem;
}

.content-block p:last-child {
    margin-bottom: 0;
}

.content-block + .content-block {
    margin-top: 1.5rem;
}

/* --- Depth Ruler (Fixed Right Edge) --- */
#depth-ruler {
    position: fixed;
    top: 0;
    right: 20px;
    width: 30px;
    height: 100vh;
    z-index: 1000;
    pointer-events: none;
}

.ruler-track {
    position: absolute;
    top: 5vh;
    bottom: 5vh;
    right: 0;
    width: 3px;
}

.ruler-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, var(--bone), var(--amethyst-pulse));
    opacity: 0.4;
    border-radius: 1px;
}

.tick {
    position: absolute;
    right: 0;
    width: 12px;
    height: 1px;
    background-color: var(--bone);
    opacity: 0.3;
    transform: translateY(-50%);
    transition: opacity 0.4s ease;
}

.tick span {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    color: var(--clay);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tick.active {
    opacity: 1;
    background-color: var(--fluorescent-cyan);
}

.tick.active span {
    opacity: 1;
    color: var(--fluorescent-cyan);
}

#drill-head {
    position: absolute;
    right: -3px;
    width: 9px;
    height: 9px;
    background-color: var(--fluorescent-cyan);
    transform: rotate(45deg) translateY(-50%);
    top: 5vh;
    transition: top 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 8px var(--fluorescent-cyan), 0 0 20px rgba(74, 234, 220, 0.3);
    z-index: 1001;
}

/* --- Section 1: Survey Header --- */
#survey-header {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background-color: var(--anthracite);
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 100% 93%, 0 100%);
}

#marble-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: auto;
    opacity: 0.85;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg, rgba(193, 122, 74, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 30%, rgba(74, 234, 220, 0.03) 0%, transparent 50%),
        conic-gradient(from 45deg at 50% 50%, rgba(123, 94, 167, 0.02) 0%, transparent 30%);
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
}

.specimen-label {
    padding: 3rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.label-rule {
    width: 60px;
    height: 1px;
    background-color: var(--bone);
    opacity: 0.5;
    margin-bottom: 0.5rem;
}

.label-domain {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--bone);
}

/* --- Strata Band Sections --- */
.strata-section {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.strata-band {
    padding: 8rem 0;
    min-height: 100vh;
}

/* Diagonal clip-paths: alternating 7deg and -4deg cuts */
#stratum-01 {
    background-color: var(--basalt-gray);
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
    margin-top: -60px;
    z-index: 2;
    background-image:
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 120px,
            rgba(193, 122, 74, 0.03) 120px,
            rgba(193, 122, 74, 0.03) 122px
        );
}

#stratum-02 {
    background-color: var(--anthracite);
    clip-path: polygon(0 0, 100% 7%, 100% 100%, 0 93%);
    margin-top: -60px;
    z-index: 3;
    background-image:
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 180px,
            rgba(123, 94, 167, 0.03) 180px,
            rgba(123, 94, 167, 0.03) 182px
        );
}

#stratum-03 {
    background-color: var(--basalt-gray);
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
    margin-top: -60px;
    z-index: 4;
    background-image:
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 100px,
            rgba(193, 122, 74, 0.04) 100px,
            rgba(193, 122, 74, 0.04) 102px
        ),
        repeating-linear-gradient(
            -30deg,
            transparent,
            transparent 200px,
            rgba(74, 234, 220, 0.02) 200px,
            rgba(74, 234, 220, 0.02) 202px
        );
}

#stratum-04 {
    background-color: var(--anthracite);
    clip-path: polygon(0 0, 100% 7%, 100% 100%, 0 93%);
    margin-top: -60px;
    z-index: 5;
    position: relative;
}

#core-sample {
    background-color: var(--anthracite);
    z-index: 6;
    padding: 6rem 0 8rem;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image:
        radial-gradient(ellipse at 50% 30%, rgba(123, 94, 167, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 70%, rgba(26, 58, 58, 0.1) 0%, transparent 50%);
}

/* --- Strata Content Layout --- */
.strata-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 3rem;
}

.stratum-label {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.content-block {
    max-width: 640px;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s ease;
    padding: 1.5rem;
    border-radius: 2px;
}

.content-block:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(74, 234, 220, 0.07), 0 4px 12px rgba(74, 234, 220, 0.05);
}

.content-block p {
    color: var(--clay);
}

.strata-content > .content-block:first-of-type p {
    color: var(--bone);
}

/* --- Data Readout --- */
.data-readout {
    margin-top: 2rem;
    padding: 1.5rem;
    border-left: 2px solid rgba(74, 234, 220, 0.3);
    background: rgba(74, 234, 220, 0.02);
}

.readout-line {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.4rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
}

.readout-key {
    color: var(--clay);
    min-width: 140px;
}

.readout-val {
    color: var(--fluorescent-cyan);
}

/* --- Discovery Accent --- */
.discovery-accent {
    margin: 3rem 0;
    padding: 2rem 0;
    position: relative;
    overflow: hidden;
}

.discovery-accent::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -10%;
    width: 120%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sienna-vein), transparent);
    opacity: 0.3;
}

/* --- Crystal Shapes --- */
.crystal-shapes {
    position: absolute;
    top: 0;
    right: -80px;
    width: 200px;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.crystal-shapes-dense {
    right: -120px;
    width: 300px;
}

.crystal {
    position: absolute;
    opacity: 0.3;
    transition: opacity 0.6s ease;
}

.crystal polygon {
    fill: none;
    stroke: var(--amethyst-pulse);
    stroke-width: 1;
}

.crystal:hover {
    opacity: 0.7;
}

.crystal:hover polygon {
    fill: url(#crystal-glow);
}

.crystal-shapes .crystal:nth-child(1) {
    top: 15%;
    left: 20%;
    width: 50px;
    height: 50px;
}

.crystal-shapes .crystal:nth-child(2) {
    top: 45%;
    left: 60%;
    width: 35px;
    height: 40px;
}

.crystal-shapes .crystal:nth-child(3) {
    top: 70%;
    left: 10%;
    width: 30px;
    height: 30px;
}

.crystal-shapes .crystal:nth-child(4) {
    top: 85%;
    left: 50%;
    width: 40px;
    height: 45px;
}

/* --- Fracture Lines --- */
.fracture-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.fracture-lines path {
    fill: none;
    stroke: var(--fluorescent-cyan);
    stroke-width: 1;
    opacity: 0.4;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fracture-lines.visible path {
    stroke-dashoffset: 0;
}

/* --- Aurora Background (Deep Sections) --- */
.aurora-section {
    position: relative;
}

.aurora-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 40%, rgba(123, 94, 167, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 60%, rgba(26, 58, 58, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(193, 122, 74, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 30% 70%, rgba(74, 234, 220, 0.05) 0%, transparent 45%);
    background-size: 200% 200%;
    animation: auroraShift 30s ease-in-out infinite alternate;
}

@keyframes auroraShift {
    0% {
        background-position: 0% 0%, 100% 100%, 50% 0%, 0% 50%;
    }
    33% {
        background-position: 50% 20%, 50% 50%, 0% 50%, 100% 0%;
    }
    66% {
        background-position: 100% 50%, 0% 0%, 100% 100%, 50% 100%;
    }
    100% {
        background-position: 20% 100%, 80% 30%, 50% 50%, 0% 0%;
    }
}

/* --- Core Sample Section --- */
.core-column {
    max-width: 320px;
    width: 100%;
    padding: 3rem 2rem;
    border-left: 1px solid rgba(168, 152, 136, 0.15);
    border-right: 1px solid rgba(168, 152, 136, 0.15);
    position: relative;
}

.core-column::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(123, 94, 167, 0.2), transparent);
    transform: translateX(-50%);
    z-index: 0;
}

.core-column .strata-heading {
    font-size: clamp(28px, 4vw, 48px);
    text-align: center;
}

.core-column .stratum-label {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.core-column .content-block {
    padding: 1rem 0;
}

.core-column .content-block p {
    font-size: 15px;
    color: var(--clay);
}

.core-reflection p {
    color: var(--bone) !important;
    font-style: italic;
}

.core-end-marker {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(74, 234, 220, 0.2);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --- Scan Line Effect --- */
@keyframes scanLine {
    0% {
        top: -2px;
        opacity: 0;
    }
    5% {
        opacity: 0.6;
    }
    95% {
        opacity: 0.6;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

.strata-band::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--fluorescent-cyan), transparent);
    opacity: 0;
    z-index: 10;
    pointer-events: none;
    top: -2px;
}

.strata-band.scanned::after {
    animation: scanLine 3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* --- Section Reveal Animations --- */
.strata-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Header is always visible */
#survey-header .header-overlay {
    opacity: 0;
    transition: opacity 1.2s ease 0.3s;
}

#survey-header.visible .header-overlay {
    opacity: 1;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .specimen-label {
        padding: 2rem;
    }

    .strata-content {
        padding: 0 1.5rem;
    }

    .strata-band {
        padding: 6rem 0;
    }

    .crystal-shapes {
        display: none;
    }

    .core-column {
        max-width: 100%;
        padding: 2rem 1.5rem;
    }

    #depth-ruler {
        right: 8px;
    }

    .tick span {
        display: none;
    }

    .data-readout {
        padding: 1rem;
    }

    .readout-line {
        flex-direction: column;
        gap: 0.2rem;
    }

    .readout-key {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .strata-heading {
        font-size: 28px;
    }

    .cinzel-accent {
        font-size: 48px;
    }

    .label-domain {
        font-size: 18px;
    }

    .strata-band {
        padding: 4rem 0;
    }
}
