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

:root {
    --deep-soil: #2a1f1a;
    --burnt-umber: #6b3a2a;
    --clay-ochre: #c4875a;
    --sandstone: #d4a574;
    --parchment: #e8dbc8;
    --mineral-green: #4a6b5a;
    --iron-oxide: #8b4a3a;
    --chalk-white: #f2ece4;
    --glitch-intensity: 0;
    --scroll-progress: 0;
}

html { scroll-behavior: smooth; }

body {
    background: var(--deep-soil);
    color: var(--parchment);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
}

/* === Navigation === */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 3vw;
    background: transparent;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #5c4a3a;
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.nav-link {
    color: #5c4a3a;
    text-decoration: none;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* === Sediment Layers === */
.sediment-layers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.sediment {
    position: absolute;
    width: 100%;
    will-change: transform;
}

/* === Glitch Overlay === */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.glitch-bar {
    position: absolute;
    top: var(--glitch-offset);
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #8b4a3a, transparent, #6b3a2a);
    mix-blend-mode: difference;
    will-change: transform, opacity;
    transition: opacity 0.3s;
}

/* === Glitch Target === */
.glitch-target {
    text-shadow:
        calc(var(--glitch-intensity) * 3px) 0 var(--iron-oxide),
        calc(var(--glitch-intensity) * -2px) 0 var(--mineral-green);
    filter: url(#displacement-filter);
    will-change: text-shadow, filter;
}

/* === Glitch Divider === */
.glitch-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--clay-ochre), var(--iron-oxide), var(--mineral-green));
    background-size: 300% 100%;
    mix-blend-mode: difference;
    animation: glitch-bar-shift 4s linear infinite;
}

@keyframes glitch-bar-shift {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* === Z-Modules Common === */
.z-mod {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    z-index: 1;
}

/* === Z-Path Lines === */
.z-path-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* === Z-Module 1: Scan === */
.z-mod--scan {
    background: linear-gradient(135deg, #2a1f1a 0%, #3a2a1f 40%, #4a3528 70%, #6b3a2a 100%);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.topo-face {
    position: absolute;
    top: 10vh;
    left: 5vw;
    width: 40vw;
    max-width: 500px;
    z-index: 2;
}

.topo-face-svg {
    width: 100%;
    height: auto;
}

.topo-line {
    will-change: stroke-dashoffset;
}

.tagline {
    position: absolute;
    top: 8vh;
    right: 8vw;
    max-width: 35vw;
    z-index: 3;
}

.tagline-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--clay-ochre);
}

.tagline-text .char {
    display: inline-block;
    will-change: transform;
    transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.tagline-sub {
    margin-top: 1.5rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--parchment);
    line-height: 1.6;
    opacity: 0.85;
}

/* === Z-Module 2: Parse === */
.z-mod--parse {
    background: linear-gradient(135deg, #2a1f1a 0%, #3a2a1f 60%, #2a1f1a 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    min-height: 100vh;
}

.data-readout {
    grid-column: 2;
    grid-row: 1;
    padding: 8vh 6vw 4vh 4vw;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 3;
}

.data-field {
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.data-field.visible {
    opacity: 1;
    transform: translateX(0);
}

.data-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.data-content {
    display: flex;
    flex-direction: column;
}

.data-label {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--sandstone);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.data-value {
    font-size: 0.95rem;
    color: var(--parchment);
}

.mono {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    line-height: 1.4;
}

/* Fingerprint terrain */
.fingerprint-terrain {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 25vw;
    max-width: 320px;
    opacity: 0.6;
    mix-blend-mode: soft-light;
    z-index: 2;
    pointer-events: none;
}

.fingerprint-svg {
    width: 100%;
    height: auto;
}

.fp-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    will-change: stroke-dashoffset;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Verification seal */
.verify-seal {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    z-index: 3;
}

.seal-svg {
    width: 180px;
    height: 180px;
}

.seal-arc, .seal-check {
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.seal-label {
    margin-top: 1rem;
    color: var(--mineral-green);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.8s;
}

/* === Z-Module 3: Confirm === */
.z-mod--confirm {
    background: linear-gradient(135deg, #2a1f1a 0%, #3a2a1f 50%, #2a1f1a 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6vw;
}

.terrain-map {
    width: 45%;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
    z-index: 2;
}

.terrain-svg {
    width: 100%;
    height: auto;
}

.confirm-block {
    width: 45%;
    z-index: 3;
    text-align: right;
}

.confirm-headline {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--clay-ochre);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s, transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.confirm-headline.visible {
    opacity: 1;
    transform: translateY(0);
}

.confirm-sub {
    margin-top: 1.5rem;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--parchment);
    line-height: 1.65;
    opacity: 0;
    transition: opacity 1s 0.3s;
}

.confirm-sub.visible { opacity: 0.85; }

.confirm-stamp {
    margin-top: 2.5rem;
    opacity: 0;
    transition: opacity 1s 0.6s;
}

.confirm-stamp.visible { opacity: 1; }

.confirm-code {
    color: var(--mineral-green);
    display: block;
}

.stamp-line {
    width: 100%;
    height: 1px;
    background: var(--mineral-green);
    margin: 0.5rem 0;
    opacity: 0.4;
}

.confirm-hash {
    color: var(--sandstone);
    opacity: 0.6;
    display: block;
}

/* === Responsive === */
@media (max-width: 768px) {
    .topo-face {
        width: 60vw;
        top: 5vh;
        left: 3vw;
    }
    .tagline {
        top: auto;
        bottom: 10vh;
        right: 5vw;
        left: 5vw;
        max-width: none;
    }
    .z-mod--parse {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }
    .data-readout {
        grid-column: 1;
        padding: 12vh 5vw 4vh;
    }
    .verify-seal {
        grid-column: 1;
        grid-row: 2;
    }
    .fingerprint-terrain {
        width: 50vw;
    }
    .z-mod--confirm {
        flex-direction: column;
        padding: 10vh 5vw;
        gap: 4vh;
    }
    .terrain-map, .confirm-block {
        width: 100%;
    }
    .confirm-block { text-align: center; }
}
