/* CSS Variables and Root */
:root {
    --color-bg: #1A1E28;
    --color-text-light: #E8EEF5;
    --color-accent-cyan: #3AF0FF;
    --color-accent-red: #FF3A3A;
    --color-text-muted: #C0C8D4;
    --color-marble: #B8A878;
    --color-panel: #D0D8E8;
    --color-dark-panel: #2A2E38;
    --color-column-gray: #2A2E38;

    --glitch-intensity: 0;

    --font-display: 'Epilogue', sans-serif;
    --font-body: 'Epilogue', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-light);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.8;
    overflow-x: hidden;
}

/* Scan line overlay for glitch effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, calc(0.03 + var(--glitch-intensity) * 0.05)) 2px,
        rgba(0, 0, 0, calc(0.03 + var(--glitch-intensity) * 0.05)) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 800;
}

p {
    font-size: clamp(1rem, 2vw, 1.15rem);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

/* Section Base Styles */
section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Depth 0: The Portico */
.depth-0 {
    background: linear-gradient(135deg, #1A1E28 0%, #2A2E38 100%);
    padding: 4rem 2rem;
    position: relative;
}

.marble-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(0deg, transparent 24%, rgba(192, 200, 212, 0.05) 25%, rgba(192, 200, 212, 0.05) 26%, transparent 27%, transparent 74%, rgba(192, 200, 212, 0.05) 75%, rgba(192, 200, 212, 0.05) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(192, 200, 212, 0.05) 25%, rgba(192, 200, 212, 0.05) 26%, transparent 27%, transparent 74%, rgba(192, 200, 212, 0.05) 75%, rgba(192, 200, 212, 0.05) 76%, transparent 77%, transparent);
    background-size: 50px 50px;
    opacity: calc(1 - var(--glitch-intensity) * 0.5);
    pointer-events: none;
}

.portico {
    text-align: center;
    width: 100%;
    position: relative;
    z-index: 10;
}

.domain-name {
    font-size: clamp(3.5rem, 9vw, 7rem);
    font-weight: 800;
    font-variation-settings: 'wght' 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--color-text-light);
    animation: breathe 4s ease-in-out infinite;
    text-shadow: calc(var(--glitch-intensity) * 4px) 0 rgba(255, 58, 58, 0.4),
                 calc(var(--glitch-intensity) * -4px) 0 rgba(58, 240, 255, 0.4);
    position: relative;
    z-index: 20;
}

@keyframes breathe {
    0%, 100% {
        font-variation-settings: 'wght' 800;
    }
    50% {
        font-variation-settings: 'wght' 700;
    }
}

.subtitle {
    font-size: 1.25rem;
    color: var(--color-accent-cyan);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: calc(1 - var(--glitch-intensity) * 0.5);
}

/* Depth 1: The Columns */
.depth-1 {
    background: linear-gradient(180deg, #2A2E38 0%, #1A1E28 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 3rem;
    padding: 4rem 2rem;
}

.columns-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 2rem;
    margin-bottom: 3rem;
    perspective: 1000px;
}

.column {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.column-top {
    width: 100px;
    height: 15px;
    background: linear-gradient(180deg, var(--color-marble) 0%, var(--color-marble) 100%);
    border-radius: 50%;
    margin-bottom: -5px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    transform: translateZ(0) scaleX(calc(1 - var(--glitch-intensity) * 0.15));
}

.column-shaft {
    width: 12px;
    height: 250px;
    background: linear-gradient(90deg, #B8A878 0%, #9A8A5E 50%, #B8A878 100%);
    position: relative;
    box-shadow: 0 0 calc(var(--glitch-intensity) * 15px) rgba(255, 58, 58, 0.4);
}

.column-shaft::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(255, 58, 58, calc(var(--glitch-intensity) * 0.3)) 2px,
        rgba(255, 58, 58, calc(var(--glitch-intensity) * 0.3)) 4px
    );
}

.column-base {
    width: 120px;
    height: 20px;
    background: var(--color-marble);
    border-radius: 3px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    margin-top: -8px;
    transform: translateY(calc(var(--glitch-intensity) * 10px));
}

.column-1 {
    transform: rotateZ(calc(var(--glitch-intensity) * 2deg));
}

.column-2 {
    transform: rotateZ(calc(var(--glitch-intensity) * -2deg));
}

.column-3 {
    transform: rotateZ(calc(var(--glitch-intensity) * 1.5deg));
}

.analysis-text {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

/* Depth 2: The Tessellation */
.depth-2 {
    background: linear-gradient(135deg, #1A1E28 0%, #2A2E38 100%);
    padding: 4rem 2rem;
}

.geometric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.geometric-shape {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    color: var(--color-accent-cyan);
    filter: drop-shadow(0 0 calc(var(--glitch-intensity) * 10px) rgba(58, 240, 255, 0.5));
}

.shape-1 {
    transform: translateX(calc(var(--glitch-intensity) * 15px)) translateY(calc(var(--glitch-intensity) * -10px)) rotate(calc(var(--glitch-intensity) * 5deg));
}

.shape-2 {
    transform: translateX(calc(var(--glitch-intensity) * -12px)) translateY(calc(var(--glitch-intensity) * 8px)) scale(calc(1 - var(--glitch-intensity) * 0.1));
}

.shape-3 {
    transform: translateX(calc(var(--glitch-intensity) * 10px)) skewX(calc(var(--glitch-intensity) * 3deg));
}

.shape-4 {
    transform: rotate(calc(var(--glitch-intensity) * 10deg)) scale(calc(1 + var(--glitch-intensity) * 0.05));
}

/* Depth 3: The Marble Veins */
.depth-3 {
    background: linear-gradient(180deg, #2A2E38 0%, #1A1E28 100%);
    padding: 4rem 2rem;
}

.marble-veins {
    margin-bottom: 3rem;
}

.vein-pattern {
    width: 100%;
    max-width: 800px;
    height: auto;
    color: var(--color-marble);
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 0 calc(var(--glitch-intensity) * 8px) rgba(255, 58, 58, 0.4));
}

.vein-pattern path {
    stroke-dasharray: calc(100 - var(--glitch-intensity) * 80), 1000;
    stroke-dashoffset: 0;
    opacity: calc(1 - var(--glitch-intensity) * 0.3);
}

/* Depth 4: The Glitch Cascade */
.depth-4 {
    background: linear-gradient(135deg, #1A1E28 0%, #2A2E38 100%);
    padding: 4rem 2rem;
}

.glitch-container {
    text-align: center;
    margin-bottom: 3rem;
}

.glitch-text {
    font-family: var(--font-mono);
    font-size: clamp(2rem, 8vw, 5rem);
    font-weight: 600;
    letter-spacing: 0.1em;
    position: relative;
    color: var(--color-accent-red);
    text-shadow: calc(var(--glitch-intensity) * 4px) 0 rgba(255, 58, 58, 0.6),
                 calc(var(--glitch-intensity) * -4px) 0 rgba(58, 240, 255, 0.6),
                 calc(var(--glitch-intensity) * 8px) 0 rgba(255, 58, 58, 0.3),
                 calc(var(--glitch-intensity) * -8px) 0 rgba(58, 240, 255, 0.3);
    animation: glitch-shift 2s ease-in-out infinite;
}

@keyframes glitch-shift {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(calc(var(--glitch-intensity) * 3px), calc(var(--glitch-intensity) * 2px));
    }
    40% {
        transform: translate(calc(var(--glitch-intensity) * -2px), calc(var(--glitch-intensity) * -3px));
    }
    60% {
        transform: translate(calc(var(--glitch-intensity) * 4px), calc(var(--glitch-intensity) * -1px));
    }
    80% {
        transform: translate(calc(var(--glitch-intensity) * -3px), calc(var(--glitch-intensity) * 4px));
    }
}

.glitch-artifacts {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.artifact {
    font-family: var(--font-mono);
    color: var(--color-accent-cyan);
    font-size: 1.5rem;
    opacity: calc(var(--glitch-intensity) * 0.8);
    animation: flicker 1s ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes flicker {
    0%, 100% {
        opacity: calc(var(--glitch-intensity) * 0.8);
    }
    50% {
        opacity: calc(var(--glitch-intensity) * 0.3);
    }
}

/* Depth 5: The Abyss */
.depth-5 {
    background: linear-gradient(180deg, #1A1E28 0%, #0A0C10 100%);
    padding: 4rem 2rem;
    position: relative;
}

.depth-5::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(255, 58, 58, calc(var(--glitch-intensity) * 0.1)) 2px,
        rgba(255, 58, 58, calc(var(--glitch-intensity) * 0.1)) 4px
    );
    pointer-events: none;
}

.abyss {
    max-width: 600px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.abyss-content p {
    color: var(--color-text-muted);
    opacity: calc(1 - var(--glitch-intensity) * 0.5);
    text-shadow: calc(var(--glitch-intensity) * 3px) 0 rgba(255, 58, 58, 0.4),
                 calc(var(--glitch-intensity) * -3px) 0 rgba(58, 240, 255, 0.4);
}

.typewriter-effect {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    display: inline-block;
    margin: 1rem auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .columns-container {
        flex-direction: column;
        align-items: center;
    }

    .column-shaft {
        height: 150px;
    }

    .geometric-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .domain-name {
        font-size: clamp(2rem, 7vw, 4rem);
    }
}

/* Glitch intensity increases with scroll */
html.scrolling {
    --glitch-intensity: var(--scroll-ratio, 0);
}

/* Glitch burst effect for content blocks */
@keyframes glitch-burst {
    0%, 100% {
        clip-path: inset(0);
        opacity: 1;
    }
    50% {
        clip-path: inset(calc(var(--glitch-intensity) * 10%) 0 calc(var(--glitch-intensity) * 15%) 0);
        opacity: 0.8;
    }
}

/* Jitter animation for text */
@keyframes jitter {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(calc(var(--glitch-intensity) * 2px));
    }
    50% {
        transform: translateX(calc(var(--glitch-intensity) * -2px));
    }
    75% {
        transform: translateX(calc(var(--glitch-intensity) * 3px));
    }
}

/* Marble radial gradients for veining effect */
.marble-vein-bg {
    background:
        radial-gradient(ellipse 500px 200px at 20% 30%, rgba(192, 200, 212, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 600px 250px at 80% 70%, rgba(192, 200, 212, 0.06) 0%, transparent 50%);
}

/* Additional utility classes */
.no-scroll {
    overflow: hidden;
}
