/* Modern Blog Gallery Styles */

/* CSS Custom Properties */
:root {
    /* Colors */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #fff;
    --bg-secondary: #f8f9fa;
    --border-color: #e9ecef;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-size-base: 16px;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-xxl: 2rem;
    --line-height: 1.6;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Layout */
    --max-width: 1200px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--text-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Layout Grid */
body {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

/* Header Styles - Unified Navigation System */
header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    white-space: nowrap;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    z-index: 1100;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-links a.active {
    background: rgba(255, 255, 255, 0.3);
}

#music-toggle {
    cursor: pointer;
    font-size: 1.5rem;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 1rem;
    border-radius: 25px;
    transition: background 0.3s ease;
    user-select: none;
    white-space: nowrap;
    margin-left: 1rem;
}

#music-toggle:hover,
#music-toggle:focus {
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

/* Main Content */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-sm);
    width: 100%;
}

/* Index page main content */
.index-page main {
    padding: 4rem 0;
    text-align: center;
}

/* Hero Section */
/* Unified content container with glass morphism effect */
.content-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 4rem 2rem;
    margin: 2rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

/* Hero container - used by both home and novel sections */
.hero {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 4rem 2rem;
    margin: 2rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

/* Audio element styling moved from inline styles */
.audio-hidden {
    display: none;
}

/* Gallery page specific styles */
.gallery-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Gallery navigation and header styles - restored from backup */
.gallery-page header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.gallery-page nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.gallery-page .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    white-space: nowrap;
}

.gallery-page .nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    z-index: 1100;
}

.gallery-page .nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.gallery-page .nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
}

.gallery-page .nav-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.gallery-page .nav-links a.active {
    background: rgba(255, 255, 255, 0.3);
}

.gallery-page #music-toggle {
    cursor: pointer;
    font-size: 1.5rem;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 1rem;
    border-radius: 25px;
    transition: background 0.3s ease;
    user-select: none;
    white-space: nowrap;
    margin-left: 1rem;
}

.gallery-page #music-toggle:hover,
.gallery-page #music-toggle:focus {
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

/* Gallery back button styling */
.gallery-page .back-btn {
    margin: 2rem auto !important;
    display: block !important;
    padding: 1rem 2rem !important;
    border: 2px solid rgba(255,255,255,0.3) !important;
    border-radius: 50px !important;
    font-size: 1.1rem !important;
    cursor: pointer;
    text-decoration: none !important;
    background: rgba(255,255,255,0.2) !important;
    color: white !important;
    transition: all 0.3s ease !important;
    width: fit-content !important;
    text-align: center !important;
}

.gallery-page .back-btn:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2) !important;
}

.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-sm);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.gallery-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.gallery-header h1 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-xxl);
}

.gallery-header p {
    color: var(--text-light);
    font-size: var(--font-size-lg);
}

/* Gallery mobile navigation - restored and enhanced with !important */
@media (max-width: 768px) {
    .gallery-page .nav-toggle {
        display: block !important;
    }

    .gallery-page .nav-links {
        display: none !important;
        flex-direction: column;
        position: absolute;
        top: 68px;
        right: 0;
        left: 0;
        background: rgba(30, 30, 30, 0.95);
        padding: 1rem 1.5rem;
        border-radius: 0 0 12px 12px;
        z-index: 1000;
    }

    .gallery-page nav.open .nav-links {
        display: flex !important;
    }
}

/* Content container typography and elements */
.content-container h1,
.hero h1 {
    font-size: 3rem;
    color: white;
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease;
}

.content-container h2,
.hero h2 {
    color: white;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 3rem;
    animation: fadeInUp 1s ease;
}

.content-container p,
.hero p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease 0.2s both;
}

/* Hero image styling moved from inline styles */
.hero-image {
    max-width: 100%;
    border-radius: 15px;
    margin-bottom: 2rem;
}

.hero img,
.content-container img {
    max-width: 100%;
    border-radius: 15px;
    margin-bottom: 2rem;
}

section {
    margin-bottom: var(--spacing-xl);
}

section h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: var(--spacing-xs);
}

/* Gallery Styles */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.gallery-item {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    aspect-ratio: 1;
    background-color: var(--bg-secondary);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-light);
    font-style: italic;
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    z-index: 1000;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    cursor: default;
}

.lightbox-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 50%;
    background-color: rgba(0,0,0,0.5);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-close:hover {
    background-color: rgba(255,255,255,0.2);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: 50%;
    background-color: rgba(0,0,0,0.5);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    user-select: none;
}

.lightbox-nav:hover {
    background-color: rgba(255,255,255,0.2);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

/* Blog Styles */
article {
    background-color: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow);
}

article h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xs);
    color: var(--primary-color);
}

.date {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
    font-style: italic;
}

article p {
    margin-bottom: var(--spacing-sm);
}

/* Button Styles */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Novel Container */
/* Legacy novel container styles removed - now using .content-container */

/* Page Navigation */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-sm);
    margin-top: var(--spacing-xl);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --font-size-xxl: 1.75rem;
        --font-size-xl: 1.25rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
    }
    
    .gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--spacing-sm);
    }
    
    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
    }
    
    .nav-toggle {
        display: block;
    }
    
    .nav-links.mobile-hidden {
        display: none;
    }
    
    .lightbox-nav {
        position: fixed;
        top: auto;
        bottom: 20px;
        transform: none;
    }
    
    .lightbox-prev {
        left: 20px;
    }
    
    .lightbox-next {
        right: 20px;
    }
    
    .lightbox-close {
        top: 20px;
        right: 20px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    main {
        padding: var(--spacing-md) var(--spacing-xs);
    }
    
    header h1 {
        font-size: var(--font-size-xl);
    }
}

/* Loading Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.gallery-item {
    animation: fadeIn 0.5s ease-out forwards;
}

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

/* Focus styles for keyboard navigation */
nav a:focus,
.gallery-item:focus,
.lightbox-close:focus,
.lightbox-nav:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Mobile index nav fix test */
@media (max-width: 768px) {
  body.index-page .nav-links {
    display: none !important;
  }

  body.index-page nav.open .nav-links {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 68px;
    right: 0;
    left: 0;
    background: rgba(30, 30, 30, 0.95);
    padding: 1rem 1.5rem;
    border-radius: 0 0 12px 12px;
    z-index: 1000;
  }
}
