:root {
    --bg-primary: #f8f4f0;
    --bg-secondary: #eee8e0;
    --text-primary: #2d2a33;
    --text-secondary: #6b6577;
    --pastel-lavender: #c4b5d4;
    --pastel-rose: #d4a5a5;
    --pastel-sage: #a5c4a5;
    --pastel-periwinkle: #a5b5d4;
    --pastel-mauve: #b5a5b5;
    --grid-line: #d0ccc6;
    --progress: #8b7ba5;
    --elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Work Sans', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
}

.spreads-container {
    scroll-snap-type: y mandatory;
    overflow-y: auto;
    height: 100vh;
    scroll-behavior: smooth;
}

.spread {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

/* Progress Indicator */
.progress-indicator {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 0%;
    background: var(--progress);
    z-index: 100;
    transition: height 0.6s var(--elastic);
}

/* Dot Matrix Background */
.dot-matrix {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, var(--text-secondary) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.1;
    pointer-events: none;
}

/* ===== SPREAD 1: OPENING ===== */
.spread-opening {
    display: grid;
    grid-template-columns: 7fr 5fr;
    background: var(--bg-primary);
}

.spread-opening__left {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.vertical-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(6rem, 14vw, 18rem);
    letter-spacing: 0.15em;
    writing-mode: vertical-lr;
    text-orientation: upright;
    color: var(--text-primary);
    line-height: 1.6;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--elastic), transform 0.8s var(--elastic);
}

.spread-opening__right {
    position: relative;
    z-index: 1;
}

.geo-field {
    position: absolute;
    inset: 0;
}

.geo-shape {
    position: absolute;
    will-change: transform;
    transform: translateZ(0) scale(0.85);
    transition: transform 1.2s var(--elastic), opacity 0.8s ease;
    opacity: 0;
}

.geo-shape.visible {
    transform: translateZ(0) scale(1);
    opacity: 1;
}

/* ===== SPREAD 2: DEFINITION ===== */
.spread-definition {
    display: grid;
    grid-template-columns: 5fr 7fr;
    background: var(--bg-secondary);
}

.spread-definition__left {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hexagon-container {
    width: clamp(180px, 22vw, 320px);
    height: clamp(180px, 22vw, 320px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.8s var(--elastic), transform 1s var(--elastic);
}

.hexagon-container.visible {
    opacity: 1;
    transform: scale(1);
}

.hexagon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: breathe 4s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

.hex-1 {
    width: 100%;
    height: 100%;
    background: var(--pastel-lavender);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: 0.3;
}

.hex-2 {
    width: 85%;
    height: 85%;
    background: var(--pastel-rose);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: 0.5;
}

.hex-3 {
    width: 85%;
    height: 85%;
    background: var(--pastel-sage);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: 0.6;
}

.hex-4 {
    width: 85%;
    height: 85%;
    background: var(--pastel-periwinkle);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: 0.7;
}

.hex-5 {
    width: 85%;
    height: 85%;
    background: var(--text-primary);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: 0.9;
}

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

.spread-definition__right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.definition-text {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    line-height: 1.9;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--elastic), transform 0.8s var(--elastic);
    transition-delay: 0.2s;
}

/* ===== SPREAD 3: MOUNTAIN ===== */
.spread-mountain {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mountain-layers {
    position: absolute;
    inset: 0;
}

.mountain-triangle {
    position: absolute;
    bottom: 0;
    will-change: transform;
    transform: translateZ(0);
}

.treeline {
    position: absolute;
    left: 0;
    right: 0;
    top: 60%;
    height: 1px;
    background: var(--grid-line);
    opacity: 0.5;
}

.mountain-text {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: var(--text-primary);
    position: relative;
    z-index: 2;
    margin-top: 19.1vh; /* golden ratio ~61.8% from top, offset from center */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s var(--elastic), transform 1s var(--elastic);
}

/* ===== SPREAD 4: GRID ===== */
.spread-grid {
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    width: min(90vw, 90vh);
    height: min(70vh, 80vw);
    background: var(--grid-line);
}

.grid-tile {
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.85);
    transition: transform 0.6s var(--elastic), opacity 0.5s ease;
    cursor: default;
}

.grid-tile.visible {
    opacity: 0.85;
    transform: scale(1);
}

.grid-tile:hover {
    opacity: 1;
    transform: scale(1.05);
}

.grid-tile-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Intersecting circles tile */
.tile-circles .circle {
    position: absolute;
    border-radius: 50%;
    mix-blend-mode: multiply;
}

/* Parallel lines tile */
.tile-lines {
    background-repeat: repeat;
}

/* Concentric hexagons tile */
.tile-hexagons .mini-hex {
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* ===== SPREAD 5: CLOSING ===== */
.spread-closing {
    display: grid;
    grid-template-columns: 5fr 7fr;
    background: var(--bg-primary);
}

.spread-closing__left {
    position: relative;
}

.spread-closing__right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.closing-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 12rem);
    color: var(--text-primary);
    line-height: 1.6;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--elastic), transform 0.8s var(--elastic);
}

.closing-xyz {
    color: var(--pastel-lavender);
}

.closing-tagline {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--elastic), transform 0.8s var(--elastic);
    transition-delay: 0.3s;
}

/* Visible state for animated elements */
.spread.active .vertical-title,
.spread.active .definition-text,
.spread.active .mountain-text,
.spread.active .closing-title,
.spread.active .closing-tagline {
    opacity: 1;
    transform: translateY(0);
}
