/* ============================================
   namu.farm — Seapunk Arboreal Design System
   Colors: #d4e8ee, #f2a7b3, #b8e8d8, #e8c84a, #e4f2f0, #0d7377, #2d4a5e, #e8f4f0, #1a3a4a, #0a1e2e, #7eb8a8
   Fonts: Quicksand (display), Nunito (headers), Inter (body)
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --color-deep-ocean: #0a1e2e;
    --color-midnight-teal: #1a3a4a;
    --color-slate-blue: #2d4a5e;
    --color-teal-accent: #0d7377;
    --color-seafoam: #7eb8a8;
    --color-mint: #b8e8d8;
    --color-pale-aqua: #d4e8ee;
    --color-ice: #e4f2f0;
    --color-mist: #e8f4f0;
    --color-coral-pink: #f2a7b3;
    --color-bioluminescent: #e8c84a;

    --font-display: 'Quicksand', sans-serif;
    --font-heading: 'Nunito', sans-serif;
    --font-body: 'Nunito Sans', sans-serif;

    --trunk-width: 2px;
    --trunk-left: 80px;
    --branch-gap: 0;
}

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

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

body.namu {
    background-color: var(--color-deep-ocean);
    color: var(--color-pale-aqua);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* --- Grain Overlay --- */
.grain {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.06;
    filter: url(#grain-filter);
    background: transparent;
}

/* --- Floating Spore Particles --- */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.spore {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--color-mint);
    opacity: 0;
    animation: spore-float var(--dur) var(--delay) infinite ease-in-out;
    box-shadow: 0 0 6px var(--color-mint), 0 0 12px rgba(184, 232, 216, 0.3);
}

@keyframes spore-float {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.5);
    }
    15% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.4;
        transform: translate(calc(var(--size) * 8), calc(var(--size) * -12)) scale(1);
    }
    85% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translate(calc(var(--size) * -4), calc(var(--size) * -20)) scale(0.3);
    }
}

/* --- Trunk Line (Vertical Axis) --- */
.trunk-line {
    position: fixed;
    top: 0;
    left: var(--trunk-left);
    width: var(--trunk-width);
    height: 0;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--color-seafoam) 10%,
        var(--color-teal-accent) 50%,
        var(--color-seafoam) 90%,
        transparent
    );
    z-index: 10;
    opacity: 0.5;
    transition: height 0.3s ease-out;
}

/* --- Ripple Container --- */
.ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border: 1px solid var(--color-coral-pink);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple-expand 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes ripple-expand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* --- Canopy (Hero Section) --- */
.canopy {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(
        ellipse at 30% 40%,
        rgba(13, 115, 119, 0.15) 0%,
        var(--color-deep-ocean) 70%
    );
    overflow: hidden;
    padding: 2rem;
}

.canopy::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(
        circle at 70% 30%,
        rgba(242, 167, 179, 0.08) 0%,
        transparent 50%
    );
    pointer-events: none;
}

.canopy-inner {
    text-align: center;
    position: relative;
    z-index: 20;
}

.canopy-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(13, 115, 119, 0.12) 0%,
        rgba(126, 184, 168, 0.06) 40%,
        transparent 70%
    );
    pointer-events: none;
    z-index: -1;
    animation: glow-pulse 6s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 1;
    }
}

.domain-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3.5rem, 10vw, 9rem);
    letter-spacing: 0.04em;
    color: var(--color-mist);
    line-height: 1.1;
    position: relative;
    text-shadow: 0 0 40px rgba(13, 115, 119, 0.3), 0 0 80px rgba(126, 184, 168, 0.15);
}

.domain-name .tld {
    color: var(--color-coral-pink);
    text-shadow: 0 0 30px rgba(242, 167, 179, 0.4);
}

.tagline {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 2vw, 1.15rem);
    color: var(--color-seafoam);
    margin-top: 1.5rem;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    opacity: 0.75;
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-seafoam);
    opacity: 0.4;
    animation: scroll-bounce 2s ease-in-out infinite;
    z-index: 20;
}

@keyframes scroll-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

/* --- Branch Sections (Content) --- */
.branch {
    position: relative;
    padding: 6rem 2rem 6rem calc(var(--trunk-left) + 60px);
    min-height: 80vh;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.branch.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger branch widths for organic F-pattern */
.branch-1 .branch-content { max-width: 65%; }
.branch-2 .branch-content { max-width: 55%; }
.branch-3 .branch-content { max-width: 70%; }
.branch-4 .branch-content { max-width: 50%; }

/* Branch connector - horizontal line from trunk */
.branch-connector {
    position: absolute;
    left: var(--trunk-left);
    top: 50%;
    width: 58px;
    height: 2px;
    background: linear-gradient(to right, var(--color-teal-accent), var(--color-seafoam));
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.6s ease-out 0.2s, opacity 0.6s ease-out 0.2s;
}

.branch.visible .branch-connector {
    opacity: 0.6;
    transform: scaleX(1);
}

/* Branch content */
.branch-content {
    position: relative;
    z-index: 20;
}

.branch-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--color-mint);
    margin-bottom: 1.2rem;
    position: relative;
    display: inline-block;
}

.branch-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(to right, var(--color-coral-pink), transparent);
    transition: width 0.8s ease-out 0.4s;
}

.branch.visible .branch-title::after {
    width: 100%;
}

.branch-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.85;
    color: var(--color-pale-aqua);
    opacity: 0.85;
    max-width: 600px;
}

/* Alternating section backgrounds */
.branch-1 {
    background: linear-gradient(135deg, rgba(13, 115, 119, 0.05) 0%, transparent 60%);
}

.branch-2 {
    background: linear-gradient(225deg, rgba(242, 167, 179, 0.04) 0%, transparent 60%);
}

.branch-3 {
    background: linear-gradient(135deg, rgba(232, 200, 74, 0.03) 0%, transparent 60%);
}

.branch-4 {
    background: linear-gradient(225deg, rgba(13, 115, 119, 0.06) 0%, transparent 60%);
}

/* --- SVG Motif Styling --- */
.branch-leaf,
.data-rings,
.kelp-strands {
    margin-top: 2rem;
    opacity: 0.6;
    transition: opacity 0.8s ease-out;
}

.branch.visible .branch-leaf,
.branch.visible .data-rings,
.branch.visible .kelp-strands {
    opacity: 0.8;
}

.leaf-svg {
    width: 120px;
    height: 80px;
    color: var(--color-mint);
    filter: drop-shadow(0 0 8px rgba(184, 232, 216, 0.3));
}

.rings-svg {
    width: 160px;
    height: 160px;
    color: var(--color-coral-pink);
    animation: rings-rotate 20s linear infinite;
}

@keyframes rings-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.kelp-svg {
    width: 180px;
    height: 140px;
    color: var(--color-seafoam);
    animation: kelp-sway 4s ease-in-out infinite;
}

@keyframes kelp-sway {
    0%, 100% { transform: skewX(0deg); }
    25% { transform: skewX(2deg); }
    75% { transform: skewX(-2deg); }
}

/* --- Code Block --- */
.code-block {
    margin-top: 2rem;
    background: rgba(10, 30, 46, 0.6);
    border: 1px solid rgba(13, 115, 119, 0.25);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    max-width: 480px;
    backdrop-filter: blur(4px);
}

.code-line {
    display: block;
    color: var(--color-pale-aqua);
    opacity: 0.8;
}

.code-kw {
    color: var(--color-coral-pink);
}

.code-fn {
    color: var(--color-bioluminescent);
}

/* --- Root System (Footer) --- */
.root-system {
    position: relative;
    padding: 8rem 2rem 4rem;
    text-align: center;
    background: linear-gradient(
        to bottom,
        var(--color-deep-ocean),
        rgba(26, 58, 74, 0.5) 50%,
        var(--color-deep-ocean)
    );
}

.root-content {
    position: relative;
    z-index: 20;
    max-width: 500px;
    margin: 0 auto;
}

.root-network {
    margin-bottom: 2rem;
    opacity: 0.5;
}

.root-svg {
    width: 300px;
    height: 90px;
    color: var(--color-seafoam);
}

.root-text {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.3rem;
    color: var(--color-mist);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.root-subtext {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--color-seafoam);
    opacity: 0.5;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    margin-bottom: 2rem;
}

.root-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.root-link {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--color-seafoam);
    opacity: 0.5;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    cursor: default;
    transition: opacity 0.3s, color 0.3s;
}

.root-link:hover {
    opacity: 0.9;
    color: var(--color-coral-pink);
}

.root-divider {
    color: var(--color-slate-blue);
    opacity: 0.4;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --trunk-left: 30px;
    }

    .branch {
        padding: 4rem 1.5rem 4rem calc(var(--trunk-left) + 30px);
    }

    .branch-connector {
        width: 28px;
    }

    .branch-1 .branch-content,
    .branch-2 .branch-content,
    .branch-3 .branch-content,
    .branch-4 .branch-content {
        max-width: 100%;
    }

    .branch-text {
        max-width: 100%;
    }

    .code-block {
        max-width: 100%;
        padding: 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    :root {
        --trunk-left: 16px;
    }

    .branch {
        padding: 3rem 1rem 3rem calc(var(--trunk-left) + 20px);
    }

    .branch-connector {
        width: 18px;
    }

    .canopy {
        padding: 1rem;
    }

    .tagline {
        letter-spacing: 0.08em;
    }
}

/* --- Holographic shimmer on domain name hover --- */
.domain-name {
    transition: text-shadow 0.5s ease;
    cursor: default;
}

.domain-name:hover {
    text-shadow:
        0 0 20px rgba(13, 115, 119, 0.5),
        0 0 40px rgba(242, 167, 179, 0.3),
        0 0 80px rgba(232, 200, 74, 0.2),
        0 0 120px rgba(126, 184, 168, 0.15);
}

/* --- Selection color --- */
::selection {
    background: rgba(242, 167, 179, 0.3);
    color: var(--color-mist);
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-deep-ocean);
}

::-webkit-scrollbar-thumb {
    background: var(--color-slate-blue);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-teal-accent);
}
