/* 
 * regenerates.css
 * Main stylesheet for The Regenerates: Heroes of #BUIDL City
 */

 :root {
    --primary: #4682B4;
    --accent: #FFD700;
    --dark: #1a1a2e;
    --light: #f7f7f7;
    --ethereum: #627eea;
    --glow: #87CEEB;
    
    /* Improved color contrast for accessibility */
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-accent: #FFD700;
    
    /* Animation durations */
    --transition-fast: 0.2s;
    --transition-medium: 0.3s;
    --transition-slow: 0.5s;
}

/* Base styles with improved defaults */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for fixed header */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom, #0f0f1e, #1a1a2e);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

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

a {
    color: var(--light);
    text-decoration: none;
    transition: color var(--transition-medium) ease;
}

a:hover, a:focus {
    color: var(--accent);
}

button {
    cursor: pointer;
    font-family: inherit;
}

/* Focus styles for accessibility */
a:focus, button:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip to content link for accessibility */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: var(--dark);
    padding: 8px 16px;
    z-index: 1001;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 0;
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    background-color: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
    transition: background-color var(--transition-medium) ease,
                padding var(--transition-medium) ease;
}

/* Compact navbar on scroll */
.navbar.compact {
    padding: 0.5rem 5%;
    background-color: rgba(26, 26, 46, 0.95);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--light);
    text-decoration: none;
    position: relative;
    padding: 0.5rem 0;
    transition: color var(--transition-medium) ease;
}

.nav-links a:hover, .nav-links a:focus {
    color: var(--accent);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--accent);
    transition: width var(--transition-medium) ease;
}

.nav-links a:hover::after, .nav-links a:focus::after {
    width: 100%;
}

/* Mobile menu */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    width: 30px;
    height: 24px;
    position: relative;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--light);
    margin: 5px 0;
    transition: transform var(--transition-medium) ease,
                opacity var(--transition-medium) ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 5rem 5%;
    background: linear-gradient(to bottom, rgba(10, 10, 30, 0.9), rgba(26, 26, 46, 0.7)), 
                url('../assets/images/hero-bg.jpg') center/cover no-repeat;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    z-index: 2;
    max-width: 800px;
    animation: fadeIn var(--transition-slow) ease;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--accent);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    animation: glow 2s ease-in-out infinite alternate;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--light);
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: var(--ethereum);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all var(--transition-medium) ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.cta-button:hover, .cta-button:focus {
    background-color: transparent;
    border: 2px solid var(--ethereum);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(98, 126, 234, 0.4);
}

/* Shared Section Styles */
.section {
    padding: 5rem 10%;
    position: relative;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--accent);
    position: relative;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.section-title::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 3px;
    background-color: var(--accent);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
}

/* Character Cards */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.character-card {
    background: linear-gradient(135deg, rgba(40, 40, 70, 0.7), rgba(20, 20, 40, 0.9));
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all var(--transition-medium) ease;
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(98, 126, 234, 0.2);
}

.character-card:hover, .character-card:focus {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(98, 126, 234, 0.4);
    border: 1px solid rgba(98, 126, 234, 0.6);
}

.character-card:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.character-image {
    height: 250px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.character-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-medium) ease;
}

.character-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(26, 26, 46, 1) 0%, rgba(26, 26, 46, 0) 50%);
    z-index: 1;
}

.character-card:hover .character-image img, .character-card:focus .character-image img {
    transform: scale(1.05);
}

.character-content {
    padding: 1.5rem;
}

.character-name {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.character-role {
    font-size: 1rem;
    color: var(--glow);
    margin-bottom: 1rem;
    font-style: italic;
}

.character-description {
    font-size: 0.9rem;
    color: var(--light);
}

.power-meter {
    margin-top: 1rem;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.power-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ethereum), var(--accent));
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: fadeIn var(--transition-fast) ease;
}

.modal-content {
    background: linear-gradient(135deg, rgba(40, 40, 70, 0.9), rgba(20, 20, 40, 0.95));
    margin: 5% auto;
    padding: 2rem;
    width: 80%;
    max-width: 800px;
    border-radius: 15px;
    box-shadow: 0 0 50px rgba(98, 126, 234, 0.3);
    position: relative;
    border: 1px solid rgba(98, 126, 234, 0.3);
    animation: slideIn var(--transition-medium) ease;
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: var(--light);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-medium) ease;
    background: transparent;
    border: none;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    border-radius: 50%;
}

.close:hover, .close:focus {
    color: var(--accent);
    transform: rotate(90deg);
    background-color: rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.modal-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-position: center;
    background-size: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    margin-right: 2rem;
    overflow: hidden;
}

.modal-title h2 {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.modal-title p {
    font-size: 1.1rem;
    color: var(--glow);
    font-style: italic;
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.bio-section {
    line-height: 1.8;
}

.stats-section h3,
.powers-section h3,
.story-section h3 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin-bottom: 2rem;
}

.stats-label {
    font-weight: bold;
    color: var(--glow);
}

.stats-value {
    color: var(--light);
}

.powers-list {
    list-style-type: none;
    margin-bottom: 2rem;
}

.powers-list li {
    padding: 0.5rem 0;
    position: relative;
    padding-left: 1.5rem;
}

.powers-list li::before {
    content: '⚡';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.modal-footer {
    margin-top: 2rem;
    text-align: center;
}

/* City Section */
.city-section {
    position: relative;
    overflow: hidden;
}

.city-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/buidl-city-bg.jpg');
    background-size: cover;
    background-position: center;
    filter: brightness(0.4) saturate(1.5);
    z-index: -1;
}

.city-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(26, 26, 46, 0.9), rgba(26, 26, 46, 0.7));
    z-index: -1;
}

.city-content {
    z-index: 1;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.location-card {
    background: linear-gradient(135deg, rgba(40, 40, 70, 0.8), rgba(20, 20, 40, 0.9));
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(98, 126, 234, 0.2);
    transition: all var(--transition-medium) ease;
    position: relative;
    overflow: hidden;
}

.location-card:hover, .location-card:focus-within {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(98, 126, 234, 0.4);
    border: 1px solid rgba(98, 126, 234, 0.6);
}

.location-title {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.location-description {
    color: var(--light);
    line-height: 1.8;
}

/* Map Container */
.map-container {
    display: none;
    max-width: 1000px;
    height: 500px;
    margin: 2rem auto;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(98, 126, 234, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.map-container.active {
    display: block;
    animation: fadeIn var(--transition-medium) ease;
}

.map-toggle-button {
    display: block;
    margin: 2rem auto;
}

.fallback-map {
    padding: 2rem;
    text-align: center;
}

.fallback-map h3 {
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.map-image-container {
    max-width: 800px;
    margin: 0 auto 1.5rem;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(98, 126, 234, 0.5);
}

.map-image-container img {
    width: 100%;
    display: block;
}

.fallback-map p {
    color: var(--text-secondary);
    font-style: italic;
}

/* Story Section */
.story-section {
    background: linear-gradient(to bottom, #1a1a2e, #0f0f1e);
}

.chapter-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.chapter-tab {
    padding: 0.5rem 1.5rem;
    margin: 0.5rem;
    background: rgba(40, 40, 70, 0.6);
    color: var(--light);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--transition-medium) ease;
}

.chapter-tab.active,
.chapter-tab:hover,
.chapter-tab:focus {
    background: rgba(98, 126, 234, 0.8);
    color: white;
}

.chapter-tab:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.chapter-content {
    max-width: 800px;
    margin: 0 auto;
    display: none;
    animation: fadeIn var(--transition-medium) ease;
}

.chapter-content.active {
    display: block;
}

.chapter-content h3 {
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    text-align: center;
}

.chapter-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* Footer */
.footer {
    background-color: rgba(15, 15, 30, 0.9);
    padding: 3rem 5%;
    text-align: center;
    border-top: 1px solid rgba(98, 126, 234, 0.3);
}

.footer-logo {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 1.5rem 0;
}

.footer-links a {
    color: var(--light);
    text-decoration: none;
    transition: color var(--transition-medium) ease;
}

.footer-links a:hover, .footer-links a:focus {
    color: var(--accent);
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.social-icon {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-medium) ease;
}

.social-icon:hover, .social-icon:focus {
    background-color: var(--ethereum);
    transform: translateY(-5px);
}

.copyright {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin-top: 2rem;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 15, 30, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-medium) ease,
                visibility var(--transition-medium) ease;
}

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

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(98, 126, 234, 0.3);
    border-top: 5px solid var(--ethereum);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes glow {
    from {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    to {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

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

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

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

/* Accessibility focus styles */
.visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Responsive styles */
@media (max-width: 992px) {
    .section {
        padding: 4rem 5%;
    }
    
    .modal-body {
        grid-template-columns: 1fr;
    }
    
    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 120px; /* Adjusted for mobile menu */
    }
    
    .navbar {
        padding: 1rem;
        flex-direction: column;
    }
    
    .logo {
        margin-bottom: 1rem;
    }
    
    .mobile-menu-toggle {
        display: block;
        position: absolute;
        right: 1rem;
        top: 1rem;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 0;
        background-color: rgba(26, 26, 46, 0.98);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        overflow: hidden;
        opacity: 0;
        transition: height var(--transition-medium) ease,
                    opacity var(--transition-medium) ease;
        z-index: 1000;
    }
    
    .nav-links.active {
        height: 100vh;
        opacity: 1;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .section {
        padding: 3rem 5%;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        margin: 10% auto;
    }
    
    .modal-header {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-image {
        width: 100px;
        height: 100px;
        margin: 0 auto 1rem;
    }
    
    .character-card {
        max-width: 350px;
        margin: 0 auto;
    }
    
    .chapter-tab {
        font-size: 0.9rem;
        padding: 0.4rem 1rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .cta-button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .character-image {
        height: 200px;
    }
    
    .character-name {
        font-size: 1.3rem;
    }
    
    .location-title {
        font-size: 1.3rem;
    }
    
    .chapter-tabs {
        flex-wrap: wrap;
    }
    
    .chapter-tab {
        margin: 0.3rem;
        padding: 0.3rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .navbar, .cta-button, .footer, .mobile-menu-toggle {
        display: none;
    }
    
    .hero, .section {
        padding: 1rem 0;
        min-height: auto;
    }
    
    .section-title::after {
        display: none;
    }
    
    .character-card, .location-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .map-container {
        display: none !important;
    }
    
    .chapter-content {
        display: block !important;
    }
    
    .chapter-tabs {
        display: none;
    }
}