/* ==========================================================================
   Games Page Specific Styles
   ========================================================================== */
.page-template-page-games #content {
    padding-top: 0;
}
/* Top Carousel Section */
.sc-top-carousel-section {
    margin: 0 -20px 20px -20px; 
}

.top-carousel-main {
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 10px;
}

.top-carousel-main .swiper-slide {
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    text-decoration: none;
}

.top-carousel-thumbs {
    height: 100px;
    box-sizing: border-box;
    padding: 0 10px;
}

.top-carousel-thumbs .swiper-slide {
    height: 100%;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    cursor: pointer;
    border-radius: 5px;
    box-sizing: border-box;
    background-size: cover;
    background-position: center;
}

.top-carousel-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border: 2px solid #ff38a2;
}

/* NEW: Glassmorphic Overlay for Top Carousel Slide */
.sc-slide-content-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: rgba(20, 20, 30, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}
.sc-slide-content-overlay h3 {
    margin: 0 0 5px 0;
    font-size: 1.5em;
    font-weight: 700;
}
.sc-slide-content-overlay p {
    margin: 0;
    font-size: 1em;
    color: #e0e0e0;
}


/* Main Page Header & Separators */
.sc-games-page-header {
    text-align: center;
    margin-bottom: 20px;
}

.page-title {
    text-transform: uppercase;
    font-style: italic;
    font-weight: 700;
    font-size: 1.8em;
    margin-bottom: 15px;
}

hr.wp-block-separator {
    background-color: #322840 !important;
    color: #322840 !important;
    border: none;
    height: 2px;
    margin: 20px auto;
    max-width: 100%;
}

/* Featured Games Section */
.sc-featured-games-section {
    margin-bottom: 30px;
}

.sc-featured-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #322840;
}

.sc-featured-title {
    margin: 0;
    font-size: 1.2em;
    text-transform: uppercase;
    font-weight: normal;
    letter-spacing: 1px;
    color: #b3a4d4;
}

.sc-featured-header .sc-games-sort-select {
    max-width: 200px; 
}

.sc-featured-carousel-container {
    position: relative;
}

.sc-featured-carousel .swiper-slide {
    /* FIX: Removed hardcoded grid, Swiper JS now handles slidesPerView for responsiveness */
    /* Only the single .sc-game-card should be inside */
}

/* Global Swiper Navigation Styles (Cleaned up to ONLY apply visual style, removing overrides) */
.swiper-button-next, .swiper-button-prev {
    color: #fff;
    width: 44px;
    height: 60px;
    background-color: rgb(0 0 0 / 80%);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 100; 
    /* The overrides (left: 0 !important etc.) that broke the top carousel were removed here. */
}

.swiper-button-next:after, .swiper-button-prev:after {
    font-size: 20px;
    font-weight: 900;
}

/* FIX: Specific positioning for Featured Carousel arrows (outside the swiper wrapper) */
.sc-featured-prev, .sc-featured-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    /* Ensuring the custom classes inherit visual styles from the global ones */
}

/* Horizontal positioning */
.sc-featured-prev {
    left: 0 !important; 
    right: auto;
    border-radius: 0 5px 5px 0; 
}
.sc-featured-next {
    right: 0 !important; 
    left: auto;
    border-radius: 5px 0 0 5px; 
}

.sc-banner-image {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 1500px;
  border-radius: 18px;
  overflow: hidden; /* ensures rounded corners apply to the shadow */
  box-shadow: 0 15px 25px 0 #00000082;
  transform-origin: center;
  animation: scBounce 1.5s ease-in-out infinite;
}

.sc-banner-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  transition: transform 0.15s ease-in-out;
}

.sc-banner-image:hover img {
  transform: scale(1.02) rotateZ(-0.3deg);
}

/* Main Games Archive Section */
.sc-games-archive-container {
    display: flex;
    gap: 30px;
    padding-top: 20px;
    align-items: flex-start; /* FIX: Prevents columns from stretching to equal height */
}

/* Filters sidebar (left column) */
.sc-games-filters {
    flex: 0 0 240px; 
    color: #fff;
}

.filter-group {
    padding: 15px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.filter-title {
    margin: 0 0 15px 0;
    font-size: 1em;
    color: #fff;
    padding-bottom: 10px;
    font-weight: normal;
    text-transform: uppercase;
    border-bottom: 2px solid #322840;
}

.sc-games-sort-select {
    width: 100%;
    padding: 12px 10px;
    background-color: #393448;
    color: #fff;
    border: 1px solid #605876;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

/* Genre Filter Styles */
.sc-genre-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.sc-genre-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #e0e0e0;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 5px;
    transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.sc-genre-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.sc-genre-item.active {
    background-color: rgba(112, 57, 155, 0.3);
    border-color: rgba(112, 57, 155, 0.8);
    color: #fff;
}

.sc-genre-icon {
    width: 60px;
    height: 60px;
    background-color: #4a4a66;
    border-radius: 6px;
    margin-bottom: 8px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.sc-genre-name {
    font-size: 13px;
    text-align: center;
    font-weight: 500;
}

/* Games grid (right column) */
.sc-games-grid-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sc-games-grid {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 across */
    gap: 25px;
    grid-auto-flow: row dense;
}

/* Individual game card styling */
.sc-game-card {
    width: 100%;
    aspect-ratio: 307 / 460;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    background-color: #3a3a3a;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sc-game-card.hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    display: none; /* For layout recalculation */
}

.sc-game-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sc-game-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.sc-game-card:hover .sc-game-card-overlay {
    transform: translateY(0);
}

.sc-card-title {
    font-size: 1.1em;
    font-weight: 700;
    margin: 0 0 5px 0;
}

.sc-card-meta {
    font-size: 0.8em;
    color: #ccc;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.sc-card-developer, .sc-card-publisher {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-card-desc {
    font-size: 0.85em;
    line-height: 1.4;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}

.sc-card-button {
    display: block;
    padding: 12px 10px;
    border: none;
    border-radius: 5px;
    background-color: #70399b;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sc-card-button:hover {
    background-color: #8c4dbb;
}

/* Published Games Grid Pagination */
.sc-pagination-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid #444;
}

.sc-page-btn {
    background-color: #333;
    color: #eee;
    border: 1px solid #555;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sc-page-btn:hover {
    background-color: #4a4a4a;
    border-color: #777;
}

.sc-page-btn.active {
    background-color: #70399b; /* Theme purple */
    border-color: #9e58d9;
    color: #fff;
    cursor: default;
}

.sc-games-archive-container {
    min-height: 1477px;
}

/* subtle infinite bounce animation */
@keyframes scBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* Responsive Styles */
@media only screen and (max-width: 960px) {
    /* FIX: Removed grid properties here to let Swiper JS control slide count */
     .sc-featured-prev {
        left: 10px;
    }
    .sc-featured-next {
        right: 10px;
    }
}

@media only screen and (max-width: 768px) {
    .sc-games-archive-container {
        flex-direction: column;
    }
    .sc-games-filters {
        flex-basis: auto;
        width: 100%;
        margin-bottom: 20px;
    }
    .sc-games-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media only screen and (max-width: 600px) {
    /* FIX: Removed grid properties here to let Swiper JS control slide count */
    .sc-featured-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    .sc-featured-header .sc-games-sort-select {
        max-width: 100%;
    }
}

@media (max-width: 1200px) {
  .sc-games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 800px) {
  .sc-games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .sc-games-grid {
    grid-template-columns: 1fr;
  }
}

/* 1) exact portrait ratio: 300x450 => 2:3 */
.sc-game-card {
  contain: layout paint;                    /* isolates layout/paint for smoother reflow */
  will-change: transform;                   /* helps hover & filter transforms */
  backface-visibility: hidden;              /* avoids subpixel flickers on scale/rotate */
}

/* 2) when hidden for filtering, kill transitions so cards don't linger in layout */
.sc-game-card.hidden {
  display: none !important;                 /* already present, keep it authoritative */
  opacity: 0 !important;
  transform: scale(0.9) !important;
  transition: none !important;              /* no fade/scale-after-effects */
}

/* 3) ensure image always fills the 2:3 box cleanly */
.sc-game-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;                         /* your current intent, kept explicit */
}

/* 4) optional: clamp title/desc heights so overlay content never nudges layout
      (the overlay is absolute, so this is purely for visual consistency) */
.sc-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1em * 1.2 * 2);          /* reserve room for 2 lines */
}
.sc-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1em * 1.4 * 3);          /* reserve room for 3 lines */
}
