/* =====================================================
   namu.land — wabi-sabi forest, neon-electric edition
   ===================================================== */

:root {
    --canopy-dark: #1A2018;
    --neon-sap: #00E880;
    --understory-mid: #3A5038;
    --forest-floor: #4A3828;
    --root-deep: #0A0A08;
    --bark-cream: #E0D8C8;
    --moss-muted: #688860;

    --content-width: 680px;

    --font-headline: "Caveat", "Noto Serif", cursive;
    --font-body: "Noto Serif", "Noto Serif KR", Georgia, serif;
}

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

html,
body {
    background: var(--canopy-dark);
    color: var(--bark-cream);
    font-family: var(--font-body);
    font-size: clamp(15px, 1vw, 17px);
    line-height: 1.85;
    overflow-x: hidden;
}

body {
    transition: background-color 600ms ease;
}

/* ---------- Persistent neon threading lines ---------- */
.thread-network {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.thread {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 232, 128, 0.55) 12%,
        rgba(0, 232, 128, 0.35) 50%,
        rgba(0, 232, 128, 0.55) 88%,
        transparent 100%
    );
    opacity: 0;
    animation: threadPulse 6s ease-in-out infinite, threadFadeIn 800ms ease 200ms forwards;
    filter: drop-shadow(0 0 4px rgba(0, 232, 128, 0.45));
}

.thread-1 { left: 12%; animation-delay: 0s, 100ms; }
.thread-2 { left: 28%; animation-delay: 1.2s, 250ms; }
.thread-3 { left: 50%; animation-delay: 2.5s, 400ms; }
.thread-4 { left: 72%; animation-delay: 0.8s, 550ms; }
.thread-5 { left: 88%; animation-delay: 1.8s, 700ms; }

@keyframes threadFadeIn {
    from { opacity: 0; }
    to   { opacity: 0.6; }
}

@keyframes threadPulse {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 0.75; }
}

/* ---------- Cursor glow ---------- */
.cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 240px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(
        circle at center,
        rgba(0, 232, 128, 0.18) 0%,
        rgba(0, 232, 128, 0.08) 30%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity 400ms ease;
    mix-blend-mode: screen;
}

.cursor-glow.is-active {
    opacity: 1;
}

/* ---------- Forest container ---------- */
.forest {
    position: relative;
    z-index: 3;
}

/* ---------- Layer base ---------- */
.layer {
    position: relative;
    width: 100%;
    padding: 7vh 24px;
    transition: background-color 600ms ease;
    overflow: hidden;
}

.layer-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-style: italic;
    letter-spacing: 0.04em;
    color: var(--moss-muted);
    margin-bottom: 28px;
    opacity: 0.85;
}

.section-headline {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(34px, 4vw, 56px);
    color: var(--bark-cream);
    line-height: 1.1;
    margin-bottom: 32px;
    letter-spacing: 0.005em;
}

/* ===========================================================
   LAYER 1 — CANOPY
   =========================================================== */
.layer--canopy {
    min-height: 100vh;
    background-color: var(--canopy-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.canopy-pulse {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at top,
        rgba(0, 232, 128, 0.12) 0%,
        rgba(0, 232, 128, 0.05) 30%,
        transparent 65%
    );
    animation: canopyPulse 5s ease-in-out infinite;
    pointer-events: none;
}

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

.canopy-content {
    position: relative;
    width: 100%;
    max-width: var(--content-width);
    text-align: left;
    z-index: 4;
    opacity: 0;
    animation: contentFadeIn 1s ease 600ms forwards;
}

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

.domain-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(48px, 9vw, 124px);
    line-height: 1;
    color: var(--bark-cream);
    margin: 18px 0 14px;
    display: inline-block;
    letter-spacing: 0.01em;
}

.domain-letter,
.domain-dot {
    display: inline-block;
    will-change: transform;
}

.domain-dot {
    color: var(--neon-sap);
    text-shadow:
        0 0 10px rgba(0, 232, 128, 0.85),
        0 0 24px rgba(0, 232, 128, 0.5);
    animation: dotBlink 2.4s ease-in-out infinite;
}

@keyframes dotBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* Per-letter jitter — different keyframes per nth-child for "random feel" */
.domain-letter:nth-child(1) { animation: jitterA 150ms steps(1, end) infinite; }
.domain-letter:nth-child(2) { animation: jitterB 170ms steps(1, end) infinite; }
.domain-letter:nth-child(3) { animation: jitterC 160ms steps(1, end) infinite; }
.domain-letter:nth-child(4) { animation: jitterD 180ms steps(1, end) infinite; }
.domain-letter:nth-child(6) { animation: jitterB 155ms steps(1, end) infinite; }
.domain-letter:nth-child(7) { animation: jitterC 175ms steps(1, end) infinite; }
.domain-letter:nth-child(8) { animation: jitterA 165ms steps(1, end) infinite; }
.domain-letter:nth-child(9) { animation: jitterD 185ms steps(1, end) infinite; }

@keyframes jitterA {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(0.6px, -0.4px); }
    50%  { transform: translate(-0.5px, 0.6px); }
    75%  { transform: translate(0.4px, 0.5px); }
    100% { transform: translate(-0.6px, -0.5px); }
}
@keyframes jitterB {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-0.7px, 0.3px); }
    50%  { transform: translate(0.5px, -0.6px); }
    75%  { transform: translate(-0.3px, 0.6px); }
    100% { transform: translate(0.6px, 0.4px); }
}
@keyframes jitterC {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(0.5px, 0.5px); }
    50%  { transform: translate(-0.6px, -0.4px); }
    75%  { transform: translate(0.6px, -0.5px); }
    100% { transform: translate(-0.4px, 0.6px); }
}
@keyframes jitterD {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-0.4px, -0.6px); }
    50%  { transform: translate(0.6px, 0.3px); }
    75%  { transform: translate(-0.6px, 0.5px); }
    100% { transform: translate(0.3px, -0.4px); }
}

.domain-korean {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--moss-muted);
    font-size: 16px;
    margin-bottom: 28px;
    letter-spacing: 0.02em;
}

.canopy-tagline {
    font-family: var(--font-body);
    color: var(--bark-cream);
    font-size: clamp(15px, 1.05vw, 18px);
    line-height: 1.85;
    max-width: 540px;
    opacity: 0.92;
}

.scroll-hint {
    margin-top: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--neon-sap);
    font-family: var(--font-body);
    font-size: 12px;
    font-style: italic;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    opacity: 0.85;
}

.scroll-line {
    display: inline-block;
    width: 64px;
    height: 1px;
    background: var(--neon-sap);
    box-shadow: 0 0 8px rgba(0, 232, 128, 0.6);
    animation: scrollLineSlide 2.6s ease-in-out infinite;
    transform-origin: left center;
}

@keyframes scrollLineSlide {
    0%, 100% { transform: scaleX(0.5); }
    50%      { transform: scaleX(1); }
}

/* ---------- Canopy nature SVGs ---------- */
.nature-svg {
    position: absolute;
    z-index: 3;
    opacity: 0;
    animation: natureFadeIn 1.2s ease forwards;
    transition: transform 500ms ease, filter 500ms ease;
    will-change: transform;
}

@keyframes natureFadeIn {
    from { opacity: 0; transform: translate(0, 8px); }
    to   { opacity: 0.85; transform: translate(0, 0); }
}

.leaf-1   { top: 8%;  left: 6%;   width: 96px;  animation-delay: 800ms;  transform: rotate(-12deg); }
.leaf-2   { top: 18%; right: 8%;  width: 80px;  animation-delay: 1000ms; transform: rotate(18deg); }
.leaf-3   { bottom: 12%; left: 14%; width: 70px; animation-delay: 1200ms; transform: rotate(-26deg); }
.branch-1 { top: 42%; right: 4%; width: 280px; animation-delay: 1400ms; transform: rotate(8deg); }
.branch-2 { bottom: 18%; right: 18%; width: 240px; animation-delay: 1600ms; transform: rotate(-6deg); }

.leaf-1:hover, .leaf-2:hover, .leaf-3:hover {
    transform: rotate(var(--sway, 3deg)) scale(1.06);
    filter: drop-shadow(0 0 12px rgba(0, 232, 128, 0.7));
}
.branch-1:hover, .branch-2:hover {
    filter: drop-shadow(0 0 10px rgba(0, 232, 128, 0.6));
}

/* Sway animation hooked from JS via class */
.nature-svg.is-swaying {
    animation: natureFadeIn 1.2s ease forwards, leafSway 4s ease-in-out infinite;
}
@keyframes leafSway {
    0%, 100% { transform: rotate(var(--rest-angle, 0deg)); }
    50%      { transform: rotate(calc(var(--rest-angle, 0deg) + 3deg)); }
}

/* ===========================================================
   LAYER 2 — UNDERSTORY
   =========================================================== */
.layer--understory {
    background-color: var(--understory-mid);
    color: var(--bark-cream);
    padding-top: 14vh;
    padding-bottom: 14vh;
}

.understory-content {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

.frame-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-bottom: 56px;
}

.wabi-frame {
    position: relative;
    padding: 28px 16px 18px;
    text-align: center;
    transition: transform 500ms ease, filter 500ms ease;
}

.wabi-frame.frame-circle {
    border-radius: 52% 48% 60% 40% / 50% 56% 44% 50%;
    border: 1.4px solid rgba(0, 232, 128, 0.45);
    transform: rotate(-1.5deg);
}
.wabi-frame.frame-rect {
    border-radius: 6px 8px 10px 5px;
    border: 1.4px solid rgba(0, 232, 128, 0.5);
    transform: rotate(0.8deg);
}
.wabi-frame.frame-blob {
    border-radius: 70% 30% 60% 40% / 40% 60% 40% 60%;
    border: 1.4px solid rgba(0, 232, 128, 0.45);
    transform: rotate(-0.5deg);
}

.wabi-frame:hover {
    transform: rotate(0deg) scale(1.03);
    filter: drop-shadow(0 0 14px rgba(0, 232, 128, 0.45));
}

.frame-svg {
    width: 60px;
    height: 60px;
    display: block;
    margin: 0 auto 12px;
}

.frame-caption {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 24px;
    color: var(--neon-sap);
    line-height: 1;
    text-shadow: 0 0 10px rgba(0, 232, 128, 0.45);
}

.prose-block {
    margin-bottom: 48px;
}

.prose-block p {
    margin-bottom: 22px;
    color: var(--bark-cream);
    opacity: 0.92;
}

.prose-block p:last-child {
    margin-bottom: 0;
}

.ecology-list {
    list-style: none;
    padding: 0;
}

.ecology-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 16px;
    color: var(--bark-cream);
    line-height: 1.7;
}

.ecology-list li em {
    color: var(--neon-sap);
    font-style: italic;
    font-weight: 400;
    text-shadow: 0 0 8px rgba(0, 232, 128, 0.4);
    margin-right: 6px;
}

.dot-mark {
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 8px;
    height: 8px;
    background: var(--neon-sap);
    border-radius: 50% 60% 40% 50% / 50% 40% 60% 50%;
    box-shadow: 0 0 10px rgba(0, 232, 128, 0.7);
}

/* ===========================================================
   LAYER 3 — FOREST FLOOR
   =========================================================== */
.layer--floor {
    background-color: var(--forest-floor);
    color: var(--bark-cream);
    padding-top: 14vh;
    padding-bottom: 14vh;
    background-image:
        radial-gradient(circle at 12% 28%, rgba(104, 136, 96, 0.08) 0%, transparent 35%),
        radial-gradient(circle at 78% 62%, rgba(0, 232, 128, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 38% 88%, rgba(224, 216, 200, 0.04) 0%, transparent 30%);
}

.floor-content {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

.floor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 36px;
    margin-bottom: 56px;
}

.floor-card {
    position: relative;
    padding: 28px;
    border: 1px solid rgba(104, 136, 96, 0.35);
    border-radius: 4px 7px 5px 8px;
    transition: box-shadow 500ms ease, transform 500ms ease, border-color 500ms ease;
    background: rgba(10, 10, 8, 0.18);
}

.floor-card:hover {
    box-shadow: 0 8px 32px rgba(74, 56, 40, 0.5), 0 0 18px rgba(0, 232, 128, 0.15);
    transform: translateY(-4px);
    border-color: rgba(0, 232, 128, 0.45);
}

.floor-svg {
    width: 80px;
    height: 80px;
    margin-bottom: 18px;
    display: block;
    transition: transform 500ms ease;
}

.floor-card:hover .floor-svg {
    transform: rotate(-3deg) scale(1.06);
}

.card-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 30px;
    color: var(--neon-sap);
    line-height: 1.05;
    margin-bottom: 14px;
    text-shadow: 0 0 8px rgba(0, 232, 128, 0.3);
}

.card-body {
    color: var(--bark-cream);
    opacity: 0.9;
    line-height: 1.8;
}

.forest-quote {
    border-left: 2px solid var(--neon-sap);
    padding: 18px 24px;
    margin-top: 32px;
    background: rgba(10, 10, 8, 0.22);
    border-radius: 0 6px 4px 0;
}

.forest-quote p {
    font-family: var(--font-headline);
    font-weight: 400;
    font-size: clamp(20px, 2.4vw, 30px);
    color: var(--bark-cream);
    line-height: 1.4;
    margin-bottom: 10px;
}

.forest-quote cite {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--moss-muted);
    font-size: 13px;
    letter-spacing: 0.04em;
}

/* ===========================================================
   LAYER 4 — ROOT SYSTEM
   =========================================================== */
.layer--roots {
    background-color: var(--root-deep);
    color: var(--bark-cream);
    min-height: 100vh;
    padding-top: 14vh;
    padding-bottom: 14vh;
}

.roots-content {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

.roots-intro {
    color: var(--bark-cream);
    opacity: 0.85;
    margin-bottom: 56px;
    line-height: 1.85;
}

.root-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    margin-bottom: 64px;
}

.root-node {
    position: relative;
    padding: 18px;
    min-height: 180px;
}

/* The hidden root-network SVG below each node */
.root-network {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, 18%) scaleY(0.9);
    width: 86%;
    height: 120px;
    opacity: 0;
    transition: opacity 500ms ease, transform 500ms ease;
    pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(0, 232, 128, 0.55));
    z-index: 1;
}

.node-card {
    position: relative;
    padding: 20px 22px;
    background: rgba(26, 32, 24, 0.85);
    border: 1px solid rgba(104, 136, 96, 0.28);
    border-radius: 5px 7px 5px 7px;
    transition: transform 500ms ease, box-shadow 500ms ease, border-color 500ms ease;
    z-index: 2;
}

.root-node:hover .node-card,
.root-node.is-lifted .node-card {
    transform: translateY(-12px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65), 0 0 18px rgba(0, 232, 128, 0.3);
    border-color: rgba(0, 232, 128, 0.55);
}

.root-node:hover .root-network,
.root-node.is-lifted .root-network {
    opacity: 0.85;
    transform: translate(-50%, 24%) scaleY(1);
}

.node-label {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--neon-sap);
    margin-bottom: 8px;
    text-transform: lowercase;
    text-shadow: 0 0 8px rgba(0, 232, 128, 0.4);
}

.node-text {
    color: var(--bark-cream);
    opacity: 0.9;
    line-height: 1.7;
    font-size: 15px;
}

.signoff {
    text-align: center;
    margin-top: 56px;
    padding-top: 40px;
    border-top: 1px solid rgba(104, 136, 96, 0.25);
}

.signoff-text {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--moss-muted);
    letter-spacing: 0.06em;
    font-size: 12px;
    margin-bottom: 18px;
}

.signoff-domain {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(28px, 3.2vw, 44px);
    color: var(--bark-cream);
    line-height: 1;
    margin-bottom: 10px;
}

.signoff-meta {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--moss-muted);
    font-style: italic;
}

/* ===========================================================
   In-view fade — content fades in gently on viewport entry
   =========================================================== */
.fade-target {
    opacity: 0.5;
    transform: translateY(8px);
    transition: opacity 700ms ease, transform 700ms ease;
}

.fade-target.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===========================================================
   Active layer cursor brightening — when hovering a layer,
   the neon thread accents subtly brighten
   =========================================================== */
.layer.is-active .frame-caption,
.layer.is-active .card-title,
.layer.is-active .node-label {
    text-shadow: 0 0 14px rgba(0, 232, 128, 0.7);
}

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 720px) {
    .frame-row {
        grid-template-columns: 1fr;
        gap: 22px;
    }
    .root-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .leaf-1   { width: 64px; }
    .leaf-2   { width: 56px; }
    .leaf-3   { width: 50px; }
    .branch-1 { width: 200px; }
    .branch-2 { width: 180px; }

    .layer {
        padding: 9vh 18px;
    }
    .layer--canopy {
        padding-top: 12vh;
    }
    .domain-title {
        font-size: clamp(48px, 14vw, 92px);
    }
}

@media (max-width: 420px) {
    .leaf-1   { top: 6%; left: 4%; width: 48px; }
    .leaf-2   { top: 22%; right: 4%; width: 44px; }
    .leaf-3   { bottom: 16%; left: 8%; width: 40px; }
    .branch-1 { display: none; }
    .branch-2 { display: none; }
}
