/**
 * Portfolio Website - Stylesheet
 * ==============================
 * Modern dark theme with glassmorphism effects
 * 
 * Table of Contents:
 *  1. CSS Variables
 *  2. Base Styles
 *  3. Cursor Trail
 *  4. Header & Navigation
 *  5. Hero Section
 *  6. Buttons
 *  7. Cards
 *  8. About Section
 *  9. Projects Section
 * 10. Favorites (Flip Cards)
 * 11. Technologies
 * 12. Timeline (Experience)
 * 13. Contact Section
 * 14. Animations
 * 15. Accessibility
 * 
 * @author Aashish Joshi
 */

/* =========================
   1. CSS Variables
   ========================= */

:root {
    --color-bg: #0b1021;
    --color-surface: #0f172a;
    --color-primary: #38bdf8;        /* Sky 400 */
    --color-secondary: #a855f7;      /* Purple 500 */
    --color-text-main: #e2e8f0;      /* Slate 200 */
    --color-text-muted: #9ca3af;     /* Gray 400 */
    --color-border: rgba(148, 163, 184, 0.18);
    --color-card-bg: rgba(15, 23, 42, 0.6);
    --hover-glow: rgba(56, 189, 248, 0.22);
}

/* Base and Tailwind setup */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-bg);
    background-image: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.08), transparent 25%), radial-gradient(circle at 80% 10%, rgba(168, 85, 247, 0.08), transparent 22%), linear-gradient(145deg, rgba(15, 23, 42, 0.8), rgba(11, 16, 33, 0.95));
    color: var(--color-text-main);
    overflow-x: hidden;
}

.container { width: 100%; margin-left: auto; margin-right: auto; padding-left: 1.5rem; padding-right: 1.5rem; }
@media (min-width: 640px) { .container { max-width: 640px; } }
@media (min-width: 768px) { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }

/* Cursor Trail */
#cursor-trail {
    position: fixed;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, var(--color-primary), transparent 60%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.1s ease-out;
}
body:hover #cursor-trail { opacity: 1; }

/* Global Hover Glow (excluding timeline items which have their own) */
.interactive-element:hover {
    box-shadow: 0 0 20px var(--hover-glow);
    border-color: var(--color-primary) !important;
}
.nav-link:hover, .social-link:hover, .project-link:hover, a:hover {
    text-shadow: 0 0 10px var(--hover-glow);
}

/* Header and Navigation */
#header { 
    background-color: transparent;
    border-bottom: 1px solid transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
#header.scrolled {
    background-color: rgba(11, 16, 33, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.nav-link { position: relative; color: var(--color-text-muted); font-weight: 600; letter-spacing: 0.01em; transition: color 0.3s ease; padding-bottom: 6px; }
.nav-link:hover { color: white; }
.nav-link::after { content: ''; position: absolute; width: 0; height: 2px; bottom: 0; left: 50%; transform: translateX(-50%); background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)); transition: width 0.3s ease; }
.nav-link.active::after, .nav-link:hover::after { width: 100%; }
#mobile-menu { background-color: rgba(11, 16, 33, 0.98); backdrop-filter: blur(10px); }
.mobile-nav-link { display: block; padding: 12px 24px; color: var(--color-text-muted); font-weight: 600; transition: background-color 0.3s ease, color 0.3s ease; }
.mobile-nav-link:hover { background-color: rgba(255, 255, 255, 0.04); color: white; }

/* Hero Section with Animated Background */
#home { position: relative; }
.stars, .twinkling { position: absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%; display:block; }
.stars { 
    background-color: #020617;
    background-image:
        radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, 0.8), transparent 55%),
        radial-gradient(1px 1px at 130px 80px, rgba(34, 211, 238, 0.5), transparent 60%),
        radial-gradient(2px 2px at 60px 140px, rgba(129, 140, 248, 0.4), transparent 60%);
    background-size: 200px 200px, 260px 260px, 320px 320px;
    z-index:-2;
    animation: drift-stars 120s linear infinite;
}
.twinkling{ 
    background-image:
        radial-gradient(1px 1px at 40px 60px, rgba(255, 255, 255, 0.4), transparent 60%),
        radial-gradient(1px 1px at 160px 20px, rgba(148, 163, 184, 0.35), transparent 65%);
    background-size: 180px 180px, 240px 240px;
    z-index:-1;
    animation: move-twink-back 90s linear infinite;
}
@keyframes drift-stars { 
    from { background-position: 0 0, 0 0, 0 0; }
    to { background-position: -400px -200px, 300px 300px, -250px 150px; }
}
@keyframes move-twink-back { 
    from { background-position: 0 0, 0 0; }
    to { background-position: 600px 200px, -400px 400px; }
}

.hero-text-shadow { text-shadow: 0 0 15px rgba(34, 211, 238, 0.3), 0 0 30px rgba(129, 140, 248, 0.2); }
.hero-name-gradient { background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.typing-text { border-right: 3px solid var(--color-primary); animation: blink 0.75s step-end infinite; display: inline-block; padding-right: 2px; white-space: nowrap; overflow: hidden; }
@keyframes blink { from, to { border-color: transparent; } 50% { border-color: var(--color-primary); } }
.hero-badges { display: inline-flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.9rem; border-radius: 9999px; background: linear-gradient(120deg, rgba(56, 189, 248, 0.15), rgba(168, 85, 247, 0.15)); color: var(--color-text-main); border: 1px solid var(--color-border); font-size: 0.9rem; }
.pill-ghost { background: rgba(255, 255, 255, 0.04); color: var(--color-text-muted); }
.hero-actions { align-items: center; }

/* Buttons */
.cta-button, .cta-button-secondary { display: inline-block; font-weight: 700; padding: 14px 30px; border-radius: 9999px; transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease; letter-spacing: 0.01em; }
.cta-button { background: linear-gradient(120deg, var(--color-primary), var(--color-secondary)); color: var(--color-bg); box-shadow: 0 15px 35px rgba(56, 189, 248, 0.28); }
.cta-button-secondary { border: 1px solid var(--color-border); color: var(--color-text-main); background: rgba(255, 255, 255, 0.02); }
.cta-button:hover, .cta-button-secondary:hover { transform: scale(1.05); }
.cta-button-secondary:hover { background: rgba(255, 255, 255, 0.06); color: white; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25); }

/* General Section Styling */
.section-title { text-align: center; font-size: 2.5rem; font-weight: 800; color: white; margin-bottom: 1rem; position: relative; padding-bottom: 0.75rem; letter-spacing: 0.01em; }
.section-title::after { content: ''; position: absolute; width: 80px; height: 3px; bottom: 0; left: 50%; transform: translateX(-50%); background: linear-gradient(120deg, var(--color-primary), var(--color-secondary)); border-radius: 999px; }
.section-subtitle { text-align: center; color: var(--color-text-muted); max-width: 720px; margin: 0 auto 3rem auto; line-height: 1.7; }

/* Card Styling */
.glass-card { 
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.005)), var(--color-card-bg);
    backdrop-filter: blur(12px); 
    border: 1px solid var(--color-border); 
    border-radius: 1rem; 
    padding: 2rem; 
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

/* About Section */
.about-card-container { 
    position: relative; 
    width: 100%; 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 1rem; 
}
.about-card { 
    padding: 1.5rem; 
    text-align: left; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: flex-start; 
    cursor: pointer; 
    position: relative; 
    gap: 0.4rem;
}
#frontend-card, #backend-card, #db-card { transform: none; }
.about-card-icon svg { color: var(--color-primary); margin-bottom: 0.4rem; width: 40px; height: 40px; }
.about-card-title { font-size: 1.1rem; font-weight: 700; color: white; }
.about-card-text { font-size: 0.95rem; color: var(--color-text-muted); }

/* GitHub Projects */
.project-card { display: flex; flex-direction: column; text-align: left; height: 100%; gap: 1rem; }
.project-card .card-content { flex-grow: 1; display: flex; flex-direction: column; gap: 0.75rem; }
.project-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.project-stats { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.65rem; background: rgba(255, 255, 255, 0.05); border-radius: 999px; color: var(--color-text-muted); font-weight: 600; }
.project-title { font-size: 1.2rem; font-weight: 700; color: white; line-height: 1.4; }
.project-description { font-size: 0.95rem; color: var(--color-text-muted); margin: 0.2rem 0 0.4rem; flex-grow: 1; line-height: 1.6; }
.project-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.project-language { padding: 0.4rem 0.75rem; border-radius: 999px; background: rgba(56, 189, 248, 0.12); border: 1px solid rgba(56, 189, 248, 0.35); color: var(--color-text-main); font-weight: 600; font-size: 0.9rem; }
.project-link { margin-top: 0.1rem; display: inline-flex; align-items: center; gap: 0.35rem; color: var(--color-primary); font-weight: 700; }
.project-link:hover { text-shadow: none; color: white; }

/* Favorites - Hover Cards */
#favorites .grid { max-width: 900px; margin: 0 auto; gap: 1.5rem; }
.flip-card-container { height: 200px !important; border-radius: 0.75rem; cursor: pointer; position: relative !important; overflow: hidden !important; border: 1px solid var(--color-border); }
.flip-card { position: relative !important; width: 100% !important; height: 100% !important; }
.flip-card-front { position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; z-index: 2 !important; }
.flip-card-front img { width: 100% !important; height: 100% !important; object-fit: cover !important; display: block !important; }
.flip-card-back { position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; z-index: 1 !important; background: var(--color-card-bg) !important; display: flex !important; flex-direction: column !important; justify-content: center !important; align-items: center !important; padding: 1.25rem !important; text-align: center !important; opacity: 0 !important; transition: opacity 0.4s ease !important; }
.flip-card-container:hover .flip-card-back { opacity: 1 !important; z-index: 3 !important; }
.hobby-title { font-size: 1.1rem; font-weight: 700; color: white; margin-bottom: 0.5rem;}
.hobby-text { color: var(--color-text-muted); font-size: 0.85rem; line-height: 1.5; }

/* Technologies Section */
.tech-title { font-size: 1.1rem; font-weight: 700; color: white; padding-bottom: 0.75rem; border-bottom: 1px solid var(--color-border); margin-bottom: 1rem; }

/* Experience Timeline */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    width: 3px;
    background-image: linear-gradient(to bottom, var(--color-primary), var(--color-secondary), var(--color-primary));
    border-radius: 3px;
}
.timeline-item {
    position: relative;
    width: 100%;
    padding: 2rem 0;
}
.timeline-marker {
    position: absolute;
    top: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--color-bg);
    border: 3px solid var(--color-primary);
    z-index: 1;
    transition: all 0.4s ease;
}
.timeline-content {
    position: relative;
    width: 45%;
}
.timeline-item:nth-child(odd) .timeline-content {
    left: 0;
    text-align: right;
}
.timeline-item:nth-child(even) .timeline-content {
    left: 55%;
    text-align: left;
}
.timeline-content.glass-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 0 25px var(--hover-glow), 0 0 50px var(--hover-glow);
}
.timeline-item:hover .timeline-marker {
    background-color: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary);
}
@media (max-width: 768px) {
    .timeline-line {
        left: 0.5rem;
    }
    .timeline-item .timeline-content {
        width: calc(100% - 2.5rem);
        left: 2.5rem !important;
        text-align: left !important;
    }
    .timeline-marker {
        left: 0.5rem;
    }
}

/* Contact Section */
.contact-input { width: 100%; background-color: rgba(30, 41, 59, 0.7); border: 1px solid var(--color-border); border-radius: 0.5rem; padding: 12px 16px; color: var(--color-text-main); transition: border-color 0.3s ease, box-shadow 0.3s ease; }
.contact-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--hover-glow); }
.form-response { font-weight: 500; padding: 12px 16px; border-radius: 0.5rem; display: none; }
.form-response.success { background-color: rgba(34, 211, 238, 0.1); color: var(--color-primary); display: block; }
.form-response.error { background-color: rgba(244, 63, 94, 0.1); color: #f43f5e; display: block; }
.social-link { color: var(--color-text-muted); transition: color 0.3s ease, transform 0.3s ease; }
.social-link:hover { color: var(--color-primary); transform: scale(1.1); }
.social-link svg { width: 1.5rem; height: 1.5rem; fill: currentColor; }

/* Animation */
.animated-section { 
    opacity: 0; 
    transform: translateY(40px); 
    transition: opacity 0.8s ease-out, transform 0.8s ease-out; 
    content-visibility: auto;
    contain: layout paint style;
    contain-intrinsic-size: 600px;
}
.animated-section.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
    #cursor-trail { display: none; }
    .animated-section { transition: none; transform: none; opacity: 1; }
    .stars, .twinkling { animation: none; }
    .flip-card { transition: none; }
}

