/* ========================================
   muhan.dev — Overgrown Terminal Garden
   ======================================== */

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

:root {
    --deep-soil: #2c1810;
    --warm-clay: #c07850;
    --dried-sage: #7a8b6e;
    --parchment: #f0e4d4;
    --river-stone: #8b7d6b;
    --sunset-amber: #d4a04a;
    --moss-shadow: #3d4a35;
    --morning-fog: rgba(240, 228, 212, 0.08);
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--deep-soil);
    color: var(--parchment);
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.75;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Layer 0: Background Terrain --- */
#bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.terrain {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50vh;
    will-change: transform;
}

.terrain-1 { transform: translate3d(0, 0, 0); }
.terrain-2 { transform: translate3d(0, 30px, 0); }
.terrain-3 { transform: translate3d(0, 60px, 0); }

/* --- Layer 1: Vine Decorations --- */
#vine-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.vine-svg {
    position: absolute;
    top: 0;
    height: 100%;
    width: 60px;
    opacity: 0.6;
}

#vine-left { left: 10px; }
#vine-right { right: 10px; }

.vine-path {
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    transition: stroke-dashoffset 3s ease-out;
    will-change: stroke-dashoffset;
}

.vine-path.grown {
    stroke-dashoffset: 0;
}

/* --- Vine Navigation --- */
#vine-nav {
    position: fixed;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

#vine-nav .nav-vine-line {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: calc(100% + 20px);
    z-index: -1;
}

.nav-bud {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
}

.bud-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--river-stone);
    transition: all 0.4s ease;
}

.nav-bud.active .bud-dot {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 40% 40%, var(--warm-clay), #a05838);
    box-shadow: 0 0 12px rgba(192, 120, 80, 0.4);
}

.nav-bud:hover .bud-dot {
    background: var(--warm-clay);
    transform: scale(1.2);
}

/* --- Layer 2: Terminal HUD --- */
#terminal {
    position: relative;
    z-index: 10;
    width: min(700px, 90vw);
    margin-left: auto;
    margin-right: 5%;
    margin-top: 5vh;
    margin-bottom: 10vh;
    background: rgba(44, 24, 16, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(139, 109, 78, 0.3);
    border-radius: 12px;
    overflow: hidden;
    transform: perspective(1200px) rotateY(-1deg);
    transition: transform 0.6s ease;
}

#terminal:hover {
    transform: perspective(1200px) rotateY(0deg);
}

/* --- Terminal Title Bar --- */
#terminal-titlebar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: rgba(44, 24, 16, 0.95);
    border-bottom: 1px solid rgba(139, 109, 78, 0.2);
    position: relative;
}

.window-dots {
    display: flex;
    gap: 7px;
    margin-right: 14px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-close { background: var(--warm-clay); }
.dot-minimize { background: var(--sunset-amber); }
.dot-maximize { background: var(--dried-sage); }

.terminal-title {
    font-family: 'Inconsolata', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--river-stone);
}

.infinity-vine {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

/* --- Terminal Content --- */
#terminal-content {
    padding: 24px 28px;
}

/* --- ASCII Art --- */
.ascii-garden {
    font-family: 'Inconsolata', monospace;
    font-size: clamp(0.7rem, 1.4vw, 0.9rem);
    line-height: 1.4;
    color: var(--parchment);
    margin-bottom: 20px;
    white-space: pre;
    overflow-x: auto;
}

.ascii-line {
    display: block;
    opacity: 0;
    transform: translateY(4px);
}

.ascii-line.revealed {
    animation: ascii-reveal 60ms ease forwards;
}

.ascii-highlight {
    color: var(--sunset-amber);
}

.ascii-highlight.revealed {
    animation: ascii-highlight-reveal 200ms ease forwards;
}

@keyframes ascii-reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ascii-highlight-reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Boot Sequence --- */
.boot-sequence {
    font-family: 'Inconsolata', monospace;
    font-size: clamp(0.85rem, 1.6vw, 1rem);
    color: var(--dried-sage);
    margin-bottom: 16px;
}

.boot-line {
    opacity: 0;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.boot-line.typing {
    opacity: 1;
}

.boot-line .char {
    opacity: 0;
}

.boot-line .char.visible {
    opacity: 1;
}

/* --- Command Lines --- */
.command-line {
    font-family: 'Inconsolata', monospace;
    font-size: clamp(0.85rem, 1.6vw, 1rem);
    color: var(--parchment);
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.command-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.prompt {
    color: var(--warm-clay);
    font-weight: 700;
    margin-right: 8px;
}

/* --- Command Response --- */
.command-response {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease 0.2s, transform 0.6s ease 0.2s;
}

.command-response.visible {
    opacity: 1;
    transform: translateY(0);
}

.command-response h2 {
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: clamp(1.8rem, 4.5vw, 3rem);
    letter-spacing: 0.02em;
    color: var(--parchment);
    margin-bottom: 12px;
}

.command-response p {
    margin-bottom: 12px;
    color: var(--parchment);
}

/* --- Mini Card --- */
.mini-card {
    background: var(--morning-fog);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(139, 125, 107, 0.15);
}

.mini-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.mini-card-header h2 {
    margin-bottom: 0;
}

/* --- Root Dividers --- */
.root-divider {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.root-divider.visible {
    opacity: 1;
}

.root-divider svg {
    width: 200px;
    height: 40px;
}

/* --- Project Cards --- */
.project-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.project-card {
    background: rgba(61, 74, 53, 0.25);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(122, 139, 110, 0.2);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.project-card-vine {
    margin-bottom: 8px;
}

.project-card-vine svg {
    width: 100%;
    height: 8px;
}

.project-card h3 {
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--warm-clay);
    margin-bottom: 6px;
}

.project-card p {
    font-size: 0.95rem;
    color: var(--parchment);
    margin-bottom: 10px;
    opacity: 0.9;
}

.project-tag {
    display: inline-block;
    font-family: 'Inconsolata', monospace;
    font-size: 0.8rem;
    color: var(--dried-sage);
    background: rgba(122, 139, 110, 0.15);
    padding: 2px 10px;
    border-radius: 12px;
    margin-right: 6px;
    border: 1px solid rgba(122, 139, 110, 0.25);
}

/* --- Skills Garden --- */
.skill-garden {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.skill-plant {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 8px;
    background: rgba(61, 74, 53, 0.15);
    border-radius: 16px;
    border: 1px solid rgba(122, 139, 110, 0.12);
    transition: transform 0.3s ease;
}

.skill-plant:hover {
    transform: translateY(-4px);
}

.plant-icon {
    margin-bottom: 8px;
}

.skill-name {
    font-family: 'Inconsolata', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--parchment);
    margin-bottom: 4px;
}

.skill-season {
    font-size: 0.8rem;
    color: var(--river-stone);
    font-style: italic;
}

/* --- Contact --- */
.contact-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.contact-link {
    color: var(--warm-clay);
    text-decoration: none;
    font-family: 'Inconsolata', monospace;
    transition: color 0.2s ease;
    position: relative;
    display: inline-block;
    width: fit-content;
}

.contact-link:hover {
    color: var(--sunset-amber);
}

.contact-link:hover::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    background: var(--dried-sage);
    clip-path: polygon(50% 0%, 100% 50%, 80% 50%, 80% 100%, 20% 100%, 20% 50%, 0% 50%);
    vertical-align: middle;
}

/* --- Seed Planter --- */
#seed-planter {
    margin-top: 16px;
}

#plant-seed-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(212, 160, 74, 0.15);
    border: 1px solid rgba(212, 160, 74, 0.3);
    color: var(--sunset-amber);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    padding: 10px 20px;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

#plant-seed-btn:hover {
    background: rgba(212, 160, 74, 0.25);
    transform: scale(1.03);
}

#seed-garden {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    min-height: 40px;
}

.planted-seed {
    display: inline-block;
    animation: sprout 0.6s ease forwards;
}

@keyframes sprout {
    0% {
        transform: scale(0) translateY(10px);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) translateY(-4px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* --- Terminal Footer --- */
.terminal-footer {
    padding: 20px 0 0;
    font-family: 'Inconsolata', monospace;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Cursor Seed --- */
.cursor-seed {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--sunset-amber);
    border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
    animation: seed-pulse 1.2s ease-in-out infinite;
}

@keyframes seed-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* --- Section reveal --- */
.terminal-section {
    margin-bottom: 10px;
}

/* --- Links in text --- */
a {
    color: var(--warm-clay);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--sunset-amber);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #terminal {
        width: 95vw;
        margin-left: auto;
        margin-right: auto;
        transform: none;
        border-radius: 8px;
    }

    #terminal:hover {
        transform: none;
    }

    #vine-nav {
        position: fixed;
        left: 0;
        top: auto;
        bottom: 0;
        transform: none;
        flex-direction: row;
        width: 100%;
        justify-content: center;
        gap: 20px;
        padding: 12px;
        background: rgba(44, 24, 16, 0.95);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 200;
    }

    #vine-nav .nav-vine-line {
        display: none;
    }

    .vine-svg {
        display: none;
    }

    #terminal-content {
        padding: 16px 18px;
    }

    .skill-garden {
        grid-template-columns: repeat(2, 1fr);
    }

    #bg-layer {
        position: fixed;
    }

    .terrain {
        transform: none !important;
    }
}
