/* === Reset & Base === */
/* Design fidelity tokens: IntersectionObserver` trigger applies `opacity: +0.05em (Google */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #1c1917;
    color: #fafaf9;
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-variation-settings: 'SOFT' 0, 'WONK' 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* === Typography === */
.hero-title {
    font-family: 'Fraunces', serif;
    font-weight: 900;
    font-variation-settings: 'SOFT' 0, 'WONK' 1;
    font-size: clamp(4rem, 8vw, 8rem);
    color: #fafaf9;
    letter-spacing: -0.02em;
    line-height: 1;
    transition: font-variation-settings 2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-title.softened {
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
}

.section-heading {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-variation-settings: 'SOFT' 50, 'WONK' 0;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #fafaf9;
    margin-bottom: 1rem;
}

.body-text {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-variation-settings: 'SOFT' 0, 'WONK' 0;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    color: #a8a29e;
    line-height: 1.7;
}

.label {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #a8a29e;
    display: block;
    margin-bottom: 0.75rem;
}

.code-block {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    color: #a8a29e;
    line-height: 1.8;
    background: rgba(255, 255, 255, 0.03);
    padding: 2rem;
    border-radius: 12px;
    overflow-x: auto;
}

.narrative-text {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #fafaf9;
    text-align: center;
    line-height: 1.6;
    position: relative;
    z-index: 2;
}

.narrative-text .word {
    font-variation-settings: 'SOFT' 50, 'WONK' 0;
    font-weight: var(--w);
    display: inline;
}

.closing-statement {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-variation-settings: 'SOFT' 50, 'WONK' 0;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    color: #78716c;
    text-align: center;
    margin-top: 2rem;
}

/* === Glass Panel === */
.glass-panel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    transition: backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, border-color 0.4s ease;
}

.glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
}

.glass-panel:hover {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.12);
}

/* === Blob Layer (Background) === */
.blob-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    opacity: 0.5;
}

.blob-1 {
    width: 450px; height: 400px;
    background: #9a3412;
    top: 5%; left: 10%;
    animation: blobMorph1 16s ease-in-out infinite;
}

.blob-2 {
    width: 350px; height: 350px;
    background: #ea580c;
    top: 30%; right: 5%;
    opacity: 0.4;
    animation: blobMorph2 14s ease-in-out infinite;
}

.blob-3 {
    width: 500px; height: 450px;
    background: #451a03;
    top: 50%; left: 30%;
    opacity: 0.6;
    animation: blobMorph3 18s ease-in-out infinite;
}

.blob-4 {
    width: 300px; height: 300px;
    background: #9a3412;
    top: 70%; left: 5%;
    opacity: 0.45;
    animation: blobMorph1 20s ease-in-out infinite reverse;
}

.blob-5 {
    width: 400px; height: 380px;
    background: #ea580c;
    top: 85%; right: 15%;
    opacity: 0.35;
    animation: blobMorph2 15s ease-in-out infinite;
}

.blob-6 {
    width: 350px; height: 320px;
    background: #451a03;
    top: 120%; left: 50%;
    opacity: 0.5;
    animation: blobMorph3 17s ease-in-out infinite;
}

.blob-7 {
    width: 280px; height: 260px;
    background: #9a3412;
    top: 160%; right: 25%;
    opacity: 0.4;
    animation: blobMorph1 13s ease-in-out infinite;
}

/* Medium blobs inside panels */
.blob-medium {
    width: 200px; height: 180px;
    z-index: 0;
    opacity: 0.2;
    background: #d97706;
}

.blob-hero-1 {
    top: 10%; left: -5%;
    animation: blobMorph2 14s ease-in-out infinite;
}

.blob-hero-2 {
    bottom: -10%; right: 5%;
    background: #ea580c;
    width: 250px; height: 230px;
    animation: blobMorph3 16s ease-in-out infinite;
}

/* Small blobs */
.blob-small {
    width: 60px; height: 55px;
    z-index: 0;
    opacity: 0.25;
    background: #d97706;
}

.blob-phil-1 { top: 15%; right: 10%; animation: blobMorph1 12s ease-in-out infinite; }
.blob-phil-2 { bottom: 15%; left: 8%; animation: blobMorph2 14s ease-in-out infinite; }
.blob-phil-3 { top: 20%; left: 15%; animation: blobMorph3 13s ease-in-out infinite; }

.blob-feat-icon {
    width: 50px; height: 45px;
    margin-bottom: 1rem;
    position: relative;
    animation: blobMorph1 12s ease-in-out infinite;
}

.blob-narrative {
    width: 400px; height: 350px;
    background: #a0522d;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    opacity: 0.3;
    animation: blobPulse 8s ease-in-out infinite;
}

.blob-large {
    position: absolute;
}

/* === Blob Animations === */
@keyframes blobMorph1 {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    50% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

@keyframes blobMorph2 {
    0%, 100% { border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%; }
    50% { border-radius: 30% 70% 50% 50% / 70% 30% 60% 40%; }
}

@keyframes blobMorph3 {
    0%, 100% { border-radius: 40% 60% 60% 40% / 50% 50% 50% 50%; }
    50% { border-radius: 70% 30% 40% 60% / 30% 70% 40% 60%; }
}

@keyframes blobPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.15); }
}

/* === Pulse Line === */
.pulse-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 60px;
    transform: translateY(-50%);
    z-index: 1;
    opacity: 0.5;
}

.pulse-path {
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    animation: pulseDraw 4s linear infinite;
}

@keyframes pulseDraw {
    0% { stroke-dashoffset: 1600; }
    100% { stroke-dashoffset: 0; }
}

/* === Chapters === */
.chapter {
    position: relative;
    z-index: 1;
}

/* Chapter 1: Hero */
.chapter-hero {
    height: 100vh;
    display: flex;
    align-items: center;
    padding: clamp(2rem, 4vw, 4rem);
    gap: 2rem;
}

.hero-panel {
    width: 60%;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.hero-descriptor {
    position: absolute;
    bottom: clamp(2rem, 4vw, 4rem);
    right: clamp(2rem, 4vw, 4rem);
    padding: 1.25rem 1.75rem;
}

/* Chapter 2: Philosophy */
.chapter-philosophy {
    padding: 20vh clamp(2rem, 4vw, 4rem);
}

.philosophy-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1.2fr;
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
}

.philosophy-block {
    padding: clamp(2rem, 3vw, 3rem);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: calc(var(--stagger-index) * 120ms);
}

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

.tall-narrow { min-height: 400px; background: rgba(41, 37, 36, 0.3); /* #292524 warm smoke tint */ }
.short-wide { min-height: 250px; }
.medium-square { min-height: 320px; }

/* Chapter 3: Narrative */
.chapter-narrative {
    padding: 20vh clamp(2rem, 4vw, 4rem);
}

.narrative-strip {
    width: 100%;
    padding: clamp(3rem, 5vw, 5rem) clamp(2rem, 4vw, 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* Chapter 4: Features */
.chapter-features {
    padding: 10vh clamp(2rem, 4vw, 4rem) 20vh;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 4vw, 4rem);
}

.feature-block {
    padding: clamp(2rem, 3vw, 3rem);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: calc(var(--stagger-index) * 120ms);
}

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

.feature-1 { min-height: 280px; }
.feature-2 { min-height: 320px; }
.feature-3 { min-height: 260px; }
.feature-4 { min-height: 300px; }
.feature-5 { min-height: 270px; }
.feature-6 { min-height: 310px; }

.feature-block:hover {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-color: rgba(255, 255, 255, 0.16);
}

.feature-1 .blob-feat-icon { background: #c2530a; }
.feature-2 .blob-feat-icon { background: #b45309; }
.feature-3 .blob-feat-icon { background: #f59e0b; }
.feature-4 .blob-feat-icon { background: #c2530a; }
.feature-5 .blob-feat-icon { background: #f59e0b; }
.feature-6 .blob-feat-icon { background: #b45309; }

/* Chapter 5: Closing */
.chapter-closing {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 4vw, 4rem);
}

.closing-panel {
    max-width: 600px;
    width: 100%;
    padding: clamp(2.5rem, 4vw, 4rem);
}

/* === Dotted Grid Texture (on some panels) === */
.hero-panel::after,
.closing-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    border-radius: 16px;
}

/* === Concentric Rings on Hero Blobs === */
.blob-hero-1::after,
.blob-hero-2::after {
    content: '';
    position: absolute;
    inset: -30px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.03);
    box-shadow:
        0 0 0 30px transparent,
        0 0 0 60px rgba(255,255,255,0.02),
        0 0 0 90px rgba(255,255,255,0.01);
    pointer-events: none;
}

/* === Responsive === */
@media (max-width: 768px) {
    .chapter-hero {
        flex-direction: column;
        padding: 2rem;
    }
    .hero-panel {
        width: 100%;
        height: 60vh;
    }
    .hero-descriptor {
        position: relative;
        bottom: auto;
        right: auto;
    }
    .philosophy-grid {
        grid-template-columns: 1fr;
    }
    .tall-narrow, .short-wide, .medium-square {
        min-height: auto;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .feature-1, .feature-2, .feature-3,
    .feature-4, .feature-5, .feature-6 {
        min-height: auto;
    }
}
