/* Section Components - Extracted from styles.css */

/* Latest in Space Section */
.latest-space {
    padding: 60px 0;
    background: var(--background-color);
    margin-bottom: var(--space-7);
    overflow: visible; /* Ensure hover animations aren't clipped */
}

.section-heading {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 24px;
    color: var(--text-color);
}

/* Launches Grid */
.launches-grid-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 320px)); /* Dynamic columns: fixed width, auto-fit for centering */
    justify-content: center; /* Centers columns horizontally */
    gap: var(--space-6); /* Consistent spacing */
    margin-bottom: var(--space-6);
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    overflow: visible; /* Prevent clipping hover effects */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .launches-grid-preview {
        grid-template-columns: repeat(auto-fit, minmax(300px, 300px)); /* Adjust min for tablets */
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .launches-grid-preview {
        grid-template-columns: repeat(auto-fit, minmax(280px, 280px)); /* Adjust for mobile */
        gap: 16px;
    }
}

/* News Grid - Horizontal scroll on mobile */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Fixed 3 columns for news */
    gap: var(--space-6);
    overflow-x: auto; /* Enable horizontal scroll */
    scroll-snap-type: x proximity; /* Smooth snapping */
    padding-top: var(--space-2); /* Add top padding to prevent hover animation clipping */
    padding-bottom: var(--space-4); /* For scroll shadow if needed */
}

/* Sub-section headings in Latest in Space */
.latest-space h3 {
    font-size: 1.5rem;
    margin: 24px 0 16px 0;
    color: var(--text-color);
    font-weight: 600;
    text-align: center;
}

.latest-space h3:first-of-type {
    margin-top: 0;
}

/* Ensure card containers don't clip hover animations */
.launches-grid-preview,
.news-grid {
    overflow: visible;
}

.news-grid article {
    scroll-snap-align: start; /* Snap to card edges */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .launches-grid-preview {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
        gap: 16px;
    }

    .news-grid {
        grid-template-columns: repeat(3, 1fr); /* Keep 3 columns on tablets */
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .launches-grid-preview {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 16px;
    }

    .news-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 16px;
    }
}

/* Card Enhancements */
.launch-card, .news-card {
    border-radius: var(--radius-card); /* Standardized card corners */
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* API Section */
.api-section {
    padding: 60px 0;
    background-color: var(--background-color);
}

.api-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--text-color);
}

.api-section p {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: var(--space-6);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.api-example {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    border-radius: var(--radius-card);
    background-color: var(--feature-card-bg);
    border: 1px solid var(--modal-border);
    box-shadow: 0 2px 8px var(--modal-shadow);
    transition: transform 0.2s;
}

.api-example:hover {
    transform: translateY(-5px);
}

.api-example code {
    display: block;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--text-color);
    padding: 12px 16px;
    background-color: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
}

/* Features Section */
.features {
    padding: 60px 0;
    background-color: rgba(var(--background-color-rgb, 245, 245, 247), 0.85);
    backdrop-filter: blur(1px);
    margin-bottom: var(--space-7);
}

.features h2 {
    text-align: center;
    margin-bottom: 60px;
    font-size: 2rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 20px;
    }

    .feature-card {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .feature-card {
        padding: 20px;
    }
}