/* Root Variables */
:root {
    --color-bg-warm: #E8E2DA;
    --color-bg-cool: #D4CFC8;
    --color-text-primary: #2E2A26;
    --color-accent-1: #C4908A;
    --color-accent-2: #7BA5A0;
    --color-accent-3: #9B8A9E;
    --color-accent-4: #A8B48A;
    --color-white-warm: #F5F1EC;
    --color-grid: #B8AFA6;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: var(--color-bg-warm);
    color: var(--color-text-primary);
    font-family: "Lora", serif;
    font-size: 16px;
    line-height: 1.7;
}

/* Scroll Container - Horizontal Scroll */
.scroll-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

.scroll-container::-webkit-scrollbar {
    height: 6px;
}

.scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-container::-webkit-scrollbar-thumb {
    background: rgba(46, 42, 38, 0.2);
    border-radius: 3px;
}

/* Panel Base Styles */
.panel {
    position: relative;
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    flex-shrink: 0;
    scroll-snap-align: start;
    background-color: var(--color-bg-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.panel:nth-child(even) {
    background-color: var(--color-bg-cool);
}

/* Grid Overlay */
.panel-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent calc(100vw / 12 - 0.5px),
            rgba(184, 175, 166, 0.08) calc(100vw / 12 - 0.5px),
            rgba(184, 175, 166, 0.08) calc(100vw / 12)
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent calc(100vh / 12 - 0.5px),
            rgba(184, 175, 166, 0.08) calc(100vh / 12 - 0.5px),
            rgba(184, 175, 166, 0.08) calc(100vh / 12)
        );
    opacity: 0.08;
    pointer-events: none;
    z-index: 1;
    animation: grid-pulse 20s ease-in-out infinite;
}

.panel-grid.grid-fade {
    opacity: 0.15;
}

@keyframes grid-pulse {
    0%, 100% {
        opacity: 0.08;
    }
    50% {
        opacity: 0.12;
    }
}

/* Blob Container */
.panel-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Blob SVG Elements */
.blob {
    position: absolute;
    filter: url(#grain);
}

.blob-1 {
    width: 600px;
    height: 600px;
    right: -100px;
    top: 50%;
    transform: translateY(-50%);
}

.blob-2 {
    width: 500px;
    height: 500px;
    left: 5%;
    top: 20%;
}

.blob-3 {
    width: 550px;
    height: 550px;
    right: 10%;
    top: 15%;
}

.blob-4 {
    width: 480px;
    height: 480px;
    left: 8%;
    bottom: 10%;
}

.blob-5a {
    width: 420px;
    height: 420px;
    left: 5%;
    top: 10%;
}

.blob-5b {
    width: 480px;
    height: 480px;
    right: 8%;
    top: 20%;
}

.blob-5c {
    width: 500px;
    height: 500px;
    left: 10%;
    bottom: 5%;
}

.blob-5d {
    width: 520px;
    height: 520px;
    right: 5%;
    bottom: 8%;
}

/* Panel Content */
.panel-content {
    position: relative;
    z-index: 3;
    max-width: 70%;
    padding: 40px;
    text-align: left;
    opacity: 0;
    animation: content-fade-in 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes content-fade-in {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Typography */
.wordmark {
    font-family: "Playfair Display", serif;
    font-size: 120px;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--color-text-primary);
    margin-bottom: 40px;
}

.statement {
    font-family: "Lora", serif;
    font-size: 28px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-text-primary);
    margin: 0;
}

.statement em {
    font-style: italic;
    font-weight: 500;
}

.statement p {
    margin: 0;
}

.color-note {
    font-family: "Playfair Display", serif;
    font-size: 48px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.closing-text {
    font-family: "Lora", serif;
    font-size: 24px;
    font-weight: 400;
    color: var(--color-text-primary);
    margin-bottom: 20px;
}

.closing-url {
    font-family: "DM Mono", monospace;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-primary);
    opacity: 0.7;
}

/* Decorative Elements */
.drip-marks {
    position: absolute;
    bottom: 10%;
    right: 15%;
    display: flex;
    gap: 80px;
}

.drip {
    display: block;
    width: 3px;
    height: 80px;
    background-color: var(--color-text-primary);
    opacity: 0.15;
    animation: drip-fade 600ms ease-out forwards;
    animation-delay: calc(var(--index) * 50ms);
}

@keyframes drip-fade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 0.15;
        transform: translateY(0);
    }
}

.hash-marks {
    position: absolute;
    bottom: 15%;
    left: 5%;
    display: flex;
    gap: 20px;
}

.hash {
    display: inline-block;
    width: 30px;
    height: 30px;
    background-image:
        linear-gradient(45deg, var(--color-accent-1) 2px, transparent 2px),
        linear-gradient(45deg, var(--color-accent-2) 2px, transparent 2px);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
    opacity: 0.6;
    animation: hash-fade 600ms ease-out forwards;
    animation-delay: calc(var(--index) * 80ms);
}

@keyframes hash-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.6;
    }
}

.splatter-dots {
    position: absolute;
    bottom: 20%;
    right: 8%;
    width: 200px;
    height: 200px;
}

.dot {
    position: absolute;
    border-radius: 50%;
    background-color: var(--color-text-primary);
    opacity: 0.2;
    animation: dot-fade 500ms ease-out forwards;
    animation-delay: calc(var(--index) * 50ms);
}

@keyframes dot-fade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 0.2;
        transform: translateY(0);
    }
}

/* Progress Line */
.progress-line {
    position: fixed;
    bottom: 20px;
    left: 0;
    height: 2px;
    background-color: var(--color-text-primary);
    width: 0%;
    z-index: 100;
    transition: width 100ms linear;
}

/* Navigation Arrows */
.nav-arrows {
    position: fixed;
    bottom: 40px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 100;
    pointer-events: none;
}

.arrow {
    font-size: 24px;
    color: var(--color-text-primary);
    opacity: 0;
    animation: arrow-pulse 2s ease-in-out infinite;
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 300ms ease;
}

.arrow-left {
    animation-delay: 0s;
}

.arrow-right {
    animation-delay: 0.5s;
}

.nav-arrows.hidden .arrow {
    opacity: 0;
    pointer-events: none;
}

@keyframes arrow-pulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.8;
    }
}

/* Panel-specific Styles */
.panel-closing {
    background-color: var(--color-bg-warm);
}

.panel-closing .panel-content {
    text-align: center;
    max-width: 100%;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .wordmark {
        font-size: 80px;
    }

    .statement {
        font-size: 22px;
    }

    .color-note {
        font-size: 36px;
    }

    .panel-content {
        max-width: 85%;
    }

    .blob-1 {
        width: 400px;
        height: 400px;
    }

    .blob-2 {
        width: 350px;
        height: 350px;
    }

    .blob-3 {
        width: 380px;
        height: 380px;
    }

    .blob-4 {
        width: 330px;
        height: 330px;
    }
}

@media (max-width: 768px) {
    .wordmark {
        font-size: 60px;
    }

    .statement {
        font-size: 18px;
    }

    .color-note {
        font-size: 28px;
    }

    .panel-content {
        padding: 20px;
        max-width: 90%;
    }

    .arrow {
        font-size: 18px;
    }

    .nav-arrows {
        padding: 0 20px;
        bottom: 30px;
    }

    .blob-1 {
        width: 300px;
        height: 300px;
    }

    .blob-2 {
        width: 250px;
        height: 250px;
    }

    .blob-3 {
        width: 280px;
        height: 280px;
    }

    .blob-4 {
        width: 240px;
        height: 240px;
    }

    .blob-5a {
        width: 280px;
        height: 280px;
    }

    .blob-5b {
        width: 300px;
        height: 300px;
    }

    .blob-5c {
        width: 320px;
        height: 320px;
    }

    .blob-5d {
        width: 340px;
        height: 340px;
    }

    .drip {
        height: 60px;
    }

    .drip-marks {
        gap: 50px;
    }
}

/* Scroll Snap Behavior */
@supports (scroll-snap-type: x mandatory) {
    .scroll-container {
        scroll-snap-type: x mandatory;
    }

    .panel {
        scroll-snap-align: start;
    }
}

/* Animation Delays for Decorative Elements */
.drip:nth-child(1) { --index: 0; }
.drip:nth-child(2) { --index: 1; }
.drip:nth-child(3) { --index: 2; }

.hash:nth-child(1) { --index: 0; }
.hash:nth-child(2) { --index: 1; }

.dot:nth-child(1) { --index: 0; width: 4px; height: 4px; left: 20px; top: 30px; }
.dot:nth-child(2) { --index: 1; width: 3px; height: 3px; left: 60px; top: 50px; }
.dot:nth-child(3) { --index: 2; width: 5px; height: 5px; left: 100px; top: 20px; }
.dot:nth-child(4) { --index: 3; width: 3px; height: 3px; left: 140px; top: 70px; }
.dot:nth-child(5) { --index: 4; width: 4px; height: 4px; left: 170px; top: 40px; }

/* Blob Parallax Drift on Scroll */
.blob {
    transition: transform 50ms linear;
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
