/*
  Responsibility:
    Homepage-scoped styles for the game cards on index.html.
    Lays out the games grid and styles each card (header, logos, media widgets: YouTube + Steam).

  Notes:
    - Consumes global theme tokens from site.css.
    - Uses --card-border (set per theme) for consistent theming.
*/

/* ---------- Page layout container ---------- */
.games {
  width: min(100%, var(--max));
  display: grid;
  gap: 30px;
}

/* ---------- Card ---------- */
.games .game-card {
  border: 2px solid var(--card-border);
  padding: 20px;
  border-radius: 12px;
  background: var(--card-bg);
  display: grid;
  gap: 12px;
}

/* ---------- Card header (logo + title) ---------- */
.game-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-name {
  margin: 0;
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  font-family: "Quantico", sans-serif;
  font-weight: 400;           
}

/* ---------- Game logo (scaled) ---------- */
.game-logo {
  width: var(--game-logo-size, 64px);
  height: var(--game-logo-size, 64px);
  max-width: var(--game-logo-size, 64px);
  max-height: var(--game-logo-size, 64px);
  flex: 0 0 var(--game-logo-size, 64px);
  display: block;
  object-fit: contain;
  border-radius: 8px;
}

/* Theme-controlled logo swap for per-card logos */
.game-logo.theme-dark { display: none; }
:root[data-theme="dark"] .game-logo.theme-dark { display: block; }
:root[data-theme="dark"] .game-logo.theme-light { display: none; }

/* ---------- YouTube video ---------- */
.video-widget {
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.video-widget iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  display: block;
  border: 0;
}

/* ---------- Steam widget ---------- */
.steam-widget {
  margin-top: 12px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  padding-bottom: 1px;   
}

.steam-widget iframe {
  width: 100%;
  height: 190px;
  display: block;
  border: 0;
}

/* ---------- Game description (optional) ---------- */
.game-desc {
  margin: -2px 0 6px 0;
  font-family: "Exo 2", system-ui, Arial, sans-serif;
  font-weight: 200;
  line-height: 1.45;
  font-size: clamp(0.95rem, 2.7vw, 1.05rem);
  color: var(--text);
  opacity: 0.92;
}

/* Mobile: clamp description only when JS adds .is-clamped */
@media (max-width: 700px) {
  .game-desc.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Toggle button for expanding/collapsing description */
.desc-toggle {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-family: "Exo 2", system-ui, Arial, sans-serif;
  font-weight: 200;
  cursor: pointer;
  text-decoration: underline;
  opacity: 0.9;
  align-self: flex-start;
}

.desc-toggle:focus-visible {
  outline: 2px solid var(--accent, #888);
  outline-offset: 2px;
}

/* ---------- Promo image (for “Coming Soon”) ---------- */
.image-widget {
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.image-widget img {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 420px) {
  .steam-widget iframe {
    height: 210px;
  }
}
