/* ============================================
   KHALIL BOUAFIA PORTFOLIO
   Developer-style theme with smooth animations
   ============================================ */

:root {
    --bg: #0a0a0a;
    --bg-alt: #111111;
    --bg-card: #161616;
    --bg-code: #1a1a1a;
    --border: #262626;
    --border-hover: #404040;
    --text: #fafafa;
    --text-dim: #a3a3a3;
    --text-muted: #525252;
    --accent: #22d3ee;
    --accent-dim: #06b6d4;
    --green: #4ade80;
    --yellow: #facc15;
    --red: #f87171;
    --purple: #c084fc;
    --orange: #fb923c;
    --pink: #f472b6;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }
}

/* ============================================
   CUSTOM CURSOR - Code Style
   ============================================ */
.cursor-dot {
    position: fixed;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease, opacity 0.2s ease;
}

/* Code bracket cursor < > */
.cursor-dot::before {
    content: '<';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
    transition: all 0.2s ease;
}

.cursor-dot::after {
    content: '>';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
    transition: all 0.2s ease;
}

.cursor-ring {
    position: fixed;
    width: 50px;
    height: 50px;
    border: 2px solid transparent;
    border-radius: 0;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%) rotate(45deg);
    transition: transform 0.2s ease-out, width 0.3s ease, height 0.3s ease, border-color 0.3s ease, border-radius 0.3s ease;
    background: linear-gradient(var(--bg), var(--bg)) padding-box,
                linear-gradient(135deg, var(--accent), var(--purple), var(--pink), var(--accent)) border-box;
    animation: cursorRotate 4s linear infinite;
}

@keyframes cursorRotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Cursor hover states */
.cursor-dot.hovering::before {
    content: '{';
    color: var(--purple);
    text-shadow: 0 0 15px var(--purple), 0 0 30px var(--purple);
    left: -10px;
}

.cursor-dot.hovering::after {
    content: '}';
    color: var(--purple);
    text-shadow: 0 0 15px var(--purple), 0 0 30px var(--purple);
    right: -10px;
}

.cursor-ring.hovering {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    animation: cursorPulse 1s ease-in-out infinite;
}

@keyframes cursorPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.7; }
}

.cursor-dot.clicking::before,
.cursor-dot.clicking::after {
    color: var(--green);
    text-shadow: 0 0 20px var(--green), 0 0 40px var(--green);
}

.cursor-ring.clicking {
    transform: translate(-50%, -50%) scale(0.8);
    border-radius: 50%;
}

/* Hide custom cursor on touch devices */
@media (hover: none) and (pointer: coarse) {
    .cursor-dot, .cursor-ring {
        display: none !important;
    }
}

/* ============================================
   BACKGROUND GRID + CODE EFFECTS
   ============================================ */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

/* Scanline effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.2), transparent);
    animation: scanLine 8s linear infinite;
    pointer-events: none;
    z-index: 999;
    opacity: 0.5;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--accent); }
    50% { box-shadow: 0 0 20px var(--accent), 0 0 30px var(--accent); }
}

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

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes slideRight {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes codeRain {
    0% { transform: translateY(-100%); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0; }
}

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

@keyframes borderGlow {
    0%, 100% { border-color: var(--accent); }
    50% { border-color: var(--purple); }
}

@keyframes textGlow {
    0%, 100% { text-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent); }
    50% { text-shadow: 0 0 15px var(--accent), 0 0 30px var(--accent), 0 0 45px var(--accent); }
}

@keyframes scanLine {
    0% { top: 0; }
    100% { top: 100%; }
}

/* ============================================
   NAVIGATION
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 16px 0;
    background: transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.scrolled {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 2px;
}

.logo::before {
    content: '~/';
    color: var(--green);
    margin-right: 4px;
}

.logo::after {
    content: '_';
    color: var(--accent);
    animation: blink 1s step-end infinite;
}

.logo-bracket { color: var(--accent); }
.logo-name { 
    color: var(--text);
    transition: color 0.3s ease;
}

.logo:hover .logo-name {
    color: var(--accent);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::before,
.nav-link.active::before {
    width: 60%;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent);
    background: rgba(34, 211, 238, 0.08);
}

.nav-slash {
    color: var(--text-muted);
    margin-right: 2px;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 101;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    min-height: 100vh;
    padding: 140px 24px 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
}

.terminal-line {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 0.2s forwards;
}

.terminal-line::before {
    content: '$ ';
    color: var(--green);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.hero-main {
    opacity: 0;
    animation: fadeInLeft 1s ease 0.4s forwards;
}

.hero-title {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.line-number {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 12px;
    padding: 4px 10px;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 4px;
}

.hero-name {
    font-size: clamp(48px, 9vw, 80px);
    font-weight: 700;
    color: var(--text);
    line-height: 1.05;
    margin-bottom: 20px;
    position: relative;
}

.hero-name .first-name {
    display: block;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-dim) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-name .last-name {
    display: block;
    background: linear-gradient(135deg, var(--accent), var(--purple), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: shimmer 3s ease infinite;
}

.blink {
    display: inline-block;
    width: 4px;
    height: 60px;
    background: var(--accent);
    margin-left: 8px;
    animation: blink 1s step-end infinite;
    vertical-align: bottom;
    box-shadow: 0 0 10px var(--accent);
}

.hero-role {
    margin-bottom: 12px;
}

.hero-role .comment {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--green);
}

.hero-tagline {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--purple);
    margin-bottom: 28px;
    padding-left: 16px;
    border-left: 3px solid var(--purple);
    animation: slideRight 0.6s ease 1s forwards;
}

.hero-desc {
    font-size: 18px;
    color: var(--text-dim);
    margin-bottom: 36px;
    line-height: 1.8;
    max-width: 520px;
}

.hero-desc .hl {
    color: var(--accent);
    font-weight: 600;
    position: relative;
}

.hero-cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-main {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

.btn-main:hover::before {
    left: 100%;
}

.btn-main:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 40px rgba(34, 211, 238, 0.4);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: transparent;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: all 0.4s ease;
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(34, 211, 238, 0.08);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.15);
}

/* Terminal Window */
.hero-terminal {
    opacity: 0;
    animation: fadeInRight 1s ease 0.6s forwards;
    perspective: 1000px;
}

.terminal-window {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 0 0 1px rgba(34, 211, 238, 0.1),
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(34, 211, 238, 0.05);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.terminal-window:hover {
    border-color: var(--accent);
    box-shadow: 
        0 0 0 1px rgba(34, 211, 238, 0.4),
        0 30px 70px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(34, 211, 238, 0.15);
    transform: rotateX(-2deg) rotateY(2deg) translateY(-10px);
}

.terminal-header {
    background: var(--bg-card);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.terminal-buttons {
    display: flex;
    gap: 8px;
}

.t-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.t-btn.close { background: var(--red); }
.t-btn.minimize { background: var(--yellow); }
.t-btn.maximize { background: var(--green); }

.terminal-window:hover .t-btn.close { box-shadow: 0 0 10px var(--red); }
.terminal-window:hover .t-btn.minimize { box-shadow: 0 0 10px var(--yellow); }
.terminal-window:hover .t-btn.maximize { box-shadow: 0 0 10px var(--green); }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.terminal-body {
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 2;
}

.t-line {
    color: var(--text);
    margin-bottom: 4px;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.t-line:nth-child(1) { animation-delay: 0.9s; }
.t-line:nth-child(2) { animation-delay: 1.1s; }
.t-line:nth-child(3) { animation-delay: 1.5s; }
.t-line:nth-child(4) { animation-delay: 1.7s; }
.t-line:nth-child(5) { animation-delay: 2.1s; }

.t-prompt {
    color: var(--green);
    margin-right: 8px;
}

.t-output {
    color: var(--text-dim);
    margin-bottom: 16px;
    white-space: pre;
    padding-left: 20px;
    border-left: 2px solid var(--border);
    margin-left: 4px;
}

.t-output .key { color: var(--purple); }
.t-output .string { color: var(--green); }
.t-output .bracket { color: var(--yellow); }

.t-green { color: var(--green); }

.t-cursor {
    display: inline-block;
    width: 10px;
    height: 18px;
    background: var(--accent);
    animation: blink 1s step-end infinite;
    vertical-align: middle;
    box-shadow: 0 0 8px var(--accent);
}

/* Code snippet floating decoration */
.code-float {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.15;
    pointer-events: none;
    white-space: pre;
    line-height: 1.4;
}

/* Hero Social Links */
.hero-links {
    display: flex;
    gap: 14px;
    margin-top: 50px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 1s forwards;
}

.hero-links a {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.hero-links a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: translateY(100%);
    transition: transform 0.4s ease;
    z-index: -1;
}

.hero-links a:hover::before {
    transform: translateY(0);
}

.hero-links a:hover {
    color: var(--bg);
    border-color: var(--accent);
    transform: translateY(-6px) scale(1.1);
    box-shadow: 0 10px 25px rgba(34, 211, 238, 0.3);
}

/* ============================================
   SECTION STYLES
   ============================================ */
.section-head {
    margin-bottom: 60px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-head.visible {
    opacity: 1;
    transform: translateY(0);
}

.head-tag {
    font-family: var(--font-mono);
    font-size: 32px;
    color: var(--text-muted);
    font-weight: 400;
    position: relative;
    display: inline-block;
}

.head-tag::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 2px;
}

.head-tag.close {
    display: block;
    margin-top: 80px;
    font-size: 22px;
}

.head-tag.close::after {
    display: none;
}

.head-sub {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--green);
    margin-left: 20px;
    font-weight: 400;
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about {
    padding: 140px 0;
    position: relative;
}

.about-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 100px;
}

.about-text {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-text.visible {
    opacity: 1;
    transform: translateX(0);
}

.about-text p {
    color: var(--text-dim);
    font-size: 17px;
    margin-bottom: 24px;
    line-height: 1.9;
}

.about-text p:first-child::first-letter {
    font-size: 56px;
    font-weight: 700;
    color: var(--accent);
    float: left;
    line-height: 1;
    margin-right: 14px;
    margin-top: 6px;
    text-shadow: 0 0 30px rgba(34, 211, 238, 0.5);
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 50px;
    padding-top: 50px;
    border-top: 1px solid var(--border);
}

.stat-item {
    text-align: center;
    padding: 28px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.stat-item:hover::before {
    transform: scaleX(1);
}

.stat-item:hover {
    border-color: var(--accent);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(34, 211, 238, 0.15);
}

.stat-num {
    display: block;
    font-family: var(--font-mono);
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGlow 3s ease-in-out infinite;
}

.stat-text {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 8px;
}

.about-tech {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

.about-tech.visible {
    opacity: 1;
    transform: translateX(0);
}

.about-tech h3 {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-weight: 400;
}

.about-tech h3::before {
    content: '// ';
    color: var(--green);
}

.tech-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tech-tag {
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.tech-tag::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(192, 132, 252, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tech-tag:hover::before {
    opacity: 1;
}

.tech-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(34, 211, 238, 0.15);
    animation: borderGlow 1.5s ease-in-out infinite;
}

/* ============================================
   WORK / PROJECTS SECTION
   ============================================ */
.work {
    padding: 140px 0;
    background: var(--bg-alt);
    position: relative;
}

.work::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 80px;
    background: linear-gradient(to bottom, transparent, var(--accent));
    transform: translateX(-50%);
}

/* Project Card */
.project {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 80px;
    margin-bottom: 120px;
    align-items: center;
    opacity: 0;
    transform: translateY(60px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.project.visible {
    opacity: 1;
    transform: translateY(0);
}

.project.reverse {
    grid-template-columns: 1fr 1.2fr;
}

.project.reverse .project-gallery {
    order: 2;
}

.project.reverse .project-info {
    order: 1;
}

/* Gallery */
.project-gallery {
    position: relative;
}

.gallery-main {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    aspect-ratio: 16/10;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(192, 132, 252, 0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    pointer-events: none;
}

.project:hover .gallery-main::before {
    opacity: 1;
}

.project:hover .gallery-main {
    border-color: var(--accent);
    box-shadow: 
        0 0 0 1px rgba(34, 211, 238, 0.3),
        0 30px 60px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(34, 211, 238, 0.1);
    transform: scale(1.03) rotateX(-1deg);
}

.gallery-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    opacity: 0;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-img.active {
    opacity: 1;
}

.project:hover .gallery-img.active {
    transform: scale(1.08);
}

.gallery-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.gallery-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: all 0.4s ease;
}

.gallery-dot:hover {
    border-color: var(--accent);
    transform: scale(1.2);
}

.gallery-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

/* Project Info */
.project-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--accent);
    display: inline-block;
    padding: 6px 14px;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 6px;
    margin-bottom: 16px;
}

.project-name {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
    transition: all 0.4s ease;
}

.project:hover .project-name {
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.project-desc {
    font-size: 16px;
    color: var(--text-dim);
    line-height: 1.9;
    margin-bottom: 28px;
}

.project-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
}

.project-stack span {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 8px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.project-stack span:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    padding: 14px 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateX(8px);
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.15);
}

.project-link i {
    transition: transform 0.4s ease;
}

.project-link:hover i {
    transform: translateX(6px);
}

/* Other Projects */
.other-projects {
    margin-top: 120px;
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.other-projects.visible {
    opacity: 1;
    transform: translateY(0);
}

.other-title {
    font-family: var(--font-mono);
    font-size: 22px;
    color: var(--text);
    margin-bottom: 48px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 14px;
}

.other-title::before {
    content: '>';
    color: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}

.other-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
    margin-left: 24px;
}

.other-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
}

.other-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.other-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--purple), var(--pink));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.other-card:hover::before {
    transform: scaleX(1);
}

.other-card:hover {
    border-color: var(--accent);
    transform: translateY(-10px);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 0 40px rgba(34, 211, 238, 0.1);
}

.other-icon {
    font-size: 32px;
    color: var(--accent);
    margin-bottom: 24px;
    transition: all 0.4s ease;
}

.other-card:hover .other-icon {
    transform: scale(1.15) rotate(5deg);
    text-shadow: 0 0 20px var(--accent);
}

.other-card h4 {
    font-size: 20px;
    color: var(--text);
    margin-bottom: 12px;
    transition: color 0.3s ease;
}

.other-card:hover h4 {
    color: var(--accent);
}

.other-card p {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 20px;
    line-height: 1.7;
}

.other-tech {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* ============================================
   CONTACT SECTION
   ============================================ */
.contact {
    padding: 140px 0;
}

.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 100px;
}

.contact-text {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-text.visible {
    opacity: 1;
    transform: translateX(0);
}

.contact-intro {
    font-size: 28px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 48px;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 48px;
}

.contact-method {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.contact-method::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), var(--purple));
    transform: scaleY(0);
    transition: transform 0.4s ease;
}

.contact-method:hover::before {
    transform: scaleY(1);
}

.contact-method:hover {
    border-color: var(--accent);
    transform: translateX(12px);
    background: rgba(34, 211, 238, 0.05);
    box-shadow: 0 15px 35px rgba(34, 211, 238, 0.1);
}

.contact-method i {
    font-size: 28px;
    color: var(--accent);
    width: 36px;
    text-align: center;
}

.method-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.method-value {
    display: block;
    color: var(--text);
    font-size: 17px;
    font-weight: 500;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.contact-links a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    text-decoration: none;
    padding: 12px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.4s ease;
}

.contact-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(34, 211, 238, 0.15);
}

/* Contact Form */
.contact-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px;
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

.contact-form.visible {
    opacity: 1;
    transform: translateX(0);
}

.form-row {
    margin-bottom: 28px;
}

.form-row input,
.form-row textarea {
    width: 100%;
    padding: 18px 24px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    transition: all 0.4s ease;
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.1);
}

.form-row input::placeholder,
.form-row textarea::placeholder {
    color: var(--text-muted);
}

.form-row textarea {
    resize: vertical;
    min-height: 160px;
}

.btn-submit {
    width: 100%;
    padding: 18px 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(34, 211, 238, 0.4);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    padding: 80px 0 50px;
    text-align: center;
    border-top: 1px solid var(--border);
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 32px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 22px;
    transition: all 0.4s ease;
}

.footer-links a:hover {
    color: var(--accent);
    transform: translateY(-5px);
    text-shadow: 0 0 15px var(--accent);
}

.footer p {
    font-size: 14px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.footer strong {
    color: var(--accent);
}

.footer-year {
    margin-top: 16px;
    font-size: 12px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet and below - no custom cursor */
@media (max-width: 1024px) {
    body {
        cursor: auto !important;
    }
    
    .cursor-dot, .cursor-ring {
        display: none !important;
    }
    
    a, button, input, textarea {
        cursor: pointer !important;
    }
}

@media (max-width: 900px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 60px;
    }
    
    .hero-terminal {
        order: 2;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
        gap: 60px;
    }
    
    .about-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* FIX: Force single column on all projects */
    .project,
    .project.reverse {
        display: flex !important;
        flex-direction: column !important;
        gap: 40px;
    }
    
    /* FIX: Reset order for reverse projects - image first, then info */
    .project .project-gallery,
    .project.reverse .project-gallery {
        order: 1 !important;
        width: 100% !important;
    }
    
    .project .project-info,
    .project.reverse .project-info {
        order: 2 !important;
        width: 100% !important;
    }
    
    .contact-wrapper {
        grid-template-columns: 1fr;
        gap: 60px;
    }
    
    .other-grid {
        grid-template-columns: 1fr;
    }
    
    /* Better image sizing for tablet */
    .gallery-main {
        aspect-ratio: 16/10;
        min-height: 280px;
    }
    
    .project-info {
        text-align: center;
    }
    
    .project-stack {
        justify-content: center;
    }
    
    .project-link {
        display: inline-flex;
    }
}

@media (max-width: 640px) {
    /* Navigation */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 24px;
        transition: right 0.4s ease;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-link {
        font-size: 18px;
        padding: 14px 24px;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    /* Hero Section */
    .hero {
        padding: 110px 20px 60px;
        min-height: auto;
    }
    
    .terminal-line {
        font-size: 12px;
        margin-bottom: 20px;
    }
    
    .hero-title {
        font-size: 12px;
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .line-number {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .hero-name {
        font-size: 36px;
        margin-bottom: 14px;
    }
    
    .blink {
        height: 36px;
        width: 3px;
    }
    
    .hero-role .comment {
        font-size: 14px;
    }
    
    .hero-tagline {
        font-size: 11px;
        margin-bottom: 20px;
        padding-left: 12px;
    }
    
    .hero-desc {
        font-size: 15px;
        line-height: 1.7;
        margin-bottom: 28px;
    }
    
    .hero-cta {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-main, .btn-ghost {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
        font-size: 13px;
    }
    
    /* Terminal */
    .terminal-window {
        border-radius: 12px;
    }
    
    .terminal-header {
        padding: 10px 14px;
    }
    
    .terminal-title {
        font-size: 10px;
    }
    
    .t-btn {
        width: 10px;
        height: 10px;
    }
    
    .terminal-body {
        padding: 14px;
        font-size: 11px;
        line-height: 1.8;
    }
    
    .t-output {
        padding-left: 10px;
        font-size: 10px;
        margin-bottom: 12px;
    }
    
    .t-cursor {
        width: 8px;
        height: 14px;
    }
    
    /* Hero links */
    .hero-links {
        margin-top: 30px;
        gap: 10px;
        justify-content: center;
    }
    
    .hero-links a {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    /* Section headers */
    .section-head {
        margin-bottom: 36px;
    }
    
    .head-tag {
        font-size: 22px;
    }
    
    .head-tag::after {
        width: 50px;
        height: 2px;
    }
    
    .head-tag.close {
        margin-top: 50px;
        font-size: 18px;
    }
    
    /* About Section */
    .about, .work, .contact {
        padding: 80px 0;
    }
    
    .about-text p {
        font-size: 15px;
        margin-bottom: 18px;
        line-height: 1.8;
    }
    
    .about-text p:first-child::first-letter {
        font-size: 42px;
        margin-right: 10px;
    }
    
    .about-stats {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-top: 36px;
        padding-top: 36px;
    }
    
    .stat-item {
        padding: 22px 16px;
        border-radius: 12px;
    }
    
    .stat-num {
        font-size: 36px;
    }
    
    .stat-text {
        font-size: 11px;
        letter-spacing: 1.5px;
    }
    
    .about-tech h3 {
        font-size: 13px;
        margin-bottom: 18px;
    }
    
    .tech-grid {
        gap: 8px;
    }
    
    .tech-tag {
        font-size: 11px;
        padding: 8px 14px;
    }
    
    /* ================================
       PROJECTS - MOBILE FIX
       ================================ */
    .work::before {
        height: 50px;
    }
    
    /* Force vertical stacking on ALL projects including reverse */
    .project,
    .project.reverse {
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 60px;
        gap: 24px;
    }
    
    .project .project-gallery,
    .project.reverse .project-gallery {
        order: 1 !important;
        width: 100% !important;
        margin-bottom: 0;
    }
    
    .project .project-info,
    .project.reverse .project-info {
        order: 2 !important;
        width: 100% !important;
    }
    
    .gallery-main {
        aspect-ratio: 16/10;
        min-height: 200px;
        border-radius: 12px;
    }
    
    .gallery-nav {
        margin-top: 14px;
        gap: 10px;
    }
    
    .gallery-dot {
        width: 12px;
        height: 12px;
    }
    
    /* Project Info - Mobile */
    .project-info {
        text-align: left;
        padding: 0 4px;
    }
    
    .project-label {
        font-size: 10px;
        padding: 5px 12px;
        letter-spacing: 2px;
        margin-bottom: 12px;
    }
    
    .project-name {
        font-size: 24px;
        margin-bottom: 14px;
        line-height: 1.2;
    }
    
    .project-desc {
        font-size: 14px;
        line-height: 1.75;
        margin-bottom: 20px;
        color: var(--text-dim);
    }
    
    .project-stack {
        gap: 8px;
        margin-bottom: 22px;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .project-stack span {
        font-size: 10px;
        padding: 6px 12px;
        border-radius: 5px;
    }
    
    .project-link {
        font-size: 13px;
        padding: 12px 20px;
        border-radius: 8px;
        width: 100%;
        justify-content: center;
    }
    
    /* Other Projects Grid */
    .other-projects {
        margin-top: 60px;
    }
    
    .other-title {
        font-size: 18px;
        margin-bottom: 28px;
    }
    
    .other-grid {
        gap: 16px;
    }
    
    .other-card {
        padding: 22px 18px;
        border-radius: 12px;
    }
    
    .other-icon {
        font-size: 26px;
        margin-bottom: 16px;
    }
    
    .other-card h4 {
        font-size: 17px;
        margin-bottom: 10px;
    }
    
    .other-card p {
        font-size: 13px;
        margin-bottom: 14px;
        line-height: 1.6;
    }
    
    .other-tech {
        font-size: 10px;
    }
    
    /* Contact Section */
    .contact-intro {
        font-size: 20px;
        margin-bottom: 32px;
        line-height: 1.5;
    }
    
    .contact-methods {
        gap: 14px;
        margin-bottom: 32px;
    }
    
    .contact-method {
        padding: 18px 16px;
        gap: 14px;
        border-radius: 12px;
    }
    
    .contact-method i {
        font-size: 22px;
        width: 28px;
    }
    
    .method-label {
        font-size: 10px;
        letter-spacing: 1.5px;
    }
    
    .method-value {
        font-size: 14px;
    }
    
    .contact-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .contact-links a {
        width: 100%;
        justify-content: center;
        padding: 14px 18px;
        font-size: 13px;
    }
    
    /* Contact Form */
    .contact-form {
        padding: 28px 20px;
        border-radius: 16px;
    }
    
    .form-row {
        margin-bottom: 20px;
    }
    
    .form-row input,
    .form-row textarea {
        padding: 14px 18px;
        font-size: 15px;
        border-radius: 10px;
    }
    
    .form-row textarea {
        min-height: 130px;
    }
    
    .btn-submit {
        padding: 16px 24px;
        font-size: 14px;
        border-radius: 10px;
    }
    
    /* Footer */
    .footer {
        padding: 50px 0 40px;
    }
    
    .footer-links {
        gap: 18px;
        margin-bottom: 24px;
    }
    
    .footer-links a {
        font-size: 20px;
    }
    
    .footer p {
        font-size: 13px;
    }
    
    .footer-year {
        font-size: 11px;
        margin-top: 12px;
    }
}

/* Extra small devices */
@media (max-width: 380px) {
    .hero-name {
        font-size: 28px;
    }
    
    .blink {
        height: 28px;
        width: 2px;
    }
    
    .hero-role .comment {
        font-size: 12px;
    }
    
    .hero-tagline {
        font-size: 10px;
    }
    
    .hero-desc {
        font-size: 14px;
    }
    
    .stat-num {
        font-size: 30px;
    }
    
    .stat-text {
        font-size: 10px;
    }
    
    .terminal-body {
        padding: 10px;
        font-size: 9px;
    }
    
    .t-output {
        font-size: 8px;
        padding-left: 8px;
    }
    
    .project-name {
        font-size: 22px;
    }
    
    .project-desc {
        font-size: 13px;
    }
    
    .gallery-main {
        min-height: 180px;
    }
    
    .head-tag {
        font-size: 20px;
    }
    
    .other-card h4 {
        font-size: 16px;
    }
    
    .contact-intro {
        font-size: 18px;
    }
}
