/* ========================================
   CSS Variables
   ======================================== */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --text-color: #ffffff;
    --bg-dark: #000000;
    --bg-glass: rgba(0, 0, 0, 0.3);
    --bg-card: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
    --transition-speed: 0.3s;
    --max-width: 1200px;
}

/* Dark theme (default) */
:root {
    --bg-dark: #000000;
    --text-color: #ffffff;
    --bg-glass: rgba(0, 0, 0, 0.3);
    --bg-card: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
}

/* Light theme variables */
:root.light-theme {
    --bg-dark: #ffffff;
    --text-color: #1a1a1a;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --bg-card: rgba(0, 0, 0, 0.05);
    --border-color: rgba(0, 0, 0, 0.1);
}

/* ========================================
   Reset & Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
    background: var(--bg-dark);
    color: var(--text-color);
    line-height: 1.6;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   3D Canvas Container
   ======================================== */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* ========================================
   Content Wrapper
   ======================================== */
.content {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* ========================================
   Header & Navigation
   ======================================== */
header {
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    background: var(--bg-glass);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--transition-speed);
}

/* ======= Center logo with image and text ======= */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* logo wrapper */
header .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px; /* espace bin logo w text */
  font-size: 1.8rem;
  font-weight: bold;
  margin-bottom: 0.8rem;
  background: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
  transition: transform var(--transition-speed);
}

/* logo image style */
header .logo img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

header .logo:hover img {
  transform: scale(1.1);
}

/* nav centered below logo */
header nav {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}


.logo {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    transition: transform var(--transition-speed);
}

.logo:hover {
    transform: scale(1.05);
}

nav {
    display: flex;
    gap: 2rem;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    transition: all var(--transition-speed);
    position: relative;
    font-weight: 500;
    padding: 0.5rem 0;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transition: width var(--transition-speed);
}

nav a:hover::after,
nav a:focus::after {
    width: 100%;
}

nav a:hover,
nav a:focus {
    color: var(--primary-color);
    outline: none;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(20deg);
    }
}

.subtitle {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    margin-bottom: 2rem;
    opacity: 0.9;
    animation: fadeInUp 1s ease 0.2s both;
    font-weight: 300;
}

/* ========================================
   Buttons
   ======================================== */
.cta-button {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    background: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-color);
    cursor: pointer;
    transition: all var(--transition-speed);
    animation: fadeInUp 1s ease 0.4s both;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.cta-button:hover,
.cta-button:focus {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
    outline: none;
}

.cta-button:active {
    transform: translateY(-1px);
}

/* Add these styles to your existing CSS */
.button-loader {
    display: inline-block;
    position: relative;
    width: 20px;
    height: 20px;
    margin-left: 8px;
}

.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.cta-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   Sections
   ======================================== */
section {
    padding: 5rem 2rem;
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.2);
    margin: 2rem 0;
}

.section-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
    text-align: center;
    margin-bottom: 3rem;
    background: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ========================================
   About Section
   ======================================== */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    line-height: 1.8;
    font-size: 1.1rem;
}

.about-content p {
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.about-content p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Skills Section
   ======================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.skill-card {
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.skill-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    opacity: 0;
    transition: opacity var(--transition-speed);
    z-index: -1;
}

.skill-card:hover::before,
.skill-card:focus-within::before {
    opacity: 0.1;
}

.skill-card:hover,
.skill-card:focus-within {
    transform: translateY(-10px);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.skill-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: grayscale(0.3);
    transition: filter var(--transition-speed);
}

.skill-card:hover .skill-icon {
    filter: grayscale(0);
}

.skill-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.skill-card p {
    opacity: 0.8;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ========================================
   Projects Section
   ======================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.project-card {
    background: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed);
    display: flex;
    flex-direction: column;
}

.project-card:hover,
.project-card:focus-within {
    transform: translateY(-10px);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.3);
}

.project-image-wrapper {
    position: relative;
    height: 250px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed);
} 
.project-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.project-content > p {
    margin-bottom: 1rem;
    opacity: 0.85;
    line-height: 1.6;
    flex: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.tag {
    padding: 0.4rem 0.8rem;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(102, 126, 234, 0.3);
    transition: all var(--transition-speed);
}

.tag:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.5);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.project-image-wrapper:hover .project-overlay {
    opacity: 1;
}

.view-project-btn {
    padding: 0.8rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform var(--transition-speed);
}

.view-project-btn:hover {
    transform: scale(1.05);
}

/* ========================================
   Contact Section
   ======================================== */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-speed);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.error-message {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: block;
    min-height: 1.2em;
}

.form-group.error input,
.form-group.error textarea {
    border-color: #ff6b6b;
}

.form-group.success input,
.form-group.success textarea {
    border-color: #51cf66;
}

/* ========================================
   Footer
   ======================================== */
footer {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-links a {
    color: var(--text-color);
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover,
.social-links a:focus {
    color: var(--primary-color);
    transform: translateY(-3px);
    outline: none;
}

.social-links svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    header {
        padding: 1.5rem;
    }
    
    nav {
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    section {
        padding: 3rem 1.5rem;
    }
    
    .skills-grid,
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .hero {
        min-height: 80vh;
    }
    
    .cta-button {
        padding: 0.9rem 2rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    header {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .footer-content {
        gap: 1rem;
    }
}

/* ========================================
   Accessibility & Performance
   ======================================== */
@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;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    #canvas-container {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    header {
        position: static;
    }
}

/* Theme toggle button styles */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-speed);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
}

/* Show/hide icons based on theme */
.dark-theme .sun-icon,
.light-theme .moon-icon {
    display: block;
}

.dark-theme .moon-icon,
.light-theme .sun-icon {
    display: none;
}

/* Adjust background opacity for light theme */
.light-theme #canvas-container {
    opacity: 0.6;
}