/* CSS Variables */
:root {
    --primary-color: #027353;
    --secondary-color: #80B9BF;
    --primary-background: #FAE9E5;
    --secondary-background: #F2B077;
    --tertiary-background: #D99873;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-light: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --shadow-medium: 0 15px 35px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Performance optimizations */
html {
    scroll-behavior: smooth;
}

/* Smooth scrolling */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #FAE9E5 0%, #F2B077 25%, #80B9BF 50%, #027353 75%, #D99873 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    position: relative;
    font-display: swap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .main-container {
        box-shadow: none;
        background: white;
    }
    
    .content-wrapper {
        background: white;
        backdrop-filter: none;
        border: 1px solid black;
    }
}

/* Main body styles are defined above with performance optimizations */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 25% 25%, rgba(242, 176, 119, 0.3) 0%, transparent 40%),
        radial-gradient(circle at 75% 75%, rgba(128, 185, 191, 0.3) 0%, transparent 40%),
        radial-gradient(circle at 50% 10%, rgba(2, 115, 83, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(217, 152, 115, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(250, 233, 229, 0.4) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

.main-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.content-wrapper {
    max-width: 800px;
    width: 100%;
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-light);
    padding: 3rem 2rem;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 1s ease-out;
}

.content-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    pointer-events: none;
}

/* Redirect Timer Section */
.redirect-timer-section {
    margin-bottom: 2rem;
    animation: slideInDown 0.8s ease-out 0.2s both;
}

.redirect-message {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 600;
    color: var(--primary-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    line-height: 1.2;
}

#countdown {
    display: inline-block;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2em;
    animation: pulse 1s ease-in-out infinite alternate;
}

/* Logo Section */
.logo-section {
    animation: fadeIn 1s ease-out 0.4s both;
}

.logo {
    width: 50%;
    min-width: 222px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* Hashtag Section */
.hashtag-section {
    margin-bottom: 2rem;
    animation: slideInLeft 0.8s ease-out 0.6s both;
}

.hashtag-link {
    text-decoration: none;
    font-size: clamp(0.9rem, 2.2vw, 1.2rem);
    max-width: 100%;
    text-overflow: ellipsis;
    font-weight: 600;
    background: linear-gradient(45deg, 
        #ff1744, #ff6d00, #ffeb3b, #76ff03, #00e676, 
        #00bcd4, #2196f3, #3f51b5, #9c27b0, #e91e63, 
        #ff1744, #ff6d00, #ffeb3b, #76ff03, #00e676);
    background-size: 260% 260%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowGlow 6.6s ease-in-out infinite;
    display: inline-block;
    position: relative;
    transition: transform 0.66s ease;
}

.hashtag-link:hover {
    transform: translateY(-2px);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Description Section */
.description-section {
    margin-bottom: 2.5rem;
    animation: slideInRight 0.8s ease-out 0.8s both;
}

.description-text {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    line-height: 1.6;
    color: var(--primary-color);
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* Images Section */
.images-section {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    animation: fadeInUp 1s ease-out 1s both;
}

.image-container {
    position: relative;
    width: 222px;
    aspect-ratio: 1/1;
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 20px;
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-container:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.image-frame {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-container:hover .image-frame {
    transform: scale(1.1);
}

/* Enhanced accessibility focus styles */
.hashtag-link:focus,
.image-container:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 20px;
}

.image-container:focus {
    box-shadow: 0 0 0 3px var(--secondary-color), var(--shadow-medium);
}

/* Keyboard navigation enhancements */
.image-container[tabindex="0"]:focus {
    cursor: pointer;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

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

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

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.05);
    }
}

/* Ripple effect for interactive elements */
.hashtag-link,
.image-container {
    position: relative;
    overflow: hidden;
}

.hashtag-link::after,
.image-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.hashtag-link:active::after,
.image-container:active::after {
    width: 300px;
    height: 300px;
}

/* Ripple animation class for JavaScript */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: rippleAnimation 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleAnimation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Loading state */
body:not(.loaded) .content-wrapper {
    opacity: 0;
    transform: translateY(20px);
}

body.loaded .content-wrapper {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        padding: 1rem;
    }
    
    .content-wrapper {
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }
    
    .logo {
        width: 100%;
    }

    .images-section {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    
    .image-container {
        width: 100%;
    }
    
    .redirect-message {
        font-size: clamp(1.2rem, 5vw, 2rem);
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 1.5rem 1rem;
    }
        
    .logo {
        max-height: 200px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000;
        --secondary-color: #333;
        --glass-bg: rgba(255, 255, 255, 0.9);
        --glass-border: rgba(0, 0, 0, 0.3);
    }
}

/* Focus styles for accessibility */
.hashtag-link:focus,
.image-container:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 20px;
}

.image-container:focus {
    box-shadow: 0 0 0 3px var(--secondary-color), var(--shadow-medium);
}