/* =========================================================================
   Frontend enhancements: animated hamburger + mobile menu, contact success
   animation, copy toast, and project detail modal.
   ========================================================================= */

/* --- Animated hamburger (turns into an X) -------------------------------- */
.hamburger span {
  transform-origin: center;
}
.hamburger.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* --- Mobile slide-in menu polish ----------------------------------------- */
@media (max-width: 768px) {
  .nav-menu {
    background: rgba(8, 6, 20, 0.82);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.65);
    gap: 0.35rem;
    row-gap: 0.35rem;
  }
  .nav-menu li {
    opacity: 0;
    transform: translateX(-18px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .nav-menu.active li {
    opacity: 1;
    transform: translateX(0);
  }
  .nav-menu.active li:nth-child(1) { transition-delay: 0.06s; }
  .nav-menu.active li:nth-child(2) { transition-delay: 0.10s; }
  .nav-menu.active li:nth-child(3) { transition-delay: 0.14s; }
  .nav-menu.active li:nth-child(4) { transition-delay: 0.18s; }
  .nav-menu.active li:nth-child(5) { transition-delay: 0.22s; }
  .nav-menu.active li:nth-child(6) { transition-delay: 0.26s; }
  .nav-menu.active li:nth-child(7) { transition-delay: 0.30s; }
  .nav-menu .nav-link {
    justify-content: center;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    transition: background 0.2s ease;
  }
  .nav-menu .nav-link:hover {
    background: rgba(108, 76, 255, 0.18);
  }
}

/* --- Contact form success animation (drawn checkmark) -------------------- */
.form-feedback-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}
.form-feedback-success.is-hidden {
  display: none;
}
.success-check {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.success-check-circle {
  stroke: #22c55e;
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: success-circle 0.5s ease forwards;
}
.success-check-mark {
  stroke: #22c55e;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: success-mark 0.3s 0.45s ease forwards;
}
@keyframes success-circle { to { stroke-dashoffset: 0; } }
@keyframes success-mark { to { stroke-dashoffset: 0; } }

/* --- Copy Email button + toast ------------------------------------------- */
button.contact-action-btn {
  font: inherit;
  cursor: pointer;
}
.contact-copy-btn.copied {
  border-color: rgba(34, 197, 94, 0.6);
  color: #22c55e;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 24px);
  background: rgba(8, 6, 20, 0.92);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  color: #fff;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 38px -8px rgba(0, 0, 0, 0.6);
  font-weight: 600;
  font-size: 0.98rem;
  z-index: 10050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --- Project detail modal ------------------------------------------------ */
.project-card {
  cursor: pointer;
}

.project-modal {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.project-modal.open {
  opacity: 1;
  visibility: visible;
}
.project-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 2, 10, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.project-modal-card {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-secondary, #0b0b12);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.3s ease;
}
.project-modal.open .project-modal-card {
  transform: translateY(0) scale(1);
}
.project-modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  z-index: 2;
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}
.project-modal-close:hover {
  background: rgba(108, 76, 255, 0.75);
  transform: rotate(90deg);
}
.project-modal-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(135deg, #111111 0%, #52525b 100%);
}
.project-modal-media.is-empty {
  display: none;
}
.project-modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-modal-body {
  padding: 1.6rem 1.8rem 2rem;
}
.project-modal-body h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 0.6rem;
}
.project-modal-body p {
  color: var(--text-secondary);
  margin-bottom: 1.1rem;
  line-height: 1.7;
}
.project-modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.project-modal-tech span {
  font-size: 0.85rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(108, 76, 255, 0.16);
  border: 1px solid rgba(108, 76, 255, 0.35);
  color: #c4b5fd;
}
body.modal-open {
  overflow: hidden;
}

/* --- Respect reduced motion ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .success-check-circle,
  .success-check-mark {
    animation: none;
    stroke-dashoffset: 0;
  }
  .nav-menu li,
  .project-modal-card,
  .toast {
    transition: none;
  }
}
