@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Rajdhani:wght@500;600;700&display=swap');

/* CSS Variables */
:root {
    --gradient: linear-gradient(135deg, #6a00ff 0%, #0077ff 50%, #ff2768 100%);
    --gradient-alt: linear-gradient(45deg, #ff2768 0%, #0077ff 50%, #6a00ff 100%);
    --bg-dark: #0a0a0f;
    --bg-card: #1a1a24;
    --text-primary: #ffffff;
    --text-secondary: #b8b8d1;
    --accent: #6a00ff;
    --accent-hover: #5500cc;
    --success: #00ff88;
    --border: #333344;
    --shadow: rgba(106, 0, 255, 0.3);
    --shadow-strong: rgba(106, 0, 255, 0.5);
    
    /* Typography */
    --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Rajdhani', system-ui, -apple-system, sans-serif;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-sm) var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    height: 80px;
    width: auto;
    transition: var(--transition-normal);
}

.logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px var(--shadow));
}

.nav-section {
    display: flex;
    gap: var(--space-sm);
}

.nav-btn {
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    transition: var(--transition-normal);
    z-index: -1;
}

.nav-btn:hover::before,
.nav-btn:focus::before {
    left: 0;
}

.nav-btn:hover,
.nav-btn:focus {
    color: white;
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Main Content */
.main-content {
    padding-top: 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-lg);
    text-shadow: 0 0 30px var(--shadow);
}

/* Envelope Section */
.envelope-section {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.envelope-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
}

/* Envelope */
.envelope {
    position: relative;
    width: 300px;
    height: 200px;
    cursor: pointer;
    transition: var(--transition-normal);
    transform-style: preserve-3d;
    margin: var(--space-xl) 0;
}

.envelope:hover {
    transform: translateY(-5px);
    filter: drop-shadow(0 10px 20px var(--shadow));
}

.envelope:focus {
    outline: 3px solid var(--accent);
    outline-offset: 5px;
}

.envelope-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #2a2a3a 0%, #1a1a24 100%);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    z-index: 1;
}

.envelope-front {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(145deg, #333344 0%, #2a2a3a 100%);
    border: 2px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 2;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: var(--gradient);
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transform-origin: bottom center;
    transition: var(--transition-slow);
    z-index: 3;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.envelope.open .envelope-flap {
    transform: rotateX(-180deg);
}

/* Letter */
.letter {
    position: absolute;
    top: 15%;
    left: 10%;
    width: 80%;
    height: 70%;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: var(--radius-sm);
    transform: translateY(100%);
    transition: var(--transition-slow);
    z-index: 4;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
}

.envelope.open .letter {
    transform: translateY(0);
    opacity: 1;
}

.letter-content {
    padding: var(--space-md);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.message-text {
    font-family: var(--font-display);
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    font-weight: 600;
    color: #1a1a24;
    line-height: 1.4;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
    align-items: center;
}

.control-btn {
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    transition: var(--transition-normal);
    z-index: -1;
}

.control-btn:hover::before,
.control-btn:focus::before {
    left: 0;
}

.control-btn:hover,
.control-btn:focus {
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.primary {
    background: var(--gradient);
    border-color: var(--accent);
    color: white;
}

.control-btn.primary::before {
    background: var(--gradient-alt);
}

.control-btn.toggle.active {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-dark);
}

.control-btn.toggle.active::before {
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
}

/* Copy Feedback */
.copy-feedback {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: var(--bg-dark);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-fast);
}

.copy-feedback.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* Particles */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.particle {
    position: absolute;
    width: 12px;
    height: 8px;
    background: var(--gradient);
    border-radius: 2px;
    animation: fall 3s ease-in-out forwards;
    opacity: 0;
}

@keyframes fall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(400px) rotate(360deg);
    }
}

/* Footer */
.footer {
    margin-top: auto;
    padding: var(--space-lg) var(--space-md);
    border-top: 1px solid var(--border);
    background: rgba(26, 26, 36, 0.5);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    text-align: center;
}

.footer-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.footer-links {
    display: flex;
    gap: var(--space-md);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.footer-link:hover,
.footer-link:focus {
    color: var(--accent);
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        position: sticky;
    }
    
    .header-container {
        padding: var(--space-xs) var(--space-sm);
    }
    
    .logo {
        height: 32px;
    }
    
    .nav-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.8rem;
    }
    
    .main-content {
        padding-top: 60px;
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }
    
    .envelope {
        width: 280px;
        height: 180px;
    }
    
    .controls {
        flex-direction: column;
        width: 100%;
        max-width: 280px;
    }
    
    .control-btn {
        width: 100%;
        justify-content: center;
    }
    
    .footer-container {
        flex-direction: column;
        gap: var(--space-xs);
    }
}

@media (max-width: 480px) {
    .envelope {
        width: 240px;
        height: 160px;
    }
    
    .nav-section {
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    .header-container {
        flex-direction: column;
        gap: var(--space-xs);
    }
}

/* Focus and 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 {
        --text-primary: #ffffff;
        --bg-dark: #000000;
        --border: #ffffff;
        --accent: #00ff00;
    }
}
