/* ===== CSS VARIABLES ===== */
:root {
    /* Color Palette */
    --primary-blue: #2563eb;
    --secondary-purple: #7c3aed;
    --accent-orange: #f97316;
    --neutral-gray: #6b7280;
    --light-gray: #f3f4f6;
    --dark-gray: #374151;
    --white: #ffffff;
    --black: #111827;
    
    /* Typography */
    --font-heading: 'Roboto', sans-serif;
    --font-body: 'Open Sans', sans-serif;
    
    /* Spacing */
    --container-max-width: 1200px;
    --section-padding: 4rem 0;
    --grid-gap: 2rem;
    
    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s ease;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark-gray);
    background-color: var(--white);
    overflow-x: hidden;
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(37, 99, 235, 0.1);
}

.logo {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    text-align: center;
    letter-spacing: -0.02em;
}

/* ===== HERO SECTION ===== */
.hero {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-purple) 50%, var(--accent-orange) 100%);
    opacity: 0.9;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: float 6s ease-in-out infinite;
}

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

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    animation: fadeInUp 1s ease-out;
}

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

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.hero-description {
    font-size: 1.2rem;
    font-weight: 300;
    margin-bottom: 2.5rem;
    line-height: 1.7;
    opacity: 0.95;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background-color: var(--accent-orange);
    color: var(--white);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.3);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.4);
    background-color: #ea580c;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: var(--section-padding);
    background-color: var(--light-gray);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--dark-gray);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-orange));
    border-radius: 2px;
}

/* ===== CHARACTER GRID ===== */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--grid-gap);
    margin-top: 2rem;
}

.character-card {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: block;
}

.character-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
    transition: left 0.5s ease;
}

.character-card:hover::before {
    left: 100%;
}

.character-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.character-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.5rem;
    border: 4px solid var(--light-gray);
    transition: var(--transition-smooth);
}

.character-card:hover .character-image {
    border-color: var(--primary-blue);
    transform: scale(1.05);
}

.character-name {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-gray);
}

.character-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--neutral-gray);
    margin-bottom: 1.5rem;
}

/* ===== UPDATED CHARACTER DESCRIPTION STYLES ===== */
.character-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--neutral-gray);
    margin-bottom: 1.5rem;
}

.character-description.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3; /* Standard property for compatibility */
    overflow: hidden;
}

.show-more-btn {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    margin-top: 0.5rem;
}

.show-more-btn:hover {
    color: var(--secondary-purple);
    text-decoration: underline;
}

.character-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
    color: var(--white);
    border-radius: 50%;
    transition: var(--transition-smooth);
    margin-top: 1rem;
}

.character-card:hover .character-link-icon {
    transform: scale(1.1);
    background: linear-gradient(135deg, var(--secondary-purple), var(--accent-orange));
}

/* ===== FOOTER ===== */
.footer {
    background-color: var(--dark-gray);
    color: var(--white);
    padding: 2rem 0;
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-link {
    color: var(--accent-orange);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.footer-link:hover {
    color: var(--white);
    text-decoration: underline;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--light-gray);
    border-top: 4px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero {
        min-height: 60vh;
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }
    
    .characters-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .character-card {
        padding: 1.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .cta-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .character-card {
        padding: 1rem;
    }
    
    .character-image {
        width: 100px;
        height: 100px;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
}

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

/* Focus styles for keyboard navigation */
.character-card:focus,
.cta-button:focus,
.footer-link:focus,
.show-more-btn:focus {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-blue: #0000ff;
        --secondary-purple: #800080;
        --accent-orange: #ff4500;
        --neutral-gray: #000000;
        --dark-gray: #000000;
    }
}
