/* ============================================================
   LOTUS.DEV - HOLOGRAPHIC TERRACOTTA SANCTUARY
   Compliance tokens: IBM Plex Mono" (Google Fonts IBM Plex Sans" Material: Material:** IntersectionObserver` (vanilla JS
   ============================================================ */

/* CSS Variables */
:root {
    --deep-ground: #1a0e09;
    --terracotta-core: #c9734a;
    --fired-clay: #e8a87c;
    --holographic-violet: #c4a1e0;
    --holographic-cyan: #8fd4c8;
    --bone-white: #f0e6db;
    --signal-red: #e0453a;
    --void: #0c0806;
    --baseline: 1.72rem;
    --half-baseline: 0.86rem;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--bone-white);
    background: linear-gradient(
        to bottom,
        var(--deep-ground) 0%,
        var(--void) 30%,
        var(--void) 70%,
        var(--deep-ground) 100%
    );
    overflow-x: hidden;
    position: relative;
    transition: background 800ms ease-out;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: -20vmax;
    pointer-events: none;
    z-index: 0;
    opacity: 0.48;
    mix-blend-mode: screen;
}

body::before {
    background:
        radial-gradient(circle at 14% 22%, rgba(196, 161, 224, 0.18), transparent 24%),
        radial-gradient(circle at 86% 36%, rgba(143, 212, 200, 0.14), transparent 22%),
        radial-gradient(circle at 72% 82%, rgba(201, 115, 74, 0.16), transparent 28%);
    animation: ambient-drift 28s ease-in-out infinite alternate;
}

body::after {
    background:
        repeating-linear-gradient(115deg, transparent 0 17px, rgba(196, 161, 224, 0.035) 17px 18px, transparent 18px 31px),
        repeating-linear-gradient(64deg, transparent 0 23px, rgba(143, 212, 200, 0.03) 23px 24px, transparent 24px 43px);
    animation: moire-slide 18s linear infinite;
}

/* ============================================================
   SCAN-LINE OVERLAY
   ============================================================ */

.scan-line-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(240, 230, 219, 0.04) 3px,
        rgba(240, 230, 219, 0.04) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

@media (max-width: 768px) {
    .scan-line-overlay {
        background: repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(240, 230, 219, 0.02) 3px,
            rgba(240, 230, 219, 0.02) 4px
        );
    }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes hue-rotate-shift {
    0% { filter: hue-rotate(0deg); }
    25% { filter: hue-rotate(15deg); }
    50% { filter: hue-rotate(0deg); }
    75% { filter: hue-rotate(-15deg); }
    100% { filter: hue-rotate(0deg); }
}

@keyframes holographic-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes glitch-entry {
    0% { transform: translate(0); clip-path: inset(0 0 0 0); }
    14% { transform: translate(-3px, 1px); clip-path: inset(20% 0 40% 0); }
    15% { transform: translate(2px, -1px); clip-path: inset(60% 0 10% 0); }
    44% { transform: translate(-1px, 2px); clip-path: inset(10% 0 70% 0); }
    45% { transform: translate(0); clip-path: inset(0 0 0 0); }
    100% { transform: translate(0); clip-path: inset(0 0 0 0); }
}

@keyframes glitch-divider-shift {
    0% { transform: translateX(0); }
    100% { transform: translateX(4px); }
}

@keyframes glitch-divider-shift-reverse {
    0% { transform: translateX(0); }
    100% { transform: translateX(-4px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes data-drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(-100vh); }
}

@keyframes signal-flash {
    0%, 100% { color: var(--bone-white); text-shadow: none; }
    50% { color: var(--signal-red); text-shadow: 0 0 10px rgba(224, 69, 58, 0.5); }
}

@keyframes ambient-drift {
    0% { transform: translate3d(-2%, 1%, 0) rotate(0deg) scale(1); }
    100% { transform: translate3d(2%, -2%, 0) rotate(5deg) scale(1.06); }
}

@keyframes moire-slide {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(42px, -26px, 0); }
}

@keyframes title-tear {
    0%, 100% { text-shadow: -2px 0 rgba(196, 161, 224, 0.34), 2px 0 rgba(143, 212, 200, 0.28), 0 0 34px rgba(12, 8, 6, 0.28); }
    35% { text-shadow: -5px 1px rgba(224, 69, 58, 0.38), 3px -1px rgba(143, 212, 200, 0.28), 0 0 42px rgba(12, 8, 6, 0.34); }
    36% { text-shadow: 3px -2px rgba(196, 161, 224, 0.42), -4px 1px rgba(224, 69, 58, 0.22), 0 0 22px rgba(12, 8, 6, 0.42); }
}

/* ============================================================
   STRATUM BASE
   ============================================================ */

.stratum {
    width: 100%;
    padding: calc(var(--baseline) * 3) var(--half-baseline);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.stratum-content {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* ============================================================
   STRATUM 0: THE FRACTURE POINT
   ============================================================ */

.stratum-0 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        135deg,
        #c4a1e0 0%,
        #e8a87c 50%,
        #8fd4c8 100%
    );
    animation: hue-rotate-shift 12s ease-in-out infinite;
    overflow: hidden;
}

.stratum-0::after {
    content: '';
    position: absolute;
    inset: 10%;
    background:
        linear-gradient(45deg, transparent 48%, rgba(26, 14, 9, 0.26) 49%, rgba(26, 14, 9, 0.26) 51%, transparent 52%),
        linear-gradient(-18deg, transparent 46%, rgba(107, 58, 42, 0.20) 47%, rgba(107, 58, 42, 0.20) 49%, transparent 50%);
    clip-path: polygon(0 18%, 18% 18%, 18% 0, 30% 0, 30% 40%, 100% 40%, 100% 52%, 64% 52%, 64% 100%, 52% 100%, 52% 64%, 0 64%);
    opacity: 0.58;
    mix-blend-mode: multiply;
    z-index: 4;
}

.lotus-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(6rem, 18vw, 14rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 0.95;
    text-transform: uppercase;
    color: var(--void);
    text-align: center;
    will-change: transform;
    position: relative;
    z-index: 10;
    animation: title-tear 5.6s steps(1, end) infinite;
}

.lotus-title span {
    display: inline-block;
}

.lotus-title span:nth-child(1) { transform: translate(-4px, 2px); }
.lotus-title span:nth-child(2) { transform: translate(3px, -3px); }
.lotus-title span:nth-child(3) { transform: translate(-2px, 5px); }
.lotus-title span:nth-child(4) { transform: translate(5px, -1px); }
.lotus-title span:nth-child(5) { transform: translate(-3px, 3px); }

.lotus-title.glitching span:nth-child(odd) {
    animation: glitch-entry 400ms ease-out forwards;
}

.lotus-title.glitching span:nth-child(even) {
    animation: glitch-entry 400ms ease-out reverse forwards;
}

/* Horizontal scan-line overlay on title */
.stratum-0::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.08) 4px,
        rgba(255, 255, 255, 0.08) 5px
    );
    pointer-events: none;
    z-index: 5;
}

/* ============================================================
   STRATUM 1: THE MANIFESTO
   ============================================================ */

.stratum-1 {
    background: linear-gradient(
        to bottom,
        var(--deep-ground),
        var(--void)
    );
}

.manifesto-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    text-align: justify;
    max-width: 680px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.manifesto-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.manifesto-divider {
    position: absolute;
    width: 1px;
    background-color: var(--terracotta-core);
    opacity: 0.3;
    top: 0;
    bottom: 0;
}

.manifesto-divider.left {
    left: calc(50% - 360px);
}

.manifesto-divider.right {
    right: calc(50% - 360px);
}

@media (max-width: 768px) {
    .manifesto-divider {
        display: none;
    }
}

/* ============================================================
   LOTUS GLYPH SECTION
   ============================================================ */

.lotus-glyph-section {
    min-height: auto;
    padding: calc(var(--baseline) * 2) var(--half-baseline);
    background: var(--void);
}

.lotus-glyph {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    position: relative;
    animation: spin 60s linear infinite;
    border: 1px solid var(--terracotta-core);
    opacity: 0.4;
    border-radius: 50%;
    box-shadow:
        0 0 30px rgba(196, 161, 224, 0.15),
        0 0 60px rgba(143, 212, 200, 0.1),
        inset 0 0 30px rgba(201, 115, 74, 0.1);
}

.lotus-glyph .petal {
    position: absolute;
    width: 42px;
    height: 92px;
    top: 18px;
    left: 78px;
    border: 1px solid rgba(201, 115, 74, 0.82);
    border-radius: 64% 54% 45% 55%;
    transform-origin: 50% 82px;
    box-shadow: 0 0 18px rgba(196, 161, 224, 0.13);
}

.lotus-glyph .p1 { transform: rotate(0deg) translate(1px, -2px); }
.lotus-glyph .p2 { transform: rotate(45deg) translate(-1px, 1px); border-radius: 58% 62% 42% 48%; }
.lotus-glyph .p3 { transform: rotate(90deg) translate(2px, 0); }
.lotus-glyph .p4 { transform: rotate(135deg) translate(-2px, 1px); border-radius: 62% 52% 50% 44%; }
.lotus-glyph .p5 { transform: rotate(180deg) translate(0, -1px); }
.lotus-glyph .p6 { transform: rotate(225deg) translate(1px, 2px); border-radius: 55% 60% 46% 52%; }
.lotus-glyph .p7 { transform: rotate(270deg) translate(-1px, -2px); }
.lotus-glyph .p8 { transform: rotate(315deg) translate(2px, 1px); border-radius: 60% 48% 52% 47%; }

/* ============================================================
   STRATUM 2: THE GLITCH GALLERY
   ============================================================ */

.stratum-2 {
    background: linear-gradient(
        to bottom,
        var(--void),
        var(--deep-ground)
    );
}

.glitch-block {
    margin: calc(var(--baseline) * 2) 0;
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.glitch-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.block-heading {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(2.2rem, 5.5vw, 4.8rem);
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 0.95;
    text-transform: uppercase;
    margin-bottom: var(--baseline);
    will-change: transform;
}

.holographic-text {
    background: linear-gradient(
        135deg,
        var(--holographic-violet),
        var(--holographic-cyan),
        var(--fired-clay),
        var(--holographic-violet)
    );
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: holographic-shift 8s ease-in-out infinite alternate;
    will-change: background-position;
}

.glitch-block.animate-glitch .block-heading {
    animation: glitch-entry 400ms ease-out forwards;
}

.block-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    line-height: 1.72;
    max-width: 680px;
    margin: 0 auto;
}

/* Glitch Dividers */
.glitch-divider {
    height: 60px;
    margin: calc(var(--baseline) * 2) 0;
    position: relative;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(201, 115, 74, 0.15) 2px,
            rgba(201, 115, 74, 0.15) 4px
        ),
        repeating-linear-gradient(
            85deg,
            transparent,
            transparent 2px,
            rgba(201, 115, 74, 0.1) 2px,
            rgba(201, 115, 74, 0.1) 4px
        );
    animation: glitch-divider-shift 3s linear infinite;
    overflow: hidden;
}

.glitch-divider::before,
.glitch-divider::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, transparent 0 5px, rgba(240, 230, 219, 0.04) 5px 6px),
        linear-gradient(90deg, transparent, rgba(196, 161, 224, 0.10), transparent, rgba(143, 212, 200, 0.08), transparent);
    transform: translateX(-12px);
    animation: glitch-divider-shift 1.4s steps(4, end) infinite;
}

.glitch-divider::after {
    opacity: 0.7;
    animation-direction: reverse;
    mix-blend-mode: screen;
}

.glitch-divider:nth-child(even) {
    animation: glitch-divider-shift-reverse 3s linear infinite;
}

.glitch-divider:hover,
.glitch-divider.flash {
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(224, 69, 58, 0.3) 2px,
            rgba(224, 69, 58, 0.3) 4px
        ),
        repeating-linear-gradient(
            85deg,
            transparent,
            transparent 2px,
            rgba(224, 69, 58, 0.25) 2px,
            rgba(224, 69, 58, 0.25) 4px
        );
}

@media (max-width: 768px) {
    .glitch-divider {
        height: 30px;
    }
}

/* ============================================================
   STRATUM 3: THE DESCENT
   ============================================================ */

.stratum-3 {
    background: linear-gradient(
        to bottom,
        var(--deep-ground),
        #6b3a2a
    );
    min-height: 150vh;
}

.descent-text {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(2.2rem, 5.5vw, 4.8rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
    text-align: center;
    max-width: 680px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
    position: relative;
    z-index: 10;
}

.descent-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   STRATUM 4: THE RESIDUE
   ============================================================ */

.stratum-4 {
    min-height: auto;
    padding: calc(var(--baseline) * 2) var(--half-baseline);
    background: #1a0e09;
}

.footer-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--terracotta-core);
    opacity: 0.5;
    text-align: center;
    margin: 0;
}

/* ============================================================
   MARGIN DATA RESIDUE
   ============================================================ */

.margin-data {
    position: fixed;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: var(--terracotta-core);
    opacity: 0.15;
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
    animation: data-drift 30s linear infinite;
    top: 0;
}

.margin-data.left-margin {
    left: 20px;
}

.margin-data.right-margin {
    right: 20px;
}

@media (max-width: 900px) {
    .margin-data {
        display: none;
    }
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 768px) {
    .stratum {
        padding: calc(var(--baseline) * 2) 24px;
        min-height: auto;
    }

    .lotus-title {
        font-size: clamp(4rem, 15vw, 8rem);
    }

    .block-heading {
        font-size: clamp(1.5rem, 4vw, 2.8rem);
    }

    .descent-text {
        font-size: clamp(1.5rem, 4vw, 2.8rem);
    }

    .lotus-glyph {
        width: 120px;
        height: 120px;
        transform: scale(0.6);
    }
}

@media (max-width: 480px) {
    body {
        font-size: 0.95rem;
    }

    .stratum {
        padding: var(--baseline) 16px;
    }

    .lotus-title {
        font-size: 3.5rem;
    }

    .block-heading {
        font-size: 1.5rem;
    }

    .manifesto-text {
        text-align: left;
    }
}

/* ============================================================
   TYPOGRAPHY BASELINE RHYTHM
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Barlow Condensed', sans-serif;
    margin-bottom: var(--half-baseline);
}

p {
    margin-bottom: var(--baseline);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.no-scroll {
    overflow: hidden;
}
