/* Root variables for easy theming */
:root {
  --primary-color: #4e54c8;
  --secondary-color: #8f94fb;
  --dark-text: #222;
  --light-bg: #f4f6fc;
  --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--dark-text);
  background-color: #fff;
  line-height: 1.6;
  scroll-behavior: smooth;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 999;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo {
  height: 40px;
  width: 40px;
  margin-right: 0.5rem;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-links li {
  margin-left: 1.5rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--dark-text);
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: '';
  display: block;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
  margin-top: 3px;
}

.nav-links a:hover {
  color: var(--primary-color);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Language Toggle Button */
.lang-toggle {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.3s ease, color 0.3s ease;
  margin-left: 1rem;
}
.lang-toggle:hover {
  background: var(--primary-color);
  color: #fff;
}


.resume-btn {
  background: var(--primary-color);
  color: #fff !important;
  padding: 0.45rem 1rem;
  border-radius: 20px;
  font-weight: 500;
  transition: background 0.3s ease;
  display: inline-block;
  margin-left: 1rem;
}

/* Position the standalone resume button within the navbar */
.navbar .resume-btn {
  margin-left: 1rem;
}

@media (max-width: 768px) {
  /* Hide standalone resume button on small screens since the navigation drawer will be used */
  .navbar .resume-btn {
    display: none;
  }
}

.resume-btn:hover {
  background: var(--secondary-color);
}

.menu-icon {
  display: none;
  font-size: 1.4rem;
  color: var(--dark-text);
  cursor: pointer;
}

#menu-toggle {
  display: none;
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 60px;
    right: 0;
    width: 100%;
    height: calc(100vh - 60px);
    background: #fff;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
  }
  #menu-toggle:checked + .menu-icon + .nav-links {
    transform: translateX(0);
  }
  .nav-links li {
    margin: 1rem 0;
  }
  .menu-icon {
    display: block;
  }
}

/* Hero Section */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90vh;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
  text-align: center;
  padding: 0 1rem;
  padding-top: 5rem;
}

.hero-content {
  max-width: 800px;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero h1 .highlight {
  color: #fff;
  text-decoration: underline;
}

.tagline {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.subtagline {
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.primary-btn {
  background: #fff;
  color: var(--primary-color);
}
.primary-btn:hover {
  background: #f5f5f5;
}

.secondary-btn {
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
}
.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Sections */
.section {
  padding: 4rem 1.5rem;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--primary-color);
}

.about-section {
  background: var(--light-bg);
}

.skills-section {
  background: #fff;
}

.experience-section {
  background: var(--light-bg);
}

.projects-section {
  background: #fff;
}

.education-section {
  background: var(--light-bg);
}

.contact-section {
  background: #fff;
}

/* Contact section content layout */
.contact-container p {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 1rem;
  color: #666;
  line-height: 1.6;
}
.contact-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: #555;
}
.contact-info i {
  margin-right: 0.5rem;
  color: var(--primary-color);
}
.contact-info a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}
.contact-info a:hover {
  color: var(--secondary-color);
}

/* Contact section social links */
.social-links {
  margin-top: 1.5rem;
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
}
.social-links a {
  display: inline-block;
  transition: transform 0.3s ease;
}
.social-links a:hover {
  transform: scale(1.1);
}

/* Size adjustments for inline SVG icons in contact section */
.icon-small {
  width: 18px;
  height: 18px;
  margin-right: 0.5rem;
  vertical-align: middle;
  /* Tint the SVG icons to match the primary color */
  filter: invert(40%) sepia(50%) saturate(600%) hue-rotate(220deg) brightness(90%) contrast(90%);
}
.icon-social {
  width: 32px;
  height: 32px;
  display: block;
  /* Tint social icons */
  filter: invert(40%) sepia(50%) saturate(600%) hue-rotate(220deg) brightness(90%) contrast(90%);
}

.section-content {
  max-width: 1000px;
  margin: 0 auto;
  color: #555;
  font-size: 1rem;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.skill-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  text-align: center;
}
.skill-card i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}
.skill-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  color: var(--primary-color);
}
.skill-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.skill-card li {
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

/* Timeline */
/*
 * Timeline container holds all experience entries. A vertical line runs through the
 * timeline and animates from the top down when the experience section becomes
 * visible. Each timeline item (job entry) also fades and slides into place in
 * sequence. By default items are hidden and only appear when the parent
 * experience section has the `visible` class added by the IntersectionObserver
 * in script.js.
 */
.timeline {
  position: relative;
  margin-left: 1rem;
}
/* Vertical line: initially collapsed (scaleY(0)), grows to full height when visible */
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--primary-color);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1s ease-out;
}
/* Expand the line only when the experience section is visible */
.experience-section.visible .timeline::before {
  transform: scaleY(1);
}

/* Individual timeline item */
.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-left: 2rem;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Expanded state for each experience role when it enters the viewport. Adds
 * a subtle background, shadow and padding to emphasise the current role. */
.timeline-item.expanded {
  background: rgba(142, 148, 251, 0.08);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 1.5rem 1.5rem;
  transform: translateY(0);
  opacity: 1;
}

/* RTL specific alignment for expanded items */
body[dir="rtl"] .timeline-item.expanded {
  text-align: right;
}
/* Circle marker on the line */
.timeline-item::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 0;
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.6s ease-out;
}
/* Text styling inside timeline items */
.timeline-item h4 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  color: var(--primary-color);
}
.timeline-item span {
  font-size: 0.9rem;
  color: #777;
}
.timeline-item p {
  margin: 0.5rem 0 0;
  color: #555;
  font-size: 0.9rem;
}

/* When the experience section becomes visible, reveal timeline items in sequence */
.experience-section.visible .timeline-item {
  opacity: 1;
  transform: translateY(0);
}
.experience-section.visible .timeline-item::before {
  transform: scale(1);
}
/* Staggered animation delays for each item */
.experience-section.visible .timeline-item:nth-child(1) {
  transition-delay: 0.2s;
}
.experience-section.visible .timeline-item:nth-child(2) {
  transition-delay: 0.4s;
}
.experience-section.visible .timeline-item:nth-child(3) {
  transition-delay: 0.6s;
}
.experience-section.visible .timeline-item:nth-child(4) {
  transition-delay: 0.8s;
}

/* RTL adjustments for experience timeline
 * When the page direction is set to RTL (Arabic), flip the timeline to the
 * right side and adjust padding, marker positions and text alignment. */
body[dir="rtl"] .timeline {
  margin-left: 0;
  margin-right: 1rem;
}
body[dir="rtl"] .timeline::before {
  left: auto;
  right: 0;
  /* maintain same animation origin */
  transform-origin: top;
}
body[dir="rtl"] .timeline-item {
  padding-left: 0;
  padding-right: 2rem;
  text-align: right;
}
body[dir="rtl"] .timeline-item::before {
  left: auto;
  right: -9px;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}
.project-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}
.project-card .card-content {
  padding: 1.5rem;
  flex: 1;
}
.project-card h3 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--primary-color);
}
.project-card p {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.5rem;
}
.project-card .tech-list {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  font-style: italic;
  color: #888;
}
.project-card .card-actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}
.project-card a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.2s ease;
}
.project-card a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

/* Education */
.education-list {
  max-width: 800px;
  margin: 0 auto;
}
.education-item {
  margin-bottom: 2rem;
}
.education-item h4 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary-color);
}
.education-item span {
  font-size: 0.9rem;
  color: #777;
}
.education-item p {
  margin: 0.5rem 0 0;
  color: #555;
  font-size: 0.9rem;
}

/* Contact */
.contact-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}
.contact-container p {
  margin-bottom: 1rem;
  font-size: 1rem;
}
.contact-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  font-size: 1rem;
}
.contact-info div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.contact-info i {
  color: var(--primary-color);
  font-size: 1.2rem;
}
.contact-info a {
  color: var(--dark-text);
  text-decoration: none;
  transition: color 0.2s ease;
}
.contact-info a:hover {
  color: var(--primary-color);
}
.social-links {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}
.social-links a {
  font-size: 1.5rem;
  color: var(--primary-color);
  transition: color 0.2s ease;
}
.social-links a:hover {
  color: var(--secondary-color);
}

/* Footer */
.footer {
  background: #1a1a2e;
  color: #ccc;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}
.footer a {
  color: var(--primary-color);
  text-decoration: none;
}
.footer a:hover {
  text-decoration: underline;
}

/* Animation: reveal sections */
.section {
  will-change: opacity, transform;
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2rem;
  }
  .hero p {
    font-size: 0.95rem;
  }
  .section-title {
    font-size: 1.6rem;
  }
}