/* Games hub (games/) and the frame shared by each game page (games/<slug>/).
   Ported from the standalone section «ألعاب نبات» (nabat-games component).
   Each game's own styles live in game-<slug>.css, scoped under .kg-<slug>. */

/* ---------- Hub ---------- */

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.game-card:hover {
  border-color: var(--green-400);
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
}

.game-card:focus-within {
  outline: 2px solid var(--text-default);
  outline-offset: 2px;
}

.game-card__tile {
  position: relative;
  flex: none;
  height: 240px;
  background: var(--bg-neutral);
}

.game-card__tile img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The colouring page: a line drawing shown whole on white. */
.game-card__tile--drawing {
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
}

.game-card__tile--drawing img {
  padding: 16px;
  object-fit: contain;
}

.game-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  /* 1px less than the 24px grid on each side: the card border takes it. */
  padding: 20px 23px 23px;
}

.game-card__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
}

.game-card__description {
  flex: 1;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 24px;
}

.game-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 0;
}

.game-tag {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-paragraph);
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
}

.game-tag--type {
  border-color: var(--green-200);
  background: var(--green-50);
  color: var(--green-700);
}

.game-card__play {
  align-self: flex-end;
  margin-top: 16px;
}

/* The whole card opens the game. */
.game-card__play::after {
  content: '';
  position: absolute;
  inset: 0;
}

.game-card__play:focus-visible {
  outline: none;
}

/* Three cards stay on one row down to tablets, so none is left alone on a row. */
@media (max-width: 991px) {
  .games-grid {
    gap: 16px;
  }

  .game-card__tile {
    height: 180px;
  }

  .game-card__body {
    padding: 16px 15px 15px;
  }

  .game-card__title {
    font-size: 20px;
    line-height: 30px;
  }
}

@media (max-width: 700px) {
  .games-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .game-card__tile {
    height: 200px;
  }

  .game-card__body {
    padding: 20px 23px 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-card {
    transition: none;
  }
}

/* ---------- Game page frame ---------- */

.game-page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px clamp(12px, 3vw, 24px) 56px;
}

.game-page__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.game-back .icon {
  font-size: 16px;
}

.game-stage {
  position: relative;
  min-width: 0;
}

.game-noscript {
  padding: 24px;
  border: 1px solid #fecdca;
  border-radius: var(--radius-md);
  background: #fef3f2;
  color: #b42318;
  text-align: center;
}
