/* ===================================
   Hamdi Bougattaya Portfolio
   Retro Futurism Design System
   =================================== */

/* CSS Variables */
:root {
    /* Neon Colors */
    --retro-neon-blue: #0080FF;
    --retro-hot-pink: #FF006E;
    --retro-cyan: #00FFFF;
    --retro-deep-black: #1A1A2E;
    --retro-purple: #5D34D0;

    /* Backgrounds */
    --retro-bg-dark: #0D0D1A;
    --retro-bg-card: #15152A;
    --retro-text-primary: #E0E0FF;
    --retro-text-secondary: #9CA3AF;

    /* Glow Effects */
    --retro-glow-blue: 0 0 10px rgba(0, 128, 255, 0.7), 0 0 20px rgba(0, 128, 255, 0.5);
    --retro-glow-pink: 0 0 10px rgba(255, 0, 110, 0.7), 0 0 20px rgba(255, 0, 110, 0.5);
    --retro-glow-cyan: 0 0 10px rgba(0, 255, 255, 0.7), 0 0 20px rgba(0, 255, 255, 0.5);
    --retro-glow-purple: 0 0 10px rgba(93, 52, 208, 0.7), 0 0 20px rgba(93, 52, 208, 0.5);

    /* Animation */
    --retro-transition-fast: 150ms ease-out;
    --retro-transition-medium: 200ms ease-out;
    --retro-transition-slow: 300ms ease-out;
}

/* Base Styles */
html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* ===================================
   CRT Effects & Overlays
   =================================== */

/* CRT Scanlines Overlay */
.retro-scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 3px
    );
}

.retro-scanlines::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0, 0, 0, 0.1) 51%
    );
    background-size: 100% 4px;
}

/* Vignette Effect */
.retro-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
}

/* Geometric Grid Background */
.retro-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 0, 110, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 110, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(500px) rotateX(60deg);
    transform-origin: center top;
    opacity: 0.5;
}

/* ===================================
   Neon Text Effects
   =================================== */

.retro-neon-text-cyan {
    color: var(--retro-cyan);
    text-shadow:
        0 0 5px var(--retro-cyan),
        0 0 10px var(--retro-cyan),
        0 0 20px var(--retro-cyan),
        0 0 40px var(--retro-cyan);
}

.retro-neon-text-pink {
    color: var(--retro-hot-pink);
    text-shadow:
        0 0 5px var(--retro-hot-pink),
        0 0 10px var(--retro-hot-pink),
        0 0 20px var(--retro-hot-pink),
        0 0 40px var(--retro-hot-pink);
}

.retro-neon-text-blue {
    color: var(--retro-neon-blue);
    text-shadow:
        0 0 5px var(--retro-neon-blue),
        0 0 10px var(--retro-neon-blue),
        0 0 20px var(--retro-neon-blue);
}

.retro-neon-text-purple {
    color: var(--retro-purple);
    text-shadow:
        0 0 5px var(--retro-purple),
        0 0 10px var(--retro-purple),
        0 0 20px var(--retro-purple);
}

/* ===================================
   Retro Futurism Components
   =================================== */

/* Retro Card */
.retro-card {
    background: var(--retro-bg-card);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.1), inset 0 0 20px rgba(0, 0, 0, 0.3);
    transition: all var(--retro-transition-medium);
    position: relative;
    overflow: hidden;
}

.retro-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(0, 255, 255, 0.05) 50%, transparent 60%);
    background-size: 200% 200%;
    transition: background-position var(--retro-transition-slow);
    pointer-events: none;
}

.retro-card:hover {
    border-color: var(--retro-cyan);
    box-shadow: var(--retro-glow-cyan), inset 0 0 30px rgba(0, 255, 255, 0.05);
    transform: translateY(-2px);
}

.retro-card:hover::before {
    background-position: 100% 100%;
}

.retro-card-highlight {
    border-color: var(--retro-hot-pink);
    box-shadow: var(--retro-glow-pink), inset 0 0 30px rgba(255, 0, 110, 0.1);
    background: linear-gradient(135deg, var(--retro-bg-card) 0%, rgba(255, 0, 110, 0.1) 100%);
}

/* Retro Portrait */
.retro-portrait {
    width: 300px;
    height: 380px;
    border-radius: 20px;
    border: 3px solid var(--retro-hot-pink);
    box-shadow: var(--retro-glow-pink), 0 0 40px rgba(255, 0, 110, 0.3);
    overflow: hidden;
    position: relative;
}

.retro-portrait::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(255, 0, 110, 0.2) 100%);
    pointer-events: none;
}

@media (min-width: 768px) {
    .retro-portrait {
        width: 350px;
        height: 450px;
    }
}

/* Retro Avatar */
.retro-avatar {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 3px solid var(--retro-cyan);
    box-shadow: var(--retro-glow-cyan), 0 0 30px rgba(0, 255, 255, 0.3);
    overflow: hidden;
    background: var(--retro-bg-card);
    position: relative;
}

.retro-avatar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0, 255, 255, 0.2) 100%);
    pointer-events: none;
}

@media (min-width: 768px) {
    .retro-avatar {
        width: 320px;
        height: 320px;
    }
}

/* Retro Buttons */
.retro-button-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--retro-hot-pink) 0%, var(--retro-purple) 100%);
    color: white;
    font-weight: 600;
    border-radius: 12px;
    border: 2px solid transparent;
    box-shadow: var(--retro-glow-pink);
    cursor: pointer;
    transition: all var(--retro-transition-fast);
    position: relative;
    overflow: hidden;
}

.retro-button-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--retro-purple) 0%, var(--retro-hot-pink) 100%);
    opacity: 0;
    transition: opacity var(--retro-transition-fast);
}

.retro-button-primary:hover {
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.8), 0 0 40px rgba(255, 0, 110, 0.4);
    transform: translateY(-2px);
}

.retro-button-primary:hover::before {
    opacity: 1;
}

.retro-button-primary span,
.retro-button-primary svg {
    position: relative;
    z-index: 1;
}

.retro-button-primary:active {
    transform: scale(0.97);
}

.retro-button-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    color: var(--retro-cyan);
    font-weight: 600;
    border-radius: 12px;
    border: 2px solid var(--retro-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    cursor: pointer;
    transition: all var(--retro-transition-fast);
}

.retro-button-secondary:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: var(--retro-glow-cyan);
    transform: translateY(-2px);
}

.retro-button-secondary:active {
    transform: scale(0.97);
}

.retro-button-sm {
    padding: 8px;
    background: transparent;
    border-radius: 10px;
    border: 2px solid rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.1);
    cursor: pointer;
    transition: all var(--retro-transition-fast);
}

.retro-button-sm:hover {
    border-color: var(--retro-cyan);
    box-shadow: var(--retro-glow-cyan);
}

/* Retro Badge */
.retro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--retro-bg-card);
    color: var(--retro-text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 999px;
    border: 2px solid rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.1);
}

.retro-badge-sm {
    padding: 6px 12px;
    background: rgba(0, 255, 255, 0.1);
    color: var(--retro-cyan);
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    border: 2px solid rgba(0, 255, 255, 0.3);
}

.retro-badge-accent {
    padding: 4px 12px;
    background: var(--retro-hot-pink);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    border: none;
    box-shadow: var(--retro-glow-pink);
}

/* Retro Pill */
.retro-pill {
    display: inline-block;
    padding: 8px 16px;
    background: transparent;
    color: var(--retro-text-secondary);
    font-size: 16px;
    font-weight: 500;
    border-radius: 12px;
    border: 2px solid rgba(0, 255, 255, 0.2);
    transition: all var(--retro-transition-fast);
}

.retro-pill:hover {
    border-color: var(--retro-cyan);
    color: var(--retro-cyan);
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ===================================
   Navigation
   =================================== */

.nav-link {
    color: var(--retro-text-secondary);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 10px;
    transition: all var(--retro-transition-fast);
}

.nav-link:hover {
    color: var(--retro-cyan);
    background: rgba(0, 255, 255, 0.1);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.nav-link.active {
    color: var(--retro-cyan);
    background: rgba(0, 255, 255, 0.1);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.mobile-nav-link {
    font-family: 'VT323', monospace;
    font-size: 28px;
    font-weight: 400;
    color: var(--retro-text-primary);
    padding: 12px 24px;
    border-radius: 12px;
    transition: all var(--retro-transition-fast);
}

.mobile-nav-link:hover {
    color: var(--retro-cyan);
    background: rgba(0, 255, 255, 0.1);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* ===================================
   Section Title
   =================================== */

.section-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--retro-hot-pink) 0%, var(--retro-cyan) 50%, var(--retro-purple) 100%);
    margin: 16px auto 0;
    box-shadow: var(--retro-glow-cyan);
}

/* ===================================
   Timeline
   =================================== */

.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--retro-hot-pink) 0%, var(--retro-cyan) 50%, var(--retro-purple) 100%);
    box-shadow: var(--retro-glow-cyan);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-node {
    position: absolute;
    left: -33px;
    top: 24px;
    width: 20px;
    height: 20px;
    background: var(--retro-bg-card);
    border: 3px solid var(--retro-cyan);
    border-radius: 50%;
    box-shadow: var(--retro-glow-cyan), 0 0 0 4px var(--retro-bg-dark);
    z-index: 1;
    transition: all var(--retro-transition-fast);
}

.timeline-item:hover .timeline-node {
    background: var(--retro-hot-pink);
    border-color: var(--retro-hot-pink);
    box-shadow: var(--retro-glow-pink), 0 0 0 4px var(--retro-bg-dark);
    transform: scale(1.2);
}

.timeline-content {
    padding-left: 16px;
}

/* ===================================
   Project Cards
   =================================== */

.project-card {
    padding: 16px;
    background: rgba(0, 255, 255, 0.05);
    border: 2px solid rgba(0, 255, 255, 0.2);
    border-radius: 12px;
    margin-top: 12px;
}

.tech-tag {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 255, 255, 0.1);
    color: var(--retro-cyan);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    transition: all var(--retro-transition-fast);
}

.tech-tag:hover {
    background: var(--retro-cyan);
    color: var(--retro-bg-dark);
    box-shadow: var(--retro-glow-cyan);
}

/* ===================================
   Bento Grid
   =================================== */

.bento-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .bento-large {
        grid-column: span 2;
        grid-row: span 2;
    }

    .bento-medium {
        grid-column: span 1;
        grid-row: span 2;
    }
}

@media (max-width: 767px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-large,
    .bento-medium {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* ===================================
   Skills
   =================================== */

.skill-tag {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(0, 255, 255, 0.1);
    color: var(--retro-text-primary);
    font-size: 16px;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.2);
    transition: all var(--retro-transition-fast);
    cursor: default;
}

.skill-tag:hover {
    border-color: var(--retro-cyan);
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

.skill-tag-ai {
    display: inline-block;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(255, 0, 110, 0.2) 0%, rgba(93, 52, 208, 0.2) 100%);
    color: var(--retro-hot-pink);
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--retro-hot-pink);
    transition: all var(--retro-transition-fast);
    cursor: default;
}

.skill-tag-ai:hover {
    background: var(--retro-hot-pink);
    color: white;
    box-shadow: var(--retro-glow-pink);
    transform: translateY(-2px);
}

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

@keyframes retro-glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes retro-glitch-skew {
    0% { transform: skew(0deg); }
    20% { transform: skew(2deg); }
    40% { transform: skew(-1deg); }
    60% { transform: skew(1deg); }
    80% { transform: skew(-2deg); }
    100% { transform: skew(0deg); }
}

@keyframes retro-flicker {
    0%, 100% { opacity: 1; }
    41.99% { opacity: 1; }
    42% { opacity: 0.8; }
    43% { opacity: 1; }
    45.99% { opacity: 1; }
    46% { opacity: 0.9; }
    47% { opacity: 1; }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDelay {
    0%, 30% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceSlow {
    0%, 100% {
        transform: translateY(0) translateX(-50%);
    }
    50% {
        transform: translateY(10px) translateX(-50%);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-fade-in-delay {
    animation: fadeInDelay 1.2s ease-out forwards;
}

.animate-slide-down {
    animation: slideDown 0.6s ease-out forwards;
}

.animate-bounce-slow {
    animation: bounceSlow 2s ease-in-out infinite;
}

/* Scroll Reveal */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    transition-delay: var(--delay, 0s);
}

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

/* ===================================
   Reduced Motion
   =================================== */

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

    .scroll-reveal {
        opacity: 1;
        transform: none;
    }

    .retro-scanlines,
    .retro-vignette {
        animation: none;
    }

    @keyframes retro-glitch {
        0%, 100% { transform: translate(0); }
    }
}

/* ===================================
   Responsive Adjustments
   =================================== */

@media (max-width: 767px) {
    .section-title {
        font-size: 1.2rem;
    }

    .timeline {
        padding-left: 30px;
    }

    .timeline::before {
        left: 10px;
    }

    .timeline-node {
        left: -28px;
        width: 16px;
        height: 16px;
    }

    .retro-button-primary,
    .retro-button-secondary {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Focus States for Accessibility */
a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--retro-cyan);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

/* Print Styles */
@media print {
    .retro-scanlines,
    .retro-vignette,
    nav,
    .animate-bounce-slow {
        display: none;
    }

    .retro-card {
        box-shadow: none;
        border: 1px solid var(--retro-cyan);
    }
}
