/* ============================================
   namu.market - Neubrutalist Timber Timeline
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --dark-bark: #2b1810;
    --aged-cream: #f5ead6;
    --heartwood-gold: #c8a45e;
    --sepia-medium: #d4b896;
    --wood-brown: #8b6f47;
    --root-earth: #3e2218;
    --sap-green: #6b8f3c;
    --parchment: #ede4d3;
    --deep-wood: #4a3728;
    --scroll: 0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 17px;
    line-height: 1.65;
    color: var(--deep-wood);
    background-color: var(--aged-cream);
    overflow-x: hidden;
    background-image:
        repeating-linear-gradient(
            3deg,
            transparent,
            transparent 40px,
            rgba(200, 164, 94, 0.04) 40px,
            rgba(200, 164, 94, 0.04) 42px
        ),
        repeating-linear-gradient(
            -2deg,
            transparent,
            transparent 60px,
            rgba(212, 184, 150, 0.06) 60px,
            rgba(212, 184, 150, 0.06) 61px
        );
}

/* --- Fixed SVG Tree --- */
#tree-svg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50vw;
    max-width: 500px;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.15;
}

/* --- Section Base --- */
.section {
    position: relative;
    z-index: 2;
}

/* ============================================
   CANOPY SECTION
   ============================================ */
.canopy-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--aged-cream);
    border-bottom: 4px solid var(--dark-bark);
    position: relative;
    overflow: hidden;
}

.canopy-content {
    text-align: center;
    position: relative;
    z-index: 3;
    padding: 2rem;
}

.title-main {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: clamp(64px, 15vw, 120px);
    font-weight: 400;
    letter-spacing: 0.08em;
    line-height: 0.95;
    color: var(--dark-bark);
    text-transform: lowercase;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0;
}

.title-line {
    display: inline-block;
    text-shadow: 6px 6px 0px rgba(43, 24, 16, 0.2);
}

.title-dot {
    color: var(--heartwood-gold);
    font-size: clamp(64px, 15vw, 120px);
    display: inline-block;
}

.subtitle-korean {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: clamp(24px, 5vw, 48px);
    font-weight: 900;
    color: var(--dark-bark);
    margin-top: 0.5rem;
    letter-spacing: 0.1em;
}

.subtitle-english {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(14px, 2vw, 20px);
    font-style: italic;
    color: var(--wood-brown);
    margin-top: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.scroll-indicator {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-label {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wood-brown);
}

.scroll-arrow {
    opacity: 0.6;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* --- Organic Blobs --- */
.organic-blob {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    pointer-events: none;
    z-index: 1;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: rgba(200, 164, 94, 0.12);
    top: -100px;
    right: -80px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: rgba(107, 143, 60, 0.08);
    bottom: -50px;
    left: -60px;
    border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
}

.blob-3 {
    width: 500px;
    height: 500px;
    background: rgba(200, 164, 94, 0.1);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%;
}

/* ============================================
   HEARTWOOD SECTION
   ============================================ */
.heartwood-section {
    padding: 6rem 2rem;
    background-image:
        repeating-linear-gradient(
            2deg,
            transparent,
            transparent 80px,
            rgba(200, 164, 94, 0.05) 80px,
            rgba(200, 164, 94, 0.05) 82px
        );
}

.timeline-track {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    padding: 2rem 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--dark-bark);
    transform: translateX(-50%);
}

/* --- Timeline Ring --- */
.timeline-ring {
    position: relative;
    margin-bottom: 5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ring-bubble {
    width: 48px;
    height: 48px;
    border: 3px solid var(--dark-bark);
    border-radius: 50%;
    background: var(--aged-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ring-bubble:hover {
    transform: scale(1.3);
}

.bubble-accent {
    background: var(--heartwood-gold);
}

.bubble-accent .ring-year {
    color: var(--aged-cream);
}

.ring-year {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--dark-bark);
    letter-spacing: 0.05em;
}

.ring-connector {
    width: 2px;
    height: 30px;
    background: var(--dark-bark);
}

/* --- Namu Cards --- */
.namu-card {
    background: var(--aged-cream);
    border: 3px solid var(--dark-bark);
    box-shadow: 5px 5px 0px var(--dark-bark);
    padding: 2rem;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.namu-card:hover {
    box-shadow: 2px 2px 0px var(--dark-bark);
    transform: translate(3px, 3px);
}

/* --- Ring Cards --- */
.ring-card {
    max-width: 420px;
    width: 100%;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.ring-card.card-right {
    transform: translateX(40px);
}

.ring-card.visible {
    opacity: 1;
    transform: translateX(0);
}

.card-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1.5rem;
}

.card-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-right: 2px solid var(--dark-bark);
    padding-right: 1rem;
}

.card-label {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wood-brown);
}

.card-meta {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--heartwood-gold);
}

.card-title-kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: var(--dark-bark);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.card-title {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--dark-bark);
    margin-bottom: 0.75rem;
    line-height: 1;
}

.card-body {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--deep-wood);
    letter-spacing: 0.01em;
}

/* Alternating band backgrounds */
.timeline-ring:nth-child(odd) .ring-card {
    background: var(--aged-cream);
}

.timeline-ring:nth-child(even) .ring-card {
    background: var(--sepia-medium);
}

/* ============================================
   ROOT NETWORK SECTION
   ============================================ */
.roots-section {
    padding: 6rem 2rem;
    position: relative;
    background: var(--parchment);
    border-top: 4px solid var(--dark-bark);
    border-bottom: 4px solid var(--dark-bark);
    overflow: hidden;
}

.roots-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    position: relative;
    z-index: 3;
}

.root-card {
    padding: 1.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: calc(var(--delay) * 120ms);
}

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

.root-label {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 18px;
    font-weight: 900;
    color: var(--dark-bark);
    display: block;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--heartwood-gold);
}

.root-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 14px;
    line-height: 1.65;
    color: var(--deep-wood);
}

.root-connectors {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.2;
}

/* ============================================
   SOIL SECTION
   ============================================ */
.soil-section {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--root-earth);
    padding: 6rem 2rem;
}

.soil-content {
    text-align: center;
    max-width: 700px;
}

.soil-korean {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: clamp(24px, 5vw, 42px);
    font-weight: 900;
    color: var(--aged-cream);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.soil-english {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(16px, 2.5vw, 22px);
    font-style: italic;
    color: var(--sepia-medium);
    margin-bottom: 2.5rem;
}

.soil-divider {
    display: flex;
    justify-content: center;
    margin-bottom: 2.5rem;
}

.soil-tagline {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: clamp(36px, 8vw, 72px);
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--heartwood-gold);
    line-height: 0.95;
    margin-bottom: 0.5rem;
}

.soil-footer-kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--wood-brown);
    letter-spacing: 0.15em;
}

/* ============================================
   SVG PATH DRAW STATES
   ============================================ */
#tree-svg path,
#tree-svg circle {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 0.1s linear;
}

.root-line-draw {
    stroke-dasharray: var(--path-length, 800);
    stroke-dashoffset: var(--path-length, 800);
    transition: stroke-dashoffset 0.6s ease;
}

.root-line-draw.drawn {
    stroke-dashoffset: 0;
}

.divider-draw {
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    transition: stroke-dashoffset 0.8s ease;
}

.divider-draw.drawn {
    stroke-dashoffset: 0;
}

/* ============================================
   RING OBSERVE ANIMATIONS
   ============================================ */
.ring-observe .ring-bubble {
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ring-observe.in-view .ring-bubble {
    transform: scale(1);
}

.ring-observe.in-view .ring-bubble:hover {
    transform: scale(1.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .timeline-line {
        left: 24px;
    }

    .timeline-ring {
        align-items: flex-start;
        padding-left: 0;
    }

    .ring-bubble {
        margin-left: 0;
    }

    .ring-connector {
        margin-left: 23px;
    }

    .ring-card {
        max-width: 100%;
        margin-left: 60px;
    }

    .ring-card.card-left,
    .ring-card.card-right {
        transform: translateX(30px);
    }

    .ring-card.visible {
        transform: translateX(0);
    }

    .roots-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .card-sidebar {
        border-right: none;
        border-bottom: 2px solid var(--dark-bark);
        padding-right: 0;
        padding-bottom: 0.75rem;
        flex-direction: row;
        justify-content: space-between;
    }

    #tree-svg {
        width: 90vw;
        opacity: 0.08;
    }
}

@media (max-width: 480px) {
    .title-main {
        flex-direction: column;
        align-items: center;
    }
    
    .title-dot {
        display: none;
    }
}
