/* Tailwind CSS CDN */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* Custom Color Variables */
:root {
    --primary-dark: #222831;
    --primary-accent: #00ADB5;
    --secondary-accent: #FF5722;
    --tertiary-accent: #FFC107;
    
    --bg-primary: #1A1A2E;
    --bg-secondary: #16213E;
    --bg-tertiary: #0F3460;
    
    --text-primary: #EEEEEE;
    --text-secondary: #B8B8B8;
    --text-white: #FFFFFF;
}

/* Pixel Font Definition - Fusion Pixel */
@font-face {
    font-family: 'Fusion Pixel';
    src: url('fusion-pixel-12px-monospaced-zh_hans.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Fusion Pixel', 'Courier New', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Styling */
::selection {
    background-color: var(--primary-accent);
    color: var(--bg-primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-accent);
    border-radius: 0; /* Square for pixel feel */
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-accent);
}

/* Typography Utilities */
.font-pixel {
    font-family: 'Fusion Pixel', 'Courier New', monospace;
}

.pixel-text-shadow {
    text-shadow: 
        2px 2px 0 rgba(0, 173, 181, 0.3),
        4px 4px 0 rgba(0, 173, 181, 0.15);
}

.pixel-title {
    letter-spacing: 3px;
    text-shadow:
        0 0 10px rgba(0, 173, 181, 0.5),
        0 0 20px rgba(255, 87, 34, 0.3),
        3px 3px 0 rgba(0, 0, 0, 0.5),
        -1px -1px 0 rgba(255, 255, 255, 0.1);
}

.pixel-glow {
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor;
}

/* Navigation Bar */
nav {
    transition: all 0.3s ease;
}

nav:hover {
    border-bottom-color: var(--secondary-accent) !important;
}

/* Language Button States */
.lang-btn {
    position: relative;
    image-rendering: pixelated;
    cursor: pointer;
    outline: none;
}

.lang-btn:hover {
    transform: translateY(-1px);
    box-shadow: 2px 2px 0 rgba(0, 173, 181, 0.5);
}

.lang-btn.active {
    background-color: var(--primary-accent);
    color: var(--bg-primary);
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Hero Section Background */
.hero-bg {
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 173, 181, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 87, 34, 0.06) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
}

.hero-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(90deg, transparent 49%, rgba(0, 173, 181, 0.03) 49%, rgba(0, 173, 181, 0.03) 51%, transparent 51%),
        linear-gradient(transparent 49%, rgba(0, 173, 181, 0.03) 49%, rgba(0, 173, 181, 0.03) 51%, transparent 51%);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0.3;
}

/* Image Container with Pixel Border Effect */
.image-container {
    position: relative;
    display: inline-block;
}

.pixel-border {
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 3px solid var(--primary-accent);
    z-index: -1;
    animation: pixelBorderPulse 2s ease-in-out infinite;
}

@keyframes pixelBorderPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.pixel-corners {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.pixel-corners::before,
.pixel-corners::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 3px solid var(--secondary-accent);
}

.pixel-corners::before {
    top: -9px;
    left: -9px;
    border-right: none;
    border-bottom: none;
}

.pixel-corners::after {
    bottom: -9px;
    right: -9px;
    border-left: none;
    border-top: none;
}

/* Gradient Animation for Title */
.animate-gradient-x {
    animation: gradientShift 4s ease-in-out infinite alternate;
    background-size: 200% auto;
}

@keyframes gradientShift {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* Pixel Button Style */
.pixel-button {
    position: relative;
    image-rendering: pixelated;
    clip-path: polygon(
        0 0, 
        calc(100% - 4px) 0, 
        100% 4px, 
        100% 100%, 
        4px 100%, 
        0 calc(100% - 4px)
    );
}

.pixel-button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 rgba(0, 173, 181, 0.5);
}

.pixel-button:active {
    transform: translate(0, 0);
    box-shadow: 2px 2px 0 rgba(0, 173, 181, 0.5);
}

/* Feature Cards */
.feature-card {
    image-rendering: pixelated;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    transform: scale(0);
    transition: transform 0.6s ease;
}

.feature-card:hover::before {
    transform: scale(1);
}

.feature-card svg {
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.3));
}

/* About Card */
.about-card {
    position: relative;
}

.about-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 48%,
        rgba(0, 173, 181, 0.03) 49%,
        rgba(0, 173, 181, 0.03) 51%,
        transparent 52%
    );
    background-size: 30px 30px;
    pointer-events: none;
}

/* Contact Card */
.contact-card {
    position: relative;
    overflow: hidden;
}

.contact-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--tertiary-accent), 
        var(--secondary-accent), 
        var(--primary-accent), 
        var(--tertiary-accent)
    );
    z-index: -1;
    animation: contactGlow 4s linear infinite;
    background-size: 400% 400%;
}

@keyframes contactGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.contact-card > * {
    position: relative;
    z-index: 1;
}

/* Email Link Hover Effect */
a[href^="mailto"] {
    position: relative;
}

a[href^="mailto"]:hover {
    text-shadow: 
        0 0 10px var(--tertiary-accent),
        0 0 20px var(--tertiary-accent),
        0 0 30px var(--tertiary-accent);
}

/* Footer */
footer {
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--primary-accent),
        var(--secondary-accent),
        var(--tertiary-accent),
        var(--primary-accent),
        transparent
    );
}

/* Responsive Adjustments */

/* Mobile Devices (320px - 480px) */
@media screen and (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .pixel-title {
        font-size: 2rem !important;
        letter-spacing: 2px;
    }
    
    nav h1 {
        font-size: 1rem !important;
    }
    
    .lang-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem !important;
    }
    
    .feature-card {
        padding: 1.25rem !important;
    }
    
    .about-card {
        padding: 1.5rem !important;
    }
}

/* Tablets and Small Laptops (481px - 1024px) */
@media screen and (min-width: 481px) and (max-width: 1024px) {
    .pixel-title {
        font-size: 3rem;
    }
}

/* Large Screens (1025px+) */
@media screen and (min-width: 1025px) {
    body {
        font-size: 16px;
    }
    
    .container {
        max-width: 1200px;
    }
}

/* Print Styles (for completeness) */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .hero-bg {
        background: white;
    }
    
    nav, footer {
        display: 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;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
    .pixel-border,
    .feature-card,
    .about-card,
    .contact-card {
        border: 2px solid CanvasText;
    }
    
    a {
        outline: 2px solid LinkText;
        outline-offset: 2px;
    }
}
