/* Modern Mars Exploration Hub CSS */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #0f1419 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
}

/* Mars Banner - configurable via template */
.mars-banner {
    height: 350px;
    /* Default fallback background */
    background: linear-gradient(180deg,
        rgba(255, 165, 0, 0.8) 0%,
        rgba(255, 112, 0, 0.7) 40%,
        rgba(212, 66, 0, 0.9) 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.banner-content {
    text-align: center;
    z-index: 2;
    color: white;
    padding: 2rem;
}

.site-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    font-family: 'Inter', sans-serif;
    color: #cc2936;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(204, 41, 54, 0.6);
}

.site-tagline {
    font-size: 1.3rem;
    font-weight: 300;
    opacity: 0.95;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    color: white;
}

/* Page Layout */
.page-layout {
    display: flex;
    min-height: calc(100vh - 300px);
    background: #fff;
}

/* Left Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.sidebar-header {
    padding: 0 2rem 1rem;
    border-bottom: 2px solid rgba(255, 107, 53, 0.3);
    margin-bottom: 2rem;
}

.sidebar-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #ff9999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-menu li {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 2rem;
    color: #e0e0e0;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-link:hover {
    background: rgba(204, 41, 54, 0.15);
    color: #ff9999;
    border-left-color: #cc2936;
    transform: translateX(5px);
}

.nav-link.active {
    background: rgba(204, 41, 54, 0.2);
    color: #ff9999;
    border-left-color: #cc2936;
}

.nav-icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.sidebar-footer {
    margin-top: 3rem;
    padding: 0 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
}

.sidebar-footer h4 {
    color: #ff9999;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-links {
    list-style: none;
}

.quick-links li {
    margin-bottom: 0.5rem;
}

.quick-links a {
    color: #b0b0b0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.quick-links a:hover {
    color: #cc2936;
}

/* Main Content */
.content {
    flex: 1;
    background: #fff;
    overflow-x: hidden;
    padding: 3rem;
    max-width: none;
    margin: 0;
}

/* Right Sidebar */
.right-sidebar {
    width: 300px;
    background: #f8f9fa;
    padding: 2rem;
    border-left: 1px solid #e0e0e0;
}

.widget {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.widget h3 {
    color: #1a1a2e;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    border-bottom: 2px solid #cc2936;
    padding-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #cc2936;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #b0b0b0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #cc2936;
}

/* Typography for content */
.content h1,
#page-content h1 {
    font-size: 2.5rem;
    color: #1a1a2e;
    margin-bottom: 1.5rem;
    font-weight: 700;
    border-bottom: 3px solid #cc2936;
    padding-bottom: 0.5rem;
}

.content h2,
#page-content h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin: 2rem 0 1rem;
    font-weight: 600;
}

.content h3,
#page-content h3 {
    font-size: 1.5rem;
    color: #34495e;
    margin: 1.5rem 0 0.75rem;
    font-weight: 600;
}

.content h4,
#page-content h4 {
    font-size: 1.25rem;
    color: #2c3e50;
    margin: 1.25rem 0 0.5rem;
    font-weight: 600;
}

.content p,
#page-content p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #444;
}

.content ul, .content ol,
#page-content ul, #page-content ol {
    margin: 1rem 0 1rem 2rem;
}

.content li,
#page-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.content a,
#page-content a {
    color: #cc2936;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.content a:hover,
#page-content a:hover {
    color: #a01e28;
    text-decoration: underline;
}

/* Tables */
.content table,
#page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.content th,
.content td,
#page-content th,
#page-content td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.content th,
#page-content th {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    font-weight: 600;
}

.content tr:hover,
#page-content tr:hover {
    background: #f8f9fa;
}

/* Code blocks */
.content code,
#page-content code {
    background: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #d14;
}

.content pre,
#page-content pre {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.content blockquote,
#page-content blockquote {
    border-left: 4px solid #ff6b35;
    padding: 1rem 2rem;
    margin: 2rem 0;
    background: #f9f9f9;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #555;
}

.content hr,
#page-content hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 2rem 0;
}

/* Footer timestamp */
.generation-time {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Homepage specific styles */
.hero-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 4rem 0;
    margin: -3rem -3rem 3rem -3rem;
    text-align: center;
}

.hero-section h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #ff6b35, #ffd700);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border: none;
    padding: 0;
}

.hero-section p {
    font-size: 1.3rem;
    color: #666;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-top: 4px solid #ff6b35;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.2);
}

.feature-card h3 {
    color: #1a1a2e;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.feature-card p {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: linear-gradient(135deg, #cc2936, #ff6b35);
    border: none;
    padding: 15px;
    min-width: 54px;
    min-height: 54px;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(204, 41, 54, 0.4);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    will-change: transform;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle span {
    width: 28px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
    pointer-events: none;
}

/* Hamburger animation to X */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

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

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

/* Mobile menu overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Footer */
.site-footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content a {
    color: #ffd700;
    text-decoration: none;
}

.footer-content a:hover {
    color: #ff6b35;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }

    .content-wrapper {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .mars-banner {
        height: 200px;
    }

    .site-title {
        font-size: 2.5rem;
    }

    .site-tagline {
        font-size: 1.1rem;
    }

    .page-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 85%;
        max-width: 320px;
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        z-index: 1000;
        transition: right 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .sidebar.active {
        right: 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .content {
        padding: 1.5rem;
    }

    .right-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .hero-section {
        margin: -1.5rem -1.5rem 2rem -1.5rem;
        padding: 2rem 0;
    }

    .hero-section h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 1rem;
    }

    .site-title {
        font-size: 2rem;
    }

    .content h1,
    #page-content h1 {
        font-size: 2rem;
    }
}

/* Gallery Styles */
.mars-gallery {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-top: 4px solid #cc2936;
}

.gallery-image-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    min-height: 200px;
}

.gallery-current-image {
    max-width: 100%;
    max-height: 600px;
    height: auto;
    object-fit: contain;
    display: block;
}

.gallery-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    pointer-events: none;
}

.gallery-prev,
.gallery-next {
    background: linear-gradient(135deg, rgba(204, 41, 54, 0.9), rgba(255, 107, 53, 0.9));
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(204, 41, 54, 0.5);
    pointer-events: all;
    opacity: 0.7;
}

.gallery-prev:hover:not(:disabled),
.gallery-next:hover:not(:disabled) {
    transform: scale(1.1);
    opacity: 1;
    background: linear-gradient(135deg, rgba(204, 41, 54, 1), rgba(255, 107, 53, 1));
}

.gallery-prev:active:not(:disabled),
.gallery-next:active:not(:disabled) {
    transform: scale(0.95);
}

.gallery-prev:disabled,
.gallery-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #444;
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #ff6b35;
}

/* Image Lightbox */
.image-lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.3);
    cursor: default;
}

.image-lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.2s;
}

.image-lightbox-close:hover {
    color: #cc2936;
}

/* Make all content images clickable */
#page-content img {
    cursor: pointer;
}

/* Center standalone images (not in custom blocks) */
#page-content > p img,
#page-content > img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Ensure gallery images are centered */
.gallery-current-image {
    margin: 0 auto;
}

/* Gallery responsive styles */
@media (max-width: 768px) {
    .mars-gallery {
        padding: 1.5rem;
    }

    .gallery-current-image {
        max-height: 400px;
    }

    .gallery-prev,
    .gallery-next {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .gallery-controls {
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .mars-gallery {
        padding: 1rem;
    }

    .gallery-current-image {
        max-height: 300px;
    }

    .gallery-prev,
    .gallery-next {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .gallery-description {
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    .image-lightbox-close {
        right: 20px;
        font-size: 30px;
    }
}