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

:root {
    --bg-primary: #b5704f;
    --bg-deep: #3b2314;
    --surface-light: #f2e6d0;
    --text-dark: #2e1a0e;
    --text-light: #d4c4b0;
    --accent-warm: #d4835a;
    --accent-cool: #7a8b6f;
    --utility-muted: #8b7355;
    --text-secondary: #5a4a3a;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    color: var(--text-light);
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

#svg-filters {
    position: absolute;
    width: 0;
    height: 0;
}

/* Grain Overlay */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.08;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
}

/* The Door */
#the-door {
    width: 100vw;
    height: 100vh;
    background: var(--bg-deep);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#wordmark-container {
    opacity: 0;
    animation: fadeIn 2s ease forwards;
}

#wordmark-canvas {
    width: clamp(280px, 60vw, 600px);
    height: 120px;
}

#tagline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 1.15rem;
    color: var(--text-light);
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeIn 2s ease 1s forwards;
}

#scroll-chevron {
    position: absolute;
    bottom: 3rem;
    animation: pulseDown 2s ease-in-out infinite;
    opacity: 0;
    animation: fadeIn 2s ease 2s forwards, pulseDown 2s ease-in-out 2s infinite;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes pulseDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* The Interior */
#the-interior {
    padding: clamp(12px, 2vw, 24px);
    background: var(--bg-deep);
}

#block-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(12px, 2vw, 24px);
}

.grid-block {
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) rotate(0.5deg);
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.grid-block.visible {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

.grid-block--text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 4vw, 4rem);
    background: var(--bg-deep);
    min-height: 250px;
}

.grid-block--text p {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 5.5vw, 5rem);
    letter-spacing: -0.03em;
    line-height: 0.98;
    color: var(--surface-light);
}

.grid-block--generative {
    aspect-ratio: 1/1;
    background: var(--bg-deep);
    position: relative;
}

.grid-block--generative canvas {
    width: 100%;
    height: 100%;
}

.grid-block--photo {
    aspect-ratio: 4/3;
    background: var(--utility-muted);
    border: 4px solid var(--utility-muted);
    position: relative;
    overflow: hidden;
}

.grid-block--photo canvas {
    width: 100%;
    height: 100%;
    filter: sepia(0.3) contrast(1.1) saturate(0.75) brightness(0.95);
}

.grid-block--blob {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.grid-block--blob svg {
    width: 80%;
    height: 80%;
}

.grid-block--span2 {
    grid-column: span 2;
}

.grid-block--tall {
    grid-row: span 2;
}

/* Blob Breaks */
.blob-break {
    position: relative;
    width: 100%;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: clamp(2rem, 5vw, 5rem) 0;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.blob-break.visible {
    opacity: 1;
}

.blob-break svg {
    width: clamp(300px, 70vw, 900px);
    height: clamp(300px, 70vh, 700px);
}

/* The Dissolution */
#the-dissolution {
    padding: clamp(12px, 2vw, 24px);
    background: var(--text-dark);
}

#dissolution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(12px, 2vw, 24px);
}

.dissolve-block {
    min-height: 150px;
    background: var(--bg-deep);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.dissolve-block canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#final-block {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    margin-top: 4rem;
}

#final-block span {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--utility-muted);
}

#void {
    height: 100vh;
    background: var(--text-dark);
}

/* Rotation variations */
.rot-1 { transform: rotate(0.3deg); }
.rot-2 { transform: rotate(-0.5deg); }
.rot-3 { transform: rotate(0.8deg); }
.rot-4 { transform: rotate(-1.0deg); }
.rot-5 { transform: rotate(1.2deg); }

/* Responsive */
@media (max-width: 600px) {
    .grid-block--span2 {
        grid-column: span 1;
    }
    .grid-block--text p {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }
}
