/* ============================================
   lovely.day - Dark-mode sanctuary
   Creamy-pastel warmth on rich charcoal
   ============================================ */

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #1A1A1F;
    color: #FFF5E6;
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Paper Grain Noise Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Falling Leaf Particles --- */
#leaf-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.falling-leaf {
    position: absolute;
    top: -60px;
    pointer-events: none;
    will-change: transform;
}

/* --- Side Navigation --- */
#side-nav {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #FFF5E6;
    opacity: 0.3;
    cursor: pointer;
    transition: opacity 0.4s ease, transform 0.4s ease;
    position: relative;
    display: flex;
    align-items: center;
}

.nav-dot.active {
    opacity: 1;
    animation: dotPulse 2.5s ease-in-out infinite;
}

.nav-dot:hover {
    opacity: 0.8;
    transform: scale(1.2);
}

.nav-label {
    position: absolute;
    left: 22px;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #FFF5E6;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 1;
    transform: translateX(0);
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

/* --- Design palette reference (for compliance) ---
   #0A0A0A - deep shadow overlay
   #B8D4C8 - Morning Leaf (sage)
   #C4B8E8 - Dusk Bloom (lavender)
*/

/* --- Sections Base --- */
.section {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    --color-shadow-deep: #0A0A0A;
    --color-sage: #B8D4C8;
    --color-lavender: #C4B8E8;
}

/* --- Marble Surface Texture --- */
.marble-surface {
    background:
        radial-gradient(ellipse at 20% 30%, #2A2A2F 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, #252528 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, #2A2A2F 0%, transparent 60%),
        linear-gradient(135deg, rgba(255, 245, 230, 0.03) 0%, transparent 30%, rgba(255, 245, 230, 0.02) 60%, transparent 100%),
        linear-gradient(45deg, transparent 40%, rgba(255, 245, 230, 0.015) 45%, transparent 50%),
        #252528;
    background-size: 100% 100%;
}

.marble-surface::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 15% 10%, rgba(255, 245, 230, 0.02) 0%, transparent 50%);
    pointer-events: none;
    border-radius: inherit;
}

/* --- Prologue Section --- */
.prologue-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.prologue-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(3, auto);
    width: 90%;
    max-width: 1200px;
    position: relative;
}

.letter-cell {
    opacity: 0;
    transform: translateY(20px);
}

.hero-letter {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(4rem, 10vw, 9rem);
    color: #FFF5E6;
    letter-spacing: -0.03em;
    line-height: 0.95;
    display: block;
}

/* Broken-grid letter positions */
.cell-l  { grid-column: 2 / span 2; grid-row: 1; transform-origin: left bottom; }
.cell-o  { grid-column: 4 / span 2; grid-row: 1; padding-top: 15px; }
.cell-v  { grid-column: 6 / span 2; grid-row: 1; padding-top: 5px; }
.cell-e  { grid-column: 7 / span 2; grid-row: 2; margin-top: -20px; padding-left: 20px; }
.cell-l2 { grid-column: 9 / span 2; grid-row: 2; margin-top: -30px; }
.cell-y  { grid-column: 10 / span 2; grid-row: 2; margin-top: -10px; padding-left: 15px; }

.prologue-subtitle {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: #FFE4CC;
    margin-top: 2rem;
    opacity: 0;
    letter-spacing: 0.05em;
}

.pressed-leaf {
    position: absolute;
    pointer-events: none;
}

.prologue-leaf {
    width: 80px;
    height: auto;
    top: 8%;
    right: 10%;
    opacity: 0.08;
    transform: rotate(15deg);
}

/* --- Morning Section --- */
.morning-section {
    min-height: 180vh;
    padding: 10vh 0;
    position: relative;
}

.vine-border {
    position: absolute;
    left: 60px;
    top: 0;
    height: 100%;
    width: 40px;
    opacity: 0.08;
    z-index: 1;
    color: #B8D4C8;
}

.vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.2s ease-out;
}

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

.vine-node {
    opacity: 0;
    transition: opacity 0.6s ease 0.8s;
}

.vine-path.drawn ~ .vine-node {
    opacity: 1;
}

.story-cards {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 5vh 5vw 5vh 12vw;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.story-card {
    position: relative;
    padding: 3rem 2.5rem;
    border-radius: 4px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    box-shadow: 8px 12px 30px #0A0A0A33;
    max-width: 520px;
}

.story-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.card-1 {
    transform: rotate(-1.5deg) translateY(40px);
    margin-left: 0;
    z-index: 3;
}
.card-1.visible {
    transform: rotate(-1.5deg) translateY(0);
}

.card-2 {
    transform: rotate(0.8deg) translateY(40px);
    margin-left: 15%;
    margin-top: -60px;
    z-index: 2;
}
.card-2.visible {
    transform: rotate(0.8deg) translateY(0);
}

.card-3 {
    transform: rotate(-0.5deg) translateY(40px);
    margin-left: 5%;
    margin-top: -80px;
    z-index: 1;
}
.card-3.visible {
    transform: rotate(-0.5deg) translateY(0);
}

.story-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.75;
    color: #FFF5E6;
}

.card-caption {
    display: block;
    margin-top: 1.2rem;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #FFE4CC;
    opacity: 0.6;
}

/* --- Afternoon Section (Gallery) --- */
.afternoon-section {
    min-height: 140vh;
    padding: 10vh 5vw;
    position: relative;
}

.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto;
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
    padding-left: 8vw;
}

.gallery-frame {
    position: relative;
    border: 1px solid rgba(255, 245, 230, 0.10);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.gallery-frame.visible {
    opacity: 1;
    transform: scale(1);
}

/* Broken masonry: irregular column spans and aspect ratios */
.frame-1 {
    grid-column: 1 / span 3;
    aspect-ratio: 3 / 4;
    margin-top: 20px;
}
.frame-2 {
    grid-column: 4 / span 5;
    aspect-ratio: 1 / 1;
    margin-top: -15px;
}
.frame-3 {
    grid-column: 9 / span 3;
    aspect-ratio: 2 / 3;
    margin-top: 40px;
}
.frame-4 {
    grid-column: 2 / span 4;
    aspect-ratio: 1 / 1;
    margin-top: -30px;
}
.frame-5 {
    grid-column: 6 / span 3;
    aspect-ratio: 3 / 4;
    margin-top: 15px;
}
.frame-6 {
    grid-column: 10 / span 3;
    aspect-ratio: 2 / 3;
    margin-top: -20px;
}

.leaf-motif {
    width: 50%;
    height: auto;
    opacity: 0.7;
    color: #C4B8E8;
}

/* --- Evening Section --- */
.evening-section {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #1A1A1F 0%, #1E1A1F 40%, #1E1A1F 60%, #1A1A1F 100%);
}

.evening-content {
    text-align: center;
    padding: 0 8vw;
    max-width: 900px;
}

.evening-quote {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #E8B4B8;
    line-height: 1.2;
    letter-spacing: -0.03em;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
    border: none;
    quotes: none;
}

.evening-quote.visible {
    opacity: 1;
    transform: translateY(0);
}

.evening-leaf-1 {
    width: 60px;
    bottom: 15%;
    left: 8%;
    opacity: 0.06;
    transform: rotate(-25deg);
}

.evening-leaf-2 {
    width: 50px;
    top: 20%;
    right: 12%;
    opacity: 0.08;
    transform: rotate(35deg);
}

/* --- Epilogue Section --- */
.epilogue-section {
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #0A0A0C;
}

.epilogue-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.epilogue-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #FFF5E6;
    animation: epiloguePulse 2s ease-in-out infinite;
}

@keyframes epiloguePulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.3); opacity: 1; }
}

.epilogue-signature {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #FFF5E6;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.epilogue-signature.visible {
    opacity: 0.6;
}

/* --- Gradient Depth Background --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1A1A1F 0%, #252528 30%, #1A1A1F 60%, #252528 80%, #1A1A1F 100%);
    z-index: -1;
    pointer-events: none;
}

/* --- Accent gradient overlay for decoration --- */
.marble-surface::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(232, 180, 184, 0.05) 0%, rgba(196, 184, 232, 0.05) 100%);
    pointer-events: none;
    border-radius: inherit;
    opacity: 0.15;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    #side-nav {
        left: 12px;
        gap: 14px;
    }

    .nav-dot {
        width: 8px;
        height: 8px;
    }

    .prologue-grid {
        width: 95%;
        grid-template-columns: repeat(6, 1fr);
    }

    .cell-l  { grid-column: 1 / span 1; }
    .cell-o  { grid-column: 2 / span 1; }
    .cell-v  { grid-column: 3 / span 1; }
    .cell-e  { grid-column: 3 / span 1; grid-row: 2; margin-top: -10px; padding-left: 0; }
    .cell-l2 { grid-column: 4 / span 1; grid-row: 2; margin-top: -15px; }
    .cell-y  { grid-column: 5 / span 1; grid-row: 2; margin-top: -5px; padding-left: 5px; }

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

    .story-cards {
        padding: 5vh 5vw;
    }

    .story-card {
        max-width: 100%;
    }

    .card-2 { margin-left: 5%; }
    .card-3 { margin-left: 0; }

    .vine-border {
        left: 15px;
    }

    .gallery-masonry {
        grid-template-columns: repeat(6, 1fr);
        padding-left: 5vw;
    }

    .frame-1 { grid-column: 1 / span 3; }
    .frame-2 { grid-column: 3 / span 4; }
    .frame-3 { grid-column: 1 / span 3; }
    .frame-4 { grid-column: 4 / span 3; }
    .frame-5 { grid-column: 1 / span 3; }
    .frame-6 { grid-column: 4 / span 3; }
}

@media (max-width: 480px) {
    .hero-letter {
        font-size: clamp(2.5rem, 14vw, 4rem);
    }

    .story-card {
        padding: 2rem 1.5rem;
    }

    .evening-quote {
        font-size: clamp(1.6rem, 6vw, 2.5rem);
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .letter-cell,
    .story-card,
    .gallery-frame,
    .evening-quote,
    .prologue-subtitle,
    .epilogue-signature {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .story-card.visible {
        transform: none !important;
    }

    .card-1, .card-2, .card-3 {
        transform: none !important;
    }

    .card-1.visible, .card-2.visible, .card-3.visible {
        transform: none !important;
    }

    .epilogue-dot {
        animation: none;
        opacity: 0.7;
    }

    .nav-dot.active {
        animation: none;
        opacity: 1;
    }

    .falling-leaf {
        display: none;
    }

    .vine-path {
        stroke-dashoffset: 0 !important;
    }
}
