/* =====================================================================
   CyberX games page v34
   Просто постеры игр + hover название/бейджи + модальное окно с описанием.
===================================================================== */

.games-page{
  position:relative;
  min-height:100vh;
  overflow:hidden;
  padding:clamp(92px, 10vw, 138px) 0 clamp(72px, 8vw, 120px);
  background:
    radial-gradient(circle at 78% 4%, rgba(255,0,51,.18), transparent 32%),
    radial-gradient(circle at 8% 42%, rgba(255,0,51,.08), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.02), transparent 18%),
    var(--bg, #050507);
}

.games-bg{
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:.34;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size:46px 46px;
  mask-image:linear-gradient(to bottom, #000 0%, rgba(0,0,0,.86) 42%, transparent 100%);
}

.games-page .container{
  position:relative;
  z-index:1;
}

.games-hero{
  max-width:920px;
  margin:0 auto 30px;
  text-align:center;
}

.games-hero h1{
  margin:12px 0 14px;
  color:var(--text, #fff);
  font-family:var(--font-display, inherit);
  font-size:clamp(2.25rem, 6vw, 5.6rem);
  line-height:.92;
  letter-spacing:-.075em;
  text-transform:uppercase;
}

.games-hero p{
  max-width:720px;
  margin:0 auto;
  color:var(--muted, #a7a7b3);
  font-size:clamp(.9rem, 1.15vw, 1rem);
  line-height:1.68;
}

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

.game-showcase-card{
  min-width:0;
}

.game-showcase-card__open{
  position:relative;
  width:100%;
  aspect-ratio:3 / 4;
  min-height:380px;
  display:block;
  overflow:hidden;
  padding:0;
  border-radius:30px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(15,16,21,.90);
  box-shadow:0 24px 64px rgba(0,0,0,.36);
  color:inherit;
  text-align:left;
  cursor:pointer;
  transition:transform .45s cubic-bezier(.16,1,.3,1), border-color .45s ease, box-shadow .45s ease;
}

.game-showcase-card__open:hover{
  transform:translateY(-8px);
  border-color:rgba(255,0,51,.34);
  box-shadow:0 32px 78px rgba(0,0,0,.44), 0 0 42px rgba(255,0,51,.12);
}

.game-showcase-card__photo{
  position:absolute;
  inset:0;
  overflow:hidden;
  background:
    radial-gradient(circle at 50% 24%, rgba(255,0,51,.22), transparent 42%),
    linear-gradient(145deg, rgba(255,255,255,.08), rgba(255,255,255,.025)),
    rgba(0,0,0,.28);
}

.game-showcase-card__photo img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  transition:transform .55s cubic-bezier(.16,1,.3,1), filter .55s ease;
}

.game-showcase-card__open:hover .game-showcase-card__photo img{
  transform:scale(1.065);
  filter:brightness(.58) saturate(1.05);
}

.game-showcase-card__placeholder,
.game-modal-shot__placeholder{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  color:var(--muted, #a7a7b3);
  text-align:center;
  font-weight:800;
}

.game-showcase-card__placeholder i,
.game-modal-shot__placeholder i{
  color:var(--accent, #ff0033);
}

.game-showcase-card__photo:not(.is-empty) .game-showcase-card__placeholder,
.game-modal-shot:not(.is-empty) .game-modal-shot__placeholder{
  display:none;
}

.game-showcase-card__hover{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  gap:16px;
  padding:22px;
  background:
    linear-gradient(180deg, transparent 10%, rgba(0,0,0,.36) 50%, rgba(0,0,0,.88) 100%),
    radial-gradient(circle at 50% 58%, rgba(255,0,51,.20), transparent 48%);
  opacity:0;
  transform:translateY(14px);
  transition:opacity .35s ease, transform .35s ease;
  pointer-events:none;
}

.game-showcase-card__open:hover .game-showcase-card__hover{
  opacity:1;
  transform:translateY(0);
}

.game-showcase-card__title{
  display:block;
  color:#fff;
  font-family:var(--font-display, inherit);
  font-size:clamp(1.25rem, 2vw, 1.75rem);
  line-height:1.04;
  letter-spacing:-.055em;
  text-shadow:0 10px 30px rgba(0,0,0,.6);
}

.game-showcase-card__badges{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.game-showcase-card__badges b,
.game-modal__tag{
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.13);
  background:rgba(255,255,255,.08);
  color:#fff;
  font-family:var(--font-display, inherit);
  font-size:.66rem;
  letter-spacing:.065em;
  text-transform:uppercase;
}

.game-showcase-card__badges b:first-child,
.game-modal__tag{
  color:var(--accent, #ff0033);
  border-color:rgba(255,0,51,.42);
  background:rgba(255,0,51,.08);
}

.game-modal{
  position:fixed;
  inset:0;
  z-index:1000;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.game-modal.is-open{
  display:flex;
}

.game-modal-open{
  overflow:hidden;
}

.game-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(12px);
}

.game-modal__dialog{
  position:relative;
  z-index:1;
  width:min(1180px, 100%);
  max-height:min(760px, calc(100vh - 48px));
  display:grid;
  grid-template-columns:minmax(0, 1.08fr) minmax(340px, .92fr);
  overflow:hidden;
  border-radius:34px;
  border:1px solid rgba(255,255,255,.11);
  background:
    radial-gradient(520px 280px at 100% 0, rgba(255,0,51,.16), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.025)),
    rgba(12,13,18,.96);
  box-shadow:0 40px 120px rgba(0,0,0,.58), 0 0 70px rgba(255,0,51,.12);
}

.game-modal__close{
  position:absolute;
  top:18px;
  right:18px;
  z-index:5;
  width:44px;
  height:44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(255,255,255,.12);
  border-radius:50%;
  background:rgba(0,0,0,.34);
  color:#fff;
  cursor:pointer;
  transition:transform .2s ease, background .2s ease, border-color .2s ease;
}

.game-modal__close:hover{
  transform:translateY(-1px);
  background:rgba(255,0,51,.14);
  border-color:rgba(255,0,51,.34);
}

.game-modal__gallery{
  position:relative;
  min-height:560px;
  background:rgba(0,0,0,.24);
}

.game-modal__viewport{
  height:100%;
  overflow:hidden;
}

.game-modal__track{
  display:flex;
  height:100%;
  transition:transform .55s cubic-bezier(.16,1,.3,1);
}

.game-modal-shot{
  position:relative;
  flex:0 0 100%;
  min-height:100%;
  background:
    radial-gradient(circle at 50% 24%, rgba(255,0,51,.20), transparent 42%),
    rgba(0,0,0,.28);
}

.game-modal-shot img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}

.game-modal__controls{
  position:absolute;
  left:20px;
  right:20px;
  bottom:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
}

.game-modal__controls button{
  width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(255,255,255,.13);
  border-radius:50%;
  background:rgba(0,0,0,.42);
  color:#fff;
  cursor:pointer;
  transition:transform .2s ease, background .2s ease, border-color .2s ease;
}

.game-modal__controls button:hover{
  transform:translateY(-1px);
  background:rgba(255,0,51,.14);
  border-color:rgba(255,0,51,.34);
}

.game-modal__dots{
  display:flex;
  gap:8px;
  padding:9px 12px;
  border-radius:999px;
  background:rgba(0,0,0,.42);
  border:1px solid rgba(255,255,255,.11);
}

.game-modal__dots button{
  width:8px;
  height:8px;
  padding:0;
  min-width:0;
  border:0;
  background:rgba(255,255,255,.34);
  border-radius:999px;
}

.game-modal__dots button.is-active{
  width:28px;
  background:var(--accent, #ff0033);
}

.game-modal__info{
  min-width:0;
  overflow:auto;
  padding:clamp(28px, 3.2vw, 44px);
}

.game-modal__info h2{
  margin:16px 0 20px;
  color:#fff;
  font-family:var(--font-display, inherit);
  font-size:clamp(1.8rem, 4vw, 3.4rem);
  line-height:.96;
  letter-spacing:-.065em;
}

.game-modal__story{
  padding:20px;
  border-radius:24px;
  background:rgba(0,0,0,.24);
  border:1px solid rgba(255,255,255,.09);
}

.game-modal__story h3{
  margin:0 0 12px;
  color:#fff;
  font-family:var(--font-display, inherit);
  font-size:1rem;
  letter-spacing:-.025em;
}

.game-modal__story p{
  margin:0;
  color:var(--muted, #a7a7b3);
  font-size:.94rem;
  line-height:1.72;
}

.game-modal__story p + p{
  margin-top:12px;
}

.game-modal__facts{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
  margin:20px 0 0;
}

.game-modal__facts div{
  min-height:112px;
  padding:16px;
  border-radius:20px;
  background:rgba(0,0,0,.24);
  border:1px solid rgba(255,255,255,.09);
}

.game-modal__facts i{
  width:34px;
  height:34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-bottom:12px;
  border-radius:12px;
  background:rgba(255,0,51,.13);
  color:var(--accent, #ff0033);
}

.game-modal__facts span{
  display:block;
  color:var(--muted, #a7a7b3);
  font-size:.68rem;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.game-modal__facts b{
  display:block;
  margin-top:6px;
  color:#fff;
  font-size:.82rem;
  line-height:1.3;
}

.games-empty{
  grid-column:1 / -1;
  min-height:260px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  border-radius:28px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  color:var(--muted, #a7a7b3);
  text-align:center;
}

.games-empty i{
  color:var(--accent, #ff0033);
  font-size:1.8rem;
}

.games-empty b{
  color:#fff;
  font-family:var(--font-display, inherit);
  font-size:1.05rem;
}

@media (max-width: 1080px){
  .games-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .game-modal__dialog{
    grid-template-columns:1fr;
    overflow:auto;
  }

  .game-modal__gallery{
    min-height:420px;
  }

  .game-modal__info{
    overflow:visible;
  }
}

@media (max-width: 680px){
  .games-page{
    padding-top:82px;
  }

  .games-grid{
    grid-template-columns:1fr;
  }

  .game-showcase-card__open,
  .game-modal__dialog{
    border-radius:24px;
  }

  .game-showcase-card__open{
    min-height:320px;
  }

  .game-modal{
    padding:14px;
  }

  .game-modal__dialog{
    max-height:calc(100vh - 28px);
  }

  .game-modal__gallery{
    min-height:300px;
  }

  .game-modal__facts{
    grid-template-columns:1fr;
  }

  .games-hero h1{
    font-size:clamp(2rem, 14vw, 3.2rem);
  }
}


/* =====================================================================
   v35 — modal performance optimization
   Убраны тяжёлые эффекты при открытии окна + lazy-load скриншотов.
===================================================================== */

.game-showcase-card,
.game-showcase-card__open{
  contain:layout paint;
}

/* Модалка теперь не заставляет браузер резко пересчитывать/размывать всю страницу */
.game-modal{
  opacity:0;
  visibility:hidden;
  display:flex !important;
  pointer-events:none;
  transition:opacity .18s ease, visibility .18s ease;
}

.game-modal.is-open{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}

/* backdrop-filter сильно тормозил при открытии — заменён на обычный затемнённый фон */
.game-modal__backdrop{
  background:rgba(0,0,0,.78) !important;
  backdrop-filter:none !important;
}

/* Уменьшены тяжёлые тени и радиусы перерисовки */
.game-modal__dialog{
  contain:layout paint;
  box-shadow:0 24px 70px rgba(0,0,0,.56) !important;
  background:
    radial-gradient(420px 220px at 100% 0, rgba(255,0,51,.11), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025)),
    rgba(12,13,18,.98) !important;
}

/* Скриншоты из слайдера загружаются только при открытии модалки */
.game-modal-shot img[hidden]{
  display:none !important;
}

/* Меньше нагрузки на анимации внутри модального окна */
.game-modal__track{
  will-change:transform;
}

.game-modal-shot,
.game-modal__gallery,
.game-modal__info{
  contain:layout paint;
}

.game-modal-shot img{
  transform:translateZ(0);
  backface-visibility:hidden;
}

/* На слабых устройствах ещё сильнее упрощаем открытие */
@media (max-width: 1080px){
  .game-modal__dialog{
    box-shadow:0 18px 54px rgba(0,0,0,.54) !important;
  }

  .game-modal__backdrop{
    background:rgba(0,0,0,.84) !important;
  }
}

@media (prefers-reduced-motion: reduce){
  .game-modal,
  .game-modal__track,
  .game-showcase-card__photo img,
  .game-showcase-card__hover{
    transition:none !important;
  }
}


/* =====================================================================
   v36 — games description + filters
===================================================================== */

.games-filter{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:10px;
  margin:0 auto 28px;
}

.games-filter button{
  min-height:42px;
  padding:0 16px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.045);
  color:var(--muted, #a7a7b3);
  font-family:var(--font-display, inherit);
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  cursor:pointer;
  transition:
    transform .25s ease,
    background .25s ease,
    border-color .25s ease,
    color .25s ease,
    box-shadow .25s ease;
}

.games-filter button:hover,
.games-filter button.is-active{
  transform:translateY(-1px);
  color:#fff;
  background:rgba(255,0,51,.13);
  border-color:rgba(255,0,51,.36);
  box-shadow:0 0 28px rgba(255,0,51,.12);
}

.game-showcase-card[hidden],
.games-empty[hidden],
.games-empty--filter[hidden],
[data-games-empty][hidden]{
  display:none !important;
}

.games-empty--filter{
  margin-top:18px;
}
