/* =============================================
   aiice.dev — Styles
   Geological Narrative Architecture
   ============================================= */

/* --- Custom Properties --- */
:root {
    --base-dark: #2d3436;
    --base-light: #f2ede6;
    --text-dark: #3d4a4f;
    --text-light: #e8e2d8;
    --accent-stone: #5a6b5e;
    --accent-warm: #c4a882;
    --accent-cool: #7fa8b5;
    --glitch-artifact: #b85c4a;
    --fog: #d4cfc6;

    --font-heading: 'Source Serif 4', 'Georgia', serif;
    --font-label: 'Atkinson Hyperlegible', 'Helvetica Neue', sans-serif;
    --font-body: 'Source Serif 4', 'Georgia', serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;

    --grid-columns: 16;
    --grid-gutter: 16px;

    /* Mountain ridgeline clip-paths */
    --mountain-back: polygon(0% 100%, 0% 72%, 5% 68%, 10% 55%, 15% 50%, 18% 48%, 22% 52%, 26% 45%, 30% 38%, 33% 42%, 37% 35%, 40% 30%, 43% 33%, 47% 28%, 50% 25%, 53% 28%, 56% 32%, 60% 27%, 63% 30%, 67% 35%, 70% 32%, 74% 38%, 78% 42%, 82% 38%, 85% 45%, 88% 50%, 92% 55%, 95% 60%, 100% 65%, 100% 100%);
    --mountain-mid: polygon(0% 100%, 0% 78%, 4% 75%, 8% 70%, 12% 65%, 16% 58%, 20% 55%, 24% 60%, 28% 52%, 32% 48%, 35% 52%, 38% 45%, 42% 42%, 45% 46%, 48% 40%, 52% 38%, 55% 42%, 58% 48%, 62% 44%, 65% 50%, 68% 46%, 72% 52%, 76% 55%, 80% 50%, 84% 55%, 88% 60%, 92% 65%, 96% 70%, 100% 75%, 100% 100%);
    --mountain-front: polygon(0% 100%, 0% 85%, 3% 82%, 7% 78%, 11% 74%, 15% 70%, 19% 68%, 23% 72%, 27% 66%, 31% 62%, 34% 66%, 38% 60%, 42% 58%, 46% 62%, 50% 56%, 54% 54%, 58% 58%, 62% 62%, 66% 58%, 70% 63%, 74% 60%, 78% 65%, 82% 68%, 86% 64%, 90% 70%, 94% 75%, 97% 78%, 100% 82%, 100% 100%);
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.72;
    color: var(--text-dark);
    background-color: var(--base-dark);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Hidden SVG --- */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Scan Line --- */
.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--glitch-artifact);
    opacity: 0.08;
    z-index: 9999;
    pointer-events: none;
    animation: scanTraverse 30s linear infinite;
}

@keyframes scanTraverse {
    0% { transform: translateY(0); }
    100% { transform: translateY(100vh); }
}

/* --- Ridge-Line Navigation --- */
.ridge-nav {
    position: fixed;
    left: calc((100vw / 16) * 2);
    top: 0;
    bottom: 0;
    width: 1px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ridge-wordmark {
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--accent-stone);
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin-top: 24px;
    margin-bottom: 24px;
}

.ridge-line {
    flex: 1;
    width: 1px;
    background-color: var(--accent-stone);
    opacity: 0.3;
}

.ridge-markers {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
}

.ridge-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-stone);
    border: none;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    padding: 0;
}

.ridge-marker.active {
    width: 12px;
    height: 12px;
    box-shadow: 0 0 12px rgba(196, 168, 130, 0.2);
}

/* --- Mobile Navigation --- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: rgba(90, 107, 94, 0.15);
    z-index: 100;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-stone);
    border: none;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    padding: 0;
    position: relative;
    top: -8px;
}

.mobile-marker.active {
    width: 12px;
    height: 12px;
    box-shadow: 0 0 12px rgba(196, 168, 130, 0.2);
}

/* --- Strata (Sections) --- */
.stratum {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.stratum--dark {
    background-color: var(--base-dark);
    color: var(--text-light);
}

.stratum--light {
    background-color: var(--base-light);
    color: var(--text-dark);
}

/* --- Stratum Grid --- */
.stratum-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: var(--grid-gutter);
    max-width: 100%;
    padding: 0 var(--grid-gutter);
    min-height: 100%;
}

/* =============================================
   SUMMIT STRATUM
   ============================================= */
.stratum--summit {
    height: 100vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Contour lines */
.contour-lines {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    animation: contourPulse 8s linear infinite;
}

@keyframes contourPulse {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.14; }
}

.contour {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid var(--fog);
    opacity: 0.2;
}

.contour--1 { width: 200px; height: 200px; }
.contour--2 { width: 360px; height: 340px; }
.contour--3 { width: 540px; height: 500px; }
.contour--4 { width: 740px; height: 680px; }
.contour--5 { width: 960px; height: 880px; }
.contour--6 { width: 1200px; height: 1100px; }

/* Summit content */
.summit-content {
    position: relative;
    z-index: 2;
    padding-left: calc((100vw / 16) * 3);
}

.summit-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 12vw;
    color: var(--text-light);
    letter-spacing: -0.015em;
    line-height: 0.9;
    margin-bottom: 16px;
}

.summit-tagline {
    font-family: var(--font-label);
    font-weight: 400;
    font-size: 16px;
    color: var(--accent-cool);
    letter-spacing: 0.04em;
}

/* Mountain Range */
.mountain-range {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    pointer-events: none;
    z-index: 1;
}

.mountain-layer {
    position: absolute;
    bottom: 0;
    left: -2%;
    right: -2%;
    height: 100%;
    transition: transform 0.3s ease-out;
}

.mountain-layer--back {
    clip-path: var(--mountain-back);
    background-color: var(--base-dark);
    filter: brightness(1.3);
    background-color: #3d4a4f;
}

.mountain-layer--mid {
    clip-path: var(--mountain-mid);
    background-color: var(--accent-stone);
}

.mountain-layer--front {
    clip-path: var(--mountain-front);
    background-color: var(--base-dark);
    filter: brightness(1.15);
    background-color: #353d3f;
}

/* =============================================
   GLITCH SEAMS
   ============================================= */
.glitch-seam {
    position: relative;
    height: 3px;
    overflow: hidden;
    z-index: 10;
}

.glitch-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dark);
    white-space: nowrap;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: calc((100vw / 16) * 3);
    opacity: 0.4;
    text-shadow:
        2px 0 var(--accent-cool),
        -1px -1px var(--accent-warm);
}

.glitch-seam--1 {
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(127, 168, 181, 0.3) 2px,
        rgba(127, 168, 181, 0.3) 2.5px,
        transparent 2.5px,
        transparent 4px,
        rgba(196, 168, 130, 0.3) 4px,
        rgba(196, 168, 130, 0.3) 4.5px
    );
}

.glitch-seam--2 {
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 3px,
        rgba(184, 92, 74, 0.15) 3px,
        rgba(184, 92, 74, 0.15) 3.5px,
        transparent 3.5px,
        transparent 5px,
        rgba(127, 168, 181, 0.2) 5px,
        rgba(127, 168, 181, 0.2) 5.5px
    );
}

.glitch-seam--3 {
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 1.5px,
        rgba(196, 168, 130, 0.25) 1.5px,
        rgba(196, 168, 130, 0.25) 2px,
        transparent 2px,
        transparent 4px,
        rgba(90, 107, 94, 0.2) 4px,
        rgba(90, 107, 94, 0.2) 4.5px
    );
}

.glitch-seam--4 {
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2.5px,
        rgba(127, 168, 181, 0.2) 2.5px,
        rgba(127, 168, 181, 0.2) 3px,
        transparent 3px,
        transparent 5px,
        rgba(184, 92, 74, 0.12) 5px,
        rgba(184, 92, 74, 0.12) 5.5px
    );
}

/* =============================================
   FOG TRANSITION
   ============================================= */
.stratum--fog {
    height: 40vh;
    min-height: 250px;
    position: relative;
}

.fog-bands {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

.fog-band {
    flex: 1;
}

.fog-band--1 { background-color: #2d3436; }
.fog-band--2 { background-color: #3f4a4c; }
.fog-band--3 { background-color: #5a6560; }
.fog-band--4 { background-color: #8a8e82; }
.fog-band--5 { background-color: #bbb8a8; }
.fog-band--6 { background-color: #d8d4c8; }

.glitch-teaser {
    position: absolute;
    top: 55%;
    left: 0;
    right: 0;
    height: 3px;
    overflow: hidden;
    z-index: 2;
}

.glitch-teaser-text {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent-cool);
    white-space: nowrap;
    position: absolute;
    top: 50%;
    left: calc((100vw / 16) * 4);
    transform: translateY(-50%);
    opacity: 0.35;
    text-shadow:
        2px 0 var(--accent-warm),
        -1px -1px var(--glitch-artifact);
    filter: blur(0.3px);
}

/* =============================================
   FIRST LIGHT STRATUM
   ============================================= */
.stratum--first-light {
    min-height: 100vh;
    padding: 120px 0 100px;
    filter: url(#birch-texture);
}

.content-block {
    padding: 32px 0;
}

.content-block--primary {
    position: relative;
    z-index: 2;
}

.content-block--secondary {
    position: relative;
    z-index: 1;
    transform: rotate(0.5deg);
}

/* --- Typography Elements --- */
.section-label {
    font-family: var(--font-label);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-stone);
    display: block;
    margin-bottom: 16px;
}

.section-label--light {
    color: var(--accent-stone);
    opacity: 0.8;
}

.hairline {
    width: 50%;
    height: 1px;
    background-color: var(--fog);
    margin-bottom: 32px;
}

.hairline--cool {
    background-color: var(--accent-cool);
    opacity: 0.3;
}

.hairline--narrow {
    width: 40%;
    margin: 16px 0;
}

.section-heading {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(36px, 5vw, 64px);
    color: var(--text-dark);
    letter-spacing: -0.015em;
    line-height: 1.1;
    margin-bottom: 32px;
}

.section-heading--light {
    color: var(--text-light);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.72;
    color: var(--text-dark);
    max-width: 38em;
    margin-bottom: 20px;
}

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

/* =============================================
   DEEP STONE STRATUM
   ============================================= */
.stratum--deep-stone {
    min-height: 100vh;
    padding: 120px 0 100px;
}

.stratum--deep-stone .body-text {
    color: var(--fog);
}

.content-block--feature {
    padding: 40px 0;
}

.feature-items {
    margin-top: 48px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 0;
}

.stone-marker {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    background-color: var(--accent-stone);
    margin-top: 6px;
}

.feature-content {
    flex: 1;
}

.feature-title {
    font-family: var(--font-label);
    font-weight: 700;
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.feature-desc {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.72;
    color: var(--fog);
    max-width: 38em;
}

/* =============================================
   VALLEY FLOOR STRATUM
   ============================================= */
.stratum--valley {
    min-height: 80vh;
    padding: 100px 0 80px;
}

.stratum--valley .stratum-grid {
    grid-template-rows: auto auto auto;
}

.valley-block {
    padding: 24px 0;
}

.valley-block--contact {
    transform: rotate(-0.5deg);
}

.valley-block--status {
    transform: rotate(0.3deg);
}

.valley-block--links {
    transform: rotate(-0.3deg);
}

.valley-block--colophon {
    transform: rotate(0.5deg);
}

.valley-text {
    font-family: var(--font-label);
    font-weight: 400;
    font-size: 15px;
    color: var(--text-dark);
    line-height: 1.8;
}

.valley-meta {
    font-family: var(--font-label);
    font-weight: 400;
    font-size: 13px;
    color: var(--accent-stone);
    line-height: 1.8;
}

.mono-accent {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 14px;
    color: var(--accent-cool);
}

.valley-closing {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(28px, 4vw, 48px);
    color: var(--text-dark);
    letter-spacing: -0.015em;
    text-align: center;
    opacity: 0.3;
}

/* =============================================
   GLITCH MICRO-BURST
   ============================================= */
.glitch-burst {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
    animation: glitchBurst 150ms cubic-bezier(0.25, 0.1, 0.25, 1.0) forwards;
}

.glitch-burst-inner {
    position: absolute;
    inset: 0;
    background: inherit;
    transform: translateX(6px);
    filter: saturate(0) opacity(0.6);
}

@keyframes glitchBurst {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    30% {
        opacity: 0.8;
        transform: translateX(6px);
    }
    100% {
        opacity: 0;
        transform: translateX(6px);
    }
}

/* =============================================
   CHROMATIC ABERRATION (at seam boundaries)
   ============================================= */
.chromatic-active .section-heading {
    text-shadow:
        2px 0 var(--accent-cool),
        -1px -1px var(--accent-warm);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .ridge-nav {
        display: none;
    }

    .mobile-nav {
        display: flex;
    }

    .stratum-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
        padding: 0 16px;
    }

    .summit-content {
        padding-left: 24px;
        padding-right: 24px;
    }

    .summit-title {
        font-size: 18vw;
    }

    /* First Light - stack blocks */
    .stratum--first-light .content-block--primary,
    .stratum--first-light .content-block--secondary {
        grid-column: 1 / -1 !important;
        margin-top: 0 !important;
        transform: none;
    }

    .stratum--first-light .content-block--secondary {
        margin-top: 24px !important;
    }

    /* Deep Stone */
    .stratum--deep-stone .content-block--feature {
        grid-column: 1 / -1 !important;
    }

    /* Valley - stack blocks */
    .valley-block {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        margin-top: 0 !important;
        transform: none !important;
    }

    .section-heading {
        font-size: clamp(28px, 7vw, 48px);
    }

    .body-text {
        font-size: 16px;
    }

    .contour--5,
    .contour--6 {
        display: none;
    }
}

@media (max-width: 480px) {
    .summit-title {
        font-size: 22vw;
    }

    .stratum--first-light,
    .stratum--deep-stone {
        padding: 80px 0 60px;
    }

    .stratum--valley {
        padding: 60px 0 40px;
    }

    .feature-item {
        flex-direction: column;
        gap: 8px;
    }

    .stone-marker {
        margin-top: 0;
    }
}

/* =============================================
   FOG DEPTH LAYERS
   ============================================= */
.stratum--first-light::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(
        to bottom,
        rgba(212, 207, 198, 0.4) 0%,
        rgba(212, 207, 198, 0.25) 33%,
        rgba(212, 207, 198, 0.12) 66%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 0;
}

.stratum--deep-stone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(
        to bottom,
        rgba(212, 207, 198, 0.15) 0%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* =============================================
   STRATUM OVERLAP ZONES
   ============================================= */
.stratum--light + .glitch-seam {
    margin-top: -40px;
    margin-bottom: -40px;
}

.stratum--dark + .glitch-seam {
    margin-top: -40px;
    margin-bottom: -40px;
}

/* Noise texture at seam boundaries */
.glitch-seam::before {
    content: '';
    position: absolute;
    inset: -20px 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(127, 168, 181, 0.06) 1px,
        rgba(127, 168, 181, 0.06) 1.5px
    );
    pointer-events: none;
}

.glitch-seam::after {
    content: '';
    position: absolute;
    inset: -20px 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(196, 168, 130, 0.04) 2px,
        rgba(196, 168, 130, 0.04) 2.5px
    );
    pointer-events: none;
}

/* =============================================
   PANEL ROTATIONS (tectonic metaphor)
   ============================================= */
.content-block--secondary {
    transform: rotate(0.5deg);
}

.valley-block--contact {
    transform: rotate(-0.5deg);
}

.valley-block--colophon {
    transform: rotate(0.5deg);
}
