/* ============================================
   desca.dev - Fairycore Terrarium
   A garden of quiet code and gentle light
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-burgundy: #6B1D3A;
    --burgundy-mid: #8C3055;
    --blush-rose: #C47A8E;
    --warm-cream: #F5EDE0;
    --pearl-white: #FAF6F1;
    --antique-gold: #C9A96E;
    --forest-whisper: #8FA78B;
    --deep-shadow: #2A1520;

    --font-display: 'Quicksand', sans-serif;
    --font-body: 'Nunito', sans-serif;
    --font-accent: 'Caveat', cursive;

    --chamber-margin: 8vw;
    --content-offset: 15%;
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.015em;
    color: var(--deep-shadow);
    background-color: var(--deep-burgundy);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Chamber Base --- */
.chamber {
    position: relative;
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.chamber-content {
    position: relative;
    z-index: 5;
    padding: var(--chamber-margin);
    padding-left: calc(var(--chamber-margin) + var(--content-offset));
    max-width: 65ch;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.2;
    letter-spacing: 0.04em;
}

h1 {
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 6rem);
}

h2 {
    font-weight: 600;
    font-size: clamp(2.2rem, 6vw, 5rem);
    margin-bottom: 1.5rem;
}

h3 {
    font-weight: 600;
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1.25rem;
}

.annotation {
    font-family: var(--font-accent);
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    font-weight: 400;
    transform: rotate(-1.5deg);
    display: inline-block;
    margin-top: 0.5rem;
}

blockquote {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.3;
    letter-spacing: 0.03em;
    text-align: center;
    max-width: 80%;
    margin: 0 auto;
}

/* --- Lens Flare System --- */
.lens-flare {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

.lens-flare::before,
.lens-flare::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.lens-flare::before {
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(201, 169, 110, 0.25) 0%, rgba(196, 122, 142, 0.12) 50%, transparent 70%);
}

.lens-flare::after {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
}

@keyframes flare-breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
}

/* --- Individual Flares --- */
.flare-1 {
    width: 280px;
    height: 280px;
    top: 15%;
    left: 18%;
    background: radial-gradient(circle, rgba(201, 169, 110, 0.35) 0%, rgba(196, 122, 142, 0.15) 40%, transparent 70%);
    animation: flare-breathe 10s ease-in-out infinite;
}

.flare-2 {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 25%;
    background: radial-gradient(circle, rgba(201, 169, 110, 0.2) 0%, rgba(196, 122, 142, 0.1) 40%, transparent 70%);
    animation: flare-breathe 12s ease-in-out infinite 2s;
}

.flare-garden {
    width: 200px;
    height: 200px;
    top: 10%;
    right: 15%;
    background: radial-gradient(circle, rgba(196, 122, 142, 0.3) 0%, rgba(201, 169, 110, 0.1) 40%, transparent 70%);
    animation: flare-breathe 9s ease-in-out infinite 1s;
}

.flare-alcove {
    width: 250px;
    height: 250px;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(201, 169, 110, 0.3) 0%, rgba(196, 122, 142, 0.15) 40%, transparent 70%);
    animation: flare-breathe 11s ease-in-out infinite;
}

.flare-archive-1 {
    width: 220px;
    height: 220px;
    top: 12%;
    left: 22%;
    background: radial-gradient(circle, rgba(201, 169, 110, 0.3) 0%, rgba(196, 122, 142, 0.12) 40%, transparent 70%);
    animation: flare-breathe 10s ease-in-out infinite;
}

.flare-archive-2 {
    width: 160px;
    height: 160px;
    bottom: 20%;
    right: 18%;
    background: radial-gradient(circle, rgba(201, 169, 110, 0.2) 0%, rgba(196, 122, 142, 0.1) 40%, transparent 70%);
    animation: flare-breathe 8s ease-in-out infinite 3s;
}

.flare-reflection {
    width: 300px;
    height: 300px;
    top: 20%;
    left: 25%;
    background: radial-gradient(circle, rgba(201, 169, 110, 0.25) 0%, rgba(196, 122, 142, 0.12) 40%, transparent 70%);
    animation: flare-breathe 12s ease-in-out infinite;
}

/* --- Iridescent Shimmer Layer --- */
.iridescent-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    background: linear-gradient(135deg,
        rgba(196, 122, 142, 0.04),
        rgba(143, 167, 139, 0.04),
        rgba(201, 169, 110, 0.04));
    background-size: 300% 300%;
    animation: shimmer-shift 20s ease-in-out infinite;
}

.shimmer-visible {
    opacity: 1;
}

@keyframes shimmer-shift {
    0% { background-position: 0% 0%; }
    33% { background-position: 100% 50%; }
    66% { background-position: 50% 100%; }
    100% { background-position: 0% 0%; }
}

/* --- Wave Form Decorations --- */
.wave-container {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

.wave {
    display: block;
    overflow: visible;
}

@keyframes wave-drift {
    0% { transform: translateX(-25%); }
    100% { transform: translateX(0%); }
}

/* Threshold Waves */
.threshold-waves {
    bottom: 15%;
    left: 0;
    width: 130%;
    height: 80px;
}

.threshold-waves .wave-1 {
    color: rgba(196, 122, 142, 0.4);
    width: 100%;
    height: 40px;
    animation: wave-drift 18s linear infinite;
}

.threshold-waves .wave-2 {
    color: rgba(196, 122, 142, 0.25);
    width: 100%;
    height: 40px;
    margin-top: -10px;
    animation: wave-drift 22s linear infinite reverse;
}

/* Alcove Waves (Vertical) */
.alcove-waves {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 100%;
}

.alcove-waves .wave-3 {
    color: rgba(196, 122, 142, 0.35);
    width: 60px;
    height: 100%;
    animation: wave-drift-vertical 16s linear infinite;
}

.alcove-waves .wave-4 {
    color: rgba(196, 122, 142, 0.2);
    width: 60px;
    height: 100%;
    position: absolute;
    top: 0;
    left: 10px;
    animation: wave-drift-vertical 20s linear infinite reverse;
}

@keyframes wave-drift-vertical {
    0% { transform: translateY(-25%); }
    100% { transform: translateY(0%); }
}

/* Reflection Waves */
.reflection-waves {
    bottom: 20%;
    left: 0;
    width: 130%;
    height: 100px;
}

.reflection-waves .wave-5 {
    color: rgba(107, 29, 58, 0.2);
    width: 100%;
    height: 35px;
    animation: wave-drift 15s linear infinite;
}

.reflection-waves .wave-6 {
    color: rgba(107, 29, 58, 0.15);
    width: 100%;
    height: 35px;
    margin-top: -8px;
    animation: wave-drift 20s linear infinite reverse;
}

.reflection-waves .wave-7 {
    color: rgba(107, 29, 58, 0.1);
    width: 100%;
    height: 35px;
    margin-top: -8px;
    animation: wave-drift 25s linear infinite;
}

/* --- Petal Silhouettes --- */
.petal-silhouettes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.petal {
    position: absolute;
}

/* Threshold petals - cream on burgundy */
.threshold-petals .petal { color: rgba(245, 237, 224, 0.1); }
.petal-1 { width: 30px; top: 20%; right: 12%; transform: rotate(25deg); }
.petal-2 { width: 22px; top: 45%; right: 8%; transform: rotate(-15deg); }
.petal-3 { width: 28px; bottom: 25%; right: 18%; transform: rotate(45deg); }

/* Garden petals - burgundy on cream */
.garden-petals .petal { color: rgba(107, 29, 58, 0.1); }
.petal-4 { width: 35px; top: 15%; right: 10%; transform: rotate(20deg); }
.petal-5 { width: 40px; top: 35%; right: 5%; transform: rotate(-30deg); }
.petal-6 { width: 20px; top: 55%; right: 15%; transform: rotate(10deg); }
.petal-7 { width: 30px; bottom: 20%; right: 8%; transform: rotate(-45deg); }
.petal-8 { width: 24px; bottom: 35%; right: 20%; transform: rotate(35deg); }

/* Alcove petals - mixed */
.alcove-petals .petal { color: rgba(107, 29, 58, 0.08); }
.petal-9 { width: 28px; top: 12%; left: 5%; transform: rotate(-20deg); }
.petal-10 { width: 32px; bottom: 18%; left: 8%; transform: rotate(30deg); }
.petal-11 { width: 22px; top: 40%; left: 3%; transform: rotate(50deg); }

/* Archive petals - cream on burgundy */
.archive-petals .petal { color: rgba(245, 237, 224, 0.1); }
.petal-12 { width: 28px; top: 10%; right: 8%; transform: rotate(15deg); }
.petal-13 { width: 36px; top: 40%; right: 5%; transform: rotate(-25deg); }
.petal-14 { width: 24px; bottom: 15%; left: 5%; transform: rotate(40deg); }
.petal-15 { width: 30px; bottom: 30%; right: 12%; transform: rotate(-10deg); }

/* Reflection petals - burgundy on cream */
.reflection-petals .petal { color: rgba(107, 29, 58, 0.08); }
.petal-16 { width: 32px; top: 15%; right: 12%; transform: rotate(22deg); }
.petal-17 { width: 38px; bottom: 25%; left: 10%; transform: rotate(-18deg); }
.petal-18 { width: 20px; top: 50%; right: 6%; transform: rotate(55deg); }

/* --- Transition Veils --- */
.transition-veil {
    height: 30vh;
    width: 100%;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.veil-1 {
    background: linear-gradient(180deg, #6B1D3A 0%, #C47A8E 40%, #F5EDE0 100%);
}

.veil-2 {
    background: linear-gradient(180deg, #F5EDE0 0%, #C47A8E 50%, #FAF6F1 60%, #8C3055 100%);
}

.veil-3 {
    background: linear-gradient(180deg, #8C3055 0%, #C47A8E 40%, #6B1D3A 100%);
}

.veil-4 {
    background: linear-gradient(180deg, #6B1D3A 0%, #C47A8E 40%, #F5EDE0 100%);
}

/* ============================================
   CHAMBER SPECIFIC STYLES
   ============================================ */

/* --- CHAMBER 1: THE THRESHOLD --- */
.chamber-threshold {
    background-color: #6B1D3A;
    background-image: radial-gradient(circle at 30% 25%, rgba(201, 169, 110, 0.35) 0%, rgba(196, 122, 142, 0.15) 40%, transparent 70%);
    justify-content: flex-start;
    align-items: center;
}

.threshold-content {
    padding-top: 0;
}

.site-name {
    color: #F5EDE0;
    margin-bottom: 0.5rem;
}

.tagline {
    font-family: var(--font-accent);
    color: #C9A96E;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    margin-bottom: 0;
    transform: rotate(-1deg);
    display: inline-block;
}

/* --- CHAMBER 2: THE GARDEN --- */
.chamber-garden {
    background-color: #F5EDE0;
    background-image: radial-gradient(circle at 75% 20%, rgba(196, 122, 142, 0.1) 0%, transparent 50%);
}

.garden-content h2 {
    color: #6B1D3A;
}

.garden-content p {
    color: #2A1520;
}

.garden-content .annotation {
    color: #C9A96E;
}

/* --- CHAMBER 3: THE ALCOVE --- */
.chamber-alcove {
    background-color: #FAF6F1;
    padding: 0;
}

.alcove-split {
    display: flex;
    width: 100%;
    height: 100%;
}

.alcove-light {
    width: 55%;
    height: 100%;
    background-color: #FAF6F1;
    display: flex;
    align-items: center;
    position: relative;
}

.alcove-dark {
    width: 45%;
    height: 100%;
    background-color: #8C3055;
    position: relative;
    overflow: hidden;
}

.alcove-content {
    padding: var(--chamber-margin);
    padding-left: calc(var(--chamber-margin) + 5%);
}

.alcove-content h2 {
    color: #6B1D3A;
}

.alcove-content p {
    color: #2A1520;
}

.alcove-content .annotation {
    color: #8FA78B;
}

/* --- CHAMBER 4: THE ARCHIVE --- */
.chamber-archive {
    background-color: #6B1D3A;
    background-image: radial-gradient(circle at 25% 30%, rgba(201, 169, 110, 0.2) 0%, transparent 50%);
    align-items: center;
}

.archive-content {
    max-width: 90%;
    padding-left: var(--chamber-margin);
}

.archive-content h2 {
    color: #F5EDE0;
    margin-bottom: 2rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 900px;
}

.project-card {
    background: rgba(245, 237, 224, 0.08);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(196, 122, 142, 0.2);
    border-radius: 16px;
    padding: 2rem;
    transition: transform 250ms ease, box-shadow 250ms ease;
    cursor: default;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(42, 21, 32, 0.2);
}

.project-card h3 {
    font-family: var(--font-display);
    font-weight: 600;
    color: #F5EDE0;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
}

.project-card p {
    color: rgba(245, 237, 224, 0.75);
    font-size: clamp(0.88rem, 1.4vw, 1rem);
    line-height: 1.65;
    margin-bottom: 0.75rem;
}

.card-tag {
    font-family: var(--font-accent);
    color: #C9A96E;
    font-size: 0.95rem;
    display: inline-block;
}

/* --- CHAMBER 5: THE REFLECTION --- */
.chamber-reflection {
    background-color: #F5EDE0;
    background-image: radial-gradient(circle at 30% 25%, rgba(201, 169, 110, 0.15) 0%, transparent 50%);
    justify-content: center;
    align-items: center;
}

.reflection-content {
    text-align: center;
    padding-left: var(--chamber-margin);
    padding-right: var(--chamber-margin);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reflection-content blockquote {
    color: #6B1D3A;
    font-style: normal;
    border: none;
    padding: 0;
}

.reflection-credit {
    color: #C9A96E;
    margin-top: 1.5rem;
    transform: rotate(-1deg);
}

/* --- Slide-Reveal Animation System --- */
.reveal-element {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 700ms cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 700ms cubic-bezier(0.25, 0.1, 0.25, 1);
    transition-delay: calc(var(--stagger-index, 0) * 150ms);
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateX(0);
}

.annotation.reveal-element {
    transform: translateX(-30px) rotate(-1.5deg);
}

.annotation.reveal-element.revealed {
    opacity: 1;
    transform: translateX(0) rotate(-1.5deg);
}

.reveal-element-vertical {
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 700ms cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 700ms cubic-bezier(0.25, 0.1, 0.25, 1);
    transition-delay: calc(var(--stagger-index, 0) * 150ms);
}

.reveal-element-vertical.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Threshold-specific reveals */
.site-name {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 700ms cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 700ms cubic-bezier(0.25, 0.1, 0.25, 1);
    transition-delay: calc(var(--stagger-index, 0) * 150ms);
}

.site-name.revealed {
    opacity: 1;
    transform: translateX(0);
}

.tagline {
    opacity: 0;
    transform: translateX(-30px) rotate(-1deg);
    transition: opacity 700ms cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 700ms cubic-bezier(0.25, 0.1, 0.25, 1);
    transition-delay: calc(var(--stagger-index, 0) * 150ms);
}

.tagline.revealed {
    opacity: 1;
    transform: translateX(0) rotate(-1deg);
}

/* --- Link Interactions --- */
a {
    color: inherit;
    text-decoration: none;
    position: relative;
    display: inline-block;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background-color: #C9A96E;
    transition: width 300ms ease;
}

a:hover::after {
    width: 100%;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --chamber-margin: 6vw;
        --content-offset: 5%;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .alcove-split {
        flex-direction: column;
    }

    .alcove-light {
        width: 100%;
        height: 60%;
    }

    .alcove-dark {
        width: 100%;
        height: 40%;
    }

    .alcove-content {
        padding-left: var(--chamber-margin);
    }

    blockquote {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
        max-width: 95%;
    }

    .project-card {
        padding: 1.5rem;
    }

    .lens-flare {
        transform: scale(0.7);
    }

    .flare-1 { width: 200px; height: 200px; }
    .flare-alcove { left: 30%; }
}

@media (max-width: 480px) {
    :root {
        --chamber-margin: 5vw;
        --content-offset: 2%;
    }

    h1 {
        font-size: clamp(2.2rem, 10vw, 3.5rem);
    }

    h2 {
        font-size: clamp(1.8rem, 7vw, 2.8rem);
    }
}
