/* ===== namu.day - Design Language ===== */
/* Palette:
   Background Paper Cream: #F5F1E8
   Primary Forest Dark: #2C3E2D
   Secondary Sage Muted: #6B8E6F
   Accent Warm Amber: #8B6F47
   Text Primary Charcoal Wood: #3D4A3F
   Text Secondary Stone Gray: #7A8578
   Surface Cream Soft: #FAFAF5
   Highlight Leaf Gold: #A89968
*/

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.8;
    color: #3D4A3F;
    background-color: #F5F1E8;
    overflow-x: hidden;
    position: relative;
}

/* ===== BACKGROUND TREE RINGS ===== */
#tree-rings-bg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120vmax;
    height: 120vmax;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle, transparent 10%, transparent 10.5%, #6B8E6F05 10.5%, #6B8E6F05 11%, transparent 11%),
        radial-gradient(circle, transparent 20%, transparent 20.5%, #6B8E6F05 20.5%, #6B8E6F05 21%, transparent 21%),
        radial-gradient(circle, transparent 30%, transparent 30.5%, #6B8E6F05 30.5%, #6B8E6F05 31%, transparent 31%),
        radial-gradient(circle, transparent 40%, transparent 40.5%, #6B8E6F05 40.5%, #6B8E6F05 41%, transparent 41%),
        radial-gradient(circle, transparent 50%, transparent 50.5%, #6B8E6F05 50.5%, #6B8E6F05 51%, transparent 51%),
        radial-gradient(circle, transparent 60%, transparent 60.5%, #6B8E6F05 60.5%, #6B8E6F05 61%, transparent 61%),
        radial-gradient(circle, transparent 70%, transparent 70.5%, #6B8E6F05 70.5%, #6B8E6F05 71%, transparent 71%),
        radial-gradient(circle, transparent 80%, transparent 80.5%, #6B8E6F05 80.5%, #6B8E6F05 81%, transparent 81%);
    animation: ringBreathe 20s ease-in-out infinite;
}

@keyframes ringBreathe {
    0%, 100% { transform: translate(-50%, -50%) scale(0.98); }
    50% { transform: translate(-50%, -50%) scale(1.02); }
}

/* ===== BACKGROUND TREE SILHOUETTE ===== */
#tree-silhouette {
    position: fixed;
    top: 20vh;
    right: 10vw;
    width: 30vw;
    max-width: 400px;
    height: 60vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
}

/* ===== CENTRAL TRUNK LINE ===== */
#trunk-line {
    position: fixed;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100vh;
    background: #4A674166; /* #4A6741 at 40% opacity */
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
}

/* ===== WAYPOINTS ===== */
#waypoints {
    position: fixed;
    left: 50%;
    top: 0;
    width: 0;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.waypoint {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.waypoint.active {
    opacity: 1;
}

.waypoint .leaf-icon {
    animation: glowPulse 2.5s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { filter: drop-shadow(0 0 0px #6B8E6F); }
    50% { filter: drop-shadow(0 0 8px #6B8E6F); }
}

/* ===== SVG BRANCH CONNECTORS ===== */
#branch-connectors {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.branch-path {
    stroke: url(#branch-gradient);
    stroke-width: 1;
    fill: none;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

/* ===== DAPPLED LIGHT OVERLAY ===== */
#dappled-light {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

.light-circle {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: radial-gradient(circle, #8B6F4715 0%, transparent 70%);
    animation: dappleDrift var(--duration) ease-in-out infinite alternate;
    transform: translate(-50%, -50%);
}

@keyframes dappleDrift {
    0% { transform: translate(-50%, -50%) translate(0, 0); }
    100% { transform: translate(-50%, -50%) translate(30px, 20px); }
}

/* ===== SECTION: HERO (Base Camp) ===== */
#base-camp {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    background: #2C3E2D;
    overflow: hidden;
}

#base-camp::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, #2C3E2D 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.domain-title {
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -0.01em;
    color: #F5F1E8;
    margin-bottom: 1rem;
}

.domain-title .letter {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.8s ease forwards;
    animation-delay: calc(var(--delay) * 0.15s + 0.5s);
}

@keyframes letterFadeIn {
    0% {
        opacity: 0;
        text-shadow: 0 0 0 #6B8E6F;
        transform: translateY(10px);
    }
    60% {
        text-shadow: 0 0 20px #6B8E6F;
    }
    100% {
        opacity: 1;
        text-shadow: 0 0 0 transparent;
        transform: translateY(0);
    }
}

.hero-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: #F5F1E8;
    opacity: 0.7;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    margin-bottom: 2rem;
    animation: fadeIn 1.5s ease 2s both;
}

.hero-korean {
    font-family: 'Crimson Text', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #A89968;
    opacity: 0.5;
    animation: fadeIn 1.5s ease 2.5s both;
}

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

.scroll-invite {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 2;
    animation: fadeIn 1.5s ease 3s both;
}

.scroll-invite .leaf-icon.pulse {
    animation: glowPulse 2.5s ease-in-out infinite, gentleBob 3s ease-in-out infinite;
}

@keyframes gentleBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.scroll-label {
    display: block;
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6B8E6F;
    opacity: 0.6;
    margin-top: 0.5rem;
}

/* ===== BRANCH BLOCKS ===== */
.branch-block {
    position: relative;
    padding: 2.5rem 3rem;
    margin-bottom: 18vh;
    background: #FAFAF5;
    border-radius: 2px;
    z-index: 2;
    max-width: 650px;
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.branch-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.branch-block::before {
    content: '';
    position: absolute;
    top: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #6B8E6F33, transparent);
}

.branch-block.left {
    margin-left: 5%;
    margin-right: auto;
}

.branch-block.right {
    margin-left: auto;
    margin-right: 5%;
}

.branch-block[data-width="40"] { width: 40%; }
.branch-block[data-width="45"] { width: 45%; }
.branch-block[data-width="50"] { width: 50%; }
.branch-block[data-width="55"] { width: 55%; }
.branch-block[data-width="60"] { width: 60%; }
.branch-block[data-width="65"] { width: 65%; }

/* ===== HEIGHT MARKERS ===== */
.height-marker {
    display: block;
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6B8E6F;
    opacity: 0.6;
    margin-bottom: 1rem;
}

/* ===== LEAF FLOURISH ===== */
.leaf-flourish {
    display: inline-block;
    margin-bottom: 0.5rem;
}

.leaf-flourish svg {
    animation: leafFloat 4s ease-in-out infinite, leafRotate 4s ease-in-out infinite;
}

@keyframes leafFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes leafRotate {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

/* ===== TYPOGRAPHY ===== */
.section-heading {
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: -0.01em;
    color: #2C3E2D;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.8;
    color: #3D4A3F;
}

/* Occasional amber headings for emphasis */
#trunk-ascent .branch-block:nth-child(even) .section-heading {
    color: #8B6F47;
}

/* ===== SECTIONS ===== */
.section-roots {
    position: relative;
    padding: 15vh 5vw 10vh;
    z-index: 2;
}

.section-trunk {
    position: relative;
    padding: 5vh 5vw 10vh;
    z-index: 2;
}

.section-canopy {
    position: relative;
    padding: 5vh 5vw 10vh;
    z-index: 2;
}

/* ===== SKY SECTION ===== */
.section-sky {
    position: relative;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw;
    z-index: 2;
    background: linear-gradient(to bottom, #F5F1E8, #FAFAF5);
}

.sky-content {
    text-align: center;
    max-width: 600px;
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.sky-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.sky-heading {
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: -0.01em;
    color: #2C3E2D;
    margin-bottom: 2rem;
    line-height: 1.1;
}

.sky-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.8;
    color: #3D4A3F;
    margin-bottom: 3rem;
}

.sky-korean {
    font-family: 'Crimson Text', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #8B6F47;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.sky-translation {
    display: block;
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #7A8578;
    opacity: 0.8;
}

/* ===== ROOT MOTIF (Footer) ===== */
.root-motif {
    margin-top: 5rem;
    text-align: center;
    opacity: 0.4;
}

.root-lines {
    width: 300px;
    max-width: 80vw;
    height: auto;
}

/* ===== HOVER STATES ===== */
.branch-block:hover {
    background: radial-gradient(ellipse at center, #8B6F4708 0%, #FAFAF5 80%);
}

.branch-block:hover .section-heading {
    text-shadow: 0 0 40px #8B6F4720;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .branch-block.left,
    .branch-block.right {
        width: 85% !important;
        margin-left: auto;
        margin-right: auto;
    }

    .branch-block {
        padding: 2rem;
        margin-bottom: 12vh;
    }

    #trunk-line {
        opacity: 0.2;
    }

    #tree-silhouette {
        opacity: 0.02;
        right: 0;
        width: 50vw;
    }

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

@media (max-width: 480px) {
    .branch-block {
        padding: 1.5rem;
        margin-bottom: 8vh;
    }

    .section-roots,
    .section-trunk,
    .section-canopy {
        padding-left: 3vw;
        padding-right: 3vw;
    }
}
