/* CatHaxor Portfolio - Premium Dark Theme */
:root {
    /* Colors - Deep dark palette with electric cyan accents */
    --primary: #22d3ee;         /* Electric cyan */
    --primary-dark: #06b6d4;    /* Slightly darker cyan */
    --primary-light: #67e8f9;   /* Light cyan for gradients */
    
    --secondary: #818cf8;       /* Complementary purple-blue */
    --secondary-glow: rgba(99, 102, 241, 0.5);
    
    /* Base backgrounds - deep charcoal */
    --dark-bg: #0f172a;         /* Deepest near-black */
    --card-bg: #1e293b;         /* Card backgrounds */
    --nav-bg: rgba(15, 23, 42, 0.85);
    
    /* Text colors */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    /* Borders & separation */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(99, 102, 241, 0.4);
    
    /* Interactive states */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --gradient-hover: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 40px rgba(34, 211, 238, 0.15);
    
    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Root padding variables - used throughout page */
    --pad-xs: clamp(0.375rem, calc((48rem - 60px) / 20), 0.5rem);
    --pad-sm: clamp(0.5rem, calc((48rem - 60px) / 16), 0.75rem);
    --pad-md: clamp(1rem, calc((48rem - 60px) / 12), 1.25rem);
    --pad-lg: clamp(1.5rem, calc((48rem - 60px) / 9.6), 1.75rem);
    
    /* Opacity adjustments */
    --nav-bg-opacity-adjust: 4px; /* Fixed fallback to prevent calc errors */
    --max-content-wid: var(--pad-lg);
    --primary-lightness: 60%;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    letter-spacing: -0.01em;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
}

.page-title {
    font-size: clamp(2rem, 5vw + 1rem, 3rem);
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-title {
    font-size: clamp(1.5rem, 3vw + 1rem, 2rem);
    color: var(--secondary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

a {
    color: inherit;
    text-decoration-color: var(--primary-dark);
    text-underline-offset: 3px;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--dark-bg);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    z-index: 9999;
}

.skip-link:focus {
    top: 1rem;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    padding: clamp(0.5rem, 1vw, 0.875rem) calc((100vw - 48rem) / 2);
    z-index: 1000;
}

.nav-container {
    max-width: 48rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: calc((48rem - 44px) / 2.5);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(1rem, 3vw + 0.25rem, 1.25rem);
    transition: opacity var(--transition-fast);
}

.logo:hover {
    opacity: 0.9;
}

.logo svg {
    flex-shrink: 0;
}

.logo-text {
    white-space: nowrap;
}

.accent-brand {
    color: var(--primary-light);
}

/* Navigation links */
.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    padding: calc((48rem - 44px) / 2) 0;
}

.nav-links a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: clamp(0.875rem, 1vw + 0.5rem, 1rem);
    position: relative;
    padding: 0.25rem 0;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.nav-links a:hover {
    color: var(--primary-light);
    text-decoration-color: var(--primary);
}

/* Underline animation on nav links */
.nav-links a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-normal);
    border-radius: var(--radius-full);
}

.nav-links a:hover::before {
    width: 100%;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: calc((48rem - 44px) / 2);
    cursor: pointer;
    flex-shrink: 0;
}

.hamburger {
    display: block;
    width: 24px;
    height: 16px;
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-secondary);
    transition: transform var(--transition-normal), opacity var(--transition-fast);
}

.hamburger::before {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger::after {
    top: 3px;
}

/* Main content */
.main-content {
    padding-top: 72px; /* Fixed after --nav-bg-opacity-adjust definition in :root */
    max-width: 48rem;
    margin: 0 auto;
    padding-left: var(--pad-sm);
    padding-right: var(--pad-sm);
}

/* Hero section */
.hero-section {
    display: grid;
    align-items: center;
    min-height: calc(100vh - 72px);
    gap: calc((48rem - 60px) / 3);
    position: relative;
    padding-bottom: 4rem;
}

.hero-container {
    display: grid;
    align-items: center;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.hero-content {
    max-width: clamp(30ch, 25vw + 15ch, 40ch);
}

.hero-greeting {
    color: var(--primary-light);
    font-size: clamp(1rem, 1.5vw + 0.75rem, 1.25rem);
    margin-bottom: var(--pad-md);
    display: block;
}

.hero-title {
    font-size: clamp(3rem, 8vw + 1rem, 6rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: var(--pad-md);
}

.name-accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: clamp(1rem, 1.5vw + 0.625rem, 1.125rem);
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 1.5rem;
}

/* Hero social links */
.hero-social {
    display: flex;
    gap: var(--pad-md);
    flex-wrap: wrap;
    margin-bottom: calc((48rem - 60px) / 2 + var(--pad-md));
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(42px, 6vw + 32px, 48px);
    height: clamp(42px, 6vw + 32px, 48px);
    background: var(--card-bg);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.social-link:hover {
    transform: translateY(-2px);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.social-link.github:hover,
.social-link.youtube:hover,
.social-link.instagram:hover {
    color: var(--text-primary);
}

/* Different hover states per platform */
.social-link.github:hover {
    background: rgba(30, 64, 175, 0.2);
}

.social-link.youtube:hover {
    background: rgba(255, 0, 0, 0.2);
}

.social-link.instagram:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-color: transparent;
}

.social-label {
    position: absolute;
    bottom: calc(100% + clamp(4px, 1.5vw, 8px));
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--dark-bg);
    padding: var(--pad-xs) var(--pad-sm);
    border-radius: var(--radius-full);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.social-link:hover .social-label {
    opacity: 1;
    transform: translateX(-50%) translateY(calc(-100% - clamp(2px, 1vw, 4px)));
}

/* Hero CTA buttons */
.hero-cta {
    display: flex;
    gap: var(--pad-md);
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: calc((48rem - 60px) / 4 + var(--pad-xs)) clamp(1.25rem, 3vw + 0.75rem, 1.5rem);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: clamp(0.875rem, 1vw + 0.5rem, 1rem);
    text-decoration: none;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
    min-width: clamp(90px, 20vw, 130px);
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--dark-bg);
    box-shadow: var(--shadow-md), 0 0 0 0 rgba(34, 211, 238, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--gradient-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

/* Hero visual - terminal window */
.hero-visual {
    display: flex;
    justify-content: center;
}

.terminal-window {
    width: clamp(320px, calc((100vw - 48rem) / 2 + 56px), 480px);
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.terminal-header {
    display: flex;
    align-items: center;
    padding: calc((48rem - 60px) / 2 + var(--pad-xs)) 1rem;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }

.terminal-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.terminal-body {
    padding: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.8rem, 0.6vw + 0.7rem, 0.9rem);
    line-height: 2;
    color: var(--primary-light);
    overflow-x: auto;
}

code {
    font-family: 'JetBrains Mono', monospace;
}

/* Hero decoration - subtle background */
.hero-decoration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.grid-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.4;
    background-image: 
        linear-gradient(var(--border-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: calc((48rem - 60px) / 32 + 2rem) calc((48rem - 60px) / 32 + 2rem);
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 100%);
}

.glow-orb {
    position: absolute;
    width: clamp(200px, 25vw, 300px);
    height: clamp(200px, 25vw, 300px);
    border-radius: 50%;
    filter: blur(calc((48rem - 60px) / 2 + 100px));
    opacity: 0.5;
}

.orb-1 {
    top: -clamp(100px, calc(25vw / 2), 150px);
    right: clamp(-40%, calc(48rem / 2), -15%);
    background: radial-gradient(circle, rgba(34, 211, 238, 0.15) 0%, transparent 70%);
}

.orb-2 {
    bottom: clamp(-100px, calc(25vw / 2), -150px);
    left: clamp(-40%, calc(48rem / 2), -15%);
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
}

/* Content sections */
.content-section {
    padding-top: calc((48rem - 60px) / 3 + var(--pad-md));
    padding-bottom: clamp(4rem, 5vw + 2rem, 6rem);
}

/* Cards */
.about-card,
.skill-category,
.project-card,
.journey-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: calc((48rem - 60px) / 2 + var(--pad-md));
    border: 1px solid var(--border-color);
    transition: box-shadow var(--transition-normal), border-color var(--transition-fast);
}

.about-card:hover,
.project-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* Section headings with icon */
.section-title::before {
    content: '⚡';
    font-size: 1.25em;
    color: var(--primary-light);
}

/* Projects grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(30ch, 1fr));
    gap: clamp(1rem, 1vw + 0.75rem, 1.5rem);
}

.project-card {
    position: relative;
    overflow: hidden;
}

/* Project content */
.loading-indicator {
    text-align: center;
    color: var(--text-secondary);
    padding: clamp(2rem, calc(48rem - 60px + 1.5rem), 3rem);
    font-style: italic;
}

/* Skills grid */
.skills-grid {
    display: grid;
    gap: var(--pad-md);
}

.skill-category {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 0.8vw + 0.75rem, 1.25rem);
}

.skill-category-title {
    font-size: clamp(1rem, 1vw + 0.625rem, 1.125rem);
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 0.8vw + 0.4rem, 1rem);
    font-weight: 600;
}

.skills-list {
    display: grid;
    gap: clamp(0.625rem, calc((48rem - 60px) / 3 + 0.75rem), 0.875rem);
}

.skill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(0.625rem, calc((48rem - 60px) / 3), 0.75rem) calc((48rem - 60px) / 3 + var(--pad-sm));
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.skill-item:hover {
    background: rgba(99, 102, 241, 0.08);
    transform: translateX(calc(var(--pad-xs)));
}

.skill-name {
    font-weight: 500;
}

.skill-level-badge {
    padding: calc((48rem - 60px) / 4 + var(--pad-xs)) calc((48rem - 60px) / 2 + var(--pad-sm));
    border-radius: var(--radius-full);
    font-size: clamp(0.625rem, 0.6vw + 0.4rem, 0.75rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.level-expert {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.level-advanced {
    background: var(--primary-dark);
    color: white;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Journey card */
.journey-text {
    font-size: clamp(1rem, 0.8vw + 0.75rem, 1.125rem);
    line-height: 1.7;
}

.journey-step {
    position: relative;
    padding-left: calc((48rem - 60px) / 3 + var(--pad-md));
}

.step-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(28px, calc((48rem - 60px) / 2.5 + 14px), 36px);
    height: clamp(28px, calc((48rem - 60px) / 2.5 + 14px), 36px);
    background: var(--primary-dark);
    color: white;
    border-radius: 50%;
    font-size: clamp(0.75rem, 0.8vw + 0.4rem, 0.9rem);
}

/* Contact section */
.contact-card {
    text-align: center;
    max-width: var(--max-content-wid, calc((48rem - 60px) / 2 + 30px));
    margin-left: auto;
    margin-right: auto;
}

.contact-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    color: var(--secondary);
    margin-bottom: calc((48rem - 60px) / 3 + var(--pad-md));
}

.contact-card p {
    max-width: clamp(var(--max-content-wid), 100%, 50ch);
    margin-right: auto;
    margin-left: auto;
    font-size: clamp(1rem, 0.8vw + 0.75rem, 1.125rem);
    line-height: 1.65;
}

.contact-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: calc((48rem - 60px) / 2 + var(--pad-md));
    flex-wrap: wrap;
    margin-bottom: calc((48rem - 60px) / 3 + var(--pad-md));
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--pad-sm);
    padding: calc((48rem - 60px) / 2 + var(--pad-xs)) calc((48rem - 60px) / 3 + var(--pad-md));
    border-radius: var(--radius-full);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-normal);
    min-width: clamp(14ch, 15vw + 8ch, 20ch);
}

.contact-btn.primary {
    background: var(--gradient-primary);
    color: var(--dark-bg);
}

.contact-btn.secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.contact-btn.primary:hover {
    background: var(--gradient-hover);
}

.content-links-bottom,
.content-links-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: calc((48rem - 60px) / 2 + var(--pad-md));
    flex-wrap: wrap;
}

/* Footer */
.portfolio-footer {
    margin-top: calc((48rem - 60px) / 2);
    padding-top: calc((48rem - 60px) / 3 + var(--pad-md));
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: clamp(0.75rem, 0.5vw + 0.5rem, 0.875rem);
}

/* Mobile menu */
@media (max-width: 992px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: var(--pad-md);
        gap: var(--pad-sm);
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links a {
        display: block;
        padding: var(--pad-sm) calc((48rem - 60px) / 2.5 + var(--pad-md));
        color: var(--text-primary);
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: var(--primary-dark);
        text-decoration-color: white;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.menu-open {
        overflow-y: visible;
    }
}

/* Tablet adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding-bottom: calc((48rem - 60px) / 3 + var(--pad-md));
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: clamp(1.5rem, calc((48rem - 60px) / 2), 2rem);
    }

    .terminal-window {
        width: 100%;
    }

    .hero-social {
        justify-content: center;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .about-card,
    .contact-card {
        padding: calc((48rem - 60px) / 2 + var(--pad-md));
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2.25rem, 8vw + 0.5rem, 3.5rem);
    }

    .btn {
        padding: calc((48rem - 60px) / 4 + var(--pad-xs)) clamp(1rem, 2vw + 0.5rem, 1.25rem);
    }

    .logo-text {
        display: none;
    }

    .social-link {
        width: 40px;
        height: 40px;
    }
}

/* Dark mode improvements (already dark by default) */
@media (prefers-color-scheme: light) {
    /* Fallback light mode - would require additional CSS for this */
    :root {
        brightness: 1.1;
        contrast: 0.95;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Print styles */
@media print {
    .navbar {
        display: none;
    }
    
    .btn {
        text-decoration: underline;
    }
}

/* Emergency visibility overrides - ensure hero content always visible */
.hero-visible, 
.hero-flex, 
.hero-zero-opacity-none {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

.hero-content {
    display: block !important;
    min-width: 0 !important; /* prevent flex-shrink from hiding */
}

/* Ensure ALL text is readable on dark backgrounds */
.hero-title, 
.hero-description, 
.hero-greeting, 
.name-accent {
    color: var(--text-primary) !important; /* Override any invisible colors */
    min-height: 1.2em !important; /* Prevent collapse */
}

/* Verify hero elements aren't hidden */
#hero-heading {
    min-width: auto !important;
}

/* Emergency text fallback */
.hero-section[style*="display:none"], 
.hero-content[style*="opacity:0"] {
    display: flex !important;
    opacity: 1 !important;
}


/* Utility classes removed - variables already defined in :root above */
