/* Custom CSS for Ary Setya P. Portfolio */

:root {
   --font-inter-tight: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base Styles */
* {
   scroll-behavior: smooth;
}

body {
   font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
   line-height: 1.6;
}

/* Navigation Styles */
.nav-link {
   position: relative;
   color: #374151;
   text-decoration: none;
   font-weight: 500;
   transition: color 0.3s ease;
   padding: 0.5rem 0;
}

.nav-link:hover {
   color: #2563eb;
}

.nav-link.active {
   color: #2563eb;
}

.nav-link::after {
   content: '';
   position: absolute;
   width: 0;
   height: 2px;
   bottom: 0;
   left: 0;
   background-color: #2563eb;
   transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
   width: 100%;
}

.mobile-nav-link {
   color: #374151;
   text-decoration: none;
   font-size: 1.25rem;
   font-weight: 500;
   transition: color 0.3s ease;
}

.mobile-nav-link:hover {
   color: #2563eb;
}

/* Header Transparency Effect */
#header.scrolled {
   background: rgba(255, 255, 255, 0.95);
   backdrop-filter: blur(10px);
   -webkit-backdrop-filter: blur(10px);
   box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Typewriter Vertical Rotate Animation */
#rotating-text {
   display: inline-block;
   min-height: 1.5em;
   position: relative;
   font-family: var(--font-inter-tight);
   color: #ffffff;
   border-right: 2px solid rgba(255, 255, 255, 0.8);
   animation: blink-caret 1s infinite;
   transition: all 0.3s ease;
}

/* Typewriter cursor blinking effect */
@keyframes blink-caret {

   from,
   to {
      border-color: rgba(255, 255, 255, 0.8);
   }

   50% {
      border-color: transparent;
   }
}

/* Smooth bounce effect for letters */
@keyframes letterBounce {

   0%,
   100% {
      transform: translateY(0) rotateX(0deg) scale(1);
   }

   50% {
      transform: translateY(-8px) rotateX(2deg) scale(1.05);
   }
}

.letter.bounce {
   animation: letterBounce 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Smooth pulse effect for emphasis */
@keyframes letterPulse {

   0%,
   100% {
      transform: scale(1);
      text-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
   }

   50% {
      transform: scale(1.08);
      text-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
   }
}

.letter.pulse {
   animation: letterPulse 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* Tech Stack Marquee Animation */
@keyframes marquee {
   0% {
      transform: translateX(0);
   }

   100% {
      transform: translateX(-50%);
   }
}

.animate-marquee {
   animation: marquee 20s linear infinite;
   animation-play-state: running;
}

.animate-marquee:hover {
   animation-play-state: paused;
}

/* Ensure marquee animation works */
#tech-stack-carousel {
   animation: marquee 20s linear infinite;
}

#tech-stack-carousel:hover {
   animation-play-state: paused;
}

/* Tech Stack Item Styles */
.tech-item {
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   margin: 0 2rem;
   min-width: 120px;
   padding: 1rem;
   transition: transform 0.3s ease, filter 0.3s ease;
}

.tech-item:hover {
   transform: translateY(-5px) scale(1.05);
   filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
}

.tech-logo {
   width: 64px;
   height: 64px;
   margin-bottom: 0.5rem;
   transition: all 0.3s ease;
}

.tech-item:hover .tech-logo {
   transform: rotate(5deg) scale(1.1);
}

.tech-item span {
   font-size: 0.875rem;
   font-weight: 600;
   color: #374151;
   text-align: center;
   white-space: nowrap;
   opacity: 0.8;
   transition: opacity 0.3s ease;
}

.tech-item:hover span {
   opacity: 1;
   color: #2563eb;
}

/* Fade In Animation */
.fade-in {
   opacity: 0;
   transform: translateY(30px);
   transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
   opacity: 1;
   transform: translateY(0);
}

/* Staggered Animation for Lists */
.fade-in:nth-child(1) {
   transition-delay: 0.1s;
}

.fade-in:nth-child(2) {
   transition-delay: 0.2s;
}

.fade-in:nth-child(3) {
   transition-delay: 0.3s;
}

.fade-in:nth-child(4) {
   transition-delay: 0.4s;
}

.fade-in:nth-child(5) {
   transition-delay: 0.5s;
}

/* Hero Section Enhancements */
#home {
   position: relative;
   background: linear-gradient(135deg, #f59e42 0%, #fbbf24 50%, #f97316 100%);
   /* Orange-yellow gradient: fresh, energetic, and warm */
   background-size: cover;
   background-position: center;
}

#home::before {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: linear-gradient(45deg, rgba(251, 191, 36, 0.12), rgba(249, 115, 22, 0.12));
   z-index: 1;
}

#home .container {
   position: relative;
   z-index: 2;
}

/* Video Optimization Styles */
#hero-video {
   will-change: opacity;
   backface-visibility: hidden;
   transform: translateZ(0);
}

/* Video loading states */
#hero-video[data-loading="true"] {
   opacity: 0;
}

#hero-video[data-loaded="true"] {
   opacity: 1;
}

/* Play button styles */
.video-play-button {
   backdrop-filter: blur(10px);
   -webkit-backdrop-filter: blur(10px);
   transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-play-button:hover {
   transform: scale(1.05);
   backdrop-filter: blur(15px);
   -webkit-backdrop-filter: blur(15px);
}

.video-play-button:active {
   transform: scale(0.95);
}

/* Button Hover Effects */
.btn-primary {
   background: linear-gradient(135deg, #2563eb, #3b82f6);
   transition: all 0.3s ease;
   position: relative;
   overflow: hidden;
}

.btn-primary::before {
   content: '';
   position: absolute;
   top: 0;
   left: -100%;
   width: 100%;
   height: 100%;
   background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
   transition: left 0.5s;
}

.btn-primary:hover::before {
   left: 100%;
}

/* Card Hover Effects */
.project-card {
   transition: transform 0.3s ease, box-shadow 0.3s ease;
   cursor: pointer;
}

.project-card:hover {
   transform: translateY(-5px);
   box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.project-card:focus {
   outline: 2px solid #2563eb;
   outline-offset: 2px;
   transform: translateY(-2px);
}

/* Image overlay effects */
.project-card .relative::after {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(59, 130, 246, 0.1));
   opacity: 0;
   transition: opacity 0.3s ease;
   pointer-events: none;
}

.project-card:hover .relative::after {
   opacity: 1;
}

/* Section Dividers */
.section-divider {
   position: relative;
   overflow: hidden;
}

.section-divider::before {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   height: 1px;
   background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

/* Loading Animation */
.loading-spinner {
   display: inline-block;
   width: 20px;
   height: 20px;
   border: 3px solid rgba(255, 255, 255, 0.3);
   border-radius: 50%;
   border-top-color: #fff;
   animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
   to {
      transform: rotate(360deg);
   }
}

/* Responsive Design */
@media (max-width: 768px) {
   .rotating-text-item {
      font-size: 1.5rem;
   }

   #home h1 {
      font-size: 2.5rem;
   }

   .nav-link::after {
      display: none;
   }

   /* Reduce letter animation complexity on tablets */
   .letter {
      transition-duration: 0.4s;
   }

   .letter:nth-child(n+10) {
      transition-delay: 0.3s;
   }

   /* Tech stack mobile adjustments */
   .tech-item {
      margin: 0 1rem;
      min-width: 90px;
      padding: 0.75rem;
   }

   /* Video optimizations for tablets */
   #hero-video {
      object-position: center center;
   }
}

@media (max-width: 640px) {
   .container {
      padding-left: 1rem;
      padding-right: 1rem;
   }

   #home h1 {
      font-size: 2rem;
   }

   .rotating-text-item {
      font-size: 1.25rem;
   }

   /* Optimized animations for mobile */
   .letter {
      transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
      transform: translateY(-30px) rotateX(-20deg);
      will-change: transform, opacity;
   }

   .letter.letter-in {
      transform: translateY(0) rotateX(0deg);
      transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
   }

   .letter.letter-out {
      transform: translateY(25px) rotateX(15deg) scale(0.95);
      transition: all 0.2s cubic-bezier(0.55, 0.085, 0.68, 0.53);
   }

   .letter.letter-behind {
      transform: translateY(-8px) scale(0.92);
      filter: blur(0.5px);
      transition: all 0.2s ease-out;
   }

   /* Reduce stagger delays for mobile */
   .letter:nth-child(1) {
      transition-delay: 0.03s;
   }

   .letter:nth-child(2) {
      transition-delay: 0.06s;
   }

   .letter:nth-child(3) {
      transition-delay: 0.09s;
   }

   .letter:nth-child(4) {
      transition-delay: 0.12s;
   }

   .letter:nth-child(5) {
      transition-delay: 0.15s;
   }

   .letter:nth-child(6) {
      transition-delay: 0.18s;
   }

   .letter:nth-child(7) {
      transition-delay: 0.21s;
   }

   .letter:nth-child(8) {
      transition-delay: 0.24s;
   }

   .letter:nth-child(9) {
      transition-delay: 0.27s;
   }

   .letter:nth-child(10) {
      transition-delay: 0.3s;
   }

   .letter:nth-child(n+11) {
      transition-delay: 0.3s;
   }

   /* Disable hover effects on mobile */
   .letter.letter-in:hover::before {
      opacity: 0;
      transform: scale(1);
   }

   /* Tech stack mobile - smaller spacing */
   .tech-item {
      margin: 0 0.5rem;
      min-width: 80px;
      padding: 0.5rem;
   }

   .tech-logo {
      width: 48px;
      height: 48px;
   }

   .tech-item span {
      font-size: 0.75rem;
   }

   /* Mobile video optimizations */
   #hero-video {
      /* Reduce video quality on mobile for better performance */
      filter: contrast(0.9) brightness(1.1);
      object-position: center center;
   }

   /* Ensure fallback background works well on mobile */
   #home {
      min-height: 100vh;
      min-height: 100dvh;
      /* Dynamic viewport height for mobile */
   }

   /* Play button mobile optimizations */
   .video-play-button {
      touch-action: manipulation;
   }

   .video-play-button svg {
      width: 3rem;
      height: 3rem;
   }
}

@media (max-width: 480px) {
   .rotating-text-item {
      font-size: 1.1rem;
   }

   #home h1 {
      font-size: 1.75rem;
   }

   /* Further simplify for very small screens */
   .letter {
      transition-duration: 0.2s;
   }

   .letter:nth-child(n+8) {
      transition-delay: 0.2s;
   }

   /* Tech stack very small mobile - even tighter spacing */
   .tech-item {
      margin: 0 0.25rem;
      min-width: 70px;
      padding: 0.375rem;
   }

   .tech-logo {
      width: 40px;
      height: 40px;
   }

   .tech-item span {
      font-size: 0.7rem;
   }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
   .nav-link {
      color: #f3f4f6;
   }

   .nav-link:hover {
      color: #60a5fa;
   }

   #header.scrolled {
      background: rgba(17, 24, 39, 0.95);
   }
}

/* Print Styles */
@media print {

   .fixed,
   #mobile-menu,
   video {
      display: none !important;
   }

   body {
      font-size: 12pt;
      line-height: 1.4;
   }

   .container {
      max-width: none;
      padding: 0;
   }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {

   *,
   *::before,
   *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
   }
}

/* Focus Styles */
.nav-link:focus,
button:focus,
a:focus {
   outline: 2px solid #2563eb;
   outline-offset: 2px;
}

/* Remove outline/border for scroll down icon */
.scroll-down-icon {
   outline: none !important;
   border: none !important;
   -webkit-tap-highlight-color: transparent;
   -webkit-touch-callout: none;
   -webkit-user-select: none;
   -khtml-user-select: none;
   -moz-user-select: none;
   -ms-user-select: none;
   user-select: none;
}

.scroll-down-icon:focus,
.scroll-down-icon:active,
.scroll-down-icon:hover {
   outline: none !important;
   border: none !important;
   box-shadow: none !important;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
   .nav-link {
      color: #000;
   }

   .nav-link:hover {
      color: #0000ff;
   }

   .bg-blue-600 {
      background-color: #0000ff !important;
   }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
   width: 8px;
}

::-webkit-scrollbar-track {
   background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
   background: #cbd5e1;
   border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
   background: #94a3b8;
}

/* Selection Styles */
::selection {
   background-color: #2563eb;
   color: white;
}

::-moz-selection {
   background-color: #2563eb;
   color: white;
}