/* ============================================
   moral.quest - Corporate Seance Modernism
   ============================================ */

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

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

body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #4a4035;
    background-color: #e8e0d0;
    overflow-x: hidden;
}

/* ---- Grain Overlay ---- */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.grain-overlay::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.04;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 9999;
}

/* ---- Zone Base ---- */
.zone {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.zone-content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 5vw;
}

/* ---- Slide Reveal Animations ---- */
.slide-reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.slide-reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.slide-reveal-left.visible,
.slide-reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ---- Zone Markers ---- */
.zone-marker {
    display: block;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a7060;
    margin-bottom: 2rem;
}

.zone-marker-light {
    color: #8a8070;
}

/* ============================================
   ZONE I - The Foyer
   ============================================ */
.zone-foyer {
    min-height: 100vh;
    background-color: #e8e0d0;
    display: flex;
    align-items: center;
}

.zone-foyer .zone-content {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    padding-top: 8vh;
    padding-bottom: 8vh;
}

.foyer-title {
    grid-column: 1;
    grid-row: 1;
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    letter-spacing: 0.02em;
    line-height: 1.05;
    color: #2a2520;
    align-self: start;
    justify-self: start;
    position: relative;
}

.foyer-subtitle {
    grid-column: 2;
    grid-row: 1;
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: #7a7060;
    align-self: start;
    justify-self: end;
    text-align: right;
    font-style: italic;
    padding-top: 1.5rem;
}

.foyer-vine {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.foyer-vine .vine-path {
    filter: drop-shadow(0 0 2px rgba(138, 122, 80, 0.3));
}

.foyer-vine .vine-leaf {
    filter: drop-shadow(0 0 2px rgba(138, 122, 80, 0.3));
}

.foyer-question {
    grid-column: 2;
    grid-row: 3;
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    color: #4a4035;
    align-self: end;
    justify-self: end;
    text-align: right;
    position: relative;
    z-index: 2;
}

/* ============================================
   ZONE II - The Archive
   ============================================ */
.zone-archive {
    min-height: 120vh;
    background-color: #e8e0d0;
    padding: 8vh 0;
}

.archive-columns {
    display: grid;
    grid-template-columns: 55% 5% 40%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 5vw;
    min-height: 100%;
}

.archive-left {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding-right: 2rem;
}

.archive-text-block p {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.72;
    color: #4a4035;
}

.archive-vine-gutter {
    position: relative;
    display: flex;
    align-items: stretch;
}

.gutter-vine {
    width: 100%;
    height: 100%;
}

.gutter-vine .vine-path {
    filter: drop-shadow(0 0 2px rgba(138, 122, 80, 0.3));
}

.archive-right {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding-left: 2rem;
    justify-content: center;
}

/* File Cards */
.file-card {
    background: #f0e8d8;
    border: 1px solid #6a7a5a;
    border-radius: 8px;
    padding: 2rem 2.2rem;
    position: relative;
    overflow: hidden;
}

.file-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #8a7a50;
    opacity: 0.6;
}

.file-card-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a7060;
    display: block;
    margin-bottom: 0.8rem;
}

.file-card-title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 1.8vw, 1.5rem);
    letter-spacing: 0.02em;
    line-height: 1.2;
    color: #2a2520;
    margin-bottom: 0.8rem;
}

.file-card-body {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.65;
    color: #4a4035;
}

/* ============================================
   ZONE III - The Greenhouse
   ============================================ */
.zone-greenhouse {
    min-height: 100vh;
    background-color: #3a3f2a;
    position: relative;
}

.greenhouse-content {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vh 5vw;
}

.greenhouse-vine {
    position: absolute;
    top: 5%;
    left: 10%;
    width: 80%;
    height: 90%;
    z-index: 1;
    pointer-events: none;
}

.greenhouse-vine .vine-path {
    filter: drop-shadow(0 0 3px rgba(138, 122, 80, 0.4));
}

.greenhouse-provocations {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12vh;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.provocation {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    letter-spacing: 0.02em;
    line-height: 1.2;
    color: #e8e0d0;
    text-align: center;
}

.provocation-1 {
    align-self: flex-start;
    text-align: left;
}

.provocation-2 {
    align-self: flex-end;
    text-align: right;
}

.provocation-3 {
    align-self: flex-start;
    text-align: left;
}

.zone-greenhouse .zone-marker-light {
    position: absolute;
    bottom: 4vh;
    left: 5vw;
    z-index: 2;
}

/* ============================================
   ZONE IV - The Interference
   ============================================ */
.zone-interference {
    min-height: 110vh;
    background-color: #e8e0d0;
    position: relative;
    padding: 8vh 0;
}

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

.interference-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 6vh 5vw;
    min-height: 80vh;
    align-items: center;
    position: relative;
    margin-top: 4rem;
}

.moral-fragment p {
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: clamp(1.05rem, 1.5vw, 1.3rem);
    line-height: 1.6;
    color: #4a4035;
}

.fragment-tl {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    max-width: 85%;
}

.fragment-tr {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    text-align: right;
    max-width: 85%;
}

.fragment-bl {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    max-width: 85%;
}

.fragment-br {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    text-align: right;
    max-width: 85%;
}

.interference-vine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Glitch Zone Effects */
.glitch-zone {
    position: relative;
}

.glitch-zone::before,
.glitch-zone::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: clamp(1.05rem, 1.5vw, 1.3rem);
    line-height: 1.6;
    pointer-events: none;
}

.glitch-zone::before {
    color: #b87a6a;
    clip-path: polygon(0 0, 0 0, 0 0, 0 0);
    opacity: 0;
    animation: glitch-shift-1 8s steps(1) infinite;
}

.glitch-zone::after {
    color: #7a8a6a;
    clip-path: polygon(0 0, 0 0, 0 0, 0 0);
    opacity: 0;
    animation: glitch-shift-2 6s steps(1) infinite;
    animation-delay: -2s;
}

/* Glitch Tears - horizontal strips */
.glitch-tear {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: #e8e0d0;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
}

.glitch-tear-1 {
    top: 25%;
    animation: tear-glitch 4s steps(1) infinite;
}

.glitch-tear-2 {
    top: 55%;
    animation: tear-glitch 6s steps(1) infinite;
    animation-delay: -1.5s;
}

.glitch-tear-3 {
    top: 78%;
    animation: tear-glitch 5s steps(1) infinite;
    animation-delay: -3s;
}

@keyframes glitch-shift-1 {
    0%, 94% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); opacity: 0; transform: translateX(0); }
    95% { clip-path: polygon(0 20%, 100% 20%, 100% 25%, 0 25%); opacity: 0.7; transform: translateX(12px); }
    96% { clip-path: polygon(0 55%, 100% 55%, 100% 58%, 0 58%); opacity: 0.5; transform: translateX(-8px); }
    97%, 100% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); opacity: 0; transform: translateX(0); }
}

@keyframes glitch-shift-2 {
    0%, 93% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); opacity: 0; transform: translateX(0); }
    94% { clip-path: polygon(0 40%, 100% 40%, 100% 43%, 0 43%); opacity: 0.6; transform: translateX(-10px); }
    95% { clip-path: polygon(0 70%, 100% 70%, 100% 73%, 0 73%); opacity: 0.4; transform: translateX(6px); }
    96%, 100% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); opacity: 0; transform: translateX(0); }
}

@keyframes tear-glitch {
    0%, 94% { opacity: 0; transform: translateX(0); }
    95% { opacity: 1; transform: translateX(15px); }
    96% { opacity: 1; transform: translateX(-10px); }
    96.5%, 100% { opacity: 0; transform: translateX(0); }
}

/* ============================================
   ZONE V - The Registry
   ============================================ */
.zone-registry {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #e8e0d0 0%, #2a2520 100%);
}

.registry-content {
    position: relative;
    text-align: center;
    padding: 8vh 5vw;
    max-width: 900px;
    width: 100%;
}

.registry-title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 8vw, 7rem);
    letter-spacing: 0.02em;
    line-height: 1.05;
    color: #e8e0d0;
    margin-bottom: 2rem;
    position: relative;
}

.registry-closing {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.6vw, 1.4rem);
    line-height: 1.65;
    color: #c8bfb0;
    max-width: 600px;
    margin: 0 auto;
}

/* Botanical Corner Ornaments */
.botanical-corner {
    position: absolute;
    width: 100px;
    height: 100px;
    z-index: 2;
}

.corner-tl {
    top: 2rem;
    left: 2rem;
}

.corner-tr {
    top: 2rem;
    right: 2rem;
}

.corner-bl {
    bottom: 2rem;
    left: 2rem;
}

.corner-br {
    bottom: 2rem;
    right: 2rem;
}

/* ============================================
   SVG Vine Animation Base
   ============================================ */
.vine-path {
    filter: drop-shadow(0 0 2px rgba(138, 122, 80, 0.3));
}

.vine-leaf {
    filter: drop-shadow(0 0 2px rgba(138, 122, 80, 0.3));
    opacity: 0;
    transition: opacity 1.2s ease;
}

.vine-leaf.drawn {
    opacity: 1;
}

/* ============================================
   Responsive - Mobile (<768px)
   ============================================ */
@media (max-width: 768px) {
    /* Foyer */
    .zone-foyer .zone-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        padding-top: 12vh;
    }

    .foyer-title {
        grid-column: 1;
        font-size: clamp(2.2rem, 10vw, 3.5rem);
    }

    .foyer-subtitle {
        grid-column: 1;
        justify-self: start;
        text-align: left;
        padding-top: 1rem;
    }

    .foyer-question {
        grid-column: 1;
        justify-self: start;
        text-align: left;
    }

    /* Archive */
    .archive-columns {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .archive-vine-gutter {
        display: none;
    }

    .archive-left {
        padding-right: 0;
    }

    .archive-right {
        padding-left: 0;
    }

    /* Interference */
    .interference-grid {
        grid-template-columns: 1fr;
        gap: 4vh;
    }

    .fragment-tl, .fragment-tr, .fragment-bl, .fragment-br {
        justify-self: start;
        text-align: left;
        max-width: 100%;
    }

    /* Slide reveal reduced */
    .slide-reveal-left {
        transform: translateX(-20px);
    }

    .slide-reveal-right {
        transform: translateX(20px);
    }

    /* Glitch reduced on mobile */
    .glitch-zone::before {
        animation-name: glitch-shift-mobile-1;
    }

    .glitch-zone::after {
        animation-name: glitch-shift-mobile-2;
    }

    .glitch-tear {
        display: none;
    }

    /* Corner ornaments smaller */
    .botanical-corner {
        width: 60px;
        height: 60px;
    }

    .corner-tl { top: 1rem; left: 1rem; }
    .corner-tr { top: 1rem; right: 1rem; }
    .corner-bl { bottom: 1rem; left: 1rem; }
    .corner-br { bottom: 1rem; right: 1rem; }
}

@keyframes glitch-shift-mobile-1 {
    0%, 94% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); opacity: 0; transform: translateX(0); }
    95% { clip-path: polygon(0 20%, 100% 20%, 100% 25%, 0 25%); opacity: 0.5; transform: translateX(6px); }
    96%, 100% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); opacity: 0; transform: translateX(0); }
}

@keyframes glitch-shift-mobile-2 {
    0%, 93% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); opacity: 0; transform: translateX(0); }
    94% { clip-path: polygon(0 40%, 100% 40%, 100% 43%, 0 43%); opacity: 0.4; transform: translateX(-5px); }
    95%, 100% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); opacity: 0; transform: translateX(0); }
}
