/* ============================================
   ppzz.ee — Surreal Earth-Tone Dreamscape
   ============================================ */

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

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

body {
    background-color: #F6F0E4;
    color: #4A3A28;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Retro Pattern Background Layer --- */
#retro-pattern-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

#retro-svg {
    width: 100%;
    height: 100%;
}

/* --- Glitch Overlay --- */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(176, 112, 64, 0.08) 15%,
        transparent 30%,
        rgba(138, 112, 80, 0.05) 50%,
        transparent 70%,
        rgba(176, 112, 64, 0.08) 85%,
        transparent 100%
    );
    mix-blend-mode: multiply;
}

.glitch-overlay.active {
    animation: glitchFlash 0.15s step-end forwards;
}

@keyframes glitchFlash {
    0% { opacity: 1; transform: translateX(-3px); }
    20% { opacity: 1; transform: translateX(5px); }
    40% { opacity: 1; transform: translateX(-2px) skewX(1deg); }
    60% { opacity: 1; transform: translateX(3px); }
    80% { opacity: 1; transform: translateX(-1px) skewX(-0.5deg); }
    100% { opacity: 0; transform: translateX(0); }
}

/* --- Glitch Scanlines --- */
.glitch-scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9998;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(26, 20, 8, 0.015) 2px,
        rgba(26, 20, 8, 0.015) 4px
    );
    opacity: 0;
    transition: opacity 0.1s;
}

.glitch-scanlines.active {
    opacity: 1;
}

/* --- Sections --- */
.section {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.section-inner {
    max-width: 800px;
    width: 100%;
    padding: 0 clamp(24px, 5vw, 80px);
    margin: 0 auto;
}

/* --- Section Glitch Borders --- */
.section-glitch-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        #B07040 10%,
        transparent 20%,
        #8A7050 40%,
        transparent 50%,
        #B07040 70%,
        transparent 80%,
        #8A7050 90%,
        transparent 100%
    );
    opacity: 0.4;
}

/* --- Glitch Text Effect --- */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: #B07040;
    z-index: -1;
}

.glitch-text::after {
    color: #8A7050;
    z-index: -1;
}

.glitch-text.glitching::before {
    animation: glitchBefore 0.2s step-end;
    opacity: 0.6;
}

.glitch-text.glitching::after {
    animation: glitchAfter 0.2s step-end;
    opacity: 0.6;
}

@keyframes glitchBefore {
    0% { transform: translate(-2px, 1px); clip-path: inset(20% 0 40% 0); }
    25% { transform: translate(2px, -1px); clip-path: inset(60% 0 10% 0); }
    50% { transform: translate(-1px, 2px); clip-path: inset(10% 0 70% 0); }
    75% { transform: translate(1px, -2px); clip-path: inset(40% 0 30% 0); }
    100% { transform: translate(0); clip-path: inset(0); opacity: 0; }
}

@keyframes glitchAfter {
    0% { transform: translate(2px, -1px); clip-path: inset(50% 0 20% 0); }
    25% { transform: translate(-2px, 1px); clip-path: inset(10% 0 50% 0); }
    50% { transform: translate(1px, -2px); clip-path: inset(30% 0 40% 0); }
    75% { transform: translate(-1px, 2px); clip-path: inset(70% 0 5% 0); }
    100% { transform: translate(0); clip-path: inset(0); opacity: 0; }
}

@keyframes realityGlitch {
    0% { transform: translateX(-3px); opacity: 1; }
    25% { transform: translateX(5px) skewX(0.5deg); opacity: 0.8; }
    50% { transform: translateX(-2px); opacity: 1; }
    75% { transform: translateX(4px) skewX(-0.3deg); opacity: 0.9; }
    100% { transform: translateX(0); opacity: 1; }
}

/* =============================
   SECTION 1: Hero
   ============================= */
.section-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-ambient-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
    z-index: 0;
}

.section-hero .section-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.hero-title-container {
    overflow: hidden;
    width: 100%;
}

.hero-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 14vw, 12rem);
    color: #1A1408;
    letter-spacing: -0.02em;
    line-height: 0.95;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.hero-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.5s ease 0.4s, transform 1.5s ease 0.4s;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
    opacity: 0;
    transition: opacity 1.8s ease 0.6s;
}

.hero-divider.visible {
    opacity: 1;
}

.hero-divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #C0A078, transparent);
}

.hero-divider-label {
    font-size: 0.65rem;
    white-space: nowrap;
}

.hero-photo {
    width: 100%;
    max-width: 600px;
    height: 300px;
    margin-top: 1rem;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 2s ease 0.8s, transform 2s ease 0.8s;
}

.hero-photo.visible {
    opacity: 1;
    transform: scale(1);
}

/* --- Duotone Photos --- */
.duotone-photo {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.duotone-photo-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        #E8DCC8 0%,
        #C0A078 30%,
        #8A7050 60%,
        #4A3A28 100%
    );
    filter: grayscale(0.6) contrast(1.1);
    mix-blend-mode: multiply;
    transition: transform 0.6s ease;
}

.duotone-photo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        rgba(232, 220, 200, 0.3) 0%,
        rgba(192, 160, 120, 0.2) 50%,
        rgba(138, 112, 80, 0.3) 100%
    );
    mix-blend-mode: overlay;
    pointer-events: none;
}

.duotone-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 128 128' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* =============================
   SECTION 2: Dream States
   ============================= */
.section-dreamscape {
    background-color: #F6F0E4;
}

.section-heading {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 7vw, 6rem);
    color: #1A1408;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 1.5rem;
}

.section-body {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.85;
    color: #4A3A28;
    margin-bottom: 3rem;
}

.dream-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #8A7050;
    letter-spacing: 0.05em;
}

.dream-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.dream-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.dream-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.dream-card .duotone-photo {
    width: 100%;
    height: 200px;
}

.dream-card-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    line-height: 1.65;
    color: #8A7050;
}

.dream-photo-1 .duotone-photo-inner {
    background: linear-gradient(135deg, #E8DCC8, #B07040 40%, #4A3A28);
}

.dream-photo-2 .duotone-photo-inner {
    background: linear-gradient(225deg, #C0A078, #8A7050 50%, #1A1408);
}

.dream-photo-3 .duotone-photo-inner {
    background: linear-gradient(45deg, #F6F0E4, #C0A078 40%, #8A7050 80%, #4A3A28);
}

/* =============================
   SECTION 3: Scale Hallucination
   ============================= */
.section-scale {
    background-color: #1A1408;
    overflow: hidden;
}

.section-scale .section-body {
    color: #E8DCC8;
}

.scale-text-container {
    display: flex;
    justify-content: center;
    gap: 0.5vw;
    margin-bottom: 3rem;
    overflow: hidden;
}

.scale-letter {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(4rem, 12vw, 10rem);
    color: #C0A078;
    line-height: 1;
    display: inline-block;
    opacity: 0;
    transform: translateY(100%) scale(0.8);
    transition: opacity 0.6s ease, transform 0.8s ease;
}

.scale-letter.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.scale-metrics {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin: 2.5rem 0;
    max-width: 500px;
}

.scale-metric {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-metric.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-metric .dream-label {
    color: #8A7050;
}

.scale-metric-bar {
    width: 100%;
    height: 3px;
    background-color: rgba(138, 112, 80, 0.2);
    border-radius: 1px;
    overflow: hidden;
}

.scale-metric-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #B07040, #C0A078);
    border-radius: 1px;
    transition: width 1.5s ease;
}

.scale-label {
    color: #8A7050;
    margin-top: 2rem;
    display: block;
    text-align: center;
}

/* =============================
   SECTION 4: Pattern Hallucination
   ============================= */
.section-patterns {
    background-color: #E8DCC8;
}

.pattern-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.pattern-tile {
    position: relative;
    height: 250px;
    overflow: hidden;
    border-radius: 2px;
    background-color: #F6F0E4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 1rem;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.pattern-tile.visible {
    opacity: 1;
    transform: scale(1);
}

.pattern-tile svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.pattern-tile .dream-label {
    position: relative;
    z-index: 2;
}

/* =============================
   SECTION 5: Duotone States
   ============================= */
.section-duotone {
    background-color: #F6F0E4;
}

.duotone-gallery {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    min-height: 400px;
}

.duotone-large {
    height: 400px;
    position: relative;
}

.duotone-large .duotone-photo-inner {
    background: linear-gradient(180deg, #E8DCC8, #B07040 35%, #8A7050 65%, #1A1408);
}

.duotone-label-overlay {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 2;
}

.duotone-label-overlay .dream-label {
    color: #F6F0E4;
    background: rgba(26, 20, 8, 0.5);
    padding: 0.3rem 0.6rem;
}

.duotone-label-sm {
    bottom: 1rem;
    left: 1rem;
}

.duotone-small-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.duotone-small {
    flex: 1;
    position: relative;
}

.duotone-small:first-child .duotone-photo-inner {
    background: linear-gradient(135deg, #C0A078, #4A3A28);
}

.duotone-small:last-child .duotone-photo-inner {
    background: linear-gradient(225deg, #E8DCC8, #8A7050 50%, #1A1408);
}

/* =============================
   SECTION 6: Grand Theater
   ============================= */
.section-theater {
    background-color: #4A3A28;
}

.section-theater .section-heading {
    color: #F6F0E4;
}

.section-theater .section-body {
    color: #E8DCC8;
}

.theater-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.theater-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.theater-column.visible {
    opacity: 1;
    transform: translateY(0);
}

.theater-line {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #B07040, #C0A078, transparent);
}

.theater-column .dream-label {
    color: #C0A078;
}

.theater-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    line-height: 1.75;
    color: #E8DCC8;
}

.theater-ornament {
    margin-top: auto;
    padding-top: 1rem;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

.theater-column:hover .theater-ornament {
    opacity: 1;
}

/* =============================
   SECTION 7: Closing
   ============================= */
.section-closing {
    min-height: 60vh;
    background-color: #1A1408;
}

.section-closing .section-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.closing-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 8vw, 7rem);
    color: #C0A078;
    letter-spacing: -0.02em;
    line-height: 1;
}

.closing-label {
    color: #8A7050;
}

.closing-lines {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 60px;
    margin-top: 2rem;
}

.closing-line {
    height: 2px;
    background-color: #B07040;
    opacity: 0;
    transition: opacity 1s ease, width 1s ease;
}

.closing-line:nth-child(1) { width: 60px; }
.closing-line:nth-child(2) { width: 40px; margin-left: auto; margin-right: auto; }
.closing-line:nth-child(3) { width: 20px; margin-left: auto; margin-right: auto; }

.closing-whisper {
    opacity: 0;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: #8A7050;
    margin-top: 1rem;
    transition: opacity 2s ease 1.5s;
}

.closing-whisper.visible {
    opacity: 0.5;
}

/* =============================
   Scroll-reveal base
   ============================= */
.section-heading,
.section-body,
.duotone-gallery,
.theater-columns {
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section-heading.visible,
.section-body.visible,
.duotone-gallery.visible,
.theater-columns.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =============================
   Responsive
   ============================= */
@media (max-width: 768px) {
    .dream-grid {
        grid-template-columns: 1fr;
    }

    .dream-card .duotone-photo {
        height: 180px;
    }

    .pattern-showcase {
        grid-template-columns: 1fr;
    }

    .pattern-tile {
        height: 180px;
    }

    .duotone-gallery {
        grid-template-columns: 1fr;
    }

    .duotone-large {
        height: 280px;
    }

    .duotone-small-stack {
        flex-direction: row;
    }

    .duotone-small {
        height: 180px;
    }

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

    .scale-letter {
        font-size: clamp(3rem, 10vw, 7rem);
    }

    .hero-divider {
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2.5rem, 14vw, 5rem);
    }

    .section-heading {
        font-size: clamp(2rem, 7vw, 3.5rem);
    }

    .duotone-small-stack {
        flex-direction: column;
    }

    .duotone-small {
        height: 150px;
    }
}
