/* ===================================
   Thailand Unveiled - Custom Styles
   =================================== */

/* Smooth scrolling for the entire page */
html {
    scroll-behavior: smooth;
}

/* ===================================
   Flip Card Styles
   =================================== */

.flip-card {
    perspective: 1000px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner,
.flip-card:focus .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Mobile touch support for flip cards */
@media (hover: none) {
    .flip-card.flipped .flip-card-inner {
        transform: rotateY(180deg);
    }
}

/* ===================================
   Parallax Background
   =================================== */

.parallax-bg {
    will-change: transform;
}

/* ===================================
   Scroll Indicator Animation
   =================================== */

.scroll-indicator {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(10px);
        opacity: 0.5;
    }
}

/* ===================================
   Navigation Styles
   =================================== */

#navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

#navbar.scrolled .nav-logo {
    color: #115e59; /* thai-teal-800 */
}

#navbar.scrolled .nav-links {
    color: #115e59;
}

#navbar.scrolled .nav-links a:hover {
    color: #f59e0b; /* thai-gold-500 */
}

/* ===================================
   Custom Animations
   =================================== */

/* Floating animation for decorative elements */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* Pulse glow for buttons/highlights */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(20, 184, 166, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(20, 184, 166, 0.6);
    }
}

.animate-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Fade in up animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Scale in animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

/* ===================================
   Image Lazy Loading
   =================================== */

.lazy-image {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.lazy-image.loaded {
    opacity: 1;
}

/* ===================================
   Region Cards Hover Effects
   =================================== */

.region-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.region-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.region-card img {
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.region-card:hover img {
    transform: scale(1.1);
}

/* ===================================
   Festival Timeline Connector
   =================================== */

.timeline-connector {
    background: linear-gradient(
        to bottom,
        #3b82f6 0%,
        #ec4899 50%,
        #f59e0b 100%
    );
}

/* ===================================
   Food Cards Hover Effect
   =================================== */

.food-card {
    transition: all 0.3s ease;
}

.food-card:hover {
    transform: translateY(-4px);
}

/* ===================================
   Interactive Map Hotspots
   =================================== */

.region-hotspot {
    position: relative;
    width: 24px;
    height: 24px;
    background-color: #14b8a6;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.region-hotspot:hover {
    transform: scale(1.2);
}

.region-hotspot::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid rgba(20, 184, 166, 0.5);
    border-radius: 50%;
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ===================================
   Scroll Progress Bar
   =================================== */

#scroll-progress {
    transform-origin: left;
    transition: width 0.1s ease-out;
}

/* ===================================
   Mobile Menu Animation
   =================================== */

#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#mobile-menu.open {
    max-height: 400px;
}

/* ===================================
   Responsive Adjustments
   =================================== */

/* Reduce animations on mobile for performance */
@media (max-width: 768px) {
    .parallax-bg {
        background-attachment: scroll;
    }

    /* Make flip cards tap-friendly on mobile */
    .flip-card {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Respect 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;
    }

    .flip-card-inner {
        transition: none;
    }

    .flip-card:hover .flip-card-inner {
        transform: none;
    }
}

/* ===================================
   Typography Enhancements
   =================================== */

/* Improve readability of body text */
.leading-relaxed {
    letter-spacing: 0.01em;
}

/* Better heading hierarchy */
h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

/* ===================================
   Focus States for Accessibility
   =================================== */

a:focus-visible,
button:focus-visible {
    outline: 2px solid #14b8a6;
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #115e59;
    color: white;
    padding: 8px 16px;
    z-index: 100;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* ===================================
   Image Loading States
   =================================== */

img {
    max-width: 100%;
    height: auto;
}

/* Prevent layout shift during image load */
img[src] {
    background-color: #e5e7eb;
}

/* ===================================
   Custom Scrollbar (Webkit browsers)
   =================================== */

::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: #14b8a6;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0f766e;
}

/* ===================================
   Print Styles
   =================================== */

@media print {
    .parallax-bg,
    #navbar,
    .scroll-indicator,
    #scroll-progress {
        display: none;
    }

    section {
        page-break-inside: avoid;
    }
}
