/* ============================================
   undo.cafe - Kintsugi Design System
   Wabi-sabi meets analog nostalgia
   ============================================ */

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    background-color: #F5EDE3;
    color: #3D2B1F;
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    letter-spacing: 0.01em;
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}


/* --- Ceramic Texture Overlay --- */
.ceramic-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
}

/* --- Navigation Dot --- */
.nav-dot {
    position: fixed;
    top: 28px;
    left: 28px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #D4B896;
    border: none;
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.nav-dot:hover {
    transform: scale(1.15);
}

.nav-dot-inner {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #C6A664;
    animation: dotPulse 3s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- Navigation Overlay --- */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #2A1F17;
    background: rgba(42, 31, 23, 0.92);
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    backdrop-filter: blur(4px);
}

.nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-item {
    font-family: 'Karla', sans-serif;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    font-weight: 400;
    color: #F5EDE3;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 16px;
    opacity: 0.7;
    transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.nav-item:hover {
    opacity: 1;
    color: #8B6E4E;
}

.gold-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #C6A664;
    flex-shrink: 0;
}

/* --- SVG Noise overlay for nav --- */
.nav-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* --- Fracture Spine --- */
.fracture-spine {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.fracture-spine.visible {
    opacity: 1;
}

.spine-svg {
    width: 100%;
    height: 500%;
    position: absolute;
    top: 0;
    left: 0;
}

.spine-path {
    fill: none;
    stroke: #C6A664;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 15000;
    stroke-dashoffset: 15000;
    transition: stroke-dashoffset 0.05s linear;
}

.branch {
    fill: none;
    stroke: #C6A664;
    stroke-width: 0.8;
    stroke-linecap: round;
    transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

/* --- Gold Particles --- */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.gold-particle {
    position: absolute;
    border-radius: 50%;
    background: #C6A664;
    pointer-events: none;
}

/* --- Moments (General) --- */
.moment {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
    padding: 40px 20px;
}

.moment-spacer {
    height: 30vh;
}

/* --- Moment Grid (2-column layout) --- */
.moment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: 0 20px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 40px;
}

.moment-left {
    grid-column: 1 / 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    padding-right: 40px;
}

.moment-right {
    grid-column: 5 / 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
}

.moment-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    text-align: center;
}

/* --- Moment 1: The Crack --- */
.moment-1 {
    flex-direction: column;
}

.moment-1 .moment-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.crack-svg {
    position: absolute;
    width: 80%;
    height: 20px;
    top: 50%;
    left: 10%;
    transform: translateY(-50%);
    overflow: visible;
}

.crack-line {
    fill: none;
    stroke: #7A6B5D;
    stroke-width: 0.5;
    stroke-linecap: round;
    stroke-dasharray: 1300;
    stroke-dashoffset: 1300;
}

.crack-line.animate {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1500ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.crack-gold {
    fill: none;
    stroke: #C6A664;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 1300;
    stroke-dashoffset: 1300;
}

.crack-gold.animate {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.hero-title {
    font-family: 'Cormorant Infant', serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 9rem);
    letter-spacing: 0.06em;
    line-height: 1.15;
    color: #3D2B1F;
    position: relative;
    z-index: 5;
    opacity: 0;
    transition: opacity 1000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.hero-title.visible {
    opacity: 1;
}

.hero-subtitle {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: #7A6B5D;
    letter-spacing: 0.02em;
    margin-top: 24px;
    opacity: 0;
    transition: opacity 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    transition-delay: 3000ms;
}

.hero-subtitle.visible {
    opacity: 1;
}

/* --- Moment 2: The Philosophy --- */
.moment-2 .moment-grid {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.moment-2.in-view .moment-grid {
    opacity: 0.8;
    transform: translateY(0);
}

.body-text {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    color: #3D2B1F;
    line-height: 1.75;
    letter-spacing: 0.01em;
}

/* --- Crossed-out text motif --- */
.crossed-out-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.crossed-word {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    color: #7A6B5D;
    position: relative;
    display: inline-block;
}

.crossed-word .strike-svg {
    position: absolute;
    top: 50%;
    left: -4px;
    right: -4px;
    width: calc(100% + 8px);
    height: 4px;
    transform: translateY(-50%);
}

.crossed-word .strike-svg path {
    fill: none;
    stroke: #A0522D;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.crossed-word.small {
    font-size: clamp(0.85rem, 1vw, 1rem);
}

.replacement-word {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.2rem);
    color: #C6A664;
    font-style: italic;
}

/* --- Moment 3: The Collection --- */
.collection-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    padding: 40px 0;
}

.vessel {
    width: clamp(180px, 20vw, 260px);
    height: clamp(240px, 28vw, 350px);
    background: #D4B896;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 8px 32px rgba(61, 43, 31, 0.08);
    opacity: 0;
    transition: opacity 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    overflow: hidden;
}

.vessel-1 {
    transform: rotate(-0.5deg) translateX(-60px);
    align-self: flex-start;
    margin-left: 25%;
}

.vessel-2 {
    transform: rotate(0.8deg) translateX(40px);
    align-self: flex-end;
    margin-right: 25%;
}

.vessel-3 {
    transform: rotate(1deg) translateX(-30px);
    align-self: flex-start;
    margin-left: 30%;
}

.moment-3.in-view .vessel {
    opacity: 1;
}

.vessel-fractures {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.vessel-fractures path {
    fill: none;
    stroke: #C6A664;
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.6;
    transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.vessel-fractures circle {
    fill: #C6A664;
    opacity: 0.6;
    transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.vessel:hover .vessel-fractures path,
.vessel:hover .vessel-fractures circle {
    opacity: 1;
}

/* --- Moment 4: The Process --- */
.process-content {
    display: flex;
    flex-direction: column;
    gap: 80px;
    padding: 0 40px;
    align-items: center;
}

.process-step {
    position: relative;
    max-width: 600px;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1000ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.process-step h2 {
    font-family: 'Cormorant Infant', serif;
    font-weight: 300;
    font-size: clamp(1.8rem, 3vw, 3rem);
    letter-spacing: 0.06em;
    line-height: 1.15;
    color: #3D2B1F;
}

.step-left {
    align-self: flex-start;
    text-align: left;
    padding-left: 10%;
}

.step-right {
    align-self: flex-end;
    text-align: right;
    padding-right: 10%;
}

.step-crack {
    width: 100%;
    height: 6px;
    margin-top: 12px;
}

.step-crack path {
    fill: none;
    stroke: #7A6B5D;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1500ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.process-step.in-view .step-crack path {
    stroke-dashoffset: 0;
}

.step-gold-line {
    width: 100%;
    height: 6px;
    margin-top: 12px;
}

.step-gold-line path {
    fill: none;
    stroke: #C6A664;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 2000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.process-step.in-view .step-gold-line path {
    stroke-dashoffset: 0;
}

.gold-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(198, 166, 100, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 2000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    pointer-events: none;
    z-index: -1;
}

.process-step.in-view .gold-glow {
    opacity: 1;
}

.process-step.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* --- Moment 5: The Margin Notes --- */
.moment-5 {
    position: relative;
}

.fractured-grid .moment-right {
    grid-column: 5 / 9;
}

.margin-notes {
    display: flex;
    flex-direction: column;
    gap: 48px;
    align-items: flex-end;
    padding-right: 30px;
}

.margin-note {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: right;
}

.note-1 {
    transform: rotate(-2deg);
}

.note-2 {
    transform: rotate(-1.5deg);
}

.note-3 {
    transform: rotate(-2.5deg);
}

.caveat-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: #C6A664;
}

.crazing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.05;
    z-index: 1;
}

.moment-5 .moment-grid {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    position: relative;
    z-index: 2;
}

.moment-5.in-view .moment-grid {
    opacity: 1;
    transform: translateY(0);
}

/* --- Moment 6: The Invitation --- */
.invitation-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
}

.invitation-question {
    font-family: 'Cormorant Infant', serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.06em;
    line-height: 1.15;
    color: #3D2B1F;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.moment-6.in-view .invitation-question {
    opacity: 1;
    transform: translateY(0);
}

.cup-svg {
    width: clamp(140px, 15vw, 200px);
    height: clamp(140px, 15vw, 200px);
    opacity: 0;
    transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    transition-delay: 2000ms;
}

.moment-6.in-view .cup-svg {
    opacity: 1;
}

.cup-outline {
    fill: none;
    stroke: #C6A664;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 3000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    transition-delay: 2200ms;
}

.moment-6.in-view .cup-outline {
    stroke-dashoffset: 0;
}

.cup-fracture {
    fill: none;
    stroke: #C6A664;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    transition-delay: 4500ms;
}

.moment-6.in-view .cup-fracture {
    stroke-dashoffset: 0;
}

/* --- Moment 7: The Mend --- */
.moment-7 {
    position: relative;
}

.mend-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    z-index: 2;
}

.mend-fractures {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0;
    transition: opacity 2000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.moment-7.in-view .mend-fractures {
    opacity: 0.4;
}

.mend-line {
    fill: none;
    stroke: #C6A664;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2500ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.moment-7.in-view .mend-line {
    stroke-dashoffset: 0;
}

.mend-title {
    font-family: 'Cormorant Infant', serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 6rem);
    letter-spacing: 0.06em;
    line-height: 1.15;
    color: #3D2B1F;
    position: relative;
    z-index: 5;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1500ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1500ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.moment-7.in-view .mend-title {
    opacity: 1;
    transform: translateY(0);
}

.mend-subtitle {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    color: #7A6B5D;
    margin-top: 24px;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 5;
    opacity: 0;
    transition: opacity 1500ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    transition-delay: 800ms;
}

.moment-7.in-view .mend-subtitle {
    opacity: 1;
}

/* --- Final Fade --- */
.final-fade {
    height: 30vh;
    background: linear-gradient(to bottom, #F5EDE3, #EDE4D8);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .moment-grid {
        display: flex;
        flex-direction: column;
        gap: 40px;
        padding: 0 24px;
    }

    .moment-left {
        align-items: flex-start;
        padding-right: 0;
    }

    .moment-right {
        width: 100%;
    }

    .crossed-out-block {
        align-items: flex-start;
    }

    .margin-notes {
        align-items: flex-start;
        padding-right: 0;
    }

    .margin-note {
        text-align: left;
    }

    .collection-content {
        padding: 20px;
    }

    .vessel-1 {
        margin-left: 10%;
        transform: rotate(-0.5deg) translateX(0);
    }

    .vessel-2 {
        margin-right: 10%;
        transform: rotate(0.8deg) translateX(0);
        align-self: flex-end;
    }

    .vessel-3 {
        margin-left: 15%;
        transform: rotate(1deg) translateX(0);
    }

    .process-content {
        padding: 0 24px;
    }

    .step-left {
        padding-left: 0;
    }

    .step-right {
        padding-right: 0;
        text-align: left;
        align-self: flex-start;
    }

    .fracture-spine {
        display: none;
    }
}

@media (max-width: 600px) {
    .moment {
        padding: 30px 16px;
    }

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

    .process-step h2 {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .invitation-question {
        font-size: clamp(1.6rem, 7vw, 3rem);
    }

    .mend-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .vessel {
        width: clamp(140px, 50vw, 220px);
        height: clamp(190px, 65vw, 290px);
    }

    .moment-spacer {
        height: 15vh;
    }
}
