/* ========================================================================
   Modern Dark Portfolio 2025 - V7: Atmospheric Layering Engine
   ======================================================================== */

/* NEW: A richer, more varied 5-color blue palette for atmospheric depth */
:root {
    /* Base Palette */
    --midnight-blue: #0B1120;     /* A deeper, richer base color */
    --blue-yonder: #1C2A44;        /* For glass panels, a softer dark blue */
    --lightest-slate: #E6F1FF;    /* Primary text, clean and bright */
    --slate-blue: #8899B5;        /* Secondary text, muted and professional */
    
    /* Accent & Gradient Palette */
    --lapis-lazuli: #226CE0;       /* A rich, deep blue for gradients */
    --vivid-sky-blue: #00BFFF;     /* A vibrant, electric sky blue */
    --electric-blue: #7DF9FF;      /* The brightest, most electric accent */

    /* Theme Variables */
    --primary-color: var(--midnight-blue);
    --secondary-color: rgba(28, 42, 68, 0.6);   /* --blue-yonder with alpha */
    --accent-color: var(--electric-blue);
    --accent-gradient: linear-gradient(110deg, var(--vivid-sky-blue), var(--electric-blue));
    --text-color: var(--lightest-slate);
    --subtle-text-color: var(--slate-blue);
    --card-bg-color: rgba(28, 42, 68, 0.5);      /* --blue-yonder with alpha */
    --glass-blur: blur(10px);
}

/* --- Reset & Base --- */
* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
    scroll-behavior: smooth;
}

body {
    background-color: var(--primary-color);
    color: var(--text-color);
    line-height: 1.6;
    position: relative;
    isolation: isolate; 
    overflow-x: hidden;
}

/* 
   --- CORE ATMOSPHERIC ENGINE (3-Layer System) ---
   1. `body::before` (z:-3): NEW "Organic Wave" made of soft, overlapping radial gradients.
   2. `body::after` (z:-2):  NEW "Colorized Noise" using a CSS mask for a subtle, themed texture.
   3. `.background-blobs` (z:-1): Nebulae with balanced presence, blending with the layers below.
*/

/* Layer 1: The Organic Wave (Re-engineered) */
body::before {
    content: '';
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -3;
    opacity: 0.7;
    /* Two large, overlapping radial gradients create a soft, cloud-like wave effect */
    background-image: 
        radial-gradient(ellipse 80% 80% at 20% 110%, var(--blue-yonder), transparent),
        radial-gradient(ellipse 60% 80% at 80% 120%, var(--lapis-lazuli), transparent);
    animation: organicWave 40s linear infinite alternate;
}

@keyframes organicWave {
    from { transform: translateX(-10%) translateY(-10%) scale(1.2); }
    to { transform: translateX(10%) translateY(5%) scale(1.2); }
}

/* Layer 2: The Colorized Noise Layer (Re-engineered) */
body::after {
    content: '';
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -2;
    /* A colorful gradient serves as the base for the noise */
    background: linear-gradient(180deg, var(--lapis-lazuli) 0%, var(--vivid-sky-blue) 100%);
    /* A grayscale noise texture is used as a MASK to reveal the color */
    mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.2" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)"/></svg>');
    mask-size: 50%;
    mask-composite: xor;
    opacity: 0.15; /* Subtle enough to add texture without being overpowering */
    animation: maskShimmer 30s linear infinite alternate;
}

@keyframes maskShimmer {
    from { mask-position: 0% 0%; }
    to { mask-position: 100% 100%; }
}

/* Layer 3: The Nebulae / Circles (Re-balanced) */
.background-blobs {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100vh;
    z-index: -1;
    mix-blend-mode: lighten; /* Blends beautifully with the complex background */
}

.background-blobs::before,
.background-blobs::after {
    content: '';
    position: absolute;
    width: 35vmax; height: 35vmax;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5; /* Balanced opacity for clear presence */
    animation: moveNebula 50s ease-in-out infinite alternate;
}

.background-blobs::before {
    background: radial-gradient(circle, var(--vivid-sky-blue) 0%, transparent 70%);
    top: -5vmax; left: -10vmax;
    animation-duration: 45s;
}

.background-blobs::after {
    background: radial-gradient(circle, var(--lapis-lazuli) 0%, transparent 70%);
    bottom: -10vmax; right: -5vmax;
    animation-duration: 55s;
    animation-direction: alternate-reverse;
}

@keyframes moveNebula {
    from { transform: translate(0, 0) rotate(0deg) scale(1); }
    to { transform: translate(15vmax, 20vmax) rotate(180deg) scale(1.3); }
}


/* --- UI Elements (Harmonized with the new palette) --- */
.container { max-width: 1100px; margin: auto; padding: 0 2rem; }

.main-header, .project-card, .main-footer {
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(136, 153, 181, 0.2); /* --slate-blue border */
}

.main-header {
    background: var(--secondary-color);
    padding: 1rem 0; position: fixed;
    width: 100%; top: 0; z-index: 1000;
}
.main-header .container, .main-nav ul { display: flex; align-items: center; }
.main-header .container { justify-content: space-between; }
.main-nav ul { list-style: none; }
.main-nav ul li { margin-left: 20px; }
.main-header .logo, .main-nav ul li a { text-decoration: none; }
.main-header .logo {
    font-size: clamp(1.2rem, 2vw, 1.8rem); font-weight: 700;
    background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.main-nav ul li a { color: var(--text-color); font-weight: 500; transition: color 0.3s ease; }
.main-nav ul li a:hover { color: var(--accent-color); }

#hero { padding-top: 120px; min-height: 90vh; display: flex; flex-direction: column; justify-content: center; }
#hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 800; margin-bottom: 1rem;
    background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
#hero h1 .cursor { display: inline-block; background-color: var(--accent-color); margin-left: 5px; width: 4px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
#hero h2 { font-size: clamp(1.2rem, 2vw, 1.8rem); color: var(--subtle-text-color); margin-bottom: 2rem; }
.social-links a { color: var(--text-color); text-decoration: none; margin-right: 20px; font-size: 1.5rem; transition: transform 0.3s ease, color 0.3s ease; }
.social-links a:hover { color: var(--accent-color); transform: translateY(-2px); }

section { padding: 6rem 0; }
.section-title {
    font-size: clamp(2rem, 4vw, 2.8rem); text-align: center; margin-bottom: 3rem; font-weight: 700;
    background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; }
.project-card {
    background: var(--card-bg-color);
    border-radius: 16px; padding: 1.5rem;
    box-shadow: inset 0 1px 1px 0 rgba(125, 249, 255, 0.05); /* --electric-blue shadow */
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
.project-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.25);
    border-color: rgba(125, 249, 255, 0.4); /* --electric-blue border */
}
.project-card h3 { color: var(--accent-color); margin-bottom: 0.5rem; font-size: 1.3rem; }
.project-card p { color: var(--subtle-text-color); margin-bottom: 1rem; font-size: 0.95rem; }
.project-links a { color: var(--text-color); font-weight: 500; text-decoration: none; margin-right: 15px; transition: color 0.3s ease; }
.project-links a:hover { color: var(--accent-color); }

#about p, #contact p { max-width: 800px; margin: auto; text-align: center; color: var(--subtle-text-color); }
#about p { font-size: 1.1rem; }
#contact .container { text-align: center; }
#contact p { font-size: 1.2rem; margin-bottom: 2rem; }
.contact-btn {
    display: inline-block; padding: 14px 28px;
    background: var(--accent-gradient);
    color: var(--midnight-blue);
    text-decoration: none; border-radius: 8px; font-weight: bold; font-size: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.contact-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 191, 255, 0.25); /* --vivid-sky-blue shadow */
}

.main-footer {
    text-align: center; padding: 2rem 0;
    background: var(--secondary-color);
    font-size: 0.9rem; color: var(--subtle-text-color);
}

section, .project-card { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
section.visible, .project-card.visible { opacity: 1; transform: translateY(0); }

@media(max-width: 768px) { .main-nav { display: none; } }