/* =============================================
   nonri.day - Scandinavian Narrative Day
   ============================================= */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    color: #4A5060;
    background-color: #E8E0F0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Palette Variables --- */
:root {
    --lavender: #E8E0F0;
    --sage: #D0E0D0;
    --peach: #F0DCD0;
    --mountain-slate: #4A5060;
    --pine-dark: #2A3828;
    --snow-white: #FAFAFA;
    --heather: #7A6890;
}

/* --- Minimal Navigation --- */
.nav-minimal {
    position: fixed;
    top: 24px;
    right: 28px;
    z-index: 100;
}

.nav-link {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mountain-slate);
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--heather);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-link:hover {
    opacity: 1;
}

.nav-link:hover::after {
    opacity: 1;
}

/* --- Mountain Backdrop (Persistent Parallax) --- */
.mountain-backdrop {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 400px;
    z-index: 0;
    pointer-events: none;
    will-change: transform;
}

.mountain-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Mountain stroke drawing animation */
.mountain {
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    animation: drawMountain 2000ms ease-out forwards;
}

.mountain-near {
    animation-delay: 300ms;
}

@keyframes drawMountain {
    to {
        stroke-dashoffset: 0;
    }
}

/* Pine tree entrance animation */
.pine-tree {
    transform-origin: center bottom;
    transform: scale(0);
    animation: growTree 400ms ease-out forwards;
}

.pine-tree[data-index="0"] { animation-delay: 1600ms; }
.pine-tree[data-index="1"] { animation-delay: 1800ms; }
.pine-tree[data-index="2"] { animation-delay: 2000ms; }
.pine-tree[data-index="3"] { animation-delay: 2100ms; }
.pine-tree[data-index="4"] { animation-delay: 2200ms; }
.pine-tree[data-index="5"] { animation-delay: 2300ms; }
.pine-tree[data-index="6"] { animation-delay: 2400ms; }
.pine-tree[data-index="7"] { animation-delay: 2500ms; }

@keyframes growTree {
    0% {
        transform: scale(0);
    }
    80% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Wind sway on tree tips */
.pine-tree polygon:first-of-type {
    animation: windSway 8s ease-in-out infinite;
    animation-delay: 2500ms;
    transform-origin: center bottom;
}

@keyframes windSway {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(1.5px);
    }
    75% {
        transform: translateX(-1px);
    }
}

/* --- Hero Section: Morning Stillness --- */
.hero {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--lavender);
    padding: 0 24px;
}

.hero-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(28px, 3.5vw, 52px);
    letter-spacing: 0.01em;
    color: var(--mountain-slate);
    opacity: 0;
    animation: fadeInTitle 800ms ease-out 200ms forwards;
}

.hero-date {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 13px;
    color: var(--heather);
    margin-top: 16px;
    opacity: 0;
    animation: fadeInTitle 800ms ease-out 600ms forwards;
}

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

/* --- Narrative Main Content --- */
.narrative {
    position: relative;
    z-index: 1;
}

.narrative-section {
    padding: 96px 24px;
    transition: background-color 600ms ease;
}

.section-lavender {
    background-color: var(--lavender);
}

.section-sage {
    background-color: var(--sage);
}

.section-peach {
    background-color: var(--peach);
}

/* --- Entry Styles --- */
.entry {
    max-width: 640px;
    margin: 0 auto 96px auto;
    opacity: 0;
    transition: opacity 400ms ease, transform 400ms ease;
}

.entry:last-child {
    margin-bottom: 0;
}

.entry-left {
    transform: translateX(-20px);
}

.entry-right {
    transform: translateX(20px);
}

.entry.revealed {
    opacity: 1;
    transform: translateX(0);
}

.entry-time {
    display: block;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 13px;
    color: var(--heather);
    margin-bottom: 8px;
}

.entry-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(28px, 3.5vw, 52px);
    letter-spacing: 0.01em;
    color: var(--pine-dark);
    margin-bottom: 16px;
    line-height: 1.2;
}

.entry-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.1vw, 18px);
    line-height: 1.9;
    color: var(--mountain-slate);
}

/* --- Hand-drawn Border Accents --- */
.border-accent {
    max-width: 120px;
    margin: 0 auto 96px auto;
    opacity: 0;
    transition: opacity 400ms ease, transform 400ms ease;
}

.border-accent.revealed {
    opacity: 1;
}

.border-accent:hover svg {
    transform: rotate(2deg);
    transition: transform 0.2s ease;
}

.border-accent svg {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.2s ease;
}

.accent-leaf {
    max-width: 40px;
}

.accent-dots {
    max-width: 80px;
}

/* --- Closing Section --- */
.closing {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    padding: 96px 0;
}

.closing .border-accent {
    margin-bottom: 48px;
}

.closing-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 13px;
    color: var(--heather);
    margin-bottom: 12px;
}

.closing-domain {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(28px, 3.5vw, 52px);
    letter-spacing: 0.01em;
    color: var(--mountain-slate);
    opacity: 0;
    transition: opacity 600ms ease;
}

.closing-domain.revealed {
    opacity: 1;
}

/* --- Links in body text --- */
.entry-text a {
    color: var(--heather);
    text-decoration: none;
    position: relative;
}

.entry-text a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--heather);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.entry-text a:hover::after {
    opacity: 1;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .narrative-section {
        padding: 64px 20px;
    }

    .entry {
        margin-bottom: 64px;
    }

    .border-accent {
        margin-bottom: 64px;
    }

    .closing {
        padding: 64px 0;
    }

    .nav-minimal {
        top: 16px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .narrative-section {
        padding: 48px 16px;
    }

    .entry {
        margin-bottom: 48px;
    }

    .border-accent {
        margin-bottom: 48px;
    }

    .closing {
        padding: 48px 0;
    }
}
