/* Shared motion, effects & responsive polish for all portfolio themes */

@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: smooth;
}

body.pb-public-page,
body.pb-preview-page {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* —— Navbar —— */
.navbar {
  transition: box-shadow 0.35s ease, background 0.35s ease, backdrop-filter 0.35s ease;
}

.nav-menu a {
  position: relative;
  transition: color 0.25s ease, transform 0.25s ease;
}

.nav-menu a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--accent, var(--primary, #6366f1));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-menu a:hover::after,
.nav-menu a:focus-visible::after {
  transform: scaleX(1);
}

.nav-toggle {
  transition: transform 0.2s ease;
}

.nav-toggle:active {
  transform: scale(0.92);
}

/* —— Hero —— */
.hero {
  position: relative;
  overflow: hidden;
}

.hero-content > * {
  animation: pb-motion-fade-up 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-content > *:nth-child(1) { animation-delay: 0.05s; }
.hero-content > *:nth-child(2) { animation-delay: 0.12s; }
.hero-content > *:nth-child(3) { animation-delay: 0.18s; }
.hero-content > *:nth-child(4) { animation-delay: 0.24s; }
.hero-content > *:nth-child(5) { animation-delay: 0.3s; }

.hero-image,
.hero-image-placeholder {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s ease;
}

.hero-image:hover {
  transform: scale(1.04) translateY(-4px);
}

@keyframes pb-motion-fade-up {
  from { opacity: 0; transform: translateY(36px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pb-motion-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* —— Buttons —— */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, opacity 0.3s ease;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
}

.btn:hover::before {
  transform: translateX(120%);
}

.btn:hover {
  transform: translateY(-3px);
}

.btn:active {
  transform: translateY(-1px) scale(0.98);
}

/* —— Sections & scroll reveal —— */
.section {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-title {
  position: relative;
  display: inline-block;
  width: 100%;
}

.section-title::after {
  content: '';
  display: block;
  width: 56px;
  height: 3px;
  margin: 0.75rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent, var(--primary, #6366f1)), transparent);
  opacity: 0.85;
}

.section.visible .experience-card,
.section.visible .project-card,
.section.visible .education-card,
.section.visible .cert-card,
.section.visible .service-card {
  animation: pb-motion-card-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.section.visible .experience-card:nth-child(1),
.section.visible .project-card:nth-child(1),
.section.visible .education-card:nth-child(1),
.section.visible .cert-card:nth-child(1),
.section.visible .service-card:nth-child(1) { animation-delay: 0.08s; }

.section.visible .experience-card:nth-child(2),
.section.visible .project-card:nth-child(2),
.section.visible .education-card:nth-child(2),
.section.visible .cert-card:nth-child(2),
.section.visible .service-card:nth-child(2) { animation-delay: 0.16s; }

.section.visible .experience-card:nth-child(3),
.section.visible .project-card:nth-child(3),
.section.visible .education-card:nth-child(3),
.section.visible .cert-card:nth-child(3),
.section.visible .service-card:nth-child(3) { animation-delay: 0.24s; }

.section.visible .experience-card:nth-child(4),
.section.visible .project-card:nth-child(4) { animation-delay: 0.32s; }

@keyframes pb-motion-card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* —— Cards —— */
.experience-card,
.project-card,
.education-card,
.cert-card,
.service-card {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease, border-color 0.35s ease;
  will-change: transform;
}

.experience-card:hover,
.project-card:hover,
.education-card:hover,
.cert-card:hover,
.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12);
}

.project-image {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.project-card:hover .project-image {
  transform: scale(1.05);
}

.tech-tag {
  transition: transform 0.2s ease, background 0.2s ease;
}

.tech-tag:hover {
  transform: translateY(-2px);
}

.project-link,
.cert-link {
  transition: color 0.2s ease, transform 0.2s ease;
}

.project-link:hover,
.cert-link:hover {
  transform: translateX(3px);
}

.social-link {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.social-link:hover {
  transform: translateY(-4px) scale(1.08);
}

/* —— Grids —— */
.experience-grid,
.projects-grid,
.education-grid,
.certifications-grid,
.services-grid {
  gap: clamp(1rem, 2.5vw, 1.75rem);
}

/* —— Mobile —— */
@media (max-width: 768px) {
  .section {
    padding: clamp(3rem, 8vw, 4.5rem) 0;
  }

  .hero {
    min-height: auto;
    padding: clamp(5.5rem, 14vw, 7rem) 1.25rem clamp(3rem, 8vw, 4rem);
  }

  .hero h1 {
    font-size: clamp(1.85rem, 7vw, 2.5rem) !important;
    line-height: 1.15;
  }

  .hero-title {
    font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  }

  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-buttons .btn {
    text-align: center;
    width: 100%;
  }

  .nav-menu {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(88vw, 320px);
    height: 100vh;
    height: 100dvh;
    left: auto !important;
    right: -110%;
    flex-direction: column;
    padding: 5rem 1.5rem 2rem !important;
    gap: 0 !important;
    background: color-mix(in srgb, var(--bg-alt, #fff) 94%, transparent) !important;
    backdrop-filter: blur(18px) saturate(160%);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
    transition: right 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
    z-index: 999;
  }

  .nav-menu.active {
    right: 0 !important;
    left: auto !important;
  }

  .nav-menu li {
    padding: 0.85rem 0 !important;
    border-bottom: 1px solid color-mix(in srgb, var(--border, #ddd) 60%, transparent);
  }

  .nav-menu a {
    font-size: 1rem !important;
    display: block;
    padding: 0.25rem 0;
  }

  .nav-toggle {
    display: block !important;
    z-index: 1001;
  }

  .experience-grid,
  .projects-grid,
  .education-grid,
  .certifications-grid,
  .services-grid {
    grid-template-columns: 1fr !important;
  }

  .contact-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .container {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  .experience-card:hover,
  .project-card:hover {
    transform: translateY(-4px);
  }
}

@media (max-width: 480px) {
  .hero-image,
  .hero-image-placeholder {
    width: 140px !important;
    height: 140px !important;
  }

  .section-title {
    font-size: clamp(1.45rem, 6vw, 1.85rem) !important;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .experience-grid,
  .projects-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
