/* ============================================
   saram.quest - Dopamine-Rush Learning Experience
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette */
    --cloud-milk: #F8F4FF;
    --mint-whisper: #E8F5EE;
    --lavender-fizz: #C8B6FF;
    --peach-sherbet: #FFCDB2;
    --lemon-sorbet: #FFF3B0;
    --baby-spearmint: #B5EAD7;
    --deep-grape: #3B2D4A;
    --warm-graphite: #6B5B7B;
    --electric-guava: #FF6B6B;
    --cobalt-candy: #6C63FF;
    --frosted-lilac: #DDD6F3;

    /* Brightened hover variants */
    --lavender-fizz-bright: #D4C8FF;
    --peach-sherbet-bright: #FFD9C4;

    /* Scroll progress */
    --scroll-progress: 0;
    --mouse-x: 50%;
    --mouse-y: 50%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Literata', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.85;
    color: var(--deep-grape);
    background: var(--cloud-milk);
    overflow-x: hidden;
    position: relative;
}

/* --- Background Spotlight --- */
#bg-spotlight {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(
        600px circle at var(--mouse-x) var(--mouse-y),
        rgba(200, 182, 255, 0.06) 0%,
        transparent 70%
    );
    transition: background 0.3s ease;
}

/* --- Zone Base --- */
.zone {
    position: relative;
    z-index: 1;
}

/* --- Reveal Zone --- */
#reveal-zone {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.watermark {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(15rem, 40vw, 30rem);
    color: var(--frosted-lilac);
    opacity: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    line-height: 1;
    transition: opacity 0.8s ease;
    z-index: 1;
}

.watermark.visible {
    opacity: 0.3;
}

.domain-title {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: 0.04em;
    color: var(--deep-grape);
    mix-blend-mode: multiply;
    opacity: 0;
    position: relative;
    z-index: 2;
    transition: opacity 0.8s ease;
}

.domain-title.visible {
    opacity: 1;
}

/* --- Capsule Base --- */
.capsule {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 10px 28px;
    border: 1px solid var(--frosted-lilac);
    transition: background-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
}

.capsule[data-fill="1"] { background-color: var(--lavender-fizz); }
.capsule[data-fill="2"] { background-color: var(--peach-sherbet); }
.capsule[data-fill="3"] { background-color: var(--lemon-sorbet); }
.capsule[data-fill="4"] { background-color: var(--baby-spearmint); }

.capsule:hover[data-fill="1"] { background-color: var(--lavender-fizz-bright); }
.capsule:hover[data-fill="2"] { background-color: var(--peach-sherbet-bright); }
.capsule:hover[data-fill="3"] { background-color: #FFF7C4; }
.capsule:hover[data-fill="4"] { background-color: #C4F0DE; }

.capsule-text {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--deep-grape);
    white-space: nowrap;
}

/* --- Hero Capsule --- */
.capsule-hero {
    width: 200px;
    height: 48px;
    background-color: var(--lavender-fizz);
    margin-top: 120px;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.6s ease, transform 0.15s ease-out;
}

.capsule-hero.visible {
    opacity: 1;
}

/* --- Nature SVGs --- */
.nature-svg {
    position: absolute;
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.nature-svg.visible {
    opacity: 1;
}

.nature-ginkgo {
    left: 8%;
    top: 30%;
    animation: float-xy-ginkgo 8s ease-in-out infinite;
}

.nature-droplet {
    right: 12%;
    top: 18%;
    animation: float-y-droplet 11s ease-in-out infinite;
}

.nature-seed {
    right: 15%;
    bottom: 20%;
    animation: float-xy-seed 13s ease-in-out infinite;
}

@keyframes float-xy-ginkgo {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(4px, -6px) rotate(3deg); }
    50% { transform: translate(-2px, 6px) rotate(-2deg); }
    75% { transform: translate(5px, 3px) rotate(1deg); }
}

@keyframes float-y-droplet {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes float-xy-seed {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-5px, -4px); }
    66% { transform: translate(3px, 5px); }
}

/* --- Constellation Zone --- */
#constellation-zone {
    min-height: 400vh;
    position: relative;
    padding: 10vh 0;
    background: linear-gradient(
        to bottom,
        var(--cloud-milk) 0%,
        var(--mint-whisper) 50%,
        var(--cloud-milk) 100%
    );
}

.cluster {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    margin-bottom: 80vh;
    max-width: 600px;
    margin-left: var(--cluster-x, 20%);
}

.cluster-label {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
    color: var(--deep-grape);
    width: 100%;
    text-align: center;
    margin-bottom: 16px;
}

.constellation-capsule {
    opacity: 0;
    transform: translateX(-80px) translateY(calc(var(--i, 0) * 7px - 12px));
    animation: none;
}

.constellation-capsule.entered {
    opacity: 1;
    transform: translateY(calc(var(--i, 0) * 7px - 12px));
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.constellation-capsule.entered.floating {
    animation: capsule-float 6s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 0.8s);
}

@keyframes capsule-float {
    0%, 100% { transform: translateY(calc(var(--i, 0) * 7px - 12px)); }
    50% { transform: translateY(calc(var(--i, 0) * 7px - 18px)); }
}

/* Cluster wakes up on hover */
.cluster.awake .constellation-capsule[data-fill="1"] {
    background-color: var(--lavender-fizz-bright);
}
.cluster.awake .constellation-capsule[data-fill="2"] {
    background-color: var(--peach-sherbet-bright);
}
.cluster.awake .constellation-capsule.entered.floating {
    animation-name: capsule-float-intense;
}

@keyframes capsule-float-intense {
    0%, 100% { transform: translateY(calc(var(--i, 0) * 7px - 12px)); }
    50% { transform: translateY(calc(var(--i, 0) * 7px - 24px)); }
}

/* --- Root Tendrils --- */
.root-tendrils-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.tendril {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.tendril.drawn {
    stroke-dashoffset: 0;
}

/* --- Deep Dive Zone --- */
#deep-dive-zone {
    min-height: 200vh;
    padding: 10vh 0;
    background-color: var(--mint-whisper);
    position: relative;
}

.deep-dive-content {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 clamp(2rem, 5vw, 4rem);
    position: relative;
}

.deep-dive-reading {
    margin-bottom: 15vh;
    position: relative;
}

.deep-dive-title {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
    color: var(--deep-grape);
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.deep-dive-title.revealed {
    opacity: 1;
    transform: translateY(0);
}

.deep-dive-paragraph {
    margin-bottom: 1.5rem;
    color: var(--deep-grape);
    font-weight: 300;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.deep-dive-paragraph.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Annotation Capsules --- */
.annotation-capsule {
    position: absolute;
    padding: 6px 18px;
    z-index: 2;
}

.annotation-left {
    left: -180px;
}

.annotation-right {
    right: -180px;
}

@media (max-width: 1100px) {
    .annotation-capsule {
        position: relative;
        left: auto;
        right: auto;
        display: inline-flex;
        margin-bottom: 1rem;
    }
}

/* --- Echo Zone --- */
#echo-zone {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--cloud-milk);
}

.echo-watermark {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(15rem, 40vw, 30rem);
    color: var(--frosted-lilac);
    opacity: 0.15;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    line-height: 1;
}

.echo-title {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 4rem);
    letter-spacing: 0.04em;
    color: var(--deep-grape);
    mix-blend-mode: multiply;
    position: relative;
    z-index: 2;
    margin-bottom: 2rem;
}

.echo-constellation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 500px;
    position: relative;
    z-index: 2;
    margin-bottom: 2rem;
}

.echo-closing-capsule {
    position: relative;
    z-index: 2;
    animation: capsule-float 6s ease-in-out infinite;
}

/* --- Nav Dot --- */
.nav-dot {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    cursor: pointer;
}

.nav-dot-inner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--lavender-fizz);
    animation: nav-pulse 3s ease-in-out infinite;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.nav-menu {
    position: absolute;
    top: -8px;
    right: -8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 30px 10px 10px 10px;
}

.nav-dot:hover .nav-menu {
    opacity: 1;
    pointer-events: auto;
}

.nav-dot:hover .nav-dot-inner {
    transform: scale(1.5);
    background-color: var(--cobalt-candy);
}

.nav-capsule {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 6px 16px;
    background-color: var(--lavender-fizz);
    border: 1px solid var(--frosted-lilac);
    transition: background-color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    cursor: pointer;
}

.nav-capsule:hover {
    background-color: var(--peach-sherbet);
    transform: scale(1.05);
}

.nav-capsule .capsule-text {
    font-size: 0.65rem;
}

/* --- Confetti --- */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
    overflow: hidden;
}

.confetti-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    opacity: 1;
    animation: confetti-burst 1.2s cubic-bezier(0, 0.9, 0.3, 1) forwards;
}

.confetti-particle.circle {
    border-radius: 50%;
}

@keyframes confetti-burst {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
        opacity: 0;
    }
}

/* --- Drifting Leaves --- */
#drifting-leaves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.drifting-leaf {
    position: absolute;
    opacity: 0.4;
    animation: drift-leaf linear infinite;
}

@keyframes drift-leaf {
    0% {
        transform: translate(0, -60px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translate(var(--drift-x), calc(100vh + 60px)) rotate(var(--drift-rot));
        opacity: 0;
    }
}

/* --- Zone Boundary Droplets --- */
.zone-boundary-droplets {
    position: absolute;
    width: 100%;
    height: 80px;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

#droplets-1 {
    top: 100vh;
}

#droplets-2 {
    top: 400vh;
}

.boundary-droplet {
    position: absolute;
    opacity: 0;
    animation: drip-down 1.5s ease-in forwards;
}

@keyframes drip-down {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    30% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(60px);
        opacity: 0;
    }
}

/* --- Korean Accent Text --- */
.korean-accent {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 400;
    font-size: 150%;
    color: var(--frosted-lilac);
    opacity: 0.5;
}

/* --- Selection --- */
::selection {
    background-color: var(--lavender-fizz);
    color: var(--deep-grape);
}

/* --- Links --- */
a {
    color: var(--cobalt-candy);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--electric-guava);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--cloud-milk);
}

::-webkit-scrollbar-thumb {
    background: var(--frosted-lilac);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--lavender-fizz);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .cluster {
        margin-left: 5%;
        margin-right: 5%;
        max-width: 90%;
    }

    .capsule-hero {
        margin-top: 80px;
        width: 180px;
        height: 44px;
    }

    .nav-dot {
        top: 16px;
        right: 16px;
    }

    .annotation-capsule {
        position: relative;
        left: auto;
        right: auto;
        display: inline-flex;
        margin-bottom: 1rem;
    }
}
