/* ============================================
   hil.st — Styles
   Altitude-band masonry narrative
   ============================================ */

/* --- Custom Properties --- */
:root {
    --ground: #3B2F2F;
    --stone: #C4A882;
    --sky: #F0E6D3;
    --sage: #8B9A6B;
    --trail: #B85C3A;
    --brass: #8B6914;
    --glitch-red: #E84545;
    --glitch-cyan: #45B8E8;
    --parchment: #E8D5C4;
    --summit-white: #FAFAF5;

    --font-display: 'Jost', sans-serif;
    --font-body: 'Caveat', cursive;
    --font-mono: 'Overpass Mono', monospace;

    --bg-current: var(--ground);
    transition: background-color 1.2s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-current);
    color: var(--stone);
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color 1.2s ease;
}

/* --- Wordmark --- */
.wordmark {
    position: fixed;
    top: 1.5rem;
    left: 3.5rem;
    z-index: 100;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3.2rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--parchment);
    mix-blend-mode: difference;
}

.wordmark-text {
    position: relative;
    z-index: 2;
}

.wordmark-dot {
    display: inline-block;
    animation: dotPulse 3s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.wordmark-glitch {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
}

.wordmark-glitch--red {
    color: var(--glitch-red);
}

.wordmark-glitch--cyan {
    color: var(--glitch-cyan);
}

.wordmark.glitch-active .wordmark-glitch--red {
    animation: glitchRed 400ms ease-out forwards;
}

.wordmark.glitch-active .wordmark-glitch--cyan {
    animation: glitchCyan 400ms ease-out forwards;
}

@keyframes glitchRed {
    0% { opacity: 0.8; transform: translateX(-4px); }
    60% { opacity: 0.4; transform: translateX(-1px); }
    100% { opacity: 0; transform: translateX(0); }
}

@keyframes glitchCyan {
    0% { opacity: 0.8; transform: translateX(4px); }
    60% { opacity: 0.4; transform: translateX(1px); }
    100% { opacity: 0; transform: translateX(0); }
}

/* --- Altitude Indicator --- */
.altitude-indicator {
    position: fixed;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    height: 60vh;
    width: 2px;
    z-index: 90;
}

.altitude-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: var(--stone);
    opacity: 0.3;
}

.altitude-tick {
    position: absolute;
    left: -3px;
    width: 8px;
    height: 2px;
    background: var(--stone);
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.altitude-tick[data-band="1"] { top: 0%; }
.altitude-tick[data-band="2"] { top: 25%; }
.altitude-tick[data-band="3"] { top: 50%; }
.altitude-tick[data-band="4"] { top: 75%; }
.altitude-tick[data-band="5"] { top: 100%; }

.altitude-tick.active {
    opacity: 1;
    background: var(--trail);
    width: 12px;
    left: -5px;
}

.altitude-marker {
    position: absolute;
    left: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--trail);
    border: 2px solid var(--stone);
    transition: top 0.6s ease-out;
    top: 0%;
}

/* --- Altitude Bands --- */
.altitude-band {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.band-valley {
    background-color: var(--ground);
    min-height: 100vh;
    padding: 8rem 2rem 4rem;
}

.band-slopes {
    background-color: #4A3A32;
    min-height: 90vh;
    padding: 4rem 2rem;
}

.band-treeline {
    background-color: var(--sky);
    min-height: 80vh;
    padding: 4rem 2vw;
}

.band-alpine {
    background-color: var(--summit-white);
    min-height: 70vh;
    padding: 6rem 2rem;
}

.band-summit {
    background-color: var(--summit-white);
    min-height: 60vh;
    padding: 8rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Contour Backgrounds --- */
.contour-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.contour-bg svg {
    width: 100%;
    height: 100%;
}

/* --- Band Grids --- */
.band-grid {
    position: relative;
    z-index: 1;
    margin: 0 auto;
}

.valley-grid {
    max-width: 900px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.valley-grid .block:first-child {
    grid-column: 1 / -1;
}

.slopes-grid {
    max-width: 1000px;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 1.2rem;
    align-items: start;
}

.treeline-grid {
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    align-items: start;
}

.alpine-grid {
    max-width: 600px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.summit-grid {
    max-width: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Blocks --- */
.block {
    position: relative;
    padding: 1.5rem;
    border-radius: 2px;
    overflow: hidden;
    transition: transform 300ms ease-out, box-shadow 300ms ease-out;
    cursor: default;
}

.block::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 168, 130, 0.2) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
    transition: none;
}

.block.ripple-active::after {
    animation: rippleExpand 800ms ease-out forwards;
}

@keyframes rippleExpand {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

.block:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(59, 47, 47, 0.12);
}

/* Block texture overlay */
.block-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
}

.block-texture::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle, var(--ground) 1px, transparent 1px),
        linear-gradient(2deg, rgba(59, 47, 47, 0.02) 0%, transparent 100%);
    background-size: 3px 3px, 100% 100%;
    opacity: 0.03;
}

/* Valley blocks */
.band-valley .block {
    background-color: rgba(196, 168, 130, 0.08);
    border: 1px solid rgba(196, 168, 130, 0.1);
}

/* Slopes blocks */
.band-slopes .block {
    background-color: rgba(240, 230, 211, 0.06);
    border: 1px solid rgba(196, 168, 130, 0.12);
}

/* Treeline blocks */
.band-treeline .block {
    background-color: rgba(59, 47, 47, 0.04);
    border: 1px solid rgba(59, 47, 47, 0.08);
}

/* Alpine blocks */
.band-alpine .block {
    background-color: transparent;
    border: 1px solid rgba(196, 168, 130, 0.15);
}

/* Summit block */
.block--summit {
    background-color: transparent;
    text-align: center;
    border: none;
}

/* --- Block Sizes --- */
.block--wide { grid-column: span 2; }
.block--wide-2 { grid-column: span 2; }
.block--narrow { max-width: 180px; }
.block--tall { min-height: 280px; }
.block--tall-sm { min-height: 180px; }
.block--squat { min-height: 80px; }
.block--low { min-height: 120px; }
.block--medium { min-height: 160px; }
.block--compact { padding: 0.8rem; }

/* Treeline compact overrides */
.treeline-grid .block--wide-2 {
    grid-column: span 2;
}

/* Alpine floating blocks */
.block--floating {
    justify-self: center;
}

.block--float-1 {
    grid-column: 1 / span 1;
    max-width: 260px;
    margin-top: 3rem;
}

.block--float-2 {
    grid-column: 2 / span 1;
    max-width: 200px;
    margin-top: 0;
    text-align: center;
}

.block--float-3 {
    grid-column: 1 / -1;
    max-width: 320px;
    justify-self: end;
    margin-top: 4rem;
}

/* --- Typography --- */
.display-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3.2rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.1;
    position: relative;
    z-index: 1;
}

.band-valley .display-text,
.band-slopes .display-text {
    color: var(--sky);
}

.band-treeline .display-text {
    color: var(--ground);
}

.band-alpine .display-text,
.band-summit .display-text {
    color: var(--ground);
}

.display-text--vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.15em;
    opacity: 0.6;
}

.display-text--large {
    font-size: clamp(2.4rem, 6vw, 5rem);
    font-weight: 500;
}

.display-text--medium {
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
}

.display-text--small {
    font-size: clamp(1rem, 2vw, 1.4rem);
    letter-spacing: 0.2em;
}

.display-text--summit {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--trail);
    letter-spacing: 0.12em;
    font-weight: 500;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    line-height: 1.75;
    position: relative;
    z-index: 1;
    margin-top: 0.5rem;
}

.band-valley .body-text,
.band-slopes .body-text {
    color: var(--stone);
}

.band-treeline .body-text {
    color: #5C4033;
}

.band-alpine .body-text,
.band-summit .body-text {
    color: #5C4033;
}

.mono-text {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: var(--brass);
    position: relative;
    z-index: 1;
}

.summit-elevation {
    margin-top: 1rem;
    font-size: 1rem;
}

/* --- Collage Fragments --- */
.collage-fragment {
    position: relative;
    width: 100%;
    height: 120px;
    margin-bottom: 0.8rem;
}

.collage-fragment--sm {
    height: 100px;
}

.collage-layer {
    position: absolute;
    width: 80%;
    height: 70%;
}

.collage-layer--1 {
    top: 0;
    left: 5%;
    background: var(--sage);
    opacity: 0.2;
    clip-path: polygon(8% 12%, 95% 3%, 88% 92%, 2% 85%);
}

.collage-layer--2 {
    top: 15%;
    left: 15%;
    background: var(--stone);
    opacity: 0.15;
    clip-path: polygon(3% 8%, 92% 15%, 97% 88%, 12% 95%);
}

.collage-layer--3 {
    top: 25%;
    left: 10%;
    background: var(--trail);
    opacity: 0.12;
    clip-path: polygon(12% 5%, 88% 10%, 93% 90%, 5% 92%);
}

.collage-layer--4 {
    top: 0;
    left: 0;
    background: var(--ground);
    opacity: 0.08;
    clip-path: polygon(5% 10%, 90% 2%, 95% 85%, 8% 93%);
    width: 90%;
    height: 80%;
}

.collage-layer--5 {
    top: 20%;
    left: 10%;
    background: var(--sage);
    opacity: 0.15;
    clip-path: polygon(10% 5%, 85% 12%, 92% 88%, 3% 90%);
    width: 85%;
    height: 75%;
}

/* --- Crystal Clusters --- */
.crystal-cluster {
    position: absolute;
    z-index: 2;
    display: flex;
    gap: 3px;
}

.crystal-cluster--1 {
    bottom: 2rem;
    right: 3rem;
}

.crystal-cluster--2 {
    bottom: 1rem;
    left: 4rem;
}

.crystal-cluster--3 {
    top: 2rem;
    right: 5rem;
}

.crystal {
    display: block;
    transform: rotate(var(--crystal-rotation, 0deg));
}

.crystal-cluster--1 .crystal:nth-child(1) { --crystal-rotation: 15deg; }
.crystal-cluster--1 .crystal:nth-child(2) { --crystal-rotation: -30deg; margin-top: 8px; }
.crystal-cluster--1 .crystal:nth-child(3) { --crystal-rotation: 45deg; margin-top: -4px; }
.crystal-cluster--1 .crystal:nth-child(4) { --crystal-rotation: -12deg; margin-top: 5px; }

.crystal-cluster--2 .crystal:nth-child(1) { --crystal-rotation: -20deg; }
.crystal-cluster--2 .crystal:nth-child(2) { --crystal-rotation: 35deg; margin-top: 6px; }
.crystal-cluster--2 .crystal:nth-child(3) { --crystal-rotation: -8deg; margin-top: -3px; }
.crystal-cluster--2 .crystal:nth-child(4) { --crystal-rotation: 50deg; margin-top: 4px; }
.crystal-cluster--2 .crystal:nth-child(5) { --crystal-rotation: -25deg; margin-top: 7px; }

.crystal-cluster--3 .crystal:nth-child(1) { --crystal-rotation: 22deg; }
.crystal-cluster--3 .crystal:nth-child(2) { --crystal-rotation: -40deg; margin-top: 5px; }
.crystal-cluster--3 .crystal:nth-child(3) { --crystal-rotation: 10deg; margin-top: -2px; }

/* --- Glitch Strata --- */
.glitch-strata {
    position: relative;
    width: 100%;
    height: 4px;
    overflow: hidden;
    z-index: 5;
}

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

/* --- Glitch on hover easter egg --- */
.block.glitch-hover {
    animation: hoverGlitch 150ms linear;
}

@keyframes hoverGlitch {
    0% { clip-path: inset(40% 0 55% 0); transform: translateX(2px); }
    50% { clip-path: inset(50% 0 40% 0); transform: translateX(-2px); }
    100% { clip-path: none; transform: translateX(0); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .wordmark {
        left: 2.8rem;
        font-size: 1.4rem;
    }

    .altitude-indicator {
        left: 0.5rem;
        height: 50vh;
    }

    .valley-grid {
        grid-template-columns: 1fr;
    }

    .valley-grid .block:first-child {
        grid-column: 1;
    }

    .slopes-grid {
        grid-template-columns: 1fr 1fr;
    }

    .treeline-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .alpine-grid {
        grid-template-columns: 1fr;
        max-width: 90%;
    }

    .block--float-3 {
        justify-self: center;
    }

    .block--wide,
    .block--wide-2 {
        grid-column: span 1;
    }

    .block--narrow {
        max-width: 100%;
    }

    .crystal-cluster {
        display: none;
    }
}

@media (max-width: 480px) {
    .slopes-grid {
        grid-template-columns: 1fr;
    }

    .treeline-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .altitude-indicator {
        display: none;
    }
}
