/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #121212;
    color: #e0e0e0;
    line-height: 1.6;
}

/* Make page a column flex layout so footer can stick to bottom when content is short */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    background-color: #1f1f1f;
    padding: 2rem 1rem;
    text-align: center;
    border-bottom: 1px solid #333;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    color: #ffffff;
}

header p {
    margin: 0.5rem 0 0;
    color: #a0a0a0;
}

/* Search Input Styles */
#search {
    margin-top: 1.5rem;
    padding: 0.8rem;
    width: 80%;
    max-width: 500px;
    border-radius: 25px;
    border: 1px solid #333;
    background-color: #2c2c2c;
    color: #e0e0e0;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#search:focus {
    border-color: #bb86fc;
    box-shadow: 0 0 10px rgba(187, 134, 252, 0.25);
}

/* Main Content Styles */
main {
    padding: 2rem 1rem;
    flex: 1 0 auto; /* allow main to grow and push footer down */
}

section {
    margin-bottom: 3rem;
}

/* Ensure anchor jumps land below the header (offset for fixed headers) */
section {
    scroll-margin-top: 120px;
}

section h2 {
    font-size: 2rem;
    color: #bb86fc;
    border-bottom: 2px solid #bb86fc;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Card Layout Styles */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background-color: #1f1f1f;
    border-radius: 8px;
    border: 1px solid #333;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    overflow: hidden; /* To keep the image corners rounded */
}

.card .cover-image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.card .card-content {
    padding: 1.5rem;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card h3 {
    margin: 0 0 0.5rem;
    color: #bb86fc;
    font-size: 1.5rem;
}

.card p {
    margin: 0;
    color: #a0a0a0;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 4rem;
    background-color: #1f1f1f;
    border-top: 1px solid #333;
    color: #a0a0a0;
    width: 100%;
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }

    section h2 {
        font-size: 1.5rem;
    }

    .card h3 {
        font-size: 1.25rem;
    }
}

/* Back to top button */
#back-to-top {
    position: fixed;
    right: 20px;
    bottom: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #bb86fc;
    color: #121212;
    border: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: transform 0.18s ease, opacity 0.18s ease;
    opacity: 0;
    z-index: 9999;
}

#back-to-top.show {
    opacity: 1;
    transform: translateY(0);
}

#back-to-top:hover {
    transform: translateY(-4px);
}

@media (max-width: 480px) {
    #back-to-top { right: 12px; bottom: 20px; width:44px; height:44px; }
}

/* Navigation Bar Styles */
nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #1f1f1f;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* 4-column card layout */
.cards-4-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .cards-4-columns {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .cards-4-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .cards-4-columns {
        grid-template-columns: 1fr;
    }
}
