#education {
  background: #0f172a;
  position: relative;
  padding: 40px 20px;
  color: #e2e8f0;
  font-family: 'Arial', sans-serif;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.95) translateY(50px);
  animation: sectionEnter 1s ease forwards;
}

.scroll-indicator-education {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  margin-top: 50px;
}

.section-description {
  color: #d1d5db;
  font-size: 0.9rem;
  font-style: italic;
  letter-spacing: 0.36px;
  max-width: 800px;
  margin: 0 auto 20px;
  background: rgba(34, 166, 153, 0.03);
  padding: 5px 10px;
  border-radius: 5px;
  text-align: center;
}

.section-link {
  color: #22d3ee;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.section-link:hover {
  color: #67e8f9;
  text-decoration: underline;
}

.scroll-text {
  font-size: 1.2rem;
  font-weight: 500;
  color: #e2e8f0;
  margin-bottom: 4px;
  animation: subtleGlow 2.5s ease-in-out infinite;
}

.scroll-icon {
  font-size: 1.5rem;
  color: #e2e8f0;
  animation: gentleBounce 1.8s ease-in-out infinite;
}

#education-particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

#education::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #0f172a, #1e293b, #0f172a);
  background-size: 200% 200%;
  animation: gradientFlow 15s ease infinite;
  z-index: -1;
}

#education::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.1) 0%, transparent 70%);
  animation: pulse 10s ease-in-out infinite;
  z-index: -1;
}

#education h2 {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  color: #2dd4bf;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.timeline-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  border-left: 4px solid #2dd4bf;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeSlideUp 0.6s ease forwards;
  flex: 1 1 calc(50% - 10px);
  min-width: 280px;
  max-width: calc(50% - 10px);
}

.timeline-item:nth-child(1) {
  animation-delay: 0.1s;
}

.timeline-item:nth-child(2) {
  animation-delay: 0.2s;
}

.timeline-item:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 20px rgba(45, 212, 191, 0.2);
}

.logo-container {
  text-align: center;
  margin-bottom: 8px;
}

.section-logo {
  width: 100px;
  height: auto;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.kfupm-logo {
  width: 120px;
}

.section-logo:hover {
  transform: scale(1.1);
}

.timeline-item h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #2dd4bf;
  margin-bottom: 5px;
  text-align: center;
}

.timeline-item p {
  font-size: 0.95rem;
  margin-bottom: 8px;
  line-height: 1.5;
  color: #e2e8f0;
}

.timeline-item p strong {
  color: #2dd4bf;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.attachment-button {
  background: linear-gradient(45deg, #2dd4bf, #22d3ee);
  color: #000;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.attachment-button::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.4s ease;
}

.attachment-button:hover::before {
  left: 100%;
}

.attachment-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(45, 212, 191, 0.4);
}

.image-carousel, .cert-carousel {
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: #2dd4bf #0f172a;
}

.image-carousel::-webkit-scrollbar, .cert-carousel::-webkit-scrollbar {
  height: 6px;
}

.image-carousel::-webkit-scrollbar-track, .cert-carousel::-webkit-scrollbar-track {
  background: #0f172a;
}

.image-carousel::-webkit-scrollbar-thumb, .cert-carousel::-webkit-scrollbar-thumb {
  background: #2dd4bf;
  border-radius: 3px;
}

.image-carousel::-webkit-scrollbar-thumb:hover, .cert-carousel::-webkit-scrollbar-thumb:hover {
  background: #22a699;
}

.image-carousel-track, .cert-carousel-track {
  display: inline-flex;
  gap: 12px;
  padding: 0 8px;
}

.gallery-img {
  width: 195px;
  height: 135px;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.gallery-img.vertical-img {
  width: 135px;
  height: 180px;
  object-fit: contain;
}

.gallery-img.featured-img {
  width: 150px;
  height: 210px;
}

.gallery-img.large-img {
  width: 100%;
  max-width: 600px;
  min-width: 195px;
  height: 210px;
  object-fit: contain;
}

.gallery-img:hover {
  transform: scale(1.05);
}

.cert-item {
  display: inline-block;
  text-align: center;
  width: 195px;
}

.cert-item a {
  text-decoration: none;
  color: #e2e8f0;
}

.cert-item p {
  font-size: 0.85rem;
  margin-top: 4px;
  white-space: normal;
}

@keyframes sectionEnter {
  0% { opacity: 0; transform: scale(0.95) translateY(50px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeSlideUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.8; }
  100% { transform: scale(1); opacity: 0.5; }
}

@keyframes subtleGlow {
  0% { text-shadow: 0 0 5px rgba(45, 212, 191, 0.5); }
  50% { text-shadow: 0 0 10px rgba(45, 212, 191, 0.8); }
  100% { text-shadow: 0 0 5px rgba(45, 212, 191, 0.5); }
}

@keyframes gentleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

@media (max-width: 768px) {
  #education {
    padding: 30px 15px;
  }

  #education h2 {
    font-size: 2.2rem;
  }

  .section-description {
    font-size: 0.85rem;
  }

  .timeline {
    flex-direction: column;
    gap: 15px;
  }

  .timeline-item {
    flex: 1 1 100%;
    max-width: 100%;
    padding: 12px;
  }

  .timeline-item h3 {
    font-size: 1.2rem;
  }

  .timeline-item p, .timeline-item li {
    font-size: 0.9rem;
  }

  .gallery-img, .gallery-img.vertical-img {
    width: 150px;
    height: 100px;
  }

  .gallery-img.featured-img {
    width: 120px;
    height: 150px;
  }

  .gallery-img.large-img {
    width: 100%;
    max-width: 400px;
    min-width: 150px;
    height: 150px;
  }

  .section-logo {
    width: 80px;
  }

  .kfupm-logo {
    width: 100px;
  }

  .cert-item {
    width: 150px;
  }

  .cert-carousel-track, .image-carousel-track {
    gap: 10px;
  }
}

@media (max-width: 480px) {
  #education {
    padding: 20px 10px;
  }

  #education h2 {
    font-size: 2rem;
  }

  .section-description {
    font-size: 0.8rem;
  }

  .timeline-item {
    padding: 10px;
  }

  .timeline-item h3 {
    font-size: 1.1rem;
  }

  .timeline-item p, .timeline-item li {
    font-size: 0.85rem;
  }

  .gallery-img, .gallery-img.vertical-img {
    width: 120px;
    height: 80px;
  }

  .gallery-img.featured-img {
    width: 100px;
    height: 120px;
  }

  .gallery-img.large-img {
    width: 100%;
    max-width: 300px;
    min-width: 120px;
    height: 120px;
  }

  .section-logo {
    width: 70px;
  }

  .kfupm-logo {
    width: 90px;
  }

  .cert-item {
    width: 120px;
  }

  .cert-item p {
    font-size: 0.75rem;
  }

  .attachment-button {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 320px) {
  #education {
    padding: 15px 8px;
  }

  #education h2 {
    font-size: 1.8rem;
  }

  .section-description {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  .timeline-item {
    padding: 8px;
  }

  .timeline-item h3 {
    font-size: 1rem;
  }

  .timeline-item p, .timeline-item li {
    font-size: 0.8rem;
  }

  .gallery-img, .gallery-img.vertical-img {
    width: 100px;
    height: 70px;
  }

  .gallery-img.featured-img {
    width: 90px;
    height: 100px;
  }

  .gallery-img.large-img {
    width: 100%;
    max-width: 250px;
    min-width: 100px;
    height: 100px;
  }

  .section-logo {
    width: 60px;
  }

  .kfupm-logo {
    width: 80px;
  }

  .cert-item {
    width: 100px;
  }

  .cert-item p {
    font-size: 0.7rem;
  }

  .cert-carousel-track, .image-carousel-track {
    gap: 8px;
  }

  .attachment-button {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .scroll-text {
    font-size: 1rem;
  }

  .scroll-icon {
    font-size: 1.2rem;
  }
}