/* ============================================================
   continu.st v2 -- Wabi-Sabi Kintsugi Horizontal Scroll
   ============================================================ */

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

html {
    overflow: hidden;
    height: 100%;
    background: #1E1B19;
}

body {
    height: 100%;
    overflow: hidden;
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.8vw, 18px);
    letter-spacing: 0.02em;
    line-height: 1.7;
    color: #EDE6D8;
    background: #1E1B19;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Scroll Container ---------- */
#scroll-container {
    width: 100%;
    height: 100vh;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

#scroll-track {
    display: flex;
    flex-direction: row;
    width: 700vw;
    height: 100vh;
}

/* ---------- Chamber Base ---------- */
.chamber {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    background: #2C2926;
}

/* Ceramic texture overlay for all chambers */
.chamber::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(198, 164, 78, 0.015) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(143, 184, 160, 0.01) 0%, transparent 40%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(237, 230, 216, 0.012) 2px,
            rgba(237, 230, 216, 0.012) 3px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 3px,
            rgba(237, 230, 216, 0.008) 3px,
            rgba(237, 230, 216, 0.008) 4px
        );
    pointer-events: none;
    z-index: 1;
}

/* Additional grain texture */
.chamber::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 70%, rgba(168, 159, 145, 0.04) 0%, transparent 2px),
        radial-gradient(circle at 70% 20%, rgba(168, 159, 145, 0.03) 0%, transparent 2px),
        radial-gradient(circle at 50% 50%, rgba(168, 159, 145, 0.02) 0%, transparent 3px),
        radial-gradient(circle at 15% 85%, rgba(168, 159, 145, 0.035) 0%, transparent 1.5px),
        radial-gradient(circle at 85% 60%, rgba(168, 159, 145, 0.025) 0%, transparent 2px);
    background-size: 80px 80px, 120px 120px, 150px 150px, 90px 90px, 110px 110px;
    pointer-events: none;
    z-index: 1;
}

/* Chamber tint variants */
.chamber-odd {
    background: #3A3530;
}

.chamber-even {
    background: #352F3A;
}

.chamber-entry {
    background: #2C2926;
}

.chamber-final {
    background: #1E1B19;
}

/* ---------- Chamber Content ---------- */
.chamber-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
}

.content-left {
    justify-content: flex-start;
    padding-left: 12%;
    gap: 8%;
}

.content-right {
    justify-content: flex-end;
    padding-right: 12%;
    gap: 8%;
}

.content-center {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

/* ---------- Text Blocks ---------- */
.text-block {
    max-width: 480px;
    position: relative;
}

.text-block-center {
    text-align: center;
}

.section-label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #A89F91;
    margin-bottom: 24px;
}

.chamber-headline {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(28px, 4.5vw, 64px);
    letter-spacing: 0.04em;
    line-height: 1.45;
    color: #EDE6D8;
    margin-bottom: 28px;
}

.chamber-body {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.8vw, 18px);
    letter-spacing: 0.02em;
    line-height: 1.7;
    color: #A89F91;
}

/* ---------- Ceramic Panels ---------- */
.ceramic-panel {
    width: 35%;
    height: 70%;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}

.panel-right {
    background:
        radial-gradient(ellipse at 40% 60%, rgba(198, 164, 78, 0.03) 0%, transparent 60%),
        linear-gradient(135deg, rgba(58, 53, 48, 0.8), rgba(44, 41, 38, 0.9));
}

.panel-left {
    background:
        radial-gradient(ellipse at 60% 40%, rgba(198, 164, 78, 0.03) 0%, transparent 60%),
        linear-gradient(225deg, rgba(53, 47, 58, 0.8), rgba(44, 41, 38, 0.9));
}

.ceramic-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 4px,
            rgba(237, 230, 216, 0.015) 4px,
            rgba(237, 230, 216, 0.015) 5px
        );
    pointer-events: none;
}

.panel-fractures {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* ---------- Entry Chamber ---------- */
.chamber-entry .chamber-content {
    flex-direction: column;
    gap: 30px;
}

.site-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(32px, 5vw, 72px);
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: #EDE6D8;
    text-align: center;
}

.entry-thread {
    width: 120px;
    height: 1px;
    background: #C6A44E;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: opacity 1.2s ease, transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.entry-thread.visible {
    opacity: 0.6;
    transform: scaleX(1);
}

.scroll-hint {
    position: absolute;
    bottom: 80px;
    right: 10%;
    opacity: 0;
    transition: opacity 1s ease;
}

.scroll-hint.visible {
    opacity: 1;
}

.hint-arrow {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px;
    color: #C6A44E;
    animation: hint-fade 2.5s ease-in-out infinite;
}

@keyframes hint-fade {
    0%, 100% { opacity: 0.3; transform: translateX(0); }
    50% { opacity: 0.8; transform: translateX(8px); }
}

/* ---------- Final Chamber ---------- */
.chamber-final .chamber-content {
    flex-direction: column;
    gap: 40px;
}

.rising-thread {
    position: absolute;
    left: 10%;
    bottom: 40px;
    width: 40%;
    height: 70%;
    z-index: 1;
}

.final-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(18px, 2.5vw, 36px);
    letter-spacing: 0.04em;
    line-height: 1.45;
    color: #EDE6D8;
    text-align: center;
    max-width: 600px;
}

.final-text em {
    font-style: italic;
}

/* ---------- Vessels ---------- */
.vessel {
    display: block;
}

.vessel-bottle {
    width: clamp(100px, 12vw, 180px);
    height: auto;
}

.vessel-bowl {
    width: clamp(160px, 18vw, 260px);
    height: auto;
    margin-bottom: 20px;
}

.vessel-cup {
    width: clamp(100px, 12vw, 160px);
    height: auto;
    position: relative;
    z-index: 2;
}

.vessel-outline {
    stroke: #A89F91;
}

.vessel-fracture {
    filter: drop-shadow(0 0 8px rgba(198, 164, 78, 0.15));
}

/* Vessel glow animation */
.vessel-fracture,
.vessel-glow-inner {
    animation: glow-pulse 6s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(198, 164, 78, 0.2));
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(198, 164, 78, 0.4));
    }
}

.vessel-glow-inner {
    animation: inner-glow 6s ease-in-out infinite;
}

@keyframes inner-glow {
    0%, 100% { opacity: 0.04; }
    50% { opacity: 0.1; }
}

/* ---------- Kintsugi Lines ---------- */
.kintsugi-line {
    stroke: #C6A44E;
    fill: none;
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px rgba(198, 164, 78, 0.15));
}

.chamber-fractures {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ---------- Torn Edges ---------- */
.torn-edge {
    position: absolute;
    top: 0;
    width: 20px;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.torn-edge-right {
    right: 0;
}

/* ---------- Gold Thread (Bottom) ---------- */
#gold-thread {
    position: fixed;
    bottom: 40px;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.3;
}

/* ---------- Progress Indicator ---------- */
#progress-indicator {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    z-index: 101;
    pointer-events: none;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #C6A44E;
    background: transparent;
    transition: background 0.4s ease-out, box-shadow 0.4s ease-out;
}

.progress-dot.filled {
    background: #C6A44E;
}

.progress-dot.active {
    background: #C6A44E;
    box-shadow: 0 0 0 3px transparent, 0 0 0 4px #8FB8A0;
}

/* ---------- Chamber Entry Animations ---------- */
.chamber .text-block,
.chamber .ceramic-panel,
.chamber .vessel {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.chamber .ceramic-panel {
    transition-delay: 0.12s;
}

.chamber.in-view .text-block {
    opacity: 1;
    transform: translateX(0);
}

.chamber.in-view .ceramic-panel {
    opacity: 1;
    transform: translateX(0);
}

.chamber.in-view .vessel {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger within chamber */
.chamber.in-view .text-block {
    transition-delay: 0s;
}

.chamber.in-view .ceramic-panel {
    transition-delay: 0.12s;
}

/* Entry chamber specific */
.chamber-entry .site-title {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.chamber-entry.in-view .site-title {
    opacity: 1;
    transform: translateY(0);
}

/* Final chamber */
.chamber-final .final-text {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease 0.4s, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.4s;
}

.chamber-final.in-view .final-text {
    opacity: 1;
    transform: translateY(0);
}

.chamber-final .vessel-cup {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 1s ease 0.15s, transform 1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
}

.chamber-final.in-view .vessel-cup {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---------- Kintsugi line draw animation ---------- */
.kintsugi-line {
    stroke-dasharray: var(--path-length, 600);
    stroke-dashoffset: var(--path-length, 600);
    transition: stroke-dashoffset 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chamber.in-view .kintsugi-line {
    stroke-dashoffset: 0;
}

/* Entry chamber lines animate immediately */
.chamber-entry.in-view .kintsugi-line {
    transition-delay: 0.6s;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .chamber-content {
        padding: 40px 24px;
    }

    .content-left,
    .content-right {
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        padding-left: 24px;
        padding-right: 24px;
        gap: 30px;
    }

    .content-right {
        align-items: flex-end;
    }

    .text-block {
        max-width: 100%;
    }

    .ceramic-panel {
        width: 80%;
        height: 40%;
        position: absolute;
        opacity: 0.15;
        top: 10%;
    }

    .panel-right {
        right: -10%;
    }

    .panel-left {
        left: -10%;
    }

    #progress-indicator {
        gap: 20px;
    }

    .scroll-hint {
        bottom: 60px;
        right: 5%;
    }
}

@media (max-width: 480px) {
    .chamber-headline {
        font-size: clamp(22px, 6vw, 36px);
    }

    .chamber-body {
        font-size: 14px;
    }

    .section-label {
        font-size: 10px;
    }

    #progress-indicator {
        gap: 14px;
    }

    .progress-dot {
        width: 6px;
        height: 6px;
    }
}
