/* ========================================
   DigitalNode — Custom Styles
   ======================================== */

/* ---------- Smooth Scroll ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(91, 47, 232, 0.15);
  color: #4F2BD8;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f8fafc;
}
::-webkit-scrollbar-thumb {
  background: #d4c8ff;
  border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover {
  background: #5B2FE8;
}

/* ---------- Navbar ---------- */
#navbar {
  background: transparent;
}
#navbar.scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.06);
}
#navbar.scrolled .nav-link {
  color: #3d3d52;
}
#navbar.scrolled .nav-link:hover,
#navbar.scrolled .nav-link.active {
  color: #5B2FE8;
}

.nav-link {
  color: rgba(255, 255, 255, 0.75);
  position: relative;
  transition: color 0.3s ease;
}
.nav-link:hover,
.nav-link.active {
  color: #ffffff;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: #FFAA2B;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}
#navbar.scrolled .nav-link::after {
  background: #5B2FE8;
}

/* ---------- Hero Grid Background ---------- */
.hero-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ---------- Floating Nodes ---------- */
.node {
  position: absolute;
  border-radius: 50%;
  background: rgba(91, 47, 232, 0.3);
  box-shadow: 0 0 20px rgba(91, 47, 232, 0.2);
}
.node-1 {
  width: 12px; height: 12px;
  top: 20%; left: 10%;
  animation: floatNode 8s ease-in-out infinite;
}
.node-2 {
  width: 8px; height: 8px;
  top: 60%; left: 80%;
  background: rgba(255, 170, 43, 0.4);
  box-shadow: 0 0 20px rgba(255, 170, 43, 0.2);
  animation: floatNode 6s ease-in-out infinite reverse;
}
.node-3 {
  width: 16px; height: 16px;
  top: 30%; left: 70%;
  animation: floatNode 10s ease-in-out infinite 1s;
}
.node-4 {
  width: 6px; height: 6px;
  top: 75%; left: 25%;
  background: rgba(255, 170, 43, 0.3);
  animation: floatNode 7s ease-in-out infinite 2s;
}
.node-5 {
  width: 10px; height: 10px;
  top: 45%; left: 50%;
  animation: floatNode 9s ease-in-out infinite 0.5s;
}

@keyframes floatNode {
  0%, 100% { transform: translateY(0px) translateX(0px); opacity: 0.5; }
  25% { transform: translateY(-20px) translateX(10px); opacity: 1; }
  50% { transform: translateY(-10px) translateX(-10px); opacity: 0.7; }
  75% { transform: translateY(-30px) translateX(5px); opacity: 1; }
}

/* ---------- Hero Card ---------- */
.hero-card {
  animation: floatCard 6s ease-in-out infinite;
}
@keyframes floatCard {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

/* ---------- Code Typing Effect ---------- */
.code-typing p {
  opacity: 0;
  animation: typeIn 0.4s ease forwards;
}
.code-typing p:nth-child(1) { animation-delay: 0.3s; }
.code-typing p:nth-child(2) { animation-delay: 0.6s; }
.code-typing p:nth-child(3) { animation-delay: 0.9s; }
.code-typing p:nth-child(4) { animation-delay: 1.2s; }
.code-typing p:nth-child(5) { animation-delay: 1.5s; }
.code-typing p:nth-child(6) { animation-delay: 1.8s; }
.code-typing p:nth-child(7) { animation-delay: 2.1s; }
.code-typing p:nth-child(8) { animation-delay: 2.4s; }
.code-typing p:nth-child(9) { animation-delay: 2.7s; }
.code-typing p:nth-child(10) { animation-delay: 3.0s; }

@keyframes typeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Custom Animations ---------- */
@keyframes pulse-slow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}
.animate-pulse-slow {
  animation: pulse-slow 6s ease-in-out infinite;
}

@keyframes bounce-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.animate-bounce-slow {
  animation: bounce-slow 3s ease-in-out infinite;
}

/* ---------- Client Logos Carousel ---------- */
.client-logos-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}
.client-logos-track {
  display: flex;
  align-items: center;
  gap: 3rem;
  width: max-content;
  animation: scrollLogos 30s linear infinite;
}
.client-logo {
  height: 80px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.5;
  filter: grayscale(100%);
  transition: opacity 0.4s ease, filter 0.4s ease;
}
.client-logo:hover {
  opacity: 1;
  filter: grayscale(0%);
}

@keyframes scrollLogos {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Pause on hover */
.client-logos-wrapper:hover .client-logos-track {
  animation-play-state: paused;
}

/* ---------- Service Cards ---------- */
.service-card {
  position: relative;
  overflow: hidden;
}
.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #5B2FE8, #FFAA2B);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
}
.service-card:hover::before {
  transform: scaleX(1);
}
.service-card:hover {
  transform: translateY(-4px);
}

/* ---------- Portfolio Items ---------- */
.portfolio-item {
  cursor: pointer;
}
.portfolio-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(91, 47, 232, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.portfolio-item:hover::after {
  opacity: 1;
}

/* ---------- Project Detail Modal ---------- */
.project-modal {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.project-modal.active {
  opacity: 1;
  visibility: visible;
}
/* .hidden is managed by JS for initial state (Tailwind hidden = display:none) */
.project-modal__backdrop {
  transition: opacity 0.35s ease;
}
.project-modal__content {
  transform: translateY(30px) scale(0.97);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}
.project-modal.active .project-modal__content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Modal body scrollbar */
.project-modal__content ::-webkit-scrollbar {
  width: 5px;
}
.project-modal__content ::-webkit-scrollbar-track {
  background: transparent;
}
.project-modal__content ::-webkit-scrollbar-thumb {
  background: #d4c8ff;
  border-radius: 100px;
}

/* ---------- Image Carousel ---------- */
#modal-carousel {
  aspect-ratio: 16 / 9;
}
.carousel-slide img {
  display: block;
}
#carousel-prev:hover,
#carousel-next:hover {
  transform: translateY(-50%) scale(1.08);
}
#carousel-prev:active,
#carousel-next:active {
  transform: translateY(-50%) scale(0.95);
}

/* Portfolio item hover hint */
.portfolio-item[data-project] {
  transition: transform 0.3s ease;
}
.portfolio-item[data-project]:hover {
  transform: scale(1.02);
}

/* ---------- Portfolio Skeleton ---------- */
.portfolio-skeleton {
  background: linear-gradient(110deg, #f0f0f5 30%, #e8e8f0 50%, #f0f0f5 70%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Counter Animation ---------- */
.counter {
  display: inline-block;
}

/* ---------- Back to Top ---------- */
#back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

/* ---------- Form Focus Effects ---------- */
input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 4px rgba(91, 47, 232, 0.1);
}

/* ---------- Responsive Fine-tuning ---------- */
@media (max-width: 768px) {
  .hero-card {
    animation: none;
  }
  .node {
    display: none;
  }
}

/* ---------- Notification Popup ---------- */
.notification-popup {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.notification-popup::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.notification-popup.active {
  opacity: 1;
  visibility: visible;
}
.notification-popup__card {
  position: relative;
  background: #fff;
  border-radius: 1.5rem;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.notification-popup.active .notification-popup__card {
  transform: translateY(0) scale(1);
}
.notification-popup__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.notification-popup__icon--success {
  background: #ecfdf5;
  color: #16a34a;
}
.notification-popup__icon--error {
  background: #fef2f2;
  color: #dc2626;
}
.notification-popup__icon--cooldown {
  background: #fff7ed;
  color: #ea580c;
}

/* ---------- Blog Cards ---------- */
.blog-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.blog-card:hover {
  transform: translateY(-4px);
}

/* Line clamp utility */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Article Content (Prose) ---------- */
.article-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1A1A2E;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}
.article-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1A1A2E;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}
.article-content p {
  color: #475569;
  line-height: 1.85;
  margin-bottom: 1.25rem;
}
.article-content a {
  color: #5B2FE8;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}
.article-content a:hover {
  color: #4F2BD8;
}
.article-content strong {
  color: #1e293b;
  font-weight: 700;
}
.article-content ul,
.article-content ol {
  margin: 1.25rem 0;
  padding-left: 1.5rem;
  color: #475569;
}
.article-content ul {
  list-style-type: disc;
}
.article-content ol {
  list-style-type: decimal;
}
.article-content li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
}
.article-content code {
  background: #f3f0ff;
  color: #5B2FE8;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}
.article-content blockquote {
  border-left: 4px solid #5B2FE8;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: #f8fafc;
  border-radius: 0 0.75rem 0.75rem 0;
  color: #334155;
  font-style: italic;
}
.article-content img {
  border-radius: 1rem;
  margin: 1.5rem 0;
}

/* ---------- Blog Skeleton ---------- */
.blog-skeleton {
  background: linear-gradient(110deg, #f0f0f5 30%, #e8e8f0 50%, #f0f0f5 70%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
}

/* ---------- Loading Animation ---------- */
.page-loader {
  position: fixed;
  inset: 0;
  background: #1A1A2E;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(91, 47, 232, 0.2);
  border-top-color: #5B2FE8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
