/* Refined Custom CSS for Haokai Tan's Portfolio */

/* CSS Variables for consistency */
:root {
  /* Transitions */
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(164, 118, 255, 0.15);
  
  /* Spacing */
  --spacing-section: 5rem;
  --spacing-container: 2rem;
}

/* Base styles */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Smooth scroll behavior with offset for fixed header */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

/* Enhanced custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #0A0A0A;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #A476FF, #8A5ADF);
  border-radius: 5px;
  border: 2px solid #0A0A0A;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #BB99FF, #A476FF);
}

/* Selection styles */
::selection {
  background: #A476FF;
  color: #0A0A0A;
}

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid #A476FF;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Typography enhancements */
.prose {
  line-height: 1.75;
  letter-spacing: -0.01em;
}

/* Refined animations */
@keyframes fadeIn {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInRight {
  from { 
    opacity: 0;
    transform: translateX(30px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulseSubtle {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.02); opacity: 0.9; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

/* Animation utilities */
.animate-fade-in {
  animation: fadeIn 0.6s var(--transition-base) both;
}

.animate-slide-up {
  animation: slideUp 0.6s var(--transition-base) both;
}

.animate-gradient {
  background-size: 300% 300%;
  animation: gradient 6s ease infinite;
}

/* Stagger animations */
.stagger-animation > * {
  opacity: 0;
  animation: fadeIn 0.6s var(--transition-base) forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }

/* Enhanced hover effects */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Glassmorphism effect */
.glass {
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced button styles */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.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 */
.card-hover {
  transition: all var(--transition-base);
  position: relative;
}

.card-hover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(164, 118, 255, 0.1), transparent 40%);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
  z-index: 1;
}

.card-hover:hover::before {
  opacity: 1;
}

/* Refined nav indicator */
.nav-indicator {
  transition: all var(--transition-base);
  box-shadow: 0 0 10px rgba(169, 255, 91, 0.5);
}

.nav-indicator.active {
  opacity: 1;
  transform: scale(1.2);
}

/* Text animations */
.text-reveal {
  position: relative;
  overflow: hidden;
}

.text-reveal::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0A0A0A;
  transform: translateX(-100%);
  animation: reveal 0.8s var(--transition-base) forwards;
}

@keyframes reveal {
  to { transform: translateX(100%); }
}

/* Smooth accordion transitions */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow), opacity var(--transition-base);
  opacity: 0;
}

.accordion-content:not(.hidden) {
  max-height: 500px;
  opacity: 1;
}

.accordion-arrow {
  transition: transform var(--transition-base);
}

/* Enhanced scroll animations */
.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s var(--transition-base);
}

.scroll-animate.animate {
  opacity: 1;
  transform: translateY(0);
}

/* Parallax effect */
.parallax {
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Magnetic button effect */
.magnetic {
  transition: transform 0.3s var(--transition-spring);
}

/* Noise texture overlay */
.noise-bg::before {
  content: '';
  position: absolute;
  inset: -50%;
  background-image: 
    repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255, 255, 255, 0.01) 35px, rgba(255, 255, 255, 0.01) 70px),
    repeating-linear-gradient(-45deg, transparent, transparent 35px, rgba(255, 255, 255, 0.01) 35px, rgba(255, 255, 255, 0.01) 70px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}

/* Improved gradient borders */
.gradient-border {
  position: relative;
  background: #141414;
  border-radius: 1rem;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(45deg, #A476FF, #BB99FF, #A476FF);
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.gradient-border:hover::before {
  opacity: 1;
}

/* Loading states */
.skeleton {
  background: linear-gradient(90deg, #1A1A1A 25%, #242424 50%, #1A1A1A 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Refined blob animation */
.blob {
  border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
  animation: morph 15s ease-in-out infinite;
  transform-origin: center;
  will-change: border-radius;
}

@keyframes morph {
  0%, 100% { border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%; }
  25% { border-radius: 48% 52% 68% 32% / 42% 58% 42% 58%; }
  50% { border-radius: 52% 48% 48% 52% / 48% 52% 52% 48%; }
  75% { border-radius: 58% 42% 52% 48% / 52% 48% 48% 52%; }
}

/* Scroll to top button */
#scroll-to-top {
  transition: opacity var(--transition-base), transform var(--transition-base);
}

#scroll-to-top.show {
  opacity: 1;
  transform: translateY(0);
}

#scroll-to-top:not(.show) {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* Performance optimizations */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* Responsive typography */
@media (max-width: 768px) {
  :root {
    --spacing-section: 3rem;
    --spacing-container: 1.5rem;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus trap for modals */
.focus-trap:focus {
  outline: none;
}

/* Reduced motion preferences */
@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;
  }
}

/* Dark mode adjustments (for future implementation) */
@media (prefers-color-scheme: light) {
  /* Light mode overrides if needed */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :focus-visible {
    outline-width: 3px;
  }
  
  .btn-primary {
    border: 2px solid currentColor;
  }
}

/* Advanced Tech Stack Marquee */
.tech-stack-marquee {
  position: relative;
  width: 100%;
  overflow: hidden;
  height: 120px;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-track {
  display: flex;
  width: 100%;
  height: 100%;
}

.marquee-content {
  display: flex;
  gap: 3rem;
  padding-right: 3rem;
  animation: scroll-marquee 40s linear infinite;
  will-change: transform;
}

.tech-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 120px;
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tech-item:hover {
  transform: translateY(-5px) scale(1.05);
}

.tech-item i,
.tech-item svg {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tech-item:hover i,
.tech-item:hover svg {
  filter: drop-shadow(0 4px 12px currentColor);
}

@keyframes scroll-marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* Pause on hover */
.tech-stack-marquee:hover .marquee-content {
  animation-play-state: paused;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tech-stack-marquee {
    height: 100px;
  }
  
  .tech-item {
    min-width: 100px;
    padding: 0.75rem;
  }
  
  .tech-item i,
  .tech-item svg {
    font-size: 2rem !important;
    width: 2rem !important;
    height: 2rem !important;
  }
  
  .marquee-content {
    gap: 2rem;
    padding-right: 2rem;
    animation-duration: 30s;
  }
}

/* Performance optimization for marquee */
@media (prefers-reduced-motion: reduce) {
  .marquee-content {
    animation: none;
    transform: none;
  }
}

/* Animated Gradient Text - Inspired by ReactBits */
.animated-gradient-text {
  background: linear-gradient(
    to right,
    #A476FF,
    #BB99FF,
    #A9FF5B,
    #61DAFB,
    #A476FF
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(164, 118, 255, 0.3));
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
}

/* Enhanced gradient text hover effect */
.animated-gradient-text:hover {
  filter: drop-shadow(0 0 30px rgba(164, 118, 255, 0.5));
  animation-duration: 1.5s;
}

/* Custom CSS for styles not achievable with Tailwind alone */

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Adjust this value based on your fixed header's height */
}

/* Custom scrollbar for a elegant themed look */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #1A1A1A; /* Or your hk-dark color */
}
::-webkit-scrollbar-thumb {
    background: #A476FF; /* Or your hk-accent color */
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #BB99FF; /* Or your hk-accent-hover color */
}

/* Blinking cursor animation for typing effect */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.blinking-cursor::after {
    content: '_';
    animation: blink 1s step-end infinite;
}

/* Shiny text effect - inspired by ReactBits */
.shiny-text {
  position: relative;
  color: #A476FF; /* Base accent color */
  background: linear-gradient(
    120deg,
    #A476FF 0%,
    #A476FF 40%,
    #F5F5F5 50%, /* White shine */
    #A476FF 60%,
    #A476FF 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  animation: shine 3s linear infinite;
}

.shiny-text:hover {
  animation-duration: 1.5s;
}

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

/* React Bits Inspired Animations 
 * Inspired by: https://github.com/DavidHDev/react-bits
 */

/* Core animation keyframes with consistent timing functions */
@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(5px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from { 
    transform: translateX(30px);
    opacity: 0;
  }
  to { 
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from { 
    transform: translateX(-30px);
    opacity: 0;
  }
  to { 
    transform: translateX(0);
    opacity: 1;
  }
}

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

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); } /* More subtle pulse */
  100% { transform: scale(1); }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); } /* Less extreme floating */
  100% { transform: translateY(0px); }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

@keyframes morph {
  0% {
    border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
  }
  25% {
    border-radius: 45% 55% 65% 35% / 50% 40% 60% 50%;
  }
  50% {
    border-radius: 50% 50% 55% 45% / 55% 45% 55% 45%;
  }
  75% {
    border-radius: 55% 45% 57% 43% / 45% 55% 45% 55%;
  }
  100% {
    border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
  }
}

/* Consistent animation utility classes */
.animate-fade-in {
  animation: fadeIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.animate-slide-right {
  animation: slideInRight 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.animate-slide-left {
  animation: slideInLeft 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.animate-slide-up {
  animation: slideInUp 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.animate-pulse {
  animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-float {
  animation: float 3.5s ease-in-out infinite;
}

/* Stagger animations with elegantly spaced delays */
.stagger-animation > * {
  opacity: 0;
  animation-fill-mode: forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Shimmer effect - subtle and elegant */
.shimmer-effect {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.08) 50%, /* More subtle shimmer */
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2.5s infinite linear;
}

/* 3D Card Tilt Effect - more elegant with subtle depth */
.tilt-card {
  transition: var(--standard-transition);
  transform-style: preserve-3d;
  perspective: 1000px;
  will-change: transform;
}

.tilt-card:hover {
  transform: var(--hover-translate) rotateX(2deg) rotateY(2deg);
  box-shadow: var(--hover-shadow);
}

/* Glow on Hover - subtle and refined */
.hover-glow {
  transition: var(--standard-transition);
}

.hover-glow:hover {
  transform: var(--hover-translate);
  box-shadow: 0 0 12px rgba(164, 118, 255, 0.3);
}

/* Interactive Blob - organic morphing effect */
.blob {
  border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
  animation: morph 8s ease-in-out infinite alternate;
  transform-style: preserve-3d;
  transition: all 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: border-radius;
}

/* Typing Animation - elegant with proper timing */
.typing-animation {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid #A476FF;
  animation: blink 0.75s step-end infinite;
}

/* Scroll-triggered animations - unified smooth reveal */
.scroll-animate {
  opacity: 0;
  transform: translateY(15px); /* Reduced movement for subtlety */
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

.scroll-animate.animate {
  opacity: 1;
  transform: translateY(0);
}

/* Particle background effect - subtle floating elements */
.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(164, 118, 255, 0.15); /* More subtle particles */
  pointer-events: none;
  will-change: transform;
}

/* Gradient Text Animation - smoother color flow */
.gradient-text {
  background: linear-gradient(90deg, #A476FF, #49FF68, #FF49A4, #A476FF);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textGradientAnimation 7s ease infinite; /* Slower for elegance */
}

/* Service Tab Active State - ensure it overrides hover effects directly if needed */
.service-tab-active {
    /* background-color: #A476FF !important; /* Example: Use your hk-accent */
    /* color: #101010 !important;      /* Example: Use your hk-dark */
    /* These are now handled by adding/removing Tailwind classes directly in JS */
}

/* Fix for sticky service tabs sidebar potentially overlapping header on jump */
#services .sticky {
    top: 80px; /* Adjust based on your fixed header height */
}

/* Blinking cursor for the simulated terminal text (if needed and not handled by JS directly) */
.blinking-cursor::after {
    content: '_';
    animation: blink 1s step-end infinite;
}

/* LetterGlitch Canvas specific styling if needed */
#letter-glitch-canvas {
    /* letter-spacing: 4px; /* Not directly applicable to canvas text like this */
    /* font-family: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace; /* Set in JS */
}

/* Radial Gradient Cards */
.radial-card {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.radial-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(164, 118, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.5s ease;
}

.radial-card:hover::before {
  opacity: 1;
}

/* Custom Animated Cursor */
.custom-cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  border: 2px solid #A476FF;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 9999;
  transition: width 0.3s, height 0.3s, border-color 0.3s;
}

.custom-cursor-dot {
  position: fixed;
  width: 4px;
  height: 4px;
  background-color: #A476FF;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 10000;
  transition: transform 0.1s;
}

/* Custom Magnetic Effect */
.magnetic {
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Background Noise */
.noise-bg {
  position: relative;
  overflow: hidden;
}

.noise-bg::before {
  content: '';
  position: absolute;
  top: -10rem;
  left: -10rem;
  right: -10rem;
  bottom: -10rem;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23a)' opacity='.1'/%3E%3C/svg%3E");
  opacity: 0.05;
  z-index: -1;
  pointer-events: none;
}

/* Define a standard interactive transition
 * This makes all hover/focus interactions consistent across the site
 */
:root {
  --standard-transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  --hover-translate: translateY(-2px);
  --hover-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Hide scrollbar for Chrome, Safari and Opera */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.scrollbar-hide {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

/* Instagram Widget Centering */
.instagram-embed-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Force Elfsight widget to center */
.elfsight-app-b2100776-abed-4fa6-8239-1dc32c441098 {
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
}

/* Mobile Optimization Styles - Added for better phone readability */
@media (max-width: 640px) {
  /* Typography adjustments */
  html {
    font-size: 14px;
    scroll-padding-top: 60px;
  }
  
  /* Section spacing */
  section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }
  
  /* Header adjustments */
  header nav {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  
  /* Hero section mobile optimizations */
  #hero {
    min-height: auto;
    padding-top: 5rem !important;
  }
  
  /* Button touch targets */
  button, a.inline-flex {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Form input improvements */
  input, textarea, select {
    font-size: 16px !important; /* Prevents zoom on iOS */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
  
  /* Project cards */
  .group.relative.bg-hk-dark-secondary\/50 {
    margin-bottom: 1rem;
  }
  
  /* Line clamp for mobile */
  .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  /* Tech stack marquee mobile */
  .tech-stack-marquee {
    height: 80px;
  }
  
  .tech-item {
    min-width: 80px;
    padding: 0.5rem;
  }
  
  .tech-item i,
  .tech-item svg {
    font-size: 1.5rem !important;
    width: 1.5rem !important;
    height: 1.5rem !important;
  }
  
  /* Instagram feed mobile */
  .instagram-embed-container {
    padding: 0 !important;
    margin: 0 -1rem;
  }
  
  /* Footer Spotify embed */
  footer iframe {
    height: 152px !important;
  }
  
  /* Accordion improvements */
  .accordion-header {
    padding: 1rem !important;
  }
  
  .accordion-content {
    max-height: 600px;
  }
  
  /* Canvas height on mobile */
  #letter-glitch-services-container {
    max-height: 250px;
  }
  
  /* Contact form mobile */
  .contact-form input,
  .contact-form textarea {
    padding: 0.75rem !important;
  }
  
  /* Prevent horizontal scroll */
  body {
    overflow-x: hidden;
  }
  
  /* Particle effects mobile */
  .particle {
    display: none;
  }
  
  /* Reduce animations on mobile for performance */
  .blob,
  .shimmer-effect {
    animation: none;
  }
}

/* Extra small devices */
@media (max-width: 475px) {
  /* Even smaller font adjustments */
  html {
    font-size: 13px;
  }
  
  /* Tighter padding */
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Stack all grid layouts */
  .grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Full width buttons on very small screens */
  .inline-flex {
    width: 100% !important;
    justify-content: center !important;
  }
  
  /* Smaller tech badges */
  .shiny-text {
    font-size: 0.625rem !important;
    padding: 0.25rem 0.5rem !important;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .hover\:scale-105:hover {
    transform: none !important;
  }
  
  .hover\:bg-hk-accent:hover {
    background-color: transparent !important;
  }
  
  /* Increase tap targets */
  a, button {
    padding: 0.75rem !important;
  }
  
  /* Disable parallax on mobile */
  .parallax {
    transform: none !important;
  }
}

/* Landscape mobile optimization */
@media (max-height: 600px) and (orientation: landscape) {
  #hero {
    min-height: auto;
    padding-top: 4rem;
    padding-bottom: 2rem;
  }
  
  .min-h-screen {
    min-height: auto !important;
  }
}

/* Additional mobile fixes */
@media (max-width: 768px) {
  /* Fix overflow issues */
  * {
    max-width: 100vw;
  }
  
  /* Elfsight widget mobile fix */
  .elfsight-app-b2100776-abed-4fa6-8239-1dc32c441098 {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  
  /* Prevent horizontal scrolling from Instagram widget */
  #instagram {
    overflow-x: hidden;
  }
} 