/* =====================================================================
   gabs.games — gossiping playground stylesheet
   Palette:
     #FFF6F0 eggshell sugar (page bg)
     #FF8FB1 bubblegum heart
     #FFD86B butter sun
     #7AD0C9 mint whisper
     #B89AFF lilac gossip
     #2A1F3F plum ink (text + spine)
     #FFD6E8 floss line (dashed strokes)
     #FFFFFF mcbling glaze rim/specular
   Fonts: Fraunces (display), Caveat (handwritten), DM Mono (tiny accents)
   ===================================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #FFF6F0;
    color: #2A1F3F;
    font-family: 'Fraunces', 'Inter', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    overflow-x: hidden;
    cursor: default;
    line-height: 0.92;
    letter-spacing: -0.018em;
}

/* ============= dust motes (parallax depth-2 background) ============= */
.dust-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.dust-mote {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    opacity: 0.68;
    will-change: transform;
}

/* ============= conversation spine ============= */
.spine {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 240px;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
}

.spine path {
    animation: spineFlow 12s linear infinite;
}

@keyframes spineFlow {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -200; }
}

.cluster-06 .spine path,
body.in-pause .spine path {
    animation-duration: 24s;
}

/* ============= floating header bubble (magnetic) ============= */
.header-bubble {
    position: fixed;
    top: 28px;
    left: 32px;
    z-index: 50;
    background: #FF8FB1;
    border-radius: 64% 36% 70% 30% / 50% 60% 40% 50%;
    padding: 14px 22px 16px 22px;
    box-shadow: inset 0 0 0 1px #FFFFFF, 0 6px 0 -3px #FFD6E8;
    color: #2A1F3F;
    font-family: 'Fraunces', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-size: 1.05rem;
    will-change: transform;
    transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
}

.header-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 28px;
    width: 14px;
    height: 14px;
    background: #FF8FB1;
    border-radius: 60% 40% 30% 70% / 60% 50% 50% 40%;
    box-shadow: inset 0 0 0 1px #FFFFFF;
}

.header-name {
    font-weight: 600;
}

.header-shh {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: #2A1F3F;
    opacity: 0.75;
    margin-left: 6px;
}

/* ============= thread index (vertical cluster dots) ============= */
.thread-index {
    position: fixed;
    top: 40px;
    right: 36px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.thread-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2A1F3F;
    opacity: 0.55;
    margin-bottom: 6px;
}

.thread-dot {
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid #2A1F3F;
    background: transparent;
    text-decoration: none;
    transition: transform 200ms ease;
}

.thread-dot span {
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: #FF8FB1;
    transform: scale(0);
    transform-origin: center;
    transition: transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.thread-dot.passed span {
    transform: scale(1);
}

.thread-dot::before {
    content: attr(data-num);
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'DM Mono', monospace;
    font-style: italic;
    font-size: 0.7rem;
    color: #2A1F3F;
    opacity: 0;
    white-space: nowrap;
    transition: opacity 200ms ease;
}

.thread-dot:hover::before,
.thread-dot.active::before {
    opacity: 0.7;
}

/* ============= cupped-ear cursor ============= */
.cupped-ear {
    position: fixed;
    top: 0;
    left: 0;
    width: 34px;
    height: 34px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-12deg) scale(0.6);
    transition: opacity 180ms ease, transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.eavesdropping .cupped-ear {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-12deg) scale(1);
}

/* ============= conversation main container ============= */
.conversation {
    position: relative;
    z-index: 5;
    width: 100%;
    overflow: hidden;
}

.cluster {
    position: relative;
    width: 100%;
    padding: 0;
}

.cluster-label {
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Fraunces', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-feature-settings: "smcp";
    text-transform: lowercase;
    color: #2A1F3F;
    opacity: 0.65;
    z-index: 6;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.cluster-label .num {
    font-family: 'DM Mono', monospace;
    font-style: italic;
    font-size: 0.85rem;
    opacity: 0.7;
}

.cluster-label .name {
    font-size: 1.1rem;
    font-variant: small-caps;
    letter-spacing: 0.04em;
}

/* ============= bubble base styles ============= */
.blob-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.specular {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #FFFFFF;
    border-radius: 50%;
    top: 22%;
    left: 28%;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(255,255,255,0.7);
}

.bubble-text {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #2A1F3F;
    pointer-events: none;
}

.caveat-tag {
    position: absolute;
    bottom: -28px;
    right: 12%;
    font-family: 'Caveat', cursive;
    font-size: 1.15rem;
    color: #2A1F3F;
    opacity: 0.6;
    transform: rotate(-3deg);
    z-index: 3;
    white-space: nowrap;
    pointer-events: none;
}

.tag-bottom {
    bottom: -36px;
    right: auto;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
}

/* ============= CLUSTER 01 — sshhh ============= */
.cluster-01 {
    height: 110vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bubble {
    position: relative;
    width: 38vw;
    aspect-ratio: 1 / 1;
    min-width: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: heroPulse 4.2s ease-in-out infinite;
    will-change: transform;
}

@keyframes heroPulse {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(1.012); }
}

.hero-text {
    position: relative;
    z-index: 2;
    padding: 0 12%;
    font-family: 'Fraunces', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-size: clamp(2.4rem, 5vw, 5.6rem);
    line-height: 0.92;
    color: #2A1F3F;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.18em 0.32em;
}

.hero-text .word {
    opacity: 0;
    transform: translateY(14px);
    display: inline-block;
}

.hero-text .word.show {
    animation: wordIn 620ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes wordIn {
    from { opacity: 0; transform: translateY(14px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-bubble .caveat-tag {
    opacity: 0;
    transition: opacity 600ms ease 220ms;
    bottom: -54px;
    font-size: 1.4rem;
}

.hero-bubble.spoken .caveat-tag {
    opacity: 0.7;
}

/* ============= CLUSTER 02 — who's gabbing ============= */
.cluster-02 {
    min-height: 160vh;
    padding: 16vh 0 8vh;
    position: relative;
}

.portrait-bubble {
    position: absolute;
    width: 22vw;
    min-width: 240px;
    aspect-ratio: 1 / 1;
    top: var(--y);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(40px) scale(0.92);
    transition: opacity 620ms cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 620ms cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.portrait-bubble.entered {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.portrait-bubble.pos-left { left: 6%; }
.portrait-bubble.pos-left-mid { left: 22%; }
.portrait-bubble.pos-right-mid { right: 22%; }
.portrait-bubble.pos-right { right: 6%; }

.portrait-bubble:hover .blob-svg {
    transform: rotate(-3deg) scale(1.04);
}

.portrait-bubble .bubble-text {
    padding: 14% 18%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-name {
    font-family: 'Fraunces', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-weight: 600;
    font-size: clamp(1.6rem, 2.4vw, 2.6rem);
    line-height: 0.96;
}

.quote {
    font-family: 'Fraunces', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-style: italic;
    font-size: clamp(1rem, 1.5vw, 1.6rem);
    line-height: 1.18;
    opacity: 0.85;
}

.game-icon {
    position: absolute;
    width: 48px;
    height: 48px;
    bottom: -8px;
    right: -14px;
    z-index: 4;
    transform: rotate(8deg);
}

.portrait-bubble.pos-right .game-icon,
.portrait-bubble.pos-right-mid .game-icon {
    right: auto;
    left: -14px;
    transform: rotate(-8deg);
}

/* tiny thread connecting icon to bubble */
.game-icon::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 1.5px;
    background: repeating-linear-gradient(to right, #FFD6E8 0 3px, transparent 3px 6px);
    top: 50%;
    left: -16px;
}

/* ============= CLUSTER 03 — tangram said ============= */
.cluster-03 {
    min-height: 120vh;
    padding: 14vh 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialogue-pair {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 70vh;
    margin: 0 auto;
}

.big-bubble {
    position: absolute;
    left: 4%;
    top: 12%;
    width: 38vw;
    min-width: 360px;
    aspect-ratio: 1.05 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 700ms cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.big-bubble.entered {
    opacity: 1;
    transform: scale(1);
}

.big-bubble .bubble-text {
    padding: 0 14%;
}

.quote-large {
    font-family: 'Fraunces', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-style: italic;
    font-size: clamp(1.4rem, 2.2vw, 2.4rem);
    line-height: 1.08;
}

.connector {
    position: absolute;
    left: 30%;
    top: 36%;
    width: 50%;
    height: 22%;
    pointer-events: none;
}

.connector path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1800ms ease;
}

.connector.drawn path {
    stroke-dashoffset: 0;
}

.small-bubble {
    position: absolute;
    right: 4%;
    top: 36%;
    width: 18vw;
    min-width: 200px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8) rotate(-6deg);
    transition: opacity 700ms cubic-bezier(0.34, 1.56, 0.64, 1) 600ms,
                transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1) 600ms;
}

.small-bubble.entered {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.small-bubble .quote {
    font-size: clamp(1.1rem, 1.6vw, 1.6rem);
    font-style: italic;
}

.small-bubble.entered .blob-svg {
    animation: retort 1200ms ease 700ms 1;
}

@keyframes retort {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(-8deg); }
    60% { transform: rotate(4deg); }
    100% { transform: rotate(0deg); }
}

/* ============= CLUSTER 04 — the rocket overheard (sticky horizontal) ============= */
.cluster-04 {
    height: 320vh;
    position: relative;
}

.sticky-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.chain-track {
    display: flex;
    align-items: center;
    gap: 60px;
    padding: 0 12vw;
    will-change: transform;
}

.chain-bubble {
    position: relative;
    flex: 0 0 auto;
    width: 24vw;
    min-width: 260px;
    aspect-ratio: 1.05 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(0);
    will-change: transform;
}

.chain-bubble:nth-child(odd) { transform: translateY(-3vh); }
.chain-bubble:nth-child(even) { transform: translateY(3vh); }

.chain-bubble .bubble-text {
    padding: 0 18%;
}

.chain-bubble .quote {
    font-size: clamp(1.1rem, 1.5vw, 1.7rem);
    font-style: italic;
}

.chain-line {
    flex: 0 0 auto;
    width: 12vw;
    min-width: 120px;
    height: 100px;
    pointer-events: none;
}

.chain-line path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1400ms ease;
}

.chain-line.drawn path {
    stroke-dashoffset: 0;
}

/* ============= CLUSTER 05 — foam ============= */
.cluster-05 {
    min-height: 140vh;
    padding: 14vh 0;
    position: relative;
}

.foam {
    position: relative;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    height: 110vh;
}

.foam-bubble {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--s);
    aspect-ratio: 1 / 1;
    mix-blend-mode: multiply;
    transform: rotate(var(--rot));
    animation: foamBob var(--p) ease-in-out var(--d) infinite;
    will-change: transform;
}

.foam-bubble svg {
    width: 100%;
    height: 100%;
}

@keyframes foamBob {
    0%, 100% { transform: rotate(var(--rot)) translateY(0); }
    50% { transform: rotate(var(--rot)) translateY(-12px); }
}

.foam-quote {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    text-align: center;
    pointer-events: none;
    max-width: 60%;
}

.foam-quote span {
    font-family: 'Fraunces', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-style: italic;
    font-size: clamp(1.6rem, 3vw, 3rem);
    line-height: 1.06;
    color: #2A1F3F;
    background: rgba(255, 246, 240, 0.85);
    padding: 8px 18px;
    border-radius: 24px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* ============= CLUSTER 06 — a long pause ============= */
.cluster-06 {
    background: #FFFAF5;
    min-height: 130vh;
    padding: 24vh 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 800ms ease;
}

.pause-bubble {
    position: relative;
    width: 9vw;
    min-width: 110px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pauseFloat 8s ease-in-out infinite;
    will-change: transform;
}

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

.ellipsis {
    font-family: 'Caveat', cursive;
    font-size: 1.6rem;
    color: #2A1F3F;
    opacity: 0.7;
}

/* ============= CLUSTER 07 — now you say something ============= */
.cluster-07 {
    min-height: 130vh;
    padding: 14vh 0 10vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6vh;
}

.input-bubble {
    position: relative;
    width: 26vw;
    min-width: 280px;
    aspect-ratio: 1.1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-bubble .caret {
    display: inline-block;
    width: 3px;
    height: 38px;
    background: #2A1F3F;
    animation: caretBlink 1.06s steps(2) infinite;
    border-radius: 2px;
}

@keyframes caretBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.reply-buttons {
    display: flex;
    gap: 4vw;
    flex-wrap: wrap;
    justify-content: center;
}

.reply-btn {
    position: relative;
    width: 12vw;
    min-width: 140px;
    aspect-ratio: 1.1 / 1;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
    transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    color: #2A1F3F;
    padding: 0;
}

.reply-btn:hover .blob-svg {
    transform: scale(1.04);
}

.reply-label {
    position: relative;
    z-index: 2;
    font-family: 'Fraunces', serif;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-style: italic;
    font-size: clamp(1.1rem, 1.5vw, 1.6rem);
    color: #2A1F3F;
    pointer-events: none;
}

.footer {
    margin-top: 8vh;
    text-align: center;
    color: #2A1F3F;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.footer-line {
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    opacity: 0.75;
    transform: rotate(-1deg);
}

.footer-time {
    font-family: 'DM Mono', monospace;
    font-style: italic;
    font-size: 0.78rem;
    opacity: 0.55;
    letter-spacing: 0.04em;
}

/* ============= reduced motion ============= */
@media (prefers-reduced-motion: reduce) {
    .hero-bubble,
    .pause-bubble,
    .foam-bubble,
    .spine path {
        animation: none !important;
    }
    .hero-text .word {
        opacity: 1;
        transform: none;
    }
    .portrait-bubble,
    .big-bubble,
    .small-bubble {
        opacity: 1;
        transform: none;
    }
}

/* ============= responsive ============= */
@media (max-width: 900px) {
    .header-bubble { font-size: 0.92rem; padding: 10px 16px; }
    .thread-index { right: 16px; gap: 10px; }
    .thread-label { display: none; }
    .portrait-bubble {
        width: 60vw;
        min-width: 240px;
    }
    .portrait-bubble.pos-left, .portrait-bubble.pos-left-mid { left: 8%; }
    .portrait-bubble.pos-right, .portrait-bubble.pos-right-mid { right: 8%; left: auto; }
    .big-bubble { width: 70vw; left: 8%; }
    .small-bubble { width: 38vw; right: 6%; top: 60%; }
    .chain-bubble { width: 60vw; min-width: 240px; }
    .input-bubble { width: 70vw; }
    .reply-btn { width: 30vw; min-width: 120px; }
    .cluster-label { top: 16px; }
}
