:root {
    --cream: #FFF8F0;
    --blush: #FDE8E0;
    --lavender: #C3A6D8;
    --mint: #A8D8CB;
    --peach: #F5C4A1;
    --sky: #A8D4E6;
    --cocoa: #4A3F45;
    --mauve: #8A7B82;
    --rose: #F2D4DC;
    --bubble-shadow: 0 8px 32px rgba(180, 160, 200, 0.12);
    --bubble-shadow-strong: 0 14px 44px rgba(180, 160, 200, 0.22);
    --island-radius: 2rem;
    --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --bounce-ease: cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

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

html, body {
    background: var(--cream);
    color: var(--cocoa);
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 100%;
}

body {
    position: relative;
    background:
        radial-gradient(ellipse 90% 60% at 20% 5%, rgba(195, 166, 216, 0.10), transparent 70%),
        radial-gradient(ellipse 80% 50% at 85% 30%, rgba(168, 216, 203, 0.10), transparent 70%),
        radial-gradient(ellipse 80% 50% at 15% 60%, rgba(245, 196, 161, 0.10), transparent 70%),
        radial-gradient(ellipse 90% 60% at 80% 90%, rgba(168, 212, 230, 0.10), transparent 70%),
        linear-gradient(180deg, var(--cream) 0%, var(--blush) 50%, var(--cream) 100%);
}

.page-gradient {
    position: fixed;
    inset: 0;
    z-index: -3;
    pointer-events: none;
    background:
        radial-gradient(circle at 30% 20%, rgba(242, 212, 220, 0.25), transparent 55%),
        radial-gradient(circle at 75% 75%, rgba(168, 216, 203, 0.18), transparent 55%);
    animation: bg-drift 24s ease-in-out infinite alternate;
}

@keyframes bg-drift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(2%, -1%, 0) scale(1.04); }
}

.bubble-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

main {
    position: relative;
    z-index: 1;
}

/* ----- Typography ----- */

h1, h2, h3 {
    font-family: 'Quicksand', system-ui, sans-serif;
    color: var(--cocoa);
    letter-spacing: 0.01em;
    line-height: 1.15;
}

h1 { font-weight: 700; font-size: clamp(2.5rem, 7vw, 5.5rem); }
h2 { font-weight: 600; font-size: clamp(1.6rem, 3.5vw, 2.8rem); margin-bottom: 0.6em; }
h3 { font-weight: 500; font-size: clamp(1.2rem, 2.5vw, 1.8rem); margin-bottom: 0.5em; }

p {
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    margin-bottom: 1em;
    color: var(--cocoa);
}

p:last-child { margin-bottom: 0; }

a {
    color: var(--sky);
    text-decoration: none;
    position: relative;
    transition: color 220ms var(--spring-ease);
}

a:hover {
    color: var(--lavender);
}

/* ----- Hero ----- */

.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    overflow: hidden;
}

.hero-inner {
    text-align: center;
    position: relative;
    z-index: 2;
}

.title {
    display: inline-flex;
    gap: 0.02em;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    color: var(--lavender);
    text-shadow:
        0 2px 0 rgba(255, 255, 255, 0.4),
        0 10px 30px rgba(195, 166, 216, 0.25);
}

.title .letter {
    display: inline-block;
    animation: bob 4.2s ease-in-out infinite;
    animation-delay: calc(var(--i) * 180ms);
    transform-origin: center;
}

.title .letter:nth-child(odd) { color: var(--lavender); }
.title .letter:nth-child(3n) { color: var(--mint); }
.title .letter:nth-child(5n) { color: var(--peach); }
.title .letter:nth-child(7n) { color: var(--sky); }

@keyframes bob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-1.2deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(6px) rotate(1deg); }
}

.hero-sub {
    margin-top: 1.4rem;
    font-family: 'Baloo 2', cursive;
    font-weight: 500;
    color: var(--mauve);
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    letter-spacing: 0.02em;
}

.scroll-cue {
    margin-top: 3rem;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    color: var(--mauve);
    font-family: 'Baloo 2', cursive;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.cue-bubble {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), var(--sky) 60%, rgba(168,212,230,0.2) 100%);
    border: 1.5px solid rgba(168, 212, 230, 0.6);
    animation: float-up 2.6s var(--spring-ease) infinite;
}

@keyframes float-up {
    0% { transform: translateY(8px) scale(0.9); opacity: 0.6; }
    50% { transform: translateY(-4px) scale(1); opacity: 1; }
    100% { transform: translateY(-18px) scale(0.85); opacity: 0; }
}

/* ----- Sections ----- */

section.story,
section.constellation,
section.play,
section.farewell {
    position: relative;
    padding: 8vh 1.5rem;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

section.story[data-side="left"] .island {
    margin-left: 5%;
    margin-right: auto;
}

/* ----- Bubble Divider ----- */

.bubble-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 3rem 1rem;
}

.div-bub {
    display: inline-block;
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), var(--lavender) 70%, rgba(195,166,216,0.15));
    border: 1.5px solid rgba(195, 166, 216, 0.45);
    box-shadow: 0 4px 12px rgba(195, 166, 216, 0.18);
    animation: bobble 3.5s ease-in-out infinite;
}

.div-bub:nth-child(2) { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), var(--mint) 70%, rgba(168,216,203,0.15)); border-color: rgba(168,216,203,0.45); animation-delay: 0.2s; }
.div-bub:nth-child(3) { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), var(--peach) 70%, rgba(245,196,161,0.15)); border-color: rgba(245,196,161,0.45); animation-delay: 0.4s; }
.div-bub:nth-child(4) { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), var(--sky) 70%, rgba(168,212,230,0.15)); border-color: rgba(168,212,230,0.45); animation-delay: 0.6s; }
.div-bub:nth-child(5) { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), var(--rose) 70%, rgba(242,212,220,0.15)); border-color: rgba(242,212,220,0.45); animation-delay: 0.8s; }
.div-bub:nth-child(6) { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), var(--lavender) 70%, rgba(195,166,216,0.15)); animation-delay: 1.0s; }
.div-bub:nth-child(7) { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), var(--mint) 70%, rgba(168,216,203,0.15)); border-color: rgba(168,216,203,0.45); animation-delay: 1.2s; }

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

/* ----- Islands ----- */

.island {
    position: relative;
    background: var(--blush);
    border-radius: var(--island-radius);
    padding: clamp(1.6rem, 3vw, 2.6rem);
    box-shadow: var(--bubble-shadow);
    max-width: 560px;
    width: 100%;
    opacity: 0;
    transform: translateY(60px) rotate(-3deg) scale(0.92);
    transition:
        opacity 800ms var(--spring-ease),
        transform 800ms var(--spring-ease),
        box-shadow 400ms ease;
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: visible;
}

.island.is-visible {
    opacity: 1;
    transform: translateY(0) rotate(var(--rest-rot, 0deg)) scale(1);
}

.island:hover {
    box-shadow: var(--bubble-shadow-strong);
}

.island-tilt-a { --rest-rot: -1.2deg; }
.island-tilt-b { --rest-rot: 1.6deg; }
.island-tilt-c { --rest-rot: -0.8deg; }

.island-tag {
    display: inline-block;
    font-family: 'Baloo 2', cursive;
    font-size: 0.85rem;
    color: var(--mauve);
    background: rgba(255, 248, 240, 0.7);
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1.1rem;
    letter-spacing: 0.04em;
    border: 1px solid rgba(195, 166, 216, 0.25);
}

.island.island-wide {
    max-width: 760px;
}

/* Constellation S-curve placement */
.constellation .islands {
    width: 100%;
    max-width: 1100px;
    margin: 3rem auto 0;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    position: relative;
}

.constellation-heading {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
}

.constellation-heading .lead {
    font-family: 'Baloo 2', cursive;
    color: var(--mauve);
    margin-top: 0.4rem;
}

.island-a { align-self: flex-start; margin-left: 4%; }
.island-b { align-self: flex-end; margin-right: 6%; }
.island-c { align-self: flex-start; margin-left: 12%; }
.island-d { align-self: flex-end; margin-right: 4%; }

/* Bubble list */
.bubble-list {
    list-style: none;
    margin-top: 0.8rem;
    padding-left: 0;
}

.bubble-list li {
    position: relative;
    padding-left: 1.8rem;
    margin-bottom: 0.4rem;
    font-family: 'Baloo 2', cursive;
    color: var(--cocoa);
}

.bubble-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), var(--mint) 65%, rgba(168,216,203,0.2));
    border: 1.5px solid rgba(168, 216, 203, 0.55);
}

.bubble-list li:nth-child(2)::before { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), var(--peach) 65%, rgba(245,196,161,0.2)); border-color: rgba(245,196,161,0.55); }
.bubble-list li:nth-child(3)::before { background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), var(--sky) 65%, rgba(168,212,230,0.2)); border-color: rgba(168,212,230,0.55); }

/* Blockquote bubble */
blockquote {
    position: relative;
    margin: 1.5rem 0 0.5rem;
    padding: 1.6rem 1.4rem;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    color: var(--cocoa);
    font-size: 1.05rem;
    line-height: 1.55;
}

.bq-bubble {
    position: absolute;
    inset: 0 auto auto -20px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.7), var(--rose) 60%, rgba(242,212,220,0.1));
    border: 1.5px solid rgba(242, 212, 220, 0.6);
    z-index: 0;
    animation: breathe 4s ease-in-out infinite;
    transform-origin: center;
}

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

.bq-text {
    position: relative;
    z-index: 1;
}

/* Big bubble in story section */
.big-bubble {
    position: relative;
    width: clamp(160px, 28vw, 240px);
    height: clamp(160px, 28vw, 240px);
    margin: 2rem auto 0;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, rgba(255,255,255,0.85), var(--lavender) 55%, rgba(195,166,216,0.15));
    border: 1.5px solid rgba(195, 166, 216, 0.55);
    box-shadow: 0 12px 36px rgba(195, 166, 216, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 600ms var(--spring-ease);
    animation: breathe-big 5s ease-in-out infinite;
}

.big-bubble:hover {
    transform: scale(1.06) rotate(2deg);
}

.bb-glow {
    position: absolute;
    top: 14%;
    left: 18%;
    width: 28%;
    height: 22%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.85), rgba(255,255,255,0));
    pointer-events: none;
}

.bb-label {
    font-family: 'Baloo 2', cursive;
    color: var(--cocoa);
    font-weight: 500;
    letter-spacing: 0.04em;
    font-size: 0.95rem;
    background: rgba(255,248,240,0.55);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
}

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

/* Play canvas */
.play-canvas {
    position: relative;
    margin-top: 1.6rem;
    width: 100%;
    height: clamp(260px, 40vh, 380px);
    border-radius: 1.6rem;
    background:
        radial-gradient(circle at 30% 30%, rgba(168, 212, 230, 0.18), transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(242, 212, 220, 0.18), transparent 60%),
        rgba(255, 248, 240, 0.65);
    border: 1.5px dashed rgba(195, 166, 216, 0.4);
    overflow: hidden;
    cursor: crosshair;
}

.play-hint {
    position: absolute;
    inset: auto auto 1rem 1.2rem;
    font-family: 'Baloo 2', cursive;
    font-size: 0.85rem;
    color: var(--mauve);
    background: rgba(255, 248, 240, 0.7);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    pointer-events: none;
}

.play-bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Farewell */
.farewell {
    padding-bottom: 12vh;
}

.farewell .island {
    text-align: center;
    max-width: 620px;
}

.signature {
    font-family: 'Baloo 2', cursive;
    color: var(--mauve);
    margin-top: 1rem;
}

.farewell-rise {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

/* ----- Bubble Menu ----- */

.bubble-menu {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    z-index: 50;
    width: 64px;
    height: 64px;
}

.menu-trigger {
    position: absolute;
    inset: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1.5px solid rgba(195, 166, 216, 0.6);
    background: radial-gradient(circle at 32% 30%, rgba(255,255,255,0.9), var(--lavender) 60%, rgba(195,166,216,0.2));
    box-shadow: 0 10px 28px rgba(195, 166, 216, 0.32);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 400ms var(--spring-ease);
    font-family: 'Baloo 2', cursive;
    color: var(--cocoa);
    font-size: 0.85rem;
}

.menu-trigger:hover {
    transform: scale(1.08);
}

.bubble-menu.is-open .menu-trigger {
    transform: scale(0.92) rotate(45deg);
}

.trigger-glow {
    position: absolute;
    top: 16%;
    left: 22%;
    width: 28%;
    height: 22%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.9), rgba(255,255,255,0));
    pointer-events: none;
}

.trigger-label {
    position: relative;
    z-index: 1;
}

.menu-children {
    position: absolute;
    inset: 0;
    list-style: none;
    pointer-events: none;
}

.menu-children li {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    transform: translate(0, 0) scale(0.2);
    opacity: 0;
    transition:
        transform 600ms var(--spring-ease),
        opacity 320ms ease;
    transition-delay: 0ms;
}

.bubble-menu.is-open .menu-children li {
    opacity: 1;
    pointer-events: auto;
}

.bubble-menu.is-open .menu-children li[data-i="0"],
.bubble-menu.is-open .menu-children li:nth-child(1) { transform: translate(-110px, -40px) scale(1); transition-delay: 0ms; }
.bubble-menu.is-open .menu-children li:nth-child(2) { transform: translate(-130px, -120px) scale(1); transition-delay: 80ms; }
.bubble-menu.is-open .menu-children li:nth-child(3) { transform: translate(-60px, -170px) scale(1); transition-delay: 160ms; }
.bubble-menu.is-open .menu-children li:nth-child(4) { transform: translate(30px, -160px) scale(1); transition-delay: 240ms; }
.bubble-menu.is-open .menu-children li:nth-child(5) { transform: translate(80px, -90px) scale(1); transition-delay: 320ms; }

.menu-children a {
    display: flex;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 32% 30%, rgba(255,255,255,0.9), var(--mint) 60%, rgba(168,216,203,0.2));
    border: 1.5px solid rgba(168, 216, 203, 0.55);
    box-shadow: 0 8px 22px rgba(168, 216, 203, 0.28);
    color: var(--cocoa);
    font-family: 'Baloo 2', cursive;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    transition: transform 280ms var(--spring-ease);
}

.menu-children li:nth-child(2) a { background: radial-gradient(circle at 32% 30%, rgba(255,255,255,0.9), var(--peach) 60%, rgba(245,196,161,0.2)); border-color: rgba(245,196,161,0.55); }
.menu-children li:nth-child(3) a { background: radial-gradient(circle at 32% 30%, rgba(255,255,255,0.9), var(--sky) 60%, rgba(168,212,230,0.2)); border-color: rgba(168,212,230,0.55); }
.menu-children li:nth-child(4) a { background: radial-gradient(circle at 32% 30%, rgba(255,255,255,0.9), var(--rose) 60%, rgba(242,212,220,0.2)); border-color: rgba(242,212,220,0.55); }
.menu-children li:nth-child(5) a { background: radial-gradient(circle at 32% 30%, rgba(255,255,255,0.9), var(--lavender) 60%, rgba(195,166,216,0.2)); border-color: rgba(195,166,216,0.55); }

.menu-children a:hover {
    transform: scale(1.1);
}

/* ----- Cursor trail ----- */

.cursor-trail {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 60;
    overflow: visible;
}

.trail-bubble {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), var(--sky) 65%, rgba(168,212,230,0.1));
    border: 1px solid rgba(168, 212, 230, 0.5);
    pointer-events: none;
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
}

/* ----- Click-spawn bubble ----- */

.spawn-bubble {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    will-change: transform, opacity;
}

/* ----- Responsive ----- */

@media (max-width: 720px) {
    .island, .island-a, .island-b, .island-c, .island-d {
        align-self: center;
        margin: 0 auto;
        max-width: 92%;
    }

    section.story[data-side="left"] .island {
        margin-left: auto;
        margin-right: auto;
    }

    .bubble-menu {
        right: 50%;
        transform: translateX(50%);
        bottom: 1.2rem;
    }

    .cursor-trail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
}
