/* GENERAL */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap");
@font-face {
  font-family: shabnam;
  src: url("font/Shabnam.woff2") format("woff2"),
       url("font/Shabnam.woff") format("woff"),
       url("font/Shabnam.eot") format("eot");
  font-weight: normal;
  font-style: normal;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box; /* Added for consistency */
}
:root {
  --background-color: #fff;
  --text-color: #000;
  --section-background-color: rgb(250, 250, 250);
  --border-color: rgb(163, 163, 163);
  --nav-link-color: #000;
  --nav-link-hover-color: grey;
  --btn-text-color: #000;
  --btn-border-color: rgb(53, 53, 53);
  --btn-hover-text-color: #fff;
  --btn-hover-bg-color: rgb(53, 53, 53);
  /* Define a semi-transparent background for scrolled state */
  --navbar-scrolled-bg: rgba(255, 255, 255, 0.9); /* White with 90% opacity */
  /* You can change the color inside rgba() if needed, e.g., rgba(18, 18, 18, 0.9) for dark */
  --focus-shadow-color: rgba(0, 0, 0, 0.1);
  --muted-text-color: rgb(85, 85, 85);
  --title-content-gap: 2rem; /* Uniform desktop title -> content spacing (32px) */
  --about-qr-offset: 0; /* Align the QR code with the About cards */
}
body {
  font-family: "Poppins", sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
  /* Ensure body is positioned relative for absolute spinner positioning */
  position: relative;
}
body.dark-mode {
  --background-color: #121212;
  --text-color: #fff;
  --section-background-color: #333;
  --border-color: #555;
  --nav-link-color: #fff;
  --nav-link-hover-color: #bbb;
  --btn-text-color: #fff;
  --btn-border-color: #fff;
  --btn-hover-text-color: #000;
  --btn-hover-bg-color: #fff;
  /* Define a semi-transparent background for scrolled state in dark mode */
  --navbar-scrolled-bg: rgba(18, 18, 18, 0.9); /* Dark with 90% opacity */
  --focus-shadow-color: rgba(255, 255, 255, 0.1); /* Subtle shadow for dark mode focus */
  --muted-text-color: #aaa;
}
html {
  scroll-behavior: smooth;
}
p {
  color: var(--muted-text-color);
}
.logo1 {
  width: 100px;
}
/* TRANSITION */
a,
.btn {
  transition: all 300ms ease;
}
/* LOADING SPINNER */
.loading-spinner {
  position: fixed; /* Cover the entire viewport */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--background-color); /* Match body background */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999; /* Ensure it's on top of everything */
  transition: opacity 0.5s ease-out; /* Smooth fade out */
}
.loading-spinner.fade-out {
  opacity: 0;
  pointer-events: none; /* Disable interaction during fade out */
}
.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(85, 85, 85, 0.2); /* Light grey border */
  border-top: 5px solid var(--text-color); /* Darker top border for animation */
  border-radius: 50%; /* Make it circular */
  animation: spin 1s linear infinite; /* Apply the spin animation */
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* DESKTOP NAV */
#desktop-nav {
  position: fixed; /* Fixed position */
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000; /* Ensure it's on top */
  display: flex; /* Keep existing styles */
  justify-content: space-around;
  align-items: center;
  height: 10vh; /* Reduced height */
  /* Initial background: transparent or match body color */
  background-color: transparent;
  /* Optional: Add a subtle box-shadow to define the navbar when scrolled */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0); /* Initially no shadow */
  padding: 0 20px; /* Optional: Add padding */
  box-sizing: border-box; /* Include padding in width */
  margin: 0; /* Remove any default margin */
  /* Transition for smooth change when scrolled */
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
/* Style for navbar when scrolled */
#desktop-nav.scrolled {
  background-color: var(--navbar-scrolled-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Add shadow when scrolled */
}
.nav-links {
  display: flex; /* Keep existing styles */
  align-items: center;
  gap: 2rem;
  list-style: none;
  font-size: 1.5rem;
}
.nav-links li {
  display: flex;
  align-items: center;
}
a {
  color: var(--nav-link-color);
  text-decoration: none;
}
a:hover {
  color: grey;
  text-decoration: underline;
  text-underline-offset: 1rem;
  text-decoration-color: rgb(181, 181, 181);
}
.logo {
  font-size: 2rem;
}
.logo:hover {
  cursor: default;
}
/* HAMBURGER MENU */
#hamburger-nav {
  display: none; /* Hidden by default */
  position: fixed; /* Fixed position when shown */
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000; /* Ensure it's on top */
  justify-content: space-between; /* Adjust layout */
  align-items: center;
  height: 70px; /* Fixed height */
  background-color: transparent; /* Initial transparent */
  padding: 0 20px; /* Add padding */
  box-sizing: border-box; /* Include padding in width */
  /* Transition for smooth change when scrolled */
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0); /* Initially no shadow */
}
/* Style for mobile navbar when scrolled */
#hamburger-nav.scrolled {
  background-color: var(--navbar-scrolled-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Add shadow when scrolled */
}
.hamburger-menu {
  position: relative;
  display: inline-block;

}
.hamburger-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 24px;
  width: 30px;
  cursor: pointer;
}
.hamburger-icon span {
  width: 100%;
  height: 2px;
  background-color: var(--text-color);
  /* transition: all 0.3s ease-in-out; */
}
.menu-links {
  position: absolute;
  top: 100%;
  margin-top: 15px;
  right: 1vw;
  width: 90vw;
  background-color: var(--background-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  max-height: 0;
  padding: 0 0;
  opacity: 0;
  visibility: hidden;
  transition: 
    max-height 0.35s ease,
    opacity 0.3s ease,
    padding 0.3s ease,
    visibility 0.35s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* Style for the open state - increased max-height and added scrolling */
.menu-links.open {
  max-height: 60vh; /* Must be >= actual content height */
  opacity: 1;
  visibility: visible;
  padding: 1.25rem 0;
}
#mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999; /* Below the menu (1000) but above page content */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
#mobile-menu-backdrop.show {
  opacity: 1;
  visibility: visible;
}
.menu-links a {
  display: block;
  padding: 14px 20px; /* Increased padding for better touch target */
  text-align: center;
  font-size: 1.4rem; /* Slightly larger text */
  color: var(--nav-link-color);
  text-decoration: none;
  width: 100%; /* Fill container width */
  box-sizing: border-box;
}
.menu-links li {
  list-style: none;
  /* Center individual list items if needed, though align-items: center on parent should handle it */
  /* width: 100%; */
  text-align: center; /* Ensure text inside is centered */
}
/* SECTIONS */
section {
  padding-top: 4vh;
  height: 96vh;
  margin: 0 5rem;
  box-sizing: border-box;
  min-height: fit-content;
  margin-top: 10vh; /* Push content below the fixed desktop navbar */
}
.section-container {
  display: flex;
  gap: 4rem;
  height: 80%;
}
/* PROFILE SECTION */
#profile {
  display: flex;
  justify-content: center;
  gap: 5rem;
  height: 80vh; /* Adjusted based on new navbar height */
  margin-top: 10vh; /* Ensure profile section starts below navbar */
}
.section__pic-container {
  display: flex;
  height: 400px;
  width: 400px;
  margin: auto 0;
}
.section__pic-container picture {
  display: flex;
  width: 100%;
  height: 100%;
}
#profile .section__pic-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#about .section__pic-container {
  height: auto;
  width: 300px;
  max-width: 90vw;
  flex-shrink: 0;
  margin: 0;
  align-self: flex-start;
}
#about .section__pic-container img {
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
}
@media screen and (min-width: 1201px) {
  #about .section__pic-container {
    width: 300px;
    margin-top: var(--about-qr-offset);
  }
  #about .section__pic-container img {
    max-width: 300px;
  }
}
.section__text {
  align-self: center;
  text-align: center;
  font-weight: 600;
  opacity: 0;
  animation: fadeInText 2s forwards;
}
.section__text__p1 {
  text-align: center;
}
.section__text__p2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}
.title {
  font-size: 2.5rem;
  text-align: center;
  margin: 0;
}
@media screen and (min-width: 1201px) {
  /* Uniform desktop title -> content gap (best-practice UI rhythm) */
  /* Keep the gap between completed sections consistent, independent of content height. */
  main > section:not(#profile) {
    height: auto;
    min-height: 0;
    margin: 6rem 5rem 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  .title {
    margin-bottom: var(--title-content-gap);
  }
  #profile .title {
    margin-bottom: 0;
  }
  #about .section-container {
    margin-top: 0;
    align-items: flex-start;
  }
  #about .about-details-container {
    justify-content: flex-start;
  }
  #about .text-container {
    margin-top: 1rem;
  }
  #about .about-containers,
  #experience .about-containers,
  #projects .about-containers,
  #work-together .about-containers {
    margin: 0;
  }
  /* Bring desktop skill icons closer to their labels without moving the labels. */
  #experience .skill-logo {
    transform: translateX(2.5rem);
  }
  #work-together .btn-container {
    margin-top: 2rem;
  }
  #professional-experience .experience-cards-container {
    margin-top: 0;
  }
  #contact .contact-info-upper-container {
    margin: 0 auto;
  }
  .about-pic {
    margin-top: 0;
  }
  body footer {
    margin: 6rem 5% 0;
    padding-top: 0;
  }
}
#socials-container {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  gap: 1rem;
}
img[src*="linkedin.webp"] {
  padding: 2px;
  box-sizing: border-box;
}
/* ICONS */
.icon {
  width: 35px;
  height: 35px;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.icon:hover {
  transform: scale(1.2);
}
/* These are solid-black PNGs with no dark-mode variant; invert them so they stay visible */
body.dark-mode img[src*="arrow.png"],
body.dark-mode img[src*="experience.png"],
body.dark-mode img[src*="education.png"],
body.dark-mode img[src*="github.png"],
body.dark-mode img[src*="vercel-logo"],
body.dark-mode img[src*="icons8-ShadCN-UI"],
body.dark-mode img[src*="linkedin.webp"],
body.dark-mode img[src*="github.webp"],
body.dark-mode img[src*="email.png"] {
  filter: invert(1);
}
/* BUTTONS */
.btn-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
}
.btn {
  font-weight: 300;
  padding: 1rem;
  width: 8rem;
  border-radius: 2rem;
  font-family: shabnam, "Poppins", sans-serif;
  text-align: center;
  cursor: pointer;
  transition: all 300ms ease;
}
.btn-color-1 {
  background-color: var(--btn-hover-bg-color);
  color: var(--btn-hover-text-color);
  border: 0.1rem solid var(--btn-hover-bg-color);
}
.btn-color-1:hover {
  background-color: var(--btn-hover-text-color);
  color: var(--btn-hover-bg-color);
  border-color: var(--btn-hover-text-color);
}
.btn-color-2 {
  background-color: transparent;
  color: var(--btn-text-color);
  border: 0.1rem solid var(--btn-border-color);
}
.btn-color-2:hover {
  background-color: var(--btn-hover-bg-color);
  color: var(--btn-hover-text-color);
  border-color: var(--btn-hover-bg-color);
}

/* Override for "Contact Me" button hover in light mode */
body:not(.dark-mode) .btn-container .btn-color-1:hover {
  background-color: #000; /* Use a dark color that contrasts with light bg */
  color: #fff;
  border-color: #000;
}

/* ABOUT SECTION */
#about {
  position: relative;
}
#about-title1 {
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
}
.about-containers,
.about-details-container {
  display: flex;
}
.about-containers {
  gap: 2rem;
  margin: 2rem 0;
}
.about-details-container {
  justify-content: center;
  flex-direction: column;
}
.about-pic {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 0;
}
.details-container {
  padding: 1.5rem;
  flex: 1;
  background: var(--background-color);
  border-radius: 2rem;
  border: var(--border-color) 0.1rem solid;
  text-align: center;
}
/* EXPERIENCE SECTION */
#experience {
  position: relative;
}
.experience-sub-title {
  color: var(--muted-text-color);
  font-weight: 400;
  font-size: 1.75rem;
  margin-bottom: 2rem;
}
.experience-details-container {
  display: flex;
  justify-content: center;
  flex-direction: column;
}

/* SKILLS VISUALIZATION - Updated */
.skills-container {
  display: flex;
  flex-direction: column;
  gap: 1rem; /* Space between skill items */
  width: 100%; /* Ensure it takes full width of its container */
}
.skill-item {
  display: flex;
  align-items: center; /* Align logo and name vertically */
  gap: 1rem; /* Space between logo and name */
  padding: 0.5rem 0; /* Add some vertical padding */
}
.skill-logo {
  width: 32px; /* Adjust size as needed */
  height: 32px; /* Adjust size as needed */
  object-fit: contain; /* Maintain aspect ratio */
  flex-shrink: 0; /* Prevent logo from shrinking */
}
.skill-name {
  font-weight: 500;
  color: var(--text-color);
  font-size: 1.1rem; /* Adjust size as needed */
  flex-grow: 1; /* Allow name to take remaining space */
}
/* PROFESSIONAL EXPERIENCE SECTION */
#professional-experience {
  position: relative;
  padding-top: 4vh;
  min-height: fit-content;
  margin-top: 10vh;
  height: fit-content;
}

#professional-experience .timeline-line {
  position: absolute;
  top: 162px;
  bottom: 59px;
  left: 50%;
  width: 2px;
  background: linear-gradient(to bottom, var(--btn-hover-bg-color), var(--btn-hover-text-color), var(--btn-hover-bg-color));
  transform: translateX(-50%);
  z-index: 0;
}

#professional-experience .experience-cards-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 2rem;
  position: relative;
  z-index: 1;
}

#professional-experience .experience-card {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}
/* Compact CV Modal */
#cv-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#cv-modal.show {
  opacity: 1;
  visibility: visible;
}

.cv-modal-content {
  background: var(--background-color);
  color: var(--text-color);
  border-radius: 14px;
  padding: 1.5rem;
  width: 90%;
  max-width: 320px;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

#cv-modal.show .cv-modal-content {
  transform: scale(1);
}

.cv-modal-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-color);
}

.cv-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.cv-btn {
  display: block;
  padding: 0.75rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  text-align: center;
  background: var(--btn-hover-bg-color);
  color: var(--btn-hover-text-color);
  transition: all 0.2s ease;
  border: 1px solid var(--btn-hover-bg-color);
}

.cv-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.cv-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-color);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.cv-close-btn:hover,
.cv-close-btn:focus {
  background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .cv-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Focus visibility for accessibility */
.cv-close-btn:focus,
.cv-btn:focus {
  outline: 2px solid var(--btn-hover-bg-color);
  outline-offset: 2px;
}

@media screen and (min-width: 1024px) {
  #professional-experience .experience-card:nth-child(odd) {
    justify-content: flex-end;
    padding-right: 2rem;
  }
  #professional-experience .experience-card:nth-child(even) {
    justify-content: flex-start;
    padding-left: 2rem;
  }
}

#professional-experience .card-content {
  background-color: var(--section-background-color);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  width: 100%;
  max-width: 500px;
  position: relative;
  overflow: hidden;
  border: var(--border-color) 0.1rem solid;
}

#professional-experience .card-content::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 50px;
  height: 50px;
  background: linear-gradient(to bottom right, var(--btn-hover-bg-color), var(--btn-hover-text-color));
  opacity: 0.2;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  z-index: -1;
}

#professional-experience .card-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(to top right, var(--btn-hover-text-color), var(--btn-hover-bg-color));
  opacity: 0.2;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  z-index: -1;
}

#professional-experience .card-header {
  display: flex;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

#professional-experience .icon-wrapper {
  position: relative;
}

#professional-experience .icon {
  width: 32px;
  height: 32px;
  background-color: #fff;
  border-radius: 0.5rem;
  padding: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  object-fit: contain;
}

#professional-experience .position-company {
  flex-grow: 1;
}

#professional-experience .position {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

#professional-experience .company {
  font-size: 1rem;
  font-weight: 500;
  color: var(--btn-hover-bg-color);
  margin: 0;
}

#professional-experience .period {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: var(--btn-hover-bg-color);
  color: var(--btn-hover-text-color);
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

#professional-experience .description-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

#professional-experience .description-list li {
  display: flex;
  align-items: start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-size: 0.9rem;
}

#professional-experience .description-list li::before {
  content: '•';
  color: var(--btn-hover-bg-color);
  font-weight: bold;
  margin-top: 0.25rem;
}

#professional-experience .experience-card:hover .card-content {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

#professional-experience .experience-card:hover .icon {
  transform: scale(1.1);
}

/* Professional Experience tablet layout lives in mediaqueries.css */

/* ARTICLE CONTAINER (for other sections that might still use it) */
.article-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  justify-content: space-around;
  text-align: initial;
}
/* PROJECTS SECTION */
#projects {
  position: relative;
}
.color-container {
  background: var(--section-background-color);
  border-color: var(--border-color);
}
.project-img {
  border-radius: 2rem;
  width: 90%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.article-container picture {
  display: block;
  width: 100%;
}
.project-title {
  margin: 1rem;
  color: var(--text-color);
}
.project-description {
  margin: 0 1rem 1rem;
  color: var(--muted-text-color);
  font-size: 0.95rem;
  line-height: 1.5;
}
.project-btn {
  color: var(--btn-text-color);
  border-color: var(--border-color);
}
/* WORK TOGETHER */
#work-together {
  height: auto;
  min-height: fit-content;
  overflow: hidden;
  margin-bottom: 10vh;
}
#work-together .btn {
  min-width: 12rem;
  width: auto;
  text-decoration: none;
}
/* CONTACT */
#contact {
  display: flex;
  justify-content: flex-start;
  flex-direction: column;
  height: auto; /* Adjust height to content */
  min-height: 70vh; /* Ensure minimum height */
  margin-bottom: 4rem; /* Add some space at the bottom */
  margin-top: 10vh; /* Push below navbar */
}
/* Updated container for the form to remove old info styles */
.contact-info-upper-container {
  display: flex;
  justify-content: center;
  align-items: center; /* Center vertically if space allows */
  margin: 2rem auto;
  padding: 0; /* Remove padding as form will have its own */
  border: none; /* Remove border as form will have its own */
  background: none; /* Remove background as form will have its own */
  max-width: 700px; /* Constrain width for better form presentation */
  width: 100%;
}
/* CONTACT FORM STYLES */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  padding: 2.5rem; /* Increased padding */
  border-radius: 2rem; /* Match other cards (.details-container, .color-container) */
  background: var(--section-background-color); /* Use section background */
  border: var(--border-color) 0.1rem solid; /* Add border */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}
.form-group {
  display: flex;
  flex-direction: column;
}

#submit-btn {
  align-self: flex-end;
}


.form-group label {
  font-size: 1.2rem;
  margin-bottom: 0.75rem; /* Increased margin */
  color: var(--text-color);
  font-weight: 500; /* Slightly bolder label */
}
.form-group input,
.form-group textarea,
.form-group select { /* Added select to the selector */
  padding: 1rem; /* Increased padding */
  border: 1px solid var(--border-color);
  border-radius: 0.75rem; /* Slightly larger border-radius */
  font-family: "Poppins", sans-serif;
  font-size: 1.1rem; /* Slightly larger font size */
  background-color: var(--background-color); /* Match theme */
  color: var(--text-color); /* Match theme */
  transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
  outline: none; /* Remove default outline */
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { /* Added select:focus */
  outline: none; /* Ensure outline is removed */
  border-color: var(--text-color); /* Use theme text color for focus border */
  box-shadow: 0 0 0 2px var(--focus-shadow-color);
}

/* Style for the select element specifically */
.form-group select {
  cursor: pointer; /* Indicate it's interactive */
  /* Inherits padding, border, font-family, font-size, background, color from above rules */
  /* Specific styles for dropdown arrow can be added if needed, but often left to browser default */
}
/* Style for the options within the select element */
.form-group select option {
  background-color: var(--section-background-color); /* Use section bg for options */
  color: var(--text-color); /* Use theme text color for option text */
  /* Padding and other styles for options are often limited by browsers */
}
/* FOOTER SECTION */
footer {
  margin: 0 5%;
  margin-top: 10vh;
  padding-top: 3rem;
  border-top: 0.1rem solid var(--border-color);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  padding-bottom: 2rem;
}
.footer-brand {
  display: flex;
  align-items: center;
}
.footer-logo-img {
  width: 50px;
  height: 50px;
}
.footer-socials {
  display: flex;
  gap: 1rem;
}
.footer-socials .icon {
  width: 24px;
  height: 24px;
}
.footer-wordmark {
  display: block;
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: clamp(2.75rem, 13vw, 8rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-color);
  text-decoration: none;
  cursor: pointer;
  animation: footer-wordmark-flicker 7s linear infinite;
}
.footer-wordmark:hover {
  opacity: 0.65;
  animation-play-state: paused;
}
@keyframes footer-wordmark-flicker {
  0%, 2%, 8%, 27%, 29%, 63%, 65%, 100% { opacity: 0.45; }
  1% { opacity: 0.06; }
  3% { opacity: 0.18; }
  4%, 7% { opacity: 0.45; }
  5% { opacity: 0.06; }
  6% { opacity: 0.32; }
  28% { opacity: 0.06; }
  64% { opacity: 0.1; }
  80% { opacity: 0.45; }
  81% { opacity: 0.06; }
  82% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .footer-wordmark {
    animation: none;
    opacity: 0.4;
  }
}
footer p {
  text-align: center;
  border-top: 0.1rem solid var(--border-color);
  padding: 1.5rem 0;
}
.language-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}
.globe-icon {
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.globe-icon:hover {
  transform: scale(1.1);
}
.lang-menu {
  position: absolute;
  top: 35px;
  right: 0;
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 4px 0;
  display: none;
  z-index: 1000;
  min-width: 100px;
  text-align: left;
}
.lang-menu a {
  display: block;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-color);
  text-decoration: none;
}
.lang-menu a:hover {
  background-color: #f0f0f0; /* Light hover background */
  color: var(--text-color); /* Ensure text color stays consistent on hover */
}
/* Add specific dark mode hover styles for the language menu */
body.dark-mode .lang-menu a:hover {
  background-color: #333; /* Darker hover background for dark mode */
  color: var(--text-color); /* Keep text color as defined in dark mode */
}
.lang-menu.show {
  display: block;
}
/* Language buttons inside mobile menu */
#hamburger-nav .language-mobile {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding: 1.25rem 0.5rem 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 1rem;
  cursor: pointer;
}
#hamburger-nav .language-mobile a {
  display: block;
  min-width: 2.75rem;
  padding: 8px 14px;
  background-color: var(--background-color); /* Use theme background */
  color: var(--text-color); /* Use theme text color */
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
#hamburger-nav .language-mobile a:hover {
  background-color: #f0f0f0; /* Use a light hover state, might need adjustment for dark mode */
  transform: translateY(-1px);
}
body.dark-mode #hamburger-nav .language-mobile a:hover {
  background-color: #333; /* Use a dark hover state for dark mode */
}
/* Theme toggle row inside mobile menu */
.menu-theme-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
  padding: 1rem 0 1.25rem;
  border-top: 1px solid var(--border-color);
  font-size: 1rem;
  color: var(--text-color);
  cursor: pointer;
}
/* MODAL STYLES */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}
.modal-content {
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 4vh auto;
  padding: 2rem;
  border-radius: 18px;
  width: min(85%, 1200px);
  max-width: 1200px;
  max-height: 92vh;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  animation: slideIn 0.4s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-header {
  display: contents;
}
.modal-footer {
  display: none;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.close-btn {
  background: transparent;
  border: 0;
  color: var(--text-color);
  font-size: 28px;
  font-weight: 400;
  cursor: pointer;
  line-height: 1;
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 2;
}
.mobile-slide-count,
.mobile-expand-image-btn {
  display: none;
}
.close-btn:hover {
  color: var(--btn-hover-bg-color);
}
.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}
/* Slideshow container inside modal */
.slideshow-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.slideshow {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
  background: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative; /* For positioning arrows relative to this element */
  touch-action: pan-y;
}
.slideshow img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}
.expand-image-btn {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--background-color);
  border-radius: 50%;
  background-color: #000;
  color: #fff;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  z-index: 1;
}
.expand-image-btn:hover {
  background-color: var(--btn-hover-bg-color);
  color: var(--btn-hover-text-color);
}
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: 2.75rem;
  height: 2.75rem;
  margin-top: -1.375rem;
  padding: 0;
  border: 1px solid var(--background-color);
  color: white;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 50%;
  user-select: none;
  background-color: #000;
  z-index: 1;
}
.prev {
  left: 0.75rem;
}
.next {
  right: 0.75rem;
}
.prev:hover, .next:hover {
  background-color: var(--btn-hover-bg-color);
  color: var(--btn-hover-text-color);
}
.slideshow-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
  color: var(--text-color);
  font-size: 0.95rem;
}
.slideshow-dots {
  display: flex;
  flex: 1;
  gap: 0;
  height: 0.35rem;
  border-radius: 999px;
  background-color: #e5e5e5;
  overflow: hidden;
  position: relative;
  --slide-progress: 100%;
}
.slideshow-dots::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--slide-progress);
  border-radius: inherit;
  background-color: var(--btn-hover-bg-color);
  transition: width 360ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.slideshow-dot {
  cursor: pointer;
  height: 100%;
  flex: 1;
  margin: 0;
  background-color: transparent;
  border-radius: 0;
  display: inline-block;
}
.slideshow-dot:hover {
  background-color: rgba(0, 0, 0, 0.08);
}
@media (prefers-reduced-motion: reduce) {
  .slideshow-dots::before {
    transition: none;
  }
}
/* Modal text content container */
.modal-text-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem 0;
}
.modal-text-content h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 1.12;
}
.modal-text-content p {
  color: var(--muted-text-color);
  line-height: 1.6;
}
.description-toggle {
  display: none;
}
.modal-tech {
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid #e5e5e5;
}
.modal-tech strong {
  display: block;
  color: var(--text-color);
  font-weight: 600;
}
.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.tech-list span {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 400;
}
/* Modal links container */
.modal-links {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-start; /* Align buttons to the start */
}
.modal-links .btn {
  width: auto;
  min-width: 8rem;
  padding: 0.65rem 1.4rem;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
/* Dark mode support for modal */
body.dark-mode .modal-content {
  background-color: #1e1e1e;
}
.image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: rgba(0, 0, 0, 0.9);
  touch-action: pan-y;
}
.image-lightbox.is-open {
  display: flex;
}
.image-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}
.image-lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 2.25rem;
  line-height: 1;
}
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  width: 3rem;
  height: 3rem;
  margin-top: -1.5rem;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #000;
  color: #fff;
  cursor: pointer;
  font-size: 1.25rem;
  z-index: 1;
}
.lightbox-prev {
  left: 1.5rem;
}
.lightbox-next {
  right: 1.5rem;
}
.lightbox-prev:hover,
.lightbox-next:hover {
  background: #fff;
  color: #000;
}
/* ANIMATIONS */
@keyframes fadeInText {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeInLeft {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s ease-out;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }
.delay-7 { transition-delay: 0.7s; }
.delay-8 { transition-delay: 0.8s; }
.delay-9 { transition-delay: 0.9s; }
.delay-10 { transition-delay: 1s; }
.delay-11 { transition-delay: 1.1s; }
.delay-12 { transition-delay: 1.2s; }
.delay-13 { transition-delay: 1.3s; }
.delay-14 { transition-delay: 1.4s; }
.delay-15 { transition-delay: 1.5s; }
.delay-16 { transition-delay: 1.6s; }
.delay-17 { transition-delay: 1.7s; }
.copyright {
  font-size: 1em;
  color: var(--muted-text-color);
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 2s ease-in-out, transform 2s ease-in-out;
}
#desktop-nav,
#hamburger-nav {
  opacity: 0;
  transform: translateY(-20px);
  animation: fadeInUp 1s forwards;
}
#desktop-nav .nav-items li,
#hamburger-nav .menu-links li {
  opacity: 0;
  transform: translateX(-20px);
  animation: fadeInLeft 1s forwards;
}
#desktop-nav .nav-items li:nth-child(1),
#hamburger-nav .menu-links li:nth-child(1) { animation-delay: 0.1s; }
#desktop-nav .nav-items li:nth-child(2),
#hamburger-nav .menu-links li:nth-child(2) { animation-delay: 0.2s; }
#desktop-nav .nav-items li:nth-child(3),
#hamburger-nav .menu-links li:nth-child(3) { animation-delay: 0.3s; }
#desktop-nav .nav-items li:nth-child(4),
#hamburger-nav .menu-links li:nth-child(4) { animation-delay: 0.4s; }
#desktop-nav .nav-items li:nth-child(5),
#hamburger-nav .menu-links li:nth-child(5) { animation-delay: 0.5s; }
.theme-icon {
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.theme-icon:hover {
  transform: scale(1.1);
}
/* Responsive overrides live in mediaqueries.css */

/* Optional: Make sure menu appears above backdrop */
#hamburger-nav .menu-links {
  z-index: 1000;
}

/* RTL OVERRIDES (Arabic) */
html[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
  text-align: right;
}
html[dir="rtl"] .menu-links {
  right: auto;
  left: 5vw;
}
html[dir="rtl"] .close-btn {
  float: left;
  right: auto;
  left: 15px;
}
html[dir="rtl"] .cv-close-btn {
  right: auto;
  left: 12px;
}
html[dir="rtl"] .prev {
  left: auto;
  right: 0.75rem;
  transform: scaleX(-1);
}
html[dir="rtl"] .next {
  right: auto;
  left: 0.75rem;
  transform: scaleX(-1);
}

/* Technology names and logos use their familiar left-to-right presentation. */
html[dir="rtl"] #experience .skill-item {
  direction: ltr;
}

@media screen and (min-width: 1024px) {
  html[dir="rtl"] #professional-experience .experience-card:nth-child(odd) {
    padding-right: 0;
    padding-left: 2rem;
  }
  html[dir="rtl"] #professional-experience .experience-card:nth-child(even) {
    padding-left: 0;
    padding-right: 2rem;
  }
}
