/* ============================================
   bada.casa — House of the Sea
   Seapunk + blobitecture, zen-contemplative
   ============================================ */

:root {
    --sunlit-surface: #b8e8d0;
    --turquoise-lum: #40e0d0;
    --nacre-shimmer: #e8d5c4;
    --meso-teal: #0b3d4e;
    --bathyal-midnight: #061e2b;
    --hadal-abyss: #020a0f;
    --coral-blush: #e07860;
    --bleached-coral: #b8d8e0;

    --font-display: 'Nanum Myeongjo', serif;
    --font-body: 'Sora', sans-serif;
    --font-accent: 'Gowun Batang', serif;
}

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

body {
    background: var(--meso-teal);
    color: var(--bleached-coral);
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.9;
    overflow-x: hidden;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(to bottom, rgba(2, 10, 15, 0) 0%, rgba(2, 10, 15, 0.4) 100%);
    pointer-events: none;
    z-index: 200;
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* ============================================
   Chamber Common
   ============================================ */

.chamber {
    position: relative;
    overflow: hidden;
}

.chamber-blob {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.chamber-content {
    position: relative;
    max-width: 520px;
    padding: 2rem;
}

.layer-fg { z-index: 3; }
.layer-mid { z-index: 2; opacity: 0.6; }
.layer-bg { z-index: 1; opacity: 0.2; }

.chamber-label {
    display: block;
    font-family: var(--font-accent);
    font-size: 0.85rem;
    color: var(--turquoise-lum);
    margin-bottom: 0.75rem;
}

.chamber-heading {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--sunlit-surface);
    text-shadow: 0 0 40px rgba(64, 224, 208, 0.3);
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.chamber-text {
    margin-bottom: 1rem;
    color: var(--bleached-coral);
}

.glow-text {
    text-shadow: 0 0 20px rgba(64, 224, 208, 0.3);
    color: var(--turquoise-lum);
    font-size: 1.3rem;
}

/* ============================================
   Chamber 0: Entry
   ============================================ */

.chamber-entry {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--meso-teal);
}

.blob-0 {
    text-align: center;
}

.nacre-shimmer {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(45deg, rgba(232, 213, 196, 0.08) 0%, transparent 50%),
        linear-gradient(135deg, rgba(64, 224, 208, 0.06) 0%, transparent 50%),
        linear-gradient(225deg, rgba(184, 232, 208, 0.05) 0%, transparent 50%);
    background-blend-mode: screen;
    pointer-events: none;
    transition: background-position 0.3s ease;
}

.entry-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 700;
    color: var(--nacre-shimmer);
    text-shadow: 0 0 40px rgba(64, 224, 208, 0.3);
    letter-spacing: 0.05em;
    position: relative;
    z-index: 5;
}

.entry-title span {
    display: inline-block;
    opacity: 0;
    animation: charFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes charFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.entry-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1rem;
    color: var(--bleached-coral);
    opacity: 0.5;
    margin-top: 1.5rem;
    position: relative;
    z-index: 5;
}

.current-indicator {
    margin-top: 3rem;
    animation: currentPulse 3s ease-in-out infinite;
    position: relative;
    z-index: 5;
}

@keyframes currentPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(6px); }
}

/* ============================================
   Horizontal Scroll Container
   ============================================ */

.horizontal-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.horizontal-container::-webkit-scrollbar {
    display: none;
}

.horizontal-track {
    display: flex;
    flex-direction: row;
    width: max-content;
}

.chamber-horizontal {
    width: 100vw;
    min-height: 100vh;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
}

/* Blob shapes via border-radius */
.blob-1 { border-radius: 42% 58% 67% 33% / 55% 45% 38% 62%; background: rgba(11, 61, 78, 0.7); margin: 5vh 5vw; padding: 4rem; }
.blob-2 { border-radius: 58% 42% 33% 67% / 45% 55% 62% 38%; background: rgba(6, 30, 43, 0.6); margin: 5vh 5vw; padding: 4rem; }
.blob-3 { border-radius: 33% 67% 42% 58% / 62% 38% 55% 45%; background: rgba(6, 30, 43, 0.8); margin: 5vh 5vw; padding: 4rem; }
.blob-4 { border-radius: 67% 33% 58% 42% / 38% 62% 45% 55%; background: rgba(2, 10, 15, 0.5); margin: 5vh 5vw; padding: 4rem; }
.blob-5 { border-radius: 45% 55% 38% 62% / 42% 58% 67% 33%; background: rgba(6, 30, 43, 0.9); margin: 5vh 5vw; padding: 4rem; }

.nacre-bg {
    background:
        linear-gradient(45deg, rgba(232, 213, 196, 0.15) 0%, transparent 40%),
        linear-gradient(135deg, rgba(64, 224, 208, 0.1) 0%, transparent 40%),
        linear-gradient(225deg, rgba(184, 232, 208, 0.08) 0%, transparent 40%),
        rgba(6, 30, 43, 0.6) !important;
    background-blend-mode: screen;
}

/* Current Lines */
.current-lines {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.current-line-path {
    position: absolute;
    left: -100%;
    width: 300%;
    height: 2px;
    animation: currentDrift 20s linear infinite;
}

@keyframes currentDrift {
    from { transform: translateX(0); }
    to { transform: translateX(-33.33%); }
}

/* Coral Decorations */
.coral-decoration {
    position: absolute;
    bottom: 5%;
    right: 5%;
    width: 200px;
    height: 300px;
}

.coral-svg {
    width: 100%;
    height: 100%;
}

.coral-branch {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 2.5s ease-out;
}

.coral-branch.grown {
    stroke-dashoffset: 0;
}

.coral-shelves {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.coral-shelf-svg {
    width: 80%;
    max-width: 400px;
    height: auto;
    opacity: 0.5;
}

.shell-centerpiece {
    position: absolute;
    width: 200px;
    height: 200px;
    animation: shellRotate 30s linear infinite;
}

@keyframes shellRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.shell-svg {
    width: 100%;
    height: 100%;
}

/* Deep character */
.deep-char {
    font-family: var(--font-display);
    font-size: 30vw;
    font-weight: 700;
    color: var(--bathyal-midnight);
    opacity: 0.15;
    position: absolute;
    text-align: center;
    line-height: 1;
    user-select: none;
}

/* ============================================
   Chamber 6: Trench
   ============================================ */

.chamber-trench {
    min-height: 200vh;
    background: linear-gradient(to bottom, var(--bathyal-midnight) 0%, var(--hadal-abyss) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.trench-content {
    text-align: center;
    padding: 4rem 2rem;
}

.trench-text {
    font-family: var(--font-body);
    font-weight: 300;
    margin-bottom: 4rem;
    color: var(--bleached-coral);
}

.trench-final {
    font-family: var(--font-display);
    font-size: clamp(4rem, 15vw, 12rem);
    font-weight: 700;
    color: var(--turquoise-lum);
    opacity: 0.3;
    margin-top: 6rem;
    transition: opacity 2s ease;
}

.trench-final.dissolved {
    opacity: 0;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .horizontal-container {
        overflow-x: auto;
    }

    .chamber-horizontal {
        width: 100vw;
        min-height: 80vh;
    }

    .blob-1, .blob-2, .blob-3, .blob-4, .blob-5 {
        margin: 2vh 2vw;
        padding: 2rem;
        border-radius: 20px;
    }

    .entry-title {
        font-size: clamp(2rem, 12vw, 5rem);
    }

    .chamber-content {
        padding: 1.5rem;
    }

    .coral-decoration {
        width: 120px;
        height: 180px;
    }

    .deep-char {
        font-size: 50vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .current-indicator,
    .shell-centerpiece {
        animation: none;
    }

    .current-line-path {
        animation: none;
    }

    .coral-branch {
        stroke-dashoffset: 0;
        transition: none;
    }

    .entry-title span {
        opacity: 1;
        animation: none;
    }
}
