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

:root {
    --bg-light: #f5efe6;
    --bg-dark: #1e1a16;
    --text-light: #2d2824;
    --text-dark: #e8ddd0;
    --accent-primary: #c45d3e;
    --accent-secondary: #5b8a72;
    --glitch-pink: #e84f6a;
    --glitch-cyan: #3dd8c5;
    --muted-brown: #8c7054;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.6rem, 1.25rem);
    line-height: 1.7;
    color: var(--text-light);
    background: var(--bg-light);
    overflow-x: hidden;
    animation: glitchPulse 12s infinite;
}

@keyframes glitchPulse {
    0% { transform: none; filter: none; }
    49.8% { transform: none; filter: none; }
    49.9% { transform: translateX(2px); filter: hue-rotate(15deg); }
    50.1% { transform: translateX(-1px); filter: hue-rotate(-10deg); }
    50.2% { transform: none; filter: none; }
    100% { transform: none; filter: none; }
}

/* === FRAMES === */
.frame {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4rem 1rem;
}

.frame--light {
    background: var(--bg-light);
    color: var(--text-light);
}

.frame--dark {
    background: var(--bg-dark);
    color: var(--text-dark);
}

.frame__content {
    max-width: 42rem;
    width: 90%;
    margin: 0 auto;
    text-align: center;
}

/* === COORDINATE METADATA === */
.frame__coord {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.75rem, 0.8vw + 0.4rem, 0.875rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.5;
}

.frame--dark .frame__coord {
    color: var(--accent-secondary);
}

.frame--light .frame__coord {
    color: var(--muted-brown);
}

/* === WORDMARK === */
.wordmark {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(3rem, 7vw, 5rem);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.wordmark--small {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

/* === DISPLAY HEADINGS === */
.display-heading {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2.5rem, 6vw + 1rem, 5.5rem);
    font-variation-settings: 'wght' 300;
    letter-spacing: -0.03em;
    margin-bottom: 2rem;
    transition: font-variation-settings 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.display-heading.revealed {
    font-variation-settings: 'wght' 700;
}

.section-label {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1rem, 2vw + 0.5rem, 1.5rem);
    font-variation-settings: 'wght' 300;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    margin-bottom: 2rem;
    color: var(--muted-brown);
    transition: font-variation-settings 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.section-label.revealed {
    font-variation-settings: 'wght' 700;
}

/* === GLITCH TEXT === */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.glitch-text::before {
    color: var(--accent-primary);
    z-index: -1;
}

.glitch-text::after {
    color: var(--glitch-cyan);
    z-index: -1;
}

.glitch-text.active::before {
    opacity: 0.7;
    transform: translate(-2px, -1px);
}

.glitch-text.active::after {
    opacity: 0.7;
    transform: translate(2px, 1px);
}

/* === TAGLINE === */
.tagline {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(1rem, 1.5vw + 0.5rem, 1.3rem);
    font-weight: 400;
    max-width: 38ch;
    margin: 0 auto;
    opacity: 0.85;
}

/* === PROSE === */
.prose {
    text-align: left;
    max-width: 38ch;
    margin: 0 auto;
}

.prose p {
    margin-bottom: 2.4em;
}

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

/* === CODA === */
.coda {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(1rem, 1.5vw + 0.5rem, 1.3rem);
    margin-bottom: 3rem;
    opacity: 0.85;
}

/* === CURSOR LINE === */
.cursor-line {
    display: inline-block;
}

.mono-domain {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.875rem, 1vw + 0.5rem, 1.1rem);
    letter-spacing: 0.06em;
    color: var(--muted-brown);
}

.blink-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--accent-primary);
    vertical-align: middle;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

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

/* === STATUS INDICATORS === */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-secondary);
    margin-right: 0.75rem;
    vertical-align: middle;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* === EROSION BLOCKS === */
.erosion-block {
    position: absolute;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--muted-brown) 100%);
    mix-blend-mode: multiply;
    opacity: 0.6;
}

.frame--dark .erosion-block {
    mix-blend-mode: screen;
}

.erosion-block--top-right {
    width: 200px;
    height: 120px;
    top: 10%;
    right: 5%;
    clip-path: polygon(0% 0%, 85% 0%, 100% 15%, 100% 100%, 75% 100%, 70% 80%, 15% 85%, 0% 70%);
}

.erosion-block--large {
    position: relative;
    width: min(400px, 80vw);
    height: 250px;
    margin: 2rem auto;
    clip-path: polygon(0% 5%, 20% 0%, 45% 3%, 70% 0%, 100% 8%, 98% 30%, 100% 60%, 95% 85%, 100% 100%, 80% 98%, 55% 100%, 30% 95%, 0% 100%, 3% 75%, 0% 45%, 5% 20%);
}

/* === GLITCH SEPARATOR === */
.glitch-separator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-primary);
    clip-path: polygon(0% 0%, 5% 100%, 12% 0%, 18% 100%, 25% 0%, 33% 100%, 40% 0%, 48% 100%, 55% 0%, 62% 100%, 70% 0%, 78% 100%, 85% 0%, 92% 100%, 100% 0%, 100% 100%, 0% 100%);
}

/* === SCANLINES === */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        to bottom,
        #2d2824 0px,
        #2d2824 1px,
        transparent 1px,
        transparent 4px
    );
    opacity: 0.04;
    pointer-events: none;
}

/* === PIXEL RAIN === */
.pixel-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.rain-drop {
    position: absolute;
    width: var(--size);
    height: var(--size);
    background: var(--color);
    left: var(--x);
    top: -10px;
    opacity: 0.4;
    mix-blend-mode: overlay;
    animation: fall var(--duration) linear infinite;
}

@keyframes fall {
    0% { transform: translateY(-10px); }
    100% { transform: translateY(100vh); }
}

/* === REVEAL ANIMATIONS === */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

[data-reveal].visible {
    opacity: 1;
    transform: translateY(0);
}

/* === FRAME 04 GLITCH === */
#frame04 .frame__content {
    animation: microGlitch 8s infinite;
}

@keyframes microGlitch {
    0% { transform: none; }
    98.5% { transform: none; }
    99% { transform: translateX(1px); }
    99.5% { transform: translateX(-1px); }
    100% { transform: none; }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .erosion-block--top-right {
        width: 120px;
        height: 80px;
    }

    .rain-drop:nth-child(n+13) {
        display: none;
    }
}

@media (max-width: 480px) {
    .frame__coord {
        display: none;
    }

    .glitch-text.active::before {
        transform: translate(-1px, -1px);
    }

    .glitch-text.active::after {
        transform: translate(1px, 1px);
    }
}
