/* Color Palette */
:root {
    /* Background colors */
    --bg-primary: #F5EDD8;
    --bg-deep: #EDE0C8;
    --bg-dark: #3A2A1A;
    
    /* Blob fills */
    --blob-1: rgba(200, 170, 120, 0.15);
    --blob-2: rgba(180, 150, 100, 0.12);
    --blob-3: rgba(160, 130, 80, 0.1);
    
    /* Text colors */
    --text-primary: #3A2A1A;
    --text-secondary: #6A5A4A;
    --text-tertiary: #8A6A4A;
    
    /* Accent and decorative */
    --accent: #B86A3A;
    --line-color: #8A6A4A;
    --margin-line: #D0C0A0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-weight: 400;
    line-height: 1.6;
}

/* Typography */
h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(3rem, 9vw, 8rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--text-primary);
}

h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

p {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

/* Section 1: The Shelf */
.shelf {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.shelf-content {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
    transform: scale(1.1);
    animation: heroZoom 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroZoom {
    from {
        transform: scale(1.1);
    }
    to {
        transform: scale(1);
    }
}

.blobs-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    z-index: -1;
}

.blob {
    position: absolute;
    width: 200px;
    height: 200px;
}

.blob-1 {
    top: 20%;
    left: 10%;
}

.blob-2 {
    top: 30%;
    left: 50%;
}

.blob-3 {
    top: 10%;
    right: 15%;
}

.domain-name {
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.spine-container {
    position: relative;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spine-line {
    width: 2px;
    height: 30vh;
    background-color: var(--line-color);
    margin: 0;
}

.book-icon {
    width: 40px;
    height: 40px;
    margin-top: 2rem;
    display: block;
}

/* Section 2: The Stacks */
.stacks {
    background-color: var(--bg-primary);
    padding: 4rem 2rem;
    min-height: 300vh;
}

.stacks-content {
    max-width: 640px;
    margin: 0 auto;
    position: relative;
}

.content-block {
    padding: 2rem;
    margin: 4rem auto;
    position: relative;
    max-width: 640px;
}

.content-block h2 {
    color: var(--text-primary);
    text-transform: lowercase;
}

.content-block p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.content-block.offset {
    max-width: 90vw;
    margin-left: auto;
    margin-right: auto;
}

.margin-note {
    font-family: 'Space Grotesk', sans-serif;
    font-style: italic;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    position: absolute;
    left: -140px;
    top: 0;
    width: 120px;
    display: none;
    padding-left: 0.5rem;
    border-left: 1px solid var(--margin-line);
}

@media (min-width: 900px) {
    .margin-note {
        display: block;
    }
}

/* Decorative blob behind blocks */
.content-block::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 300px;
    height: 300px;
    border-radius: 42% 58% 70% 30% / 45% 38% 62% 55%;
    background-color: var(--blob-1);
    z-index: -1;
}

.content-block:nth-child(even)::before {
    background-color: var(--blob-2);
}

.content-block:nth-child(3n)::before {
    background-color: var(--blob-3);
}

/* Intersection Observer Zoom Animation */
.content-block.zoom-in {
    animation: zoomIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Section 3: The Clearing */
.clearing {
    min-height: 100vh;
    background-color: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
}

.clearing-blob {
    width: clamp(200px, 50vw, 500px);
    height: clamp(200px, 50vh, 500px);
    border-radius: 42% 58% 70% 30% / 45% 38% 62% 55%;
    background-color: rgba(200, 170, 120, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clearing-blob.zoom-in {
    animation: zoomIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.clearing-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 2rem;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.4;
    max-width: 300px;
}

/* Section 4: The Spine */
.spine-final {
    min-height: 50vh;
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-tertiary);
    position: relative;
}

.spine-final-content {
    text-align: center;
    position: relative;
    animation: spineFinalZoom 10s ease-in-out infinite;
}

@keyframes spineFinalZoom {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.spine-final-name {
    color: var(--text-tertiary);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
    text-transform: lowercase;
}

.spine-final-line {
    width: 2px;
    height: 10vh;
    background-color: var(--line-color);
    margin: 0 auto 2rem;
}

.spine-final-blob {
    width: 20px;
    height: 20px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .shelf {
        padding: 2rem 1rem;
    }

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

    .stacks {
        padding: 2rem 1rem;
        min-height: auto;
    }

    .content-block {
        max-width: 100%;
        padding: 1.5rem;
        margin: 3rem 0;
    }

    .content-block.offset {
        max-width: 100%;
    }

    .margin-note {
        display: none !important;
    }

    .clearing-text {
        font-size: 1.5rem;
    }
}

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

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .shelf,
    .clearing,
    .spine-final {
        page-break-after: always;
    }

    .content-block {
        page-break-inside: avoid;
    }

    .margin-note {
        display: block;
    }
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
