/* --- 1. GLOBAL SETTINGS --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;800&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0b0e14;
    --container-bg: #11141b;
    --card-bg: #1a1d2e;
    --accent: #5865f2;
    --text: #ffffff;
    --text-dim: #a3a6aa;
    --dot-color: rgba(255, 255, 255, 0.2);
    --wall-color: rgba(11, 14, 20, 0.8); /* Added this */
    --button-bg: #1b2838; /* Keep the classic Steam blue for Dark Mode */
    --button-text: #ffffff;
}

[data-theme="light"] {
    --bg: #ffffff;
    --container-bg: #f2f3f5;
    --card-bg: #ffffff;
    --text: #060607;
    --text-dim: #444444; /* Darkened for better contrast on light */
    --dot-color: rgba(0, 0, 0, 0.2); /* Soft dark dots for light mode */
    --wall-color: rgba(255, 255, 255, 0.8); /* Added this */
    --button-bg: var(--accent); 
    --button-text: #ffffff;
}

body { 
    background: var(--bg); color: var(--text); 
    font-family: 'Inter', sans-serif; 
    min-height: 100vh;
}

/* Global Drag State */
body.is-dragging-cards, 
body.is-dragging-cards .game-card { 
    cursor: grabbing !important; 
}

.main-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; }
.section-title { text-align: center; margin: 20px 0; font-size: 1rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }

/* --- 2. MAIN CAROUSEL (The "Window") --- */
.carousel-wrapper { 
    position: relative; 
    width: 100%; 
    background: var(--container-bg); 
    padding: 30px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    /* MOVE SCROLLBAR HERE */
    overflow-x: auto;
}
/* --- THE OUTER FRAME --- */
.timeline-frame {
    position: relative;
    width: 100%;
    overflow: hidden; /* Clips anything that tries to peek out */
}

/* --- THE PHYSICAL WALLS --- */
.wall {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 180px; /* How deep the "darkness" goes */
    z-index: 30; /* Sits HIGHER than the cards and scrollbar */
    pointer-events: none; /* Allows you to click "through" the shadow */
}

.left-wall {
    left: 0;
    /* Solid color for 40px, then a very fast fade to transparent */
    background: linear-gradient(to right, 
        var(--bg) 0%, 
        var(--wall-color) 50%, 
        transparent 100%);
}

.right-wall {
    right: 0;
    background: linear-gradient(to left, 
        var(--bg) 0%, 
        var(--wall-color) 50%, 
        transparent 100%);
}

/* --- ADJUST THE WRAPPER --- */
.carousel-wrapper {
    position: relative;
    width: 100%;
    background: var(--container-bg);
    padding: 10px 0; /* Tighten vertical space */
    overflow-x: auto;
    /* This ensures the scrollbar stays visible but gets "cut off" by the walls */
    scrollbar-gutter: stable; 
}

/* --- 3. CAROUSEL CONTAINER (The "Content") --- */
.carousel-container {
    display: flex; 
    gap: 10px; 
    padding: 2px 0px 15px 100px; 
    cursor: default; /* No man's land is safe */
    user-select: none;
    overflow: visible; /* Let the wrapper handle the scroll */
    width: max-content;
}

.carousel-container::after {
    content: "";
    flex: 0 0 80px; /* This gives you ~2 cards of empty space on the right */
}

/* --- 4. SCROLLBAR STYLING (Targeting Wrapper) --- */
.carousel-wrapper::-webkit-scrollbar { height: 20px; display: block; }
.carousel-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin: 0 150px;
}
.carousel-wrapper::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
    border: 3px solid var(--container-bg);
}

/* --- 5. GAME CARDS --- */
.game-card { flex: 0 0 110px; position: relative; cursor: grab; transition: 0.2s; }
.game-card:hover { transform: scale(1.05); }

.poster-wrapper { width: 110px; height: 155px; border-radius: 8px; overflow: hidden; position: relative; }
.game-card img.main-cover { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

.hover-info {
    position: absolute; inset: 0; 
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    display: flex; align-items: flex-end; padding: 8px; gap: 4px;
    opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.game-card:hover .hover-info { opacity: 1; }
.game-card:hover .main-cover { filter: brightness(0.4); }

.platform-svg { width: 14px; height: 14px; filter: invert(1); }
.date-label { display: block; text-align: center; font-size: 0.7rem; margin-top: 10px; font-weight: 800; color: var(--text-dim); }

/* --- 6. MODAL / POPUP --- */
.modal-overlay { 
    position: fixed; 
    inset: 0; 
    background: rgba(0, 0, 0, 0.85); 
    backdrop-filter: blur(5px); /* Makes the background pop */
    display: none; 
    align-items: center; 
    justify-content: center; 
    z-index: 200; /* Must be higher than our 'walls' */
}
.modal-content { 
    background: var(--card-bg); 
    width: 95vw; 
    max-width: 1100px; 
    height: 85vh; 
    border-radius: 16px; 
    display: flex; 
    flex-direction: row; /* Sidebar on left, Content on right */
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}
/* Sidebar: Fixed width, holds the cover and key stats */
.modal-sidebar { 
    width: 280px; 
    background: var(--bg); 
    filter: brightness(0.95);
    padding: 20px; 
    border-right: 1px solid rgba(0,0,0,0.05);
    display: flex; 
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}
.sidebar-cover { 
    width: 120px;
    margin: 0 auto;
    display: block;
    border-radius: 8px; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}
.sidebar-stats {display: flex; flex-direction: column; gap: 12px; max-height: 100%;}
.stat-item .label {font-size: 0.65rem; color: var(--accent); font-weight: 800; display: block;}
.stat-item {font-size: 0.75rem; color: var(--text-dim); line-height: 1.4;}
.modal-divider {
    height: 1px;
    width: 100%;
    /* This creates a line that fades into the background at the edges */
    background: linear-gradient(to right, 
        transparent, 
        var(--text-dim), 
        transparent
    );
    opacity: 0.2; /* Keeps it very subtle */
    margin: 20px 0; /* Adds consistent spacing around the line */
}

/* Light mode tweak to make the line slightly more visible */
[data-theme="light"] .modal-divider {
    opacity: 0.15;
    background: linear-gradient(to right, 
        transparent, 
        #000, 
        transparent
    );
}
.update-banner {
    display: inline-block;
    padding: 4px 5px;
    background: rgba(88, 101, 242, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    margin-top: 5px;
    margin-bottom: 5px;
}
/* Main Content: Hero image/trailer and description */
.modal-main { 
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure it fills the modal height */
    padding: 20px; /* Consistent internal spacing */
}
.modal-close-sticky {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2); /* Subtle background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 500; /* High enough to stay above all content */
    transition: all 0.2s ease;
}
[data-theme="light"] .modal-close-sticky {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-close-sticky:hover {
    background: var(--accent);
    color: white;
}
#modal-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}
#modal-header h2 { 
    font-size: 2rem; 
    margin-bottom: 10px; 
    font-weight: 800; 
}
.media-carousel { 
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    background: #000;
    border-radius: 12px;
    margin: 20px 0;
    min-height: 350px;
}
.media-item {
    flex: 0 0 100%;
    height: 350px;
    object-fit: cover;
    scroll-snap-align: start;
    border: none;
}
.modal-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
    opacity: 0.8;
    margin-bottom: 5px;
    max-width: 800px;
    overflow-y: auto;
    max-height: 200px;
    flex-grow: 1;
}
.modal-footer-row {
    display: flex;
    flex-direction: row;
    align-items: center; /* Change flex-start to center */
    margin-top: auto; 
    width: 100%;
    padding-bottom: 28px; /* Give it some breathing room from the window edge */
}
.steam-link {
    width: 100%;
    text-align: center;
    padding: 15px 10px;
    font-size: 0.8rem;
}

/* --- 7. BUTTONS & UI --- */
#theme-toggle { background: #2a2d33; color: #fff; border: 1px solid #444; padding: 6px 14px; border-radius: 4px; font-size: 0.7rem; cursor: pointer; }
.shop-section {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.steam-link {
    width: 220px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 250px; /* Don't let the button get comically wide */
    padding: 18px 0;
    font-size: 0.9rem;
    letter-spacing: 2px;
    background: var(--button-bg, #1b2838);
    border: 1px solid var(--accent);
    color: var(--button-text, #ffffff);
    text-align: center;
    border-radius: 4px;
    transition: 0.3s;
    white-space: nowrap;
    font-weight: 800;
    text-decoration: none;
}

.steam-link:hover {
    background: var(--button-bg);
    filter: brightness(1.5);
}

/* Container for stacked tags */
.tag-container {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 25;
    align-items: flex-end;
}

.status-tag {
    font-size: 0.5rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    color: #fff;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Specific Colors */
.tag-ea { background: #f1c40f; color: #000; }   /* Yellow */
.tag-exp { background: #9b59b6; }              /* Purple */
.tag-port { background: #3498db; }             /* Blue */

/* --- POPUP MEDIA GALLERY (Isolated from Main Carousel) --- */
.gallery-wrapper {
    position: relative;
    flex: 0 0 350px;
    padding: 0 50px; 
    margin: 0;
    margin-bottom: -28px;
}

.gallery-viewport { 
    display: flex; 
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.gallery-slide { 
    flex: 0 0 100%; 
    aspect-ratio: 16/9; 
    overflow: hidden;
}

.gallery-slide img, 
.gallery-slide iframe { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    border: none;
}

/* Gallery Navigation */
.gallery-nav {
    position: absolute; 
    top: 42%; /* Center to the media, not 25% */
    transform: translateY(-50%);
    background: var(--button-bg);
    color: #ffffff !important; /* Force the arrow to be WHITE */
    border: 1px solid var(--accent);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    border-radius: 50%;
    font-size: 1.5rem; /* Make the arrow larger */
    line-height: 1;
}
.gallery-nav:hover { background: var(--button-bg); filter: brightness(1.5); }
.gallery-nav.prev { left: 5px; } 
.gallery-nav.next { right: 5px; }

/* Dots Indicator */
.gallery-dots { 
    display: flex; 
    justify-content: center; 
    gap: 10px; 
    margin-top: 20px; 
}
.gallery-dot { 
    width: 8px; 
    height: 8px; 
    background: var(--dot-color, rgba(255,255,255,0.2)); 
    border-radius: 50%; 
    cursor: pointer;
    transition: 0.3s; 
}
.gallery-dot.active { 
    background: var(--accent); 
    transform: scale(1.3); 
}

/* --- Screenshots --- */
/* --- FULLSCREEN SCREENSHOT PREVIEW --- */
.preview-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
#screenshot-preview {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}
.preview-image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    user-select: none;
}
.preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 60px;
    height: 100%; /* Giant hit area for easy clicking */
    font-size: 2rem;
    cursor: pointer;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s, background 0.2s;
    z-index: 1010;
}
/* Show buttons when hovering the container */
.preview-container:hover .preview-nav {
    opacity: 1;
}
.preview-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}
.preview-nav.prev { left: 0; }
.preview-nav.next { right: 0; }
/* Close Button */
.preview-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1100; /* HIGHER than the .preview-nav (which is 1010) */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}
.preview-close:hover { opacity: 1; background: var(--accent)}
@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.clickable-screenshot {
    cursor: zoom-in;
    transition: filter 0.2s;
}
.clickable-screenshot:hover {
    filter: brightness(1.2);
}

/* --- 8. MOBILE OPTIMIZATIONS (Max-width: 768px) --- */
@media (max-width: 768px) {
    /* 1. Yeet the Scrollbar but keep functionality */
    .carousel-wrapper::-webkit-scrollbar {
        display: none;
    }
    .carousel-wrapper {
        scrollbar-width: none; /* Firefox */
        padding: 15px 0;
    }

    /* 2. Shrink the 'Walls' to save real estate */
    .wall {
        width: 60px; /* Reduced from 180px */
    }
    .carousel-container {
        padding-left: 40px; /* Bring cards closer to edge */
    }

    /* 3. The Big Modal Reset (Stack everything vertically) */
    .modal-content {
        flex-direction: column; /* Stack Sidebar over Main */
        height: 95vh; /* Take up more height on mobile */
        overflow-y: auto; /* Allow the whole modal to scroll */
    }

    .modal-close-sticky {
        top: 15px;
        right: 15px;
        background: var(--accent); /* Make it more obvious on mobile */
        color: white;
        width: 45px;
        height: 45px;
    }

    .modal-sidebar {
        width: 100%; /* Full width */
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 15px;
        flex: 0 0 auto; /* Don't grow/shrink weirdly */
    }

    .sidebar-cover {
        width: 100px; /* Smaller cover for mobile */
    }

    .modal-main {
        padding: 15px;
        display: block; /* Remove flex to allow natural scrolling */
    }

    .modal-description {
        max-height: none; /* Let it expand since the whole modal scrolls */
        margin-bottom: 20px;
    }

    /* 4. Footer & Gallery Stack */
    .modal-footer-row {
        flex-direction: column; /* Stack Gallery over Button */
        gap: 20px;
        padding-bottom: 20px;
        margin-bottom: 0;
    }

    .gallery-wrapper {
        flex: 0 0 auto;
        width: 100%;
        padding: 0 40px; /* Ensure arrows have room */
        margin-bottom: 0; /* Reset your desktop offset */
    }

    .shop-section {
        width: 100%;
        padding: 10px 0;
    }

    .steam-link {
        width: 100%; /* Full width button for easy thumb-tapping */
        max-width: none;
    }

    /* 5. Navigation Tweaks */
    .gallery-nav {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    .preview-nav {
        height: 70%; /* Pull the hit area down so it doesn't overlap the top X */
        top: 60%; 
    }
    
    /* Make the screenshot preview close button easier to hit */
    .preview-close {
        top: 10px;
        right: 10px;
        font-size: 2rem;
        padding: 10px;
    }
}

/* ----------------------------THE NEWS SECTION OF THE WEB PAGE----------------------*/
.news-section {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 per row on PC */
    gap: 25px;
}

/* --- THE NEWS CARD --- */
.news-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, border-color 0.3s;
    text-decoration: none; /* In case the whole card is a link */
}

.news-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.news-image-wrapper {
    width: 100%;
    aspect-ratio: 16/8; /* Cinematic wide ratio */
    overflow: hidden;
    background: #000;
}

.news-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.news-card:hover .news-image {
    transform: scale(1.05);
}

.news-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.news-source {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.news-category-tag {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    background: rgba(88, 101, 242, 0.15);
    color: var(--accent);
    border-radius: 6px;
    text-transform: uppercase;
}

.news-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
    margin-bottom: 15px;
    flex-grow: 1;
}

.news-footer {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.btn-news {
    flex: 1;
    padding: 10px;
    font-size: 0.75rem;
    font-weight: 800;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: 0.2s;
}

.btn-visit { background: var(--accent); color: white; }
.btn-visit:hover { filter: brightness(1.2); }

.btn-copy { 
    background: rgba(255, 255, 255, 0.05); 
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-copy:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }

/* --- MOBILE TWEAKS --- */
@media (max-width: 768px) {
    .news-grid { grid-template-columns: 1fr; } /* 1 per row */
    .news-title { font-size: 1rem; }
}

/* --- LIGHT MODE NEWS ADJUSTMENTS --- */
[data-theme="light"] .news-card {
    background: #ffffff;
    /* Add a subtle border so the white card stands out from the white background */
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .news-title {
    color: #1a1a1a; /* Ensure high contrast for the headline */
}

[data-theme="light"] .news-source {
    color: #666666; /* Slightly darker text for the source */
}

/* --- LIGHT MODE BUTTONS --- */
[data-theme="light"] .btn-copy {
    background: #f0f0f2; /* Light gray background instead of transparent */
    color: #444444;
    border: 1px solid #e0e0e4;
}

[data-theme="light"] .btn-copy:hover {
    background: #e8e8eb;
    color: #000000;
}

[data-theme="light"] .news-category-tag {
    background: rgba(88, 101, 242, 0.1); /* Keep the accent but make it softer */
    color: var(--accent);
}