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

:root {
    --bg: #f4ede4;
    --surface: #e8e0d4;
    --text-primary: #3b3530;
    --text-mid: #4a4540;
    --text-secondary: #8a8278;
    --accent-warm: #b8706a;
    --accent-cool: #6a9b96;
    --deep-ground: #2a2420;
    --highlight: #d4a853;
    --sidebar-width: clamp(200px, 18vw, 280px);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

/* === Film Grain === */
.film-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' 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)'/%3E%3C/svg%3E");
    background-size: 100px 100px;
}

/* === Flowing Curves === */
.flowing-curves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.curve {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.curve-1, .curve-3, .curve-5 {
    stroke: var(--accent-cool);
    opacity: 0.2;
}

.curve-2, .curve-4 {
    stroke: var(--accent-warm);
    opacity: 0.15;
}

.curve-1 { animation: drift1 35s ease-in-out infinite; }
.curve-2 { animation: drift2 40s ease-in-out infinite; }
.curve-3 { animation: drift3 30s ease-in-out infinite; }
.curve-4 { animation: drift4 45s ease-in-out infinite; }
.curve-5 { animation: drift5 28s ease-in-out infinite; }

@keyframes drift1 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(20px) rotate(0.5deg); }
}
@keyframes drift2 {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-25px) rotate(-0.3deg); }
}
@keyframes drift3 {
    0%, 100% { transform: translateX(0) translateY(0); }
    50% { transform: translateX(15px) translateY(15px); }
}
@keyframes drift4 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}
@keyframes drift5 {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-20px); }
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--surface);
    z-index: 100;
    display: flex;
    align-items: center;
    border-right: 1px solid rgba(58, 53, 48, 0.08);
}

.sidebar-inner {
    padding: 3rem 1.5rem;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.site-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.nav-label {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: block;
}

.nav-label:hover {
    color: var(--accent-warm);
}

.nav-marker {
    display: block;
    font-style: normal;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-bottom: 0.2rem;
}

.sidebar-vignette {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.timestamp {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* === Main Content === */
.main-content {
    margin-left: var(--sidebar-width);
    position: relative;
    z-index: 10;
}

/* === Scenes === */
.scene {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 6rem 4rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.scene.visible {
    opacity: 1;
}

.scene-content {
    max-width: 700px;
    position: relative;
    z-index: 5;
}

/* === Typography === */
.kinetic-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.8rem, 7vw, 6rem);
    font-weight: 300;
    letter-spacing: 0.03em;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.kinetic-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) rotate(-3deg);
    transition: opacity 0.5s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.kinetic-text .char.revealed {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

.kinetic-text .char-space {
    display: inline-block;
    width: 0.3em;
}

.scene-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 540px;
}

/* === Typographic Fragments === */
.typographic-fragment {
    position: absolute;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(3rem, 5vw, 5rem);
    color: var(--text-primary);
    opacity: 0.08;
    transform: rotate(-8deg);
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

.scene-1 .typographic-fragment { top: 15%; left: 5%; }
.scene-2 .typographic-fragment { bottom: 20%; right: 5%; transform: rotate(5deg); }
.scene-3 .typographic-fragment { top: 10%; right: 10%; transform: rotate(-4deg); }
.scene-4 .typographic-fragment { bottom: 25%; left: 8%; transform: rotate(6deg); }

/* === Botanical SVGs === */
.botanical-svg {
    position: absolute;
    width: 150px;
    height: 250px;
    right: 8%;
    top: 20%;
    opacity: 0.5;
    z-index: 2;
}

.botanical-right {
    left: 8%;
    right: auto;
}

.botanical-line {
    fill: none;
    stroke: var(--accent-cool);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 2s ease;
}

.scene.visible .botanical-line {
    stroke-dashoffset: 0;
}

/* === Mixed Media === */
.mixed-media-block {
    position: absolute;
    right: 5%;
    top: 30%;
    width: 200px;
    height: 260px;
    z-index: 2;
}

.media-shape {
    position: absolute;
    border-radius: 2px;
}

.shape-1 {
    width: 160px;
    height: 200px;
    background-color: var(--accent-cool);
    opacity: 0.12;
    top: 0;
    left: 0;
    transform: rotate(-3deg);
}

.shape-2 {
    width: 140px;
    height: 180px;
    background-color: var(--accent-warm);
    opacity: 0.1;
    top: 30px;
    left: 30px;
    transform: rotate(2deg);
}

/* === Footer === */
.scene-footer {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-ground);
    position: relative;
    z-index: 10;
}

.footer-content {
    text-align: center;
}

.footer-mark {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 300;
    color: var(--bg);
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.footer-year {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

/* === Magnetic element base === */
.magnetic {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 48px;
        border-right: none;
        border-bottom: 1px solid rgba(58, 53, 48, 0.08);
        align-items: center;
    }

    .sidebar-inner {
        flex-direction: row;
        align-items: center;
        padding: 0 1.5rem;
        height: 48px;
    }

    .sidebar-nav,
    .sidebar-vignette {
        display: none;
    }

    .main-content {
        margin-left: 0;
        margin-top: 48px;
    }

    .scene {
        padding: 4rem 2rem;
    }

    .botanical-svg,
    .mixed-media-block {
        display: none;
    }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .kinetic-text .char {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .curve {
        animation: none;
    }

    .magnetic {
        transition: none;
    }

    .scene {
        opacity: 1;
        transition: none;
    }
}
