/* ============================================================
   moral.quest - Coastal Blend Graffiti Meditation
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --basalt-night: #1B2A3B;
    --seafoam-mist: #D4E4DC;
    --burnt-coral: #C97B6B;
    --tidal-slate: #5A7C8A;
    --weathered-stone: #B8AFA3;
    --starlight-gold: #D4A76A;
    --abyssal-teal: #0D3B4F;
    --salt-haze: #E8E2D8;
    --driftwood: #8B7355;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-accent: 'Caveat', cursive;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--basalt-night);
    color: var(--seafoam-mist);
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Guiding Star (fixed top-right) --- */
.guiding-star {
    position: fixed;
    top: 24px;
    right: 28px;
    width: 36px;
    height: 36px;
    z-index: 100;
    animation: star-pulse 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes star-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1.0; }
}

/* --- Navigation Dots --- */
.nav-dots {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 100;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border: none;
    background: var(--tidal-slate);
    border-radius: 50% 45% 55% 48%;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.4s ease, background-color 0.4s ease, transform 0.3s ease;
}

.nav-dot.active {
    background: var(--starlight-gold);
    opacity: 1;
    transform: scale(1.3);
    border-radius: 48% 52% 46% 54%;
}

.nav-dot:hover {
    opacity: 0.8;
}

/* --- Mural Wall (Horizontal Scroll Container) --- */
.mural-wall {
    display: flex;
    flex-wrap: nowrap;
    width: 400vw;
    height: 100vh;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.mural-wall::-webkit-scrollbar {
    display: none;
}

/* --- Panel Base --- */
.panel {
    position: relative;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Panel Concrete Overlay --- */
.panel-concrete-overlay {
    position: absolute;
    inset: 0;
    filter: url(#concrete-texture);
    background: var(--weathered-stone);
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

/* --- Panel Divider (spray drip line) --- */
.panel-divider {
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 100%;
    z-index: 10;
}

/* --- Leather Borders --- */
.leather-border {
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    z-index: 5;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(139, 115, 85, 0.15) 0px,
            rgba(184, 175, 163, 0.1) 3px,
            rgba(139, 115, 85, 0.12) 6px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(139, 115, 85, 0.1) 0px,
            transparent 1px,
            rgba(139, 115, 85, 0.08) 2px
        );
    opacity: 0.2;
}

.leather-border-top {
    top: 0;
}

.leather-border-bottom {
    bottom: 0;
}

/* --- Splatter Dots --- */
.splatter {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    background: var(--color);
    border-radius: 50% 42% 55% 48%;
    opacity: var(--opacity);
    pointer-events: none;
    z-index: 3;
}

/* --- Skeleton Loading States --- */
.skeleton-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 5;
    transition: opacity 0.4s ease;
}

.skeleton-layer.hidden {
    opacity: 0;
    pointer-events: none;
}

.skeleton-text {
    background: rgba(184, 175, 163, 0.12);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.skeleton-text::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(212, 167, 106, 0.15), transparent);
    animation: skeleton-shimmer 2s infinite linear;
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-title {
    width: 50vw;
    max-width: 480px;
    height: 48px;
    margin-bottom: 20px;
}

.skeleton-subtitle {
    width: 30vw;
    max-width: 280px;
    height: 24px;
    margin-bottom: 12px;
}

.skeleton-line {
    width: 20vw;
    max-width: 180px;
    height: 16px;
}

.skeleton-thought-bubble {
    width: 60vw;
    max-width: 560px;
    padding: 40px;
    border: 2px solid rgba(184, 175, 163, 0.15);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.skeleton-question-line {
    width: 100%;
    height: 18px;
}

.skeleton-question-line.short {
    width: 65%;
}

.skeleton-star-field {
    position: relative;
    width: 80vw;
    height: 60vh;
}

.skeleton-star {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 6px;
    height: 6px;
    background: rgba(212, 167, 106, 0.2);
    border-radius: 50%;
}

.skeleton-star::after {
    content: '';
    position: absolute;
    inset: -4px;
    background: radial-gradient(circle, rgba(212, 167, 106, 0.1), transparent);
    animation: skeleton-shimmer 2s infinite linear;
}

.skeleton-horizon {
    width: 80vw;
    height: 1px;
    background: rgba(184, 175, 163, 0.15);
}

.skeleton-word {
    width: 120px;
    height: 32px;
    margin-top: 40px;
}

/* --- Panel Content (fades in) --- */
.panel-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.panel-content.visible {
    opacity: 1;
}

/* ============================================================
   PANEL 1: THE GATEWAY
   ============================================================ */
.panel-gateway {
    background: var(--basalt-night);
}

/* Libra constellation behind title */
.constellation-libra {
    position: absolute;
    width: 40vw;
    max-width: 400px;
    height: auto;
    opacity: 0.35;
    z-index: 1;
    pointer-events: none;
}

/* Graffiti throw-up title */
.graffiti-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.03em;
    line-height: 1.2;
    color: var(--seafoam-mist);
    position: relative;
    z-index: 2;
    text-shadow:
        3px 3px 0 var(--basalt-night),
        -1px -1px 0 rgba(90, 124, 138, 0.4),
        4px 4px 8px rgba(0, 0, 0, 0.5);
    -webkit-text-stroke: 1px rgba(90, 124, 138, 0.3);
    paint-order: stroke fill;
}

.graffiti-letter {
    display: inline-block;
    position: relative;
}

.graffiti-dot {
    display: inline-block;
    color: var(--burnt-coral);
    margin: 0 0.02em;
}

/* Title drips */
.title-drips {
    position: absolute;
    width: 600px;
    max-width: 80vw;
    height: 80px;
    z-index: 2;
    margin-top: clamp(2rem, 5vw, 4rem);
    top: 50%;
    pointer-events: none;
}

/* Scroll prompt */
.scroll-prompt {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 5;
}

.scroll-prompt-text {
    font-family: var(--font-accent);
    font-weight: 700;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--burnt-coral);
    letter-spacing: 0.02em;
}

.scroll-arrow {
    font-family: var(--font-accent);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--burnt-coral);
    animation: arrow-drift 2s ease-in-out infinite;
}

@keyframes arrow-drift {
    0%, 100% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(8px); opacity: 0.6; }
}

/* ============================================================
   PANEL 2: THE FIRST QUESTION
   ============================================================ */
.panel-question {
    background: var(--basalt-night);
}

/* Thought bubble */
.thought-bubble {
    position: relative;
    width: 70vw;
    max-width: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thought-bubble-outline {
    position: absolute;
    width: 100%;
    height: auto;
    z-index: 0;
}

.question-content {
    position: relative;
    z-index: 1;
    padding: 60px 50px;
    text-align: center;
}

.moral-question {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: 0.03em;
    line-height: 1.2;
    color: var(--seafoam-mist);
    margin-bottom: 24px;
}

.question-attribution {
    font-family: var(--font-accent);
    font-weight: 700;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--burnt-coral);
    opacity: 0.7;
}

/* ============================================================
   PANEL 3: THE CONSTELLATION WALL
   ============================================================ */
.panel-constellation {
    background: linear-gradient(135deg, var(--basalt-night), var(--abyssal-teal), var(--tidal-slate));
}

.star-field {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Constellation line draw animation */
.constellation-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 3s ease-in-out;
}

.panel-constellation.lines-drawn .constellation-line {
    stroke-dashoffset: 0;
}

/* Star nodes */
.star-node {
    cursor: pointer;
    transition: opacity 0.4s ease, r 0.4s ease;
    opacity: 0.7;
}

.star-node:hover {
    opacity: 1;
}

/* Star tooltip */
.star-tooltip {
    position: fixed;
    background: rgba(27, 42, 59, 0.92);
    color: var(--seafoam-mist);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.5;
    letter-spacing: 0.01em;
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid rgba(90, 124, 138, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 200;
    max-width: 260px;
    white-space: nowrap;
}

.star-tooltip.visible {
    opacity: 1;
}

/* Star particles (scattered 4-pointed stars) */
.star-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.star-particle {
    position: absolute;
    left: var(--sp-x);
    top: var(--sp-y);
    width: var(--sp-size);
    height: var(--sp-size);
    background: var(--sp-color);
    opacity: var(--sp-opacity);
    clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
    transform: rotate(var(--sp-rotation));
}

/* ============================================================
   PANEL 4: THE REFLECTION POOL
   ============================================================ */
.panel-reflection {
    background: var(--salt-haze);
}

.horizon-container {
    position: absolute;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    top: 50%;
    transform: translateY(-50%);
}

.horizon-line {
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--tidal-slate), transparent);
}

.horizon-reflection {
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--tidal-slate), transparent);
    transform: scaleY(-1);
    opacity: 0.3;
    margin-top: 4px;
}

/* Rotating moral concept */
.moral-concept-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% - 60px));
    z-index: 5;
}

.moral-concept {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.03em;
    line-height: 1.2;
    color: var(--basalt-night);
    animation: moral-cycle 12s infinite;
}

@keyframes moral-cycle {
    0% { opacity: 0; }
    8.33% { opacity: 1; }   /* 1s fade in */
    58.33% { opacity: 1; }  /* 6s hold */
    75% { opacity: 0; }     /* 2s fade out */
    100% { opacity: 0; }    /* pause before next */
}

/* ============================================================
   TAG UNDERLINES (wavy SVG underline effect)
   ============================================================ */
.tag-underline {
    position: relative;
    display: inline;
}

.tag-underline::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 3px;
    background: var(--burnt-coral);
    border-radius: 2px;
    opacity: 0.5;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s ease;
}

.tag-underline.drawn::after {
    transform: scaleX(1);
}

/* ============================================================
   RESPONSIVE: Vertical on < 768px
   ============================================================ */
@media (max-width: 767px) {
    .mural-wall {
        flex-direction: column;
        width: 100vw;
        height: auto;
        overflow-x: hidden;
        overflow-y: scroll;
        scroll-snap-type: y mandatory;
    }

    .panel {
        width: 100vw;
        height: 100vh;
        scroll-snap-align: start;
    }

    .panel-divider {
        display: none;
    }

    /* Leather borders shift to left/right */
    .leather-border-top,
    .leather-border-bottom {
        width: 6px;
        height: 100%;
        top: 0;
        bottom: 0;
        left: auto;
        right: auto;
    }

    .leather-border-top {
        left: 0;
        top: 0;
        width: 6px;
        height: 100%;
    }

    .leather-border-bottom {
        right: 0;
        left: auto;
        top: 0;
        width: 6px;
        height: 100%;
    }

    .nav-dots {
        bottom: 16px;
    }

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

    .constellation-libra {
        width: 70vw;
    }

    .thought-bubble {
        width: 90vw;
    }

    .question-content {
        padding: 40px 24px;
    }

    .moral-question {
        font-size: clamp(1.4rem, 5vw, 2.2rem);
    }

    .scroll-prompt-text {
        font-size: 0.9rem;
    }

    /* Swap arrow direction for vertical */
    .scroll-arrow {
        transform: rotate(90deg);
    }

    @keyframes arrow-drift {
        0%, 100% { transform: rotate(90deg) translateX(0); opacity: 1; }
        50% { transform: rotate(90deg) translateX(8px); opacity: 0.6; }
    }

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

    .guiding-star {
        top: 16px;
        right: 16px;
        width: 28px;
        height: 28px;
    }

    .star-field {
        width: 100%;
        height: 100%;
    }

    .title-drips {
        max-width: 90vw;
    }
}

/* ============================================================
   SMALL SCREENS
   ============================================================ */
@media (max-width: 480px) {
    .graffiti-title {
        font-size: clamp(1.8rem, 12vw, 2.8rem);
    }

    .moral-question {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
    }

    .question-content {
        padding: 30px 20px;
    }

    .moral-concept {
        font-size: clamp(1.8rem, 12vw, 2.8rem);
    }
}
