/* ======================== Сброс и база ======================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Roboto', sans-serif;
  background-color: #121226;
  color: #e0e0e0;
  line-height: 1.6;
}

.container { width: 90%; max-width: 1200px; margin: 0 auto; }

/* ======================== Шапка ======================== */
.header {
  background-color: #1a0b2e;
  padding: .75rem 0;
  border-bottom: 1px solid #ffd700;
  overflow: visible;
  position: relative;
  z-index: 10;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  height: 50px;
  position: relative;
}

.logo img {
  height: 50px;
  width: auto;
  transform: scale(1.18);
  transform-origin: left center;
  filter: drop-shadow(0 0 6px rgba(0,0,0,0.7));
  margin-top: -8px;
}

/* ======================== Навигация ======================== */
.nav { display: flex; position: relative; z-index: 20; }
.nav ul { display: flex; list-style: none; gap: 1.1rem; }

.nav a {
  color: #f4f4f7;
  text-decoration: none;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .2px;
  position: relative;
  transition: color .2s ease;
  text-shadow: 0 0 6px rgba(0,0,0,.5);
}

.nav a:hover { color: #ffe27a; }

.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 2px;
  background: #ffe27a;
  transition: width .18s ease;
}
.nav a:hover::after { width: 100%; }

/* Кнопка входа */
.button {
  display: inline-block;
  background: linear-gradient(#ffd700, #e0c000);
  color: #121226;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(255,215,0,0.2), 0 2px 8px rgba(0,0,0,0.35);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.button:hover {
  filter: brightness(1.05);
  box-shadow: 0 0 0 1px rgba(255,215,0,0.35), 0 4px 16px rgba(0,0,0,0.45);
  transform: translateY(-1px);
}

/* ======================== Бургер-меню ======================== */
.burger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px;
  border-radius: 6px;
}
.burger:hover { background: rgba(255,215,0,.08); }
.burger div {
  width: 25px;
  height: 3px;
  background: #ffd700;
  border-radius: 2px;
}

/* ======================== Заголовки секций ======================== */
.slider h2, .popular-games h2, .latest-news h2, .latest-videos h2 {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #ffd700;
  text-shadow:
    0 0 6px rgba(0,0,0,.75),
    0 1px 0 rgba(0,0,0,.5);
}

/* ======================== Слайдер ======================== */
.slider {
  padding: 1.4rem 0;
  background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('images/fantasy-bg.jpg');
  background-size: cover;
  background-position: center;
}

.slider-item {
  background-color: rgba(26,11,46,0.82);
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #ffd700;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
}

.slider-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 200px;
  object-fit: cover;
  border-radius: 6px;
}
.slider-item.clickable { cursor: pointer; }
.slider-item.clickable:hover { box-shadow: 0 6px 20px rgba(0,0,0,.35); transform: translateY(-2px); transition: .18s ease; }

.img-cover   { object-fit: cover; }
.img-contain { object-fit: contain; background: rgba(0,0,0,.15); }
.img-top     { object-position: 50% 20%; }
.img-center  { object-position: 50% 50%; }

/* ======================== Популярные игры ======================== */
.popular-games { padding: 1.4rem 0; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.game-card {
  background-color: #1a0b2e;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #ffd700;
  text-align: center;
  transition: transform .25s ease, box-shadow .25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  width: 100%;
}

.game-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}

/* Квадрат фиксированного размера */
.game-thumb {
  width: 160px;
  height: 160px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0,0,0,.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Картинка внутри */
.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
  transition: transform .25s ease;
}

.game-card:hover .game-thumb img { transform: scale(1.06); }

.game-card h3 {
  font-size: 0; /* скрываем визуально */
  line-height: 0;
  color: transparent;
  margin: 0;
}


/* ======================== Последние новости ======================== */
.latest-news { padding: 1.4rem 0; }

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.news-card {
  background-color: #1a0b2e;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #ffd700;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  display: flex;
  flex-direction: column;
}

.news-card img {
  width: 100%;
  aspect-ratio: 5 / 4;
  max-height: 150px;
  object-fit: cover;
  border-radius: 6px;
}

.news-card h3 {
  margin-top: .45rem;
  color: #ffd700;
  text-shadow: 0 0 6px rgba(0,0,0,0.6);
  min-height: 2.2em;
}

.news-card p { margin-top: .35rem; flex: 1; }
.rating { margin-top: .6rem; }

/* В карточке новостей: видим больше по вертикали */
.news-card[data-id="hs-nerfs"] img {
  /* делаем превью чуть выше именно у этой карточки */
  max-height: 170px;          /* было 150px — подними/опусти по вкусу: 165–180 */
  aspect-ratio: 5 / 4;        /* оставляем ту же пропорцию, чтобы сетка не поплыла */
  object-fit: cover;
  object-position: 50% 38%;   /* фокус ниже центра; попробуй 35–45% */
}
/* --- Только для "Hearthstone: дорожная карта" (news5.svg) --- */

/* В карточке: смещаем чуть выше */
.news-card[data-id="hs-roadmap"] img {
  object-fit: cover;
  object-position: 50% 15%;   /* выше центра, чтобы карта поднималась */
}

/* ======================== Последние видео ======================== */
.latest-videos { padding: 1.4rem 0; }

.videos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.video-card {
  background-color: #1a0b2e;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #ffd700;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
}

.video-card iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 6px;
}

/* ======================== Подвал ======================== */
.footer {
  background-color: #1a0b2e;
  padding: 1rem 0;
  text-align: center;
  border-top: 1px solid #ffd700;
}
.social-links { margin-bottom: 1rem; }
.social-links a { color: #e0e0e0; margin: 0 0.5rem; text-decoration: none; }
.social-links a:hover { color: #ffd700; }

/* ======================== Адаптив ======================== */
@media (max-width: 992px) {
  .logo img { transform: scale(1.15); margin-top: -8px; }
  .games-grid { grid-template-columns: repeat(2, 1fr); }
  .game-thumb { width: 140px; height: 140px; }
  .news-grid, .videos-grid { grid-template-columns: 1fr; }
  .slider-item img { max-height: 180px; }
  .news-card img   { max-height: 140px; }
}

@media (max-width: 768px) {
  .logo img { transform: scale(1.08); margin-top: -6px; }
  .header .container { gap: 16px; }

  .burger { display: flex; }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #1a0b2e;
    flex-direction: column;
    width: 220px;
    border: 1px solid #ffd700;
    border-radius: 6px;
    padding: 0.5rem 0;
    transform-origin: top right;
    transform: scaleY(0.9);
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
  }
  .nav ul { flex-direction: column; gap: .6rem; padding: 0.5rem 0.75rem; }
  .nav.active { display: flex; opacity: 1; transform: scaleY(1); }

  .slider-item img { max-height: 160px; }
  .news-card img   { max-height: 130px; }
  .game-thumb { width: 130px; height: 130px; }
}

@media (max-width: 480px) {
  .logo img { transform: scale(1.05); margin-top: -4px; }
  .slider h2, .popular-games h2, .latest-news h2, .latest-videos h2 { font-size: 1.6rem; }
  .slider-item img { max-height: 140px; }
  .news-card img   { max-height: 120px; }
  .game-thumb { width: 120px; height: 120px; }
  .game-card h3    { font-size: 0.9rem; }
}

/* ======================== Accessibility ======================== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
/* Кликабельность карточек новостей */
.news-card { cursor: pointer; }
.news-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.35); transform: translateY(-2px); transition: .18s ease; }

/* ======= Модалка новости ======= */
.modal {
  position: fixed; inset: 0; display: none;
}
.modal.is-open { display: block; }

.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.6);
}

.modal__dialog {
  position: relative;
  max-width: 760px;
  margin: 6vh auto;
  background: #191133;
  border: 1px solid #ffd700;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  padding: 1rem;
}

.modal__close {
  position: absolute; top: 8px; right: 10px;
  background: transparent; border: none; color: #ffd700;
  font-size: 28px; line-height: 1; cursor: pointer;
}

.modal__image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover; object-position: top; /* показываем верх */
  border-radius: 8px;
  margin-bottom: .75rem;
}

.modal__title {
  font-family: 'Cinzel', serif;
  color: #ffd700; font-size: 1.4rem; margin: .25rem 0 .35rem;
  text-shadow: 0 0 6px rgba(0,0,0,.7);
}

.modal__meta {
  font-size: .9rem; color: #cfcfe6; opacity: .85; margin-bottom: .5rem;
}

.modal__content p { margin: .5rem 0; }
.modal__content ul { margin: .5rem 1rem; }

.modal__actions { margin-top: .9rem; text-align: right; }
.modal__actions .button { padding: .5rem .9rem; }

/* Адаптив модалки */
@media (max-width: 768px) {
  .modal__dialog { margin: 4vh auto; width: calc(100% - 2rem); }
  .modal__title { font-size: 1.2rem; }
}

/* В модалке: тоже показываем ниже, но пропорции сохраняем */
.modal__image[src*="news4.jpg"] {
  object-position: 50% 35%;   /* смещение фокуса вниз в полноразмерном просмотре */
}
/* В модалке: тоже поднимаем */
.modal__image[src*="news5.svg"] {
  object-position: 50% 20%;   /* попробуй 15–25%, чтобы подобрать идеал */
}
/* ===== Страница статьи ===== */
.article__wrap {
  max-width: 900px;
}

.article__hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
  margin: 1rem 0 1.2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.article__title {
  font-family: 'Cinzel', serif;
  color: #ffd700;
  font-size: 2rem;
  margin-bottom: .25rem;
  text-shadow: 0 0 6px rgba(0,0,0,.7);
}

.article__meta {
  color: #cfcfe6;
  opacity: .9;
  margin-bottom: 1rem;
}

.article__content h2 {
  font-family: 'Cinzel', serif;
  color: #ffd700;
  font-size: 1.25rem;
  margin: 1rem 0 .5rem;
}
.article__content p { margin: .6rem 0; }
.article__content ul, .article__content ol { margin: .4rem 1.25rem; }
.article__divider { border: none; border-top: 1px solid rgba(255,215,0,.25); margin: 1.25rem 0; }
.article__nav { display: flex; justify-content: flex-start; }
/* Кнопки и счётчик под новостями */
.news-actions {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-top: 1rem;
}

.news-counter {
  color: #cfcfe6;
  opacity: .9;
  font-size: .95rem;
}
.news-card.broken { outline: 2px dashed #ff6b6b; }
/* ===== Навигация внизу статьи — компактно и аккуратно ===== */
.article__divider { margin: 1.2rem 0; }

.article__nav { margin-top: .8rem; }
.article__nav-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .75rem;
  align-items: center;
}

/* Кнопки: компактнее и без «пузатости» */
.article__nav .button,
.article__nav .button--ghost {
  padding: .4rem .7rem;
  font-size: .95rem;
  line-height: 1.2;
  border-radius: 8px;
  max-width: 320px;              /* ограничиваем ширину боковых кнопок */
  white-space: nowrap;           /* в одну строку */
  overflow: hidden;
  text-overflow: ellipsis;       /* многоточие для длинных заголовков */
}

/* Призрачная кнопка (prev/next) — мягче */
.button--ghost {
  background: transparent;
  color: #ffd700;
  border: 1px solid rgba(255,215,0,.35);
  box-shadow: none;
}
.button--ghost:hover {
  background: rgba(255,215,0,.08);
  border-color: rgba(255,215,0,.6);
}

/* Отключённые — бледнее, не кликаются */
.button--disabled { opacity: .55; pointer-events: none; }

/* Выравнивания */
.article__nav-left  { justify-self: start; }
.article__nav-center{ justify-self: center; }
.article__nav-right { justify-self: end; }

/* Адаптив: на узких экранах складываемся в две строки */
@media (max-width: 768px) {
  .article__nav-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "prev next"
      "list list";
    gap: .6rem;
  }
  .article__nav-left  { grid-area: prev;  justify-self: start; }
  .article__nav-right { grid-area: next;  justify-self: end;   }
  .article__nav-center{ grid-area: list;  justify-self: center; }

  .article__nav .button,
  .article__nav .button--ghost {
    max-width: 100%;
  }
}

/* Совсем узко — ещё компактнее шрифт */
@media (max-width: 420px) {
  .article__nav .button,
  .article__nav .button--ghost {
    font-size: .9rem;
    padding: .35rem .6rem;
  }
}
