/* === xity.quest - Brutalist-Whimsical Hybrid === */

:root {
    --void-black: #0d0d0d;
    --bone-cream: #e8e0d4;
    --tangerine-pulse: #ff6b35;
    --teal-circuit: #4ecdc4;
    --amber-glow: #f7d794;
    --dusk-indigo: #2c2c54;
    --lavender-haze: #a29bfe;
}

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--void-black);
    color: var(--bone-cream);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 17px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* === Noise Overlay (concrete texture) === */
.noise-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    background: repeating-conic-gradient(
        var(--bone-cream) 0% 25%,
        transparent 0% 50%
    ) 0 0 / 4px 4px;
}

.noise-light {
    opacity: 0.03;
    background: repeating-conic-gradient(
        var(--void-black) 0% 25%,
        transparent 0% 50%
    ) 0 0 / 4px 4px;
}

/* === Grid Watermark (blueprint lines) === */
.grid-watermark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(90deg, #1a1a3e 1px, transparent 1px),
        linear-gradient(0deg, #1a1a3e 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.15;
}

.grid-watermark-light {
    background-image:
        linear-gradient(90deg, rgba(44,44,84,0.15) 1px, transparent 1px),
        linear-gradient(0deg, rgba(44,44,84,0.15) 1px, transparent 1px);
}

/* === Section Base === */
.section {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 0, 100% 12%, 100% 100%, 0 88%);
    transition: clip-path 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section.revealed {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.section-hero {
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}

.section-hero.revealed {
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}

/* === Diagonal Cut Top === */
.diagonal-cut-top {
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 12vh;
    background: var(--void-black);
    clip-path: polygon(0 0, 100% 0, 100% 0%, 0 100%);
    z-index: 5;
}

.diagonal-cut-light {
    background: var(--void-black);
}

/* === Section Backgrounds === */
.section-hero {
    background: var(--void-black);
}

.section-quest {
    background: var(--dusk-indigo);
}

.section-grid {
    background: var(--void-black);
}

.section-close {
    background: var(--bone-cream);
    color: var(--void-black);
}

/* === Hero Section === */
.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    transform: rotate(5deg);
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(80px, 20vw, 200px);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--tangerine-pulse);
    text-shadow: 4px 4px 0 rgba(255, 107, 53, 0.2);
    line-height: 1;
}

/* === Flowing Curves === */
.flowing-curve {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.curve-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-out;
}

.section.revealed .curve-path,
.section-hero .curve-path {
    stroke-dashoffset: 0;
}

.curve-1 { opacity: 0.7; }
.curve-2 { opacity: 0.5; }
.curve-3 { opacity: 0.4; }

.curve-grid {
    z-index: 1;
    opacity: 0.6;
}

.curve-close {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 1;
    opacity: 0.4;
}

.curve-close .curve-path {
    stroke: var(--lavender-haze);
}

/* === Geometric Shapes (spinning accents) === */
.geo-shape {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

.shape-circle {
    width: 24px;
    height: 24px;
    border: 3px solid var(--teal-circuit);
    border-radius: 50%;
    animation: spin-shape 12s linear infinite;
}

.shape-triangle {
    width: 0;
    height: 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-bottom: 22px solid transparent;
    border-bottom-color: var(--tangerine-pulse);
    animation: spin-shape 8s linear infinite;
}

.shape-rect {
    width: 20px;
    height: 20px;
    border: 3px solid var(--tangerine-pulse);
    animation: spin-shape 20s linear infinite;
}

@keyframes spin-shape {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Shape positions */
.shape-1 { top: 15%; left: 10%; border-color: var(--teal-circuit); }
.shape-2 { top: 25%; right: 15%; }
.shape-3 { bottom: 20%; left: 20%; }
.shape-4 { bottom: 30%; right: 10%; border-color: var(--amber-glow); width: 18px; height: 18px; }
.shape-5 { top: 30%; right: -5px; }
.shape-6 { bottom: 25%; right: 10%; border-color: var(--lavender-haze); }
.shape-7 { top: 10%; right: 8%; }
.shape-8 { bottom: 15%; left: 5%; border-color: var(--amber-glow); }
.shape-9 { top: 20%; left: 8%; }
.shape-10 { bottom: 30%; right: 12%; border-color: var(--dusk-indigo); }
.shape-11 { bottom: 15%; left: 15%; border-color: var(--dusk-indigo); }

/* === F-Pattern Layout === */
.section-inner {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 40px;
}

.f-pattern {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 40px;
    align-items: start;
}

/* === Primary Column - Staircase blocks === */
.primary-column {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.content-block {
    background: rgba(232, 224, 212, 0.06);
    border: 1px solid rgba(232, 224, 212, 0.1);
    padding: 32px;
    position: relative;
}

.stair-1 { margin-left: 0; }
.stair-2 { margin-left: 30px; }
.stair-3 { margin-left: 60px; }

.section-heading {
    font-family: 'Playfair Display', serif;
    font-size: clamp(40px, 6vw, 72px);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 24px;
    transform: rotate(-2deg);
}

.body-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 17px;
    line-height: 1.65;
    color: var(--bone-cream);
    opacity: 0.9;
}

/* === Secondary Column === */
.secondary-column {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding-top: 60px;
}

.annotation-card {
    background: rgba(255, 107, 53, 0.08);
    border-left: 3px solid var(--teal-circuit);
    padding: 24px;
    transform: rotate(1.5deg);
}

.annotation-text {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    color: var(--amber-glow);
    line-height: 1.5;
}

/* === Section 3: Geometric Grid === */
.geo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.geo-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(232, 224, 212, 0.03);
    border: 1px solid rgba(78, 205, 196, 0.15);
    padding: 20px;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s ease;
}

.geo-cell:hover {
    border-color: var(--tangerine-pulse);
}

.geo-shape-large {
    width: 60%;
    height: 60%;
    transition: transform 0.6s ease;
}

.shape-circle-large {
    border: 3px solid var(--teal-circuit);
    border-radius: 50%;
}

.shape-triangle-large {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 70px solid transparent;
    border-bottom-color: var(--tangerine-pulse);
}

.shape-rect-large {
    border: 3px solid var(--teal-circuit);
}

.accent-amber {
    border-color: var(--amber-glow) !important;
}

.accent-amber.shape-triangle-large {
    border-bottom-color: var(--amber-glow) !important;
}

.accent-teal {
    border-color: var(--teal-circuit) !important;
}

/* Scroll-based rearrange effect */
.section-grid.revealed .cell-1 { transform: translateY(0); }
.section-grid.revealed .cell-2 { transform: translateX(0) rotate(0deg); }
.section-grid.revealed .cell-3 { transform: translateY(0); }
.section-grid .cell-1 { transform: translateY(-30px); }
.section-grid .cell-2 { transform: translateX(20px) rotate(5deg); }
.section-grid .cell-3 { transform: translateY(30px); }
.section-grid .cell-4 { transform: translateX(-20px); }
.section-grid .cell-5 { transform: scale(0.8); }
.section-grid .cell-6 { transform: translateX(30px); }
.section-grid .cell-7 { transform: translateY(20px); }
.section-grid .cell-8 { transform: rotate(-5deg); }
.section-grid .cell-9 { transform: translateY(-20px); }
.section-grid.revealed .cell-4 { transform: translateX(0); }
.section-grid.revealed .cell-5 { transform: scale(1); }
.section-grid.revealed .cell-6 { transform: translateX(0); }
.section-grid.revealed .cell-7 { transform: translateY(0); }
.section-grid.revealed .cell-8 { transform: rotate(0deg); }
.section-grid.revealed .cell-9 { transform: translateY(0); }

.geo-cell {
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s ease;
}

/* === Section 4: Close === */
.close-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.close-heading {
    font-family: 'Playfair Display', serif;
    font-size: clamp(48px, 8vw, 120px);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--void-black);
    line-height: 1.1;
    transform: rotate(-2deg);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-close.revealed .close-heading {
    transform: rotate(0deg);
}

.close-annotation {
    margin-top: 40px;
    color: var(--dusk-indigo);
    font-size: 28px;
}

.section-close .annotation-text {
    color: var(--dusk-indigo);
}

/* === Word Reveal Animation === */
.word-reveal {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) rotate(-3deg);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.section.revealed .word-reveal {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* Stagger delays */
.section.revealed .word-reveal:nth-child(1) { transition-delay: 0ms; }
.section.revealed .word-reveal:nth-child(2) { transition-delay: 80ms; }
.section.revealed .word-reveal:nth-child(3) { transition-delay: 160ms; }
.section.revealed .word-reveal:nth-child(4) { transition-delay: 240ms; }
.section.revealed .word-reveal:nth-child(5) { transition-delay: 320ms; }

/* === Fade-in Elements === */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section.revealed .fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* === Tilt Card Base === */
.tilt-card {
    will-change: transform;
    transition: transform 0.15s ease-out;
}

/* === Responsive === */
@media (max-width: 768px) {
    .f-pattern {
        grid-template-columns: 1fr;
    }

    .secondary-column {
        padding-top: 20px;
    }

    .stair-1, .stair-2, .stair-3 {
        margin-left: 0;
    }

    .content-block {
        padding: 24px;
    }

    .section-inner {
        padding: 60px 20px;
    }

    .geo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .hero-title {
        font-size: clamp(60px, 15vw, 120px);
    }

    .section-heading {
        font-size: clamp(32px, 8vw, 56px);
    }

    .annotation-card {
        transform: rotate(0deg);
    }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .geo-shape {
        animation: none;
    }

    .curve-path {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
    }

    .word-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .fade-in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .section {
        clip-path: none;
        transition: none;
    }

    .tilt-card {
        transition: none;
    }
}