/* --- CSS Variables (Theming) --- */
:root {
    /* Fonts */
    --font-primary: 'Open Sans', sans-serif;
    --font-heading: 'Montserrat', sans-serif;
    --font-secondary: 'Roboto', sans-serif;
    --font-accent: 'Raleway', sans-serif;
    --font-display: 'Playfair Display', serif;

    /* Light Theme */
    --bg-color: #f8f9fa;
    --bg-color-secondary: #ffffff;
    --bg-color-alt: #f1f1f1;
    --text-color: #212529;
    --text-color-muted: #6c757d;
    --text-color-title: #343a40;
    --accent-color: #2563eb;
    --accent-color-dark: #1d4ed8;
    --hr-color: #dee2e6;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --focus-ring-color: #2563eb;
    --btn-primary-bg: #111827;
    --btn-primary-text: #ffffff;
    --btn-primary-hover-bg: #374151;
    --btn-secondary-border: #111827;
    --btn-secondary-text: #111827;
    --btn-secondary-hover-bg: #111827;
    --btn-secondary-hover-text: #ffffff;
    --footer-bg: #111111;
    --footer-text: #e0e0e0;
    --footer-text-muted: #757575;
}

html.dark:root {
    /* Dark Theme */
    --bg-color: #121212;
    --bg-color-secondary: #1e1e1e;
    --bg-color-alt: #1a1a1a;
    --text-color: #f1f1f1;
    --text-color-muted: #a0a0a0;
    --text-color-title: #ffffff;
    --accent-color: #3b82f6;
    --accent-color-dark: #60a5fa;
    --hr-color: #374151;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --focus-ring-color: #60a5fa;
    --btn-primary-bg: var(--accent-color);
    --btn-primary-text: #ffffff;
    --btn-primary-hover-bg: var(--accent-color-dark);
    --btn-secondary-border: #f1f1f1;
    --btn-secondary-text: #f1f1f1;
    --btn-secondary-hover-bg: #f1f1f1;
    --btn-secondary-hover-text: #121212;
    --footer-bg: #000000;
    --footer-text: #f1f1f1;
    --footer-text-muted: #888888;
}
/* --- End CSS Variables --- */


html {
    scroll-behavior: smooth;
    /* NEW: Make scrolling smooth *unless* the user prefers reduced motion.
      This is better for accessibility.
    */
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Global focus style for accessibility */
*:focus-visible {
    outline: 3px solid var(--focus-ring-color);
    outline-offset: 2px;
    border-radius: 4px;
}
/* Specific focus for cards */
.project-card:focus-visible, .skill-item:focus-visible, .service-card:focus-visible {
    transform: translateY(-8px);
    box-shadow: 0 0 0 3px var(--focus-ring-color), var(--card-shadow-hover);
    outline: none;
}


/* Fluid Typography (Already present, kept) */
h1, .text-5xl, .text-7xl {
    font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
}
h3, .text-3xl, .text-4xl {
    font-size: clamp(1.875rem, 3vw + 1rem, 2.25rem);
}
.info-p p, .about-info p, .info-pro p {
    font-size: clamp(1rem, 0.5vw + 0.8rem, 1.125rem);
}

/* NEW: Scroll Progress Bar */
#scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 5px;
    background: var(--accent-color);
    width: 0%; /* Controlled by JS */
    z-index: 100;
    transition: width 0.1s linear;
}

/* NEW: Animated Gradient for Titles */
.animated-gradient {
    background-size: 200% auto;
    animation: gradient-flow 5s ease-in-out infinite;
}
@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


/* Loading Screen (Unchanged) */
#loading-screen {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #000;
    display: flex; justify-content: center; align-items: center;
    flex-direction: column;
    z-index: 9999; overflow: hidden;
    color: #34d399;
    text-align: center;
    transition: opacity 0.5s ease;
}
#loading-screen.hide {
  opacity: 0;
  pointer-events: none;
}
.hidden { opacity: 0; transform: translateY(-200px); }
.fall { animation: fall 0.9s forwards; }
@keyframes fall {
    0% { opacity: 0; transform: translateY(-200px); }
    60% { opacity: 1; transform: translateY(20px); }
    100% { transform: translateY(0); }
}
.loading-content h1, .loading-content h2, .loading-content i { margin: 20px 0; }
.sub-icons { display: flex; justify-content: center; gap: 25px; margin-bottom: 20px; }
#main-page-wrapper { opacity: 0; transition: opacity 1s ease; }
#main-page-wrapper.visible { opacity: 1; }

/* Headers (Sticky) */
#desktop-header, .mobile-header {
    background-color: var(--bg-color-secondary);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.header-logo, .ul-list a, .mobile-nav-link {
    color: var(--text-color-title);
    transition: color 0.3s ease;
}
header.scrolled {
    background-color: var(--bg-color-secondary);
    box-shadow: var(--card-shadow);
}
.ul-list li.active a {
    color: var(--accent-color);
    font-weight: 600;
}
.ul-list li a:hover {
    color: var(--accent-color);
}

/* Mobile Menu (Unchanged) */
.mobile-menu-bg {
    background-color: var(--bg-color);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}
.mobile-menu-bg.menu-open {
    transform: translateX(0);
}

/* Dark Mode Switch Toggle (Unchanged) */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-color); }
input:focus + .slider { box-shadow: 0 0 1px var(--accent-color); }
input:checked + .slider:before { transform: translateX(26px); }

/* Text & Colors (Unchanged) */
.text-muted { color: var(--text-color-muted); }
.text-title { color: var(--text-color-title); }
.text-text { color: var(--text-color); }
.text-accent { color: var(--accent-color); }
.text-accent-dark { color: var(--accent-color-dark); }
.hr { border-color: var(--hr-color); }
.section-bg { background-color: var(--bg-color-alt); }
.available-badge { background-color: var(--bg-color-alt); }
.footer-bg { background-color: var(--footer-bg); color: var(--footer-text); }
.footer-copy { color: var(--footer-text-muted); }

/* Buttons & Links (Hover unchanged) */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}
.btn-primary {
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}
.btn-primary:hover {
    background-color: var(--btn-primary-hover-bg);
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}
.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--btn-secondary-border);
    color: var(--btn-secondary-text);
}
.btn-secondary:hover {
    background-color: var(--btn-secondary-hover-bg);
    color: var(--btn-secondary-hover-text);
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}
.btn-primary-outline {
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    font-size: 0.8rem; padding: 0.5rem 1rem;
    flex: 1;
}
.btn-primary-outline:hover { background-color: var(--accent-color); color: white; }
.btn-secondary-outline {
    background-color: #6c757d; color: white;
    border: 1px solid #6c757d;
    font-size: 0.8rem; padding: 0.5rem 1rem;
    flex: 1;
}
.btn-secondary-outline:hover { background-color: #5a6268; }

/* Social Icons (Unchanged) */
.social-icon-list a { color: var(--text-color); }
.social-icon:hover { color: var(--accent-color); }
.social-whatsapp:hover { color: #25D366; }
.social-linkedin:hover { color: #0A66C2; }
.social-instagram:hover { color: #E4405F; }

.social-link {
    width: 3rem; height: 3rem;
    background-color: var(--bg-color-alt);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-color-muted);
    font-size: 1.25rem;
    transition: all 0.3s ease;
}
.social-link:hover {
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    transform: translateY(-4px);
}
.social-link.social-linkedin:hover { background-color: #0A66C2; color: white; }
.social-link.social-whatsapp:hover { background-color: #25D366; color: white; }
.social-link.social-instagram:hover { background-color: #E4405F; color: white; }

/* NEW: IntersectionObserver Fade-in Animation.
  Replaces the old .reveal class logic.
*/
.fade-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}
.fade-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Typing Cursor (Unchanged) */
.cursor {
    display: inline-block;
    background-color: var(--text-color);
    margin-left: 0.1rem;
    width: 2px;
    animation: blink 1s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Back to Top Button */
#backToTop {
  position: fixed;
  bottom: 40px;
  right: 40px;
  font-size: 24px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: background-color 0.3s ease, opacity 0.3s, transform 0.3s;
  z-index: 1000;
  opacity: 0;
  transform: scale(0); /* NEW: Added scale for better transition */
}
#backToTop.visible {
    opacity: 1;
    transform: scale(1);
}
#backToTop.hidden {
    opacity: 0;
    transform: scale(0);
}
#backToTop:hover {
  background: var(--accent-color-dark);
  transform: scale(1.1);
}


/* Custom Skills Grid (Unchanged) */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
}
@media (min-width: 768px) { .skills-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .skills-grid { grid-template-columns: repeat(5, 1fr); } }
.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background-color: var(--bg-color-secondary);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    will-change: transform, box-shadow;
}
.skill-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-shadow-hover);
    background-color: var(--bg-color);
}

/* Project & Service Cards */
.project-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover; 
    border-radius: 0.5rem; 
    margin-bottom: 1rem; 
}
.project-card, .service-card {
    background-color: var(--bg-color-secondary);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    will-change: transform, box-shadow;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    text-align: left; /* NEW: Ensure cards are left-aligned */
}
.project-card:hover, .service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-shadow-hover);
}
.project-card {
    cursor: pointer; /* NEW: Indicate clickability for modal */
}
.service-card {
    padding: 2rem;
    text-align: center; /* Service cards can be centered */
}
.service-card .fa-solid, .service-card .fa-brands {
    transition: all 0.5s ease;
}
.service-card:hover .fa-solid, .service-card:hover .fa-brands {
    color: var(--accent-color-dark);
}
.tag {
    display: inline-block;
    background-color: var(--bg-color-alt);
    color: var(--accent-color-dark);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Project Search/Filter */
/* NEW: Replaced .project-filters with styles for search input */
#project-search-input {
    /* Use form-input styles already defined */
}

/* Project card hide animation */
.project-card {
    transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease, margin 0.4s, padding 0.4s;
    transform-origin: top;
    max-height: 1000px; /* arbitrary large value */
    overflow: hidden;
}
.project-card.hide {
    opacity: 0;
    transform: scale(0.95);
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border: 0;
}

/* NEW: Testimonials Section */
.testimonial-card {
    background-color: var(--bg-color-secondary);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.testimonial-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    border: 3px solid var(--accent-color);
}
.testimonial-quote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.125rem;
    color: var(--text-color-title);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}
.testimonial-quote::before {
    content: '“';
    font-size: 3rem;
    color: var(--accent-color);
    line-height: 0;
    margin-right: 0.5rem;
    vertical-align: -0.4em;
}
.testimonial-caption {
    display: flex;
    flex-direction: column;
}
.testimonial-name {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-color-title);
}
.testimonial-title {
    font-size: 0.875rem;
    color: var(--text-color-muted);
}


/* Contact Form (Unchanged) */
.form-bg { background-color: var(--bg-color-secondary); }
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--hr-color);
    border-radius: 8px;
    background-color: var(--bg-color-alt);
    color: var(--text-color);
    transition: all 0.2s ease;
}
.form-input::placeholder {
    color: var(--text-color-muted);
}
.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color);
}
.form-error {
    color: #ef4444; /* Red-500 */
    font-size: 0.875rem;
    margin-top: 0.25rem;
    min-height: 1.25rem; /* Prevents layout jump */
}
.form-input.input-error {
    border-color: #ef4444 !important;
}
.form-input.input-error:focus {
    box-shadow: 0 0 0 2px #ef4444;
}
.form-message {
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}
.form-message-success {
    background-color: #d1fae5;
    color: #065f46;
}
.form-message-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* NEW: Project Modal Styles */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.project-modal.hidden {
    display: none;
}
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    cursor: pointer;
    animation: fade-in 0.3s ease;
}
.modal-content-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    background-color: var(--bg-color-secondary);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3), 0 10px 10px -5px rgba(0,0,0,0.1);
    animation: fade-in-up 0.4s ease;
}
.modal-content {
    /* This class is just a conceptual wrapper, .modal-content-wrapper has the styles */
}
.modal-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}
.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.modal-close-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}
.modal-text-content {
    text-align: left;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* NEW: Accessibility - Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto; /* Disable smooth scroll */
  }
  
  /* Disable all transitions and animations */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
  
  /* Disable parallax */
  #home-lottie {
      transform: none !important;
  }
  
  /* Disable gradient animation */
  .animated-gradient {
      animation: none;
  }

  /* Make fade-in elements visible by default */
  .fade-on-scroll {
      opacity: 1;
      transform: none;
  }
}