/* =========================================================
   GRID / LAYOUT ONLY
   - No card width, height, or internal card styling here
   - Card size stays in card.css
   - This file only controls layout behavior
========================================================= */

:root {
  --text: #e9eef2;
  --muted: #a8a8a8;
  --neon-green: #00ff9c;
  --glass-2: rgba(255, 255, 255, 0.05);

  --layout-max-width: 1120px;
  --layout-padding-x: 2px;

  --section-gap: 10px;
  --grid-gap: 12px;
  --rail-gap: 14px;
  --rail-padding: 12px 14px 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
}

main {
  max-width: var(--layout-max-width);
  margin: 10px auto;
  padding: var(--layout-padding-x);
}

.content-section {
  padding: 0;
  max-width: var(--layout-max-width);
  margin: 10px auto;
}

.section-header h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--text);
}

/* ---------------------------------------------------------
   Section strip headers
--------------------------------------------------------- */
.section-header.strip {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.section-header.strip.gold {
  background: linear-gradient(90deg, #4839C5, #3FDFD2);
  border: 0;
  box-shadow: 0 6px 20px rgba(170, 124, 0, 0.18),
              inset 0 -4px 12px rgba(255, 230, 170, 0.05);
}

.section-header.strip.gold h2 {
  color: #1b1200;
  letter-spacing: 1px;
  font-weight: 700;
  margin: 0;
  width: 100%;
}

.section-header.strip.lime {
  background: linear-gradient(90deg, #E50914, #B246FF);
  border: 0;
  box-shadow: 0 8px 28px rgba(0, 255, 100, 0.12),
              inset 0 -4px 10px rgba(0, 255, 120, 0.04);
}

.section-header.strip.lime h2 {
  color: #02240a;
  letter-spacing: 1px;
  font-weight: 700;
  margin: 0;
  width: 100%;
}
/* ---------------------------------------------------------
   Default container layout
   Cards keep their own width from card.css
--------------------------------------------------------- */
#moviesContainer,
#seriesContainer,
#relatedRow,
.movies-grid,
.grid-container,
.anime-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--grid-gap);
  align-items: flex-start;
  width: 100%;
  min-width: 0;
}

/* Prevent children from stretching unless card.css says so */
#moviesContainer > *,
#seriesContainer > *,
#relatedRow > *,
.movies-grid > *,
.grid-container > *,
.anime-grid > * {
  flex: 0 0 auto;
  min-width: 0;
}

/* ---------------------------------------------------------
   Horizontal scroll mode
   Add class="horizontal-scroll" to the container
--------------------------------------------------------- */
.horizontal-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--rail-gap);
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.horizontal-scroll::-webkit-scrollbar {
  display: none;
}

.horizontal-scroll > * {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

/* Related row */
#relatedRow.horizontal-scroll {
  gap: var(--rail-gap);
  padding-bottom: 8px;
}

#relatedRow .anime-card {
  flex: 0 0 auto;
}

/* ---------------------------------------------------------
   Two-row horizontal rail
   This does NOT set card width.
   Card width stays in card.css.
--------------------------------------------------------- */
#moviesContainer.horizontal-scroll,
#seriesContainer.horizontal-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, max-content);
  grid-auto-columns: max-content;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: start;
  justify-content: start;
  padding: 8px 4px 18px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#moviesContainer.horizontal-scroll::-webkit-scrollbar,
#seriesContainer.horizontal-scroll::-webkit-scrollbar {
  display: none;
}

#moviesContainer.horizontal-scroll > *,
#seriesContainer.horizontal-scroll > * {
  scroll-snap-align: start;
}

/* ---------------------------------------------------------
   Generic responsive grid mode
   Use this only when you want wrapping rows and not a rail.
   Card width still comes from card.css.
--------------------------------------------------------- */
.grid-container,
.movies-grid,
.anime-grid {
  justify-content: flex-start;
}

/* ---------------------------------------------------------
   Original image normalization rules
   Safe for any grid/card combination
--------------------------------------------------------- */
.movie-card img,
.movie-item img,
.movie-tile img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* ---------------------------------------------------------
   Utility spacing for small screens
--------------------------------------------------------- */
@media (max-width: 420px) {
  .horizontal-scroll {
    gap: 10px;
  }

  #moviesContainer.horizontal-scroll,
  #seriesContainer.horizontal-scroll {
    gap: 8px;
  }
}