/* =========================================
   CSS Variables & Theme Settings
   - Defines a central color palette for easy updates.
   - Includes gradients, fonts, and box-shadows.
   - usage: var(--variable-name)
   ========================================= */
:root {
    /* Core Colors - Matching Logo Palette */
    --bg-color: #0a0a15;
    /* Dark blue/purple background matching logo */
    --bg-gradient: linear-gradient(135deg, #0a0a15 0%, #1a1a2e 100%);
    /* Background gradient matching logo */
    --text-color: #bcbcbc;
    /* Muted text color for body */

    /* Accents - Matching Logo Palette */
    --accent-color: #00f260;
    /* Primary accent green */
    --accent-gradient: linear-gradient(45deg, #00ffc3, #0575e6);
    /* Main gradient used on text/buttons - matches logo text */
    --logo-blue: #0575e6;
    /* Blue from logo */
    --logo-cyan: #00ffc3;
    /* Cyan from logo */

    /* Glassmorphism Variables */
    --secondary-bg: rgba(255, 255, 255, 0.3);
    /* Transparent white for cards */
    --glass-border: rgba(255, 255, 255, 0.0);
    /* Subtle border for glass effect */

    /* Typography & Effects */
    --font-main: 'Inter', sans-serif;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* =========================================
   Reset & Global Styles
   - Standard reset to remove default browser margins/padding.
   - Sets up box-sizing for predictable sizing.
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Includes padding/border in element's total width/height */
    scroll-behavior: smooth;
    /* Enables smooth scrolling for anchor links */
}

body {
    background: var(--bg-gradient);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow-x: hidden;
    /* Prevents horizontal scroll caused by animations/offsets */
    line-height: 1.6;
}

/* =========================================
   Vanta.js Background Container
   - Fixed position element to cover the entire viewport.
   - z-index: -1 places it behind all other content.
   - Vanta.js creates its own canvas inside this element.
   ========================================= */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 1;
}

/* Vanta.js canvas styling */
#bg-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* =========================================
   Header & Navigation
   - Fixed top bar with glassmorphism (backdrop-filter).
   - Flexbox used for layout (Logo left, Nav right).
   ========================================= */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;

    /* Initial State: Hidden/Transparent */
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid transparent;

    /* Animation */
    transition: all 0.4s ease;
    transform: translateY(-100%);
    /* Start hidden above viewport */
    opacity: 0;
}

.logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-left,
.header-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.social-icon {
    font-size: 1.2rem;
    color: #fff;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.social-icon:hover {
    color: var(--logo-cyan);
    transform: translateY(-3px);
    text-shadow: 0 0 10px rgba(0, 255, 195, 0.5);
    opacity: 1;
}

/* Scrolled State: Visible & Glassmorphism */
header.scrolled {
    transform: translateY(0);
    opacity: 1;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, rgba(10, 10, 21, 0.6) 0%, rgba(26, 26, 46, 0.6) 100%);
    /* Logo palette background with transparency */
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 50px;
    /* Slight shrink for sleekness */
}


nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

/* Navigation Links Hover Effect */
nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
}

/* Animated Underline */
nav a::after {
    content: '';
    position: absolute;
    width: 0;
    /* Starts invisible */
    height: 2px;
    bottom: -5px;
    left: 0;
    background: var(--accent-gradient);
    transition: width 0.3s;
    /* Smooth expansion */
}

nav a:hover::after {
    width: 100%;
    /* Expands to full width on hover */
}

section {
    min-height: 100vh;
    padding: 100px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* =========================================
   Hero Section
   ========================================= */
.hero {
    align-items: center;
    text-align: center;
    justify-content: flex-start;
    padding-top: 5vh;
}

.hero h1 {
    font-size: 6rem;
    margin-bottom: 20px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 
   Interactive Hero Letter Style
   - Letters fade in and react to mouse hover.
*/
.hero-letter {
    display: inline-block;
    /* Allows transform properties to work */
    opacity: 0;
    animation: letterFadeIn 0.6s ease-out forwards;
    /* 'forwards' keeps state after animation */
    transition: transform 0.2s ease, text-shadow 0.2s ease;
}

.hero-letter:hover {
    transform: scale(1.3) translateY(-10px);
    /* Pop up effect */
    text-shadow: 0 0 20px var(--accent-color), 0 0 40px var(--accent-color);
    /* Glow */
    cursor: default;
}

/* Initial Entry Animation for Letters */
@keyframes letterFadeIn {
    0% {
        opacity: 0;
        transform: translateY(30px) rotateX(-90deg);
        /* Starts below and rotated */
    }

    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
        /* Ends in normal position */
    }
}

.hero p {
    font-size: 1.5rem;
    color: #cccccc;
    max-width: 600px;
    margin-bottom: 40px;
    animation: fadeInUp 1s ease-out 0.3s backwards;
}

/* =========================================
   Buttons & UI Elements
   - Reusable button class with gradient background.
   ========================================= */
.btn {
    padding: 12px 30px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 50px;
    /* Pill shape */
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
    animation: fadeInUp 1s ease-out 0.6s backwards;
    /* Delayed entry */
}

.btn:hover {
    transform: translateY(-3px);
    /* Lift up */
    box-shadow: 0 10px 20px rgba(0, 242, 96, 0.3);
    /* Colored shadow */
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 60px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* =========================================
   Projects Grid
   - Uses CSS Grid for responsive layout.
   - Cards use glassmorphism and hover lift effects.
   ========================================= */
.projects-grid {
    display: grid;
    /* Auto-fit columns: at least 300px, but stretch to fill space */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.project-card {
    background: var(--secondary-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    transition: transform 0.3s, background 0.3s;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.project-card:hover {
    transform: translateY(-10px);
    /* Significant lift on hover */
    background: rgba(255, 255, 255, 0.1);
    /* Lighten background */
}

.project-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.tech-stack {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.tech-tag {
    font-size: 0.8rem;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

/* =========================================
   Contact Form
   ========================================= */
.contact-form {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-form input,
.contact-form textarea {
    padding: 15px;
    background: var(--secondary-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: #fff;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--accent-color);
}

/* =========================================
   Animations
   ========================================= */

/* Generic fade-in-up animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 
   Scroll Animation Classes 
   - 'hidden-scroll' is the initial state (invisible, lower down).
   - 'show-scroll' is added by JS to trigger the transition.
*/
.hidden-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.show-scroll {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   Hero Logo Container
   - Wraps both text and image logo options
   - Uses data-logo-type attribute for toggling
   - Supports graceful fallback on image load failure
   ========================================= */
.hero-logo-container {
    margin-bottom: 20px;
    position: relative;
}

/* Text Logo - Hidden by default, shown when image fails or data-logo-type="text" */
.hero-logo-text {
    font-size: 4rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: none;
    /* Hidden by default */
    margin: 0;
    letter-spacing: -0.02em;
}

/* Show text logo when container has data-logo-type="text" */
.hero-logo-container[data-logo-type="text"] .hero-logo-text {
    display: block;
}

/* Hide image logo when container has data-logo-type="text" */
.hero-logo-container[data-logo-type="text"] .hero-logo-img {
    display: none;
}

/* Image Logo - Visible by default */
.hero-logo-img {
    max-width: 600px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    transition: opacity 0.4s ease-out, filter 0.4s ease-out, transform 0.4s ease-out;
    will-change: opacity, filter, transform;
    image-rendering: auto;
}

/* =========================================
   Hero Logo Dissolve/Pixelate Effect
   - Triggered on scroll
   - Uses CSS filters for pixelation effect
   ========================================= */

.hero-logo-img.dissolving {
    opacity: 0;
    filter: blur(8px) contrast(150%) brightness(1.2);
    transform: scale(1.05);
    image-rendering: pixelated;
}

/* =========================================
   Media Queries (Responsive Design)
   ========================================= */
@media (max-width: 768px) {
    header {
        padding: 20px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    /* Responsive text logo */
    .hero-logo-text {
        font-size: 2.5rem;
    }

    /* Responsive image logo */
    .hero-logo-img {
        max-width: 100%;
    }

    nav ul {
        display: none;
        /* Mobile menu implementation usually goes here */
    }
}

#about p+p {
    margin-top: 20px;
}

/* =========================================
   About Values Grid
   ========================================= */
.about-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 60px auto 0;
    width: 100%;
}

.value-card {
    background: var(--secondary-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: transform 0.3s;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.value-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.value-card h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.value-card p {
    font-size: 0.95rem;
    color: #ddd;
    line-height: 1.5;
}

/* =========================================
   Featured Project Card (Custom)
   ========================================= */

#featured-project {
    position: relative;
    border: double 2px transparent;
    background-image: linear-gradient(var(--secondary-bg), var(--secondary-bg)), var(--accent-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 0 25px rgba(0, 242, 96, 0.15);
}

#featured-project:hover {
    box-shadow: 0 0 35px rgba(0, 242, 96, 0.3);
    transform: translateY(-12px) scale(1.02);
}

.featured-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent-gradient);
    color: #0a0a15;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* =========================================
   Card Preview Styles
   ========================================= */
/* =========================================
   Card Preview Styles
   ========================================= */
.project-card {
    position: relative;
    overflow: hidden;
    /* Ensure preview doesn't spill out */
    padding: 0;
    /* Remove padding so preview fills edges */
}

/* Container fills the card */
.card-preview-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Optional: Ensure background is dark if iframe loads slow */
    background: #000;
}

.card-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    pointer-events: none;
}

/* Overlay darkens the preview to make text readable */
.card-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    /* Dark overlay */
    z-index: 1;
    transition: background 0.3s;
}

.project-card:hover .card-preview-overlay {
    background: rgba(0, 0, 0, 0.2);
    /* Lighten on hover */
}

/* Content sits on top of preview */
.card-content {
    position: relative;
    z-index: 2;
    padding: 30px;
    /* Restore padding here */
    background: transparent;
    pointer-events: none;
    /* Let clicks pass through if needed, but buttons need events */
}

.card-content * {
    pointer-events: auto;
    /* Re-enable events for content elements */
}

/* Adjust badge positioning since parent padding is gone */
.featured-badge {
    top: 15px;
    right: 15px;
}