/* ============================================
   miris.xyz — Geological Glitch Design System
   ============================================ */

/* Custom Properties */
:root {
    --basalt: #0e1518;
    --shale: #1a2328;
    --teal-sediment: #2a3f47;
    --stone-moss: #5a7a6e;
    --silver-mineral: #c5ccd3;
    --ethereal-ice: #a8c4d4;
    --frost-offset: #6b8fa0;
    --seismic-warm: #c4785a;
    --angle: 8deg;
    --angle-neg: -8deg;
    --col-offset: 8vw;
    --content-max: 540px;
    --reading-line-height: 1.72;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--basalt);
    color: var(--silver-mineral);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: var(--reading-line-height);
    letter-spacing: 0.008em;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   Scan-Line Interference Overlay
   ============================================ */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0.08;
    background: repeating-linear-gradient(
        to bottom,
        var(--teal-sediment) 0px,
        var(--teal-sediment) 1px,
        transparent 1px,
        transparent 3px
    );
    animation: scanline-crawl 4s linear infinite;
}

@keyframes scanline-crawl {
    0% { transform: translateY(0); }
    100% { transform: translateY(3px); }
}

/* ============================================
   Geological Grid Marks
   ============================================ */
.grid-marks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.grid-mark {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--teal-sediment);
    opacity: 0.3;
    line-height: 1;
    user-select: none;
}

/* ============================================
   Stratum Labels (Rotated Margin Text)
   ============================================ */
.stratum-label {
    position: absolute;
    left: 1.5vw;
    top: 50%;
    writing-mode: vertical-lr;
    transform: rotate(180deg) translateY(50%);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--stone-moss);
    z-index: 5;
    white-space: nowrap;
}

/* ============================================
   Strata — Diagonal Fault-Line Sections
   ============================================ */
.stratum {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Stratum 0 — Surface / Hero */
.stratum-0 {
    min-height: 100vh;
    background-color: var(--basalt);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 4vw), 0 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 8vh;
}

.stratum-0-content {
    padding-left: var(--col-offset);
    position: relative;
    top: -38.2%;
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 6.5rem);
    letter-spacing: -0.03em;
    color: var(--ethereal-ice);
    text-shadow: 2px 0 0 rgba(107, 143, 160, 0.4);
    line-height: 1.05;
    margin-bottom: 1.5rem;
}

.hero-annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--stone-moss);
}

/* Stratum 1 — Recent Layer */
.stratum-1 {
    min-height: 100vh;
    background-color: var(--shale);
    clip-path: polygon(0 4vw, 100% 0, 100% calc(100% - 3vw), 0 100%);
    padding: 12vh 0;
    margin-top: -4vw;
}

/* Stratum 2 — Middle Layer */
.stratum-2 {
    min-height: 150vh;
    background-color: var(--basalt);
    clip-path: polygon(0 0, 100% 3vw, 100% 100%, 0 calc(100% - 4vw));
    padding: 12vh 0;
    margin-top: -3vw;
}

/* Stratum 3 — Deep Layer */
.stratum-3 {
    min-height: 100vh;
    background-color: var(--shale);
    clip-path: polygon(0 4vw, 100% 0, 100% calc(100% - 3vw), 0 100%);
    padding: 12vh 0;
    margin-top: -4vw;
}

.stratum-3 .scanline-section {
    opacity: 0.12;
}

/* Stratum 4 — Bedrock */
.stratum-4 {
    min-height: 50vh;
    background-color: var(--basalt);
    clip-path: polygon(0 0, 100% 3vw, 100% 100%, 0 100%);
    padding: 12vh 0 0;
    margin-top: -3vw;
}

/* ============================================
   Content Positioning
   ============================================ */
.stratum-content {
    position: relative;
    z-index: 3;
}

.content-left {
    padding-left: 12vw;
    padding-right: 4vw;
    max-width: calc(var(--content-max) + 12vw + 4vw);
}

.content-right {
    margin-left: auto;
    padding-right: 12vw;
    padding-left: 4vw;
    max-width: calc(var(--content-max) + 12vw + 4vw);
}

/* ============================================
   Typography
   ============================================ */
.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 6.5rem);
    letter-spacing: -0.03em;
    color: var(--ethereal-ice);
    text-shadow: 2px 0 0 rgba(107, 143, 160, 0.4);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

/* Scale down section headings vs hero */
.stratum-1 .section-heading,
.stratum-2 .section-heading,
.stratum-3 .section-heading,
.stratum-4 .section-heading {
    font-size: clamp(1.6rem, 3.5vw, 3rem);
}

.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: var(--reading-line-height);
    letter-spacing: 0.008em;
    color: var(--silver-mineral);
    max-width: 38em;
    margin-bottom: 1.5rem;
}

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

/* ============================================
   Fault Gaps
   ============================================ */
.fault-gap {
    width: 100%;
    height: 5px;
    position: relative;
    z-index: 10;
    background: repeating-linear-gradient(
        to bottom,
        var(--teal-sediment) 0px,
        var(--teal-sediment) 1px,
        transparent 1px,
        transparent 2px
    );
    margin: -2px 0;
}

/* ============================================
   Seismic Waveform SVGs
   ============================================ */
.waveform-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.waveform-0 {
    position: absolute;
    bottom: 6vh;
    left: 0;
    width: 100%;
    height: 60px;
}

.waveform-between {
    padding: 1rem 0;
    background-color: var(--basalt);
}

.waveform-final {
    width: 100%;
    height: 40px;
    margin-top: 3rem;
}

.seismic-waveform {
    width: 100%;
    height: 100%;
    display: block;
}

.waveform-path {
    stroke: var(--stone-moss);
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
}

.waveform-path.animate {
    transition: stroke-dashoffset 8s ease-in-out;
    stroke-dashoffset: 0;
}

/* ============================================
   Displacement Glitch Blocks
   ============================================ */
.displacement-glitch {
    position: relative;
    margin: 0.5rem 0 1.5rem;
    height: 8px;
    overflow: visible;
}

.glitch-block {
    position: absolute;
    top: -4px;
    left: 0;
    transform: translateX(16px);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: var(--reading-line-height);
    color: var(--silver-mineral);
    white-space: nowrap;
    clip-path: inset(0 0 calc(100% - 8px) 0);
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================
   Work Blocks (Stratum 2)
   ============================================ */
.work-block {
    margin-bottom: 6rem;
    position: relative;
}

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

.work-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--stone-moss);
    display: block;
    margin-bottom: 1rem;
}

/* ============================================
   Tectonic Stress Lines
   ============================================ */
.tectonic-stress-line {
    position: absolute;
    top: 0;
    left: -4vw;
    width: calc(100% + 8vw);
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.tectonic-stress-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -20%;
    width: 140%;
    height: 1px;
    background-color: var(--teal-sediment);
    transform: rotate(var(--angle));
    transform-origin: center;
}

/* ============================================
   Deep Layer — Enhanced Scan Lines
   ============================================ */
.stratum-3::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.12;
    background: repeating-linear-gradient(
        to bottom,
        var(--teal-sediment) 0px,
        var(--teal-sediment) 1px,
        transparent 1px,
        transparent 3px
    );
}

/* ============================================
   Seismic Warm Accent
   ============================================ */
.seismic-accent {
    color: var(--seismic-warm);
    font-weight: 500;
}

/* ============================================
   Contact / Bedrock
   ============================================ */
.contact-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--stone-moss);
    margin-bottom: 0.5rem;
    margin-top: 2rem;
}

.contact-label:first-child {
    margin-top: 0;
}

.contact-link {
    margin-bottom: 0.25rem;
}

.accent-link {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: var(--ethereal-ice);
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-block;
}

.accent-link:hover {
    color: var(--seismic-warm);
    animation: shake-error 0.3s ease-in-out;
}

@keyframes shake-error {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

.bedrock-void {
    height: 200px;
}

/* ============================================
   Fade-In Animation (IntersectionObserver)
   ============================================ */
.fade-in {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Displacement Overlays (Glitch Blocks)
   ============================================ */
.displacement-overlay {
    position: absolute;
    width: 200px;
    height: 8px;
    background-color: var(--shale);
    transform: translateX(16px);
    z-index: 4;
    pointer-events: none;
    opacity: 0.7;
    mix-blend-mode: lighten;
}

.displacement-1 {
    top: 145vh;
    left: 12vw;
    background-color: var(--basalt);
}

.displacement-2 {
    top: 275vh;
    right: 12vw;
    left: auto;
    background-color: var(--shale);
}

.displacement-3 {
    top: 380vh;
    left: 20vw;
    background-color: var(--basalt);
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .scanline-overlay {
        animation: none;
    }

    .waveform-path {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
    }

    .waveform-path.animate {
        transition: none;
    }

    .fade-in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .accent-link:hover {
        animation: none;
    }
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    .content-left {
        padding-left: 6vw;
        padding-right: 4vw;
        max-width: 100%;
    }

    .content-right {
        padding-right: 6vw;
        padding-left: 4vw;
        max-width: 100%;
    }

    .stratum-label {
        left: 0.5vw;
        font-size: 0.6rem;
    }

    .hero-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .stratum-0-content {
        padding-left: 6vw;
    }

    .work-block {
        margin-bottom: 4rem;
    }

    .grid-mark {
        display: none;
    }

    .displacement-overlay {
        width: 120px;
    }
}

@media (max-width: 480px) {
    .content-left,
    .content-right {
        padding-left: 5vw;
        padding-right: 5vw;
    }

    .stratum-label {
        display: none;
    }
}
