/* ==========================================================================
   Games4Wonders — основные стили
   Все цвета, шрифты и размеры собраны в блоке :root ниже.
   Чтобы поменять оформление сайта — правьте только его.
   ========================================================================== */

:root {
  /* --- Цвета --- */
  --c-accent:        #ffa600;   /* оранжевый: заголовки секций, активный пункт меню */
  --c-text:          #d4d4d2;   /* основной текст */
  --c-text-bright:   #ffffff;   /* белый текст (заголовки слайдов, названия карточек) */
  --c-text-muted:    #e8e6e3;   /* подписи (должность в разделе About) */
  --c-link:          #a6cbf2;   /* ссылки в подвале */
  --c-bar:           #1f2e40;   /* полоса-заголовок секции */
  --c-panel:         #00141e;   /* фон панели с карточками */
  --c-card:          #053c32;   /* зелёная подпись под карточкой */
  --c-header:        #000000;   /* фон шапки и подвала */
  --c-page:          #000000;   /* фон страницы под фоновой картинкой */
  --bg-opacity:      .25;       /* насыщенность фоновой картинки с лесом (0 = выключить) */

  /* --- Шрифт --- */
  --font: 'Exo 2', 'Segoe UI', Tahoma, sans-serif;

  /* --- Размеры --- */
  --page-fade: .3s;        /* длительность появления/затухания содержимого */

  --content-width: 980px;  /* ширина контентной колонки */
  --header-height: 81px;   /* высота шапки */
  --fs-nav: 18px;
  --fs-section: 28px;      /* заголовок секции (PERSONAL GAMES, ABOUT...) */
  --fs-card-title: 24px;
  --fs-card-sub: 18px;
  --fs-body: 18px;
  --fs-slide-title: 58px;
}

/* --- Базовое --- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;

  /* Полоса прокрутки всегда занимает место, даже если страница короткая.
     Иначе на главной (она не прокручивается) полосы нет, и вся страница
     вместе с логотипом смещается вправо на ширину полосы — при переходе
     между страницами это выглядит как рывок. */
  overflow-y: scroll;
  scrollbar-gutter: stable;

  /* Чёрный фон задаётся именно на <html>, а не на <body>.
     Если задать его на body, браузер рисует эту заливку ПОВЕРХ
     фоновой картинки ниже (она лежит на body::before с z-index: -1),
     и лес пропадает — остаётся чёрный экран. */
  background-color: var(--c-page);
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 300;
  font-size: var(--fs-body);
  color: var(--c-text);
}

/* Фоновая картинка с лесом — видна по бокам контентной колонки.
   Прозрачность 0.25 — как на оригинальном сайте.
   Меняется через --bg-opacity ниже. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('../img/bg-forest.png');
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: var(--bg-opacity);
  pointer-events: none;
}

/* --- Плавное появление / затухание содержимого ---
   Гаснет и проявляется только <main>; шапка и подвал не трогаются.

   При переходе по сайту содержимое <main> подменяет скрипт, без
   перезагрузки страницы — поэтому чёрного кадра между страницами нет.

   Появление при первом открытии сделано CSS-анимацией: она отрабатывает
   до запуска скриптов, поэтому контент не успевает мигнуть. Если JS
   отключён — работает только она, и сайт остаётся полностью рабочим. */
main {
  display: block;
  animation: page-in var(--page-fade) ease-out both;
}

@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Состояния, которыми управляет скрипт при переходе между страницами */
main.is-hidden {
  animation: none;
  opacity: 0;
  transition: opacity var(--page-fade) ease-in;
}

main.is-shown {
  animation: none;
  opacity: 1;
  transition: opacity var(--page-fade) ease-out;
}

/* Уважаем системную настройку «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  main,
  main.is-hidden,
  main.is-shown {
    animation: none;
    transition: none;
    opacity: 1;
  }
}

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

.content {
  width: var(--content-width);
  max-width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Шапка
   ========================================================================== */
.site-header {
  position: relative;
  z-index: 20;
  height: var(--header-height);
  background: var(--c-header);
}

.site-header .content {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo img { width: 187px; height: 64px; object-fit: contain; }

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  display: block;
  padding: 0 18px;
  line-height: 53px;
  font-size: var(--fs-nav);
  color: var(--c-text);
  transition: color .2s;
}

.nav a:hover { color: var(--c-accent); }
.nav a.is-active { color: var(--c-accent); }

/* Кнопка-бургер (видна только на узких экранах) */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--c-text);
  content: '';
  transition: transform .2s;
}
.nav-toggle span { margin: 0 auto; position: relative; }
.nav-toggle span::before { position: absolute; top: -7px; }
.nav-toggle span::after  { position: absolute; top: 7px; }

/* ==========================================================================
   Слайдер на главной
   ========================================================================== */
.slider {
  position: relative;
  height: 850px;
  overflow: hidden;
  background: #000;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s ease;
}

.slide.is-active { opacity: 1; visibility: visible; }

.slide__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.slide[data-align="bottom"] .slide__img { object-position: center bottom; }

/* Лёгкое затемнение поверх картинки для читаемости текста.
   На оригинальном сайте его нет — если нужно точь-в-точь,
   поставьте --slide-dim: 0. */
:root { --slide-dim: .18; }

.slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--slide-dim));
  pointer-events: none;
}

.slide__body {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: 640px;
  max-width: 90%;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0,0,0,.8);
}

.slide__title {
  margin: 0 0 14px;
  font-size: var(--fs-slide-title);
  font-weight: 700;
  color: var(--c-text-bright);
  letter-spacing: .5px;
}

.slide__text {
  margin: 0;
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--c-text-bright);
}

/* Кнопки «Buy on Steam» и т.п. */
.slide__buttons {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  display: flex;
  gap: 34px;
}

.store-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 18px;
  border-radius: 24px;
  background: rgba(0,0,0,.75);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.15;
  white-space: pre-line;
  transition: background .2s, color .2s;
}

.store-btn:hover { background: #000; color: var(--c-accent); }
.store-btn img { width: 26px; height: 26px; flex: 0 0 auto; }

/* Стрелки */
.slider__arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  background: none;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  opacity: .75;
  cursor: pointer;
  transition: opacity .2s;
}
.slider__arrow:hover { opacity: 1; }
.slider__arrow--prev { left: 18px; }
.slider__arrow--next { right: 18px; }

/* Точки */
.slider__dots {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
}

.slider__dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.45);
  cursor: pointer;
  transition: background .2s;
}
.slider__dot.is-active { background: #fff; }

/* ==========================================================================
   Секции с карточками (страница PROJECTS) и текстовые панели
   ========================================================================== */
.section { margin: 0; }

.section__bar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bar);
}

.section__title {
  margin: 0;
  font-size: var(--fs-section);
  font-weight: 300;
  letter-spacing: 1px;
  color: var(--c-accent);
  text-align: center;
}

.section__body {
  padding: 39px 46px 46px;
  background: var(--c-panel);
}

/* Сетка карточек */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 42px;
}

/* Карточка: картинка чуть увеличена и затемнена; при наведении
   она доезжает до 1.10 и затемнение плавно исчезает — как на оригинале.
   Настройки эффекта: */
:root {
  --card-zoom-rest:  1.05;  /* масштаб картинки в покое */
  --card-zoom-hover: 1.10;  /* масштаб при наведении */
  --card-dim:        .35;   /* сила затемнения в покое (0 = без затемнения) */
  --card-anim:       .2s;   /* длительность перехода */
  --card-caption-h:  75px;  /* высота зелёной подписи */
}

.card {
  position: relative;
  display: block;
  background: var(--c-card);
  overflow: hidden;
}

/* Затемняющий слой — только над картинкой, подпись он не задевает */
.card::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--card-caption-h);
  background: rgba(0, 0, 0, var(--card-dim));
  transition: opacity var(--card-anim) ease-out;
  pointer-events: none;
}

.card:hover::before,
.card:focus-visible::before { opacity: 0; }

.card__img {
  width: 100%;
  aspect-ratio: 420 / 255;
  object-fit: cover;
  transform: scale(var(--card-zoom-rest));
  transition: transform var(--card-anim) ease-out;
}

.card:hover .card__img,
.card:focus-visible .card__img { transform: scale(var(--card-zoom-hover)); }

/* На телефонах и планшетах наведения мышью не бывает, поэтому
   затемнение убираем — иначе карточки остались бы тёмными навсегда. */
@media (hover: none) {
  .card::before { opacity: 0; }
  .card__img { transform: none; }
}

.card__caption {
  position: relative;   /* чтобы подпись оставалась поверх увеличенной картинки */
  z-index: 2;
  background: var(--c-card);
  height: var(--card-caption-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  padding: 0 10px;
}

.card__title {
  margin: 0;
  font-size: var(--fs-card-title);
  font-weight: 300;
  color: var(--c-text-bright);
}

.card__sub {
  margin: 0;
  font-size: var(--fs-card-sub);
  font-weight: 300;
  color: var(--c-text-bright);
}

/* ==========================================================================
   Страница ABOUT
   ========================================================================== */
/* На странице ABOUT текстовый блок отступает от краёв сильнее, чем карточки */
.section__body--about { padding: 39px 142px 46px 142px; }

.about-text {
  margin: 0 0 40px;
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--c-text-bright);
  text-align: justify;
}

.person {
  display: flex;
  align-items: center;
  gap: 30px;
  margin: 44px 0;
}

.person__photo {
  width: 225px;
  height: 225px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.person__name {
  margin: 0 0 4px;
  font-size: var(--fs-section);
  font-weight: 300;
  color: var(--c-accent);
  transition: color .2s;
}

a.person__link:hover .person__name { color: #ffc14d; }

.person__role {
  margin: 0;
  font-size: var(--fs-body);
  color: var(--c-text-muted);
}

/* ==========================================================================
   Страница PRIVACY POLICY
   ========================================================================== */
.doc {
  color: var(--c-text-bright);
  line-height: 1.5;
  text-align: justify;
}

.doc h2 {
  margin: 34px 0 12px;
  font-size: 24px;
  font-weight: 400;
  color: var(--c-accent);
  text-align: left;
}

.doc h3 {
  margin: 24px 0 8px;
  font-size: 20px;
  font-weight: 400;
  color: var(--c-text-bright);
  text-align: left;
}

.doc p { margin: 0 0 14px; }
.doc ul { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin-bottom: 4px; }
.doc a { color: var(--c-link); }
.doc a:hover { text-decoration: underline; }

/* ==========================================================================
   Подвал
   ========================================================================== */
.site-footer {
  position: relative;
  z-index: 10;
  background: var(--c-header);
  padding: 44px 0 22px;
}

.footer__cols {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 30px;
}

.footer__heading {
  margin: 0 0 22px;
  font-size: var(--fs-nav);
  font-weight: 300;
  letter-spacing: .5px;
  color: var(--c-accent);
}

.footer__row {
  margin: 0 0 9px;
  font-size: var(--fs-body);
  color: var(--c-text);
}

.footer__row a { color: var(--c-link); }
.footer__row a:hover { text-decoration: underline; }

.footer__social {
  display: flex;
  gap: 8px;
}

.footer__social img {
  width: 48px;
  height: 48px;
  transition: transform .2s;
}
.footer__social a:hover img { transform: scale(1.08); }

.footer__platforms {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 40px 0 26px;
}

.footer__platforms img { width: 55px; height: 55px; }

.footer__copy {
  margin: 0;
  text-align: center;
  font-size: var(--fs-body);
  letter-spacing: .9px;
  color: var(--c-text);
}

/* ==========================================================================
   Адаптив
   ========================================================================== */
@media (max-width: 1000px) {
  .content { padding: 0 16px; }
  .section__body,
  .section__body--about { padding: 28px 20px 32px; }
}

@media (max-width: 900px) {
  :root {
    --fs-slide-title: 40px;
    --fs-section: 22px;
    --fs-card-title: 20px;
    --fs-card-sub: 16px;
    --fs-body: 16px;
  }

  .slider { height: 560px; }
  .slide__buttons { bottom: 36px; gap: 18px; }

  .nav-toggle { display: block; }

  .nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--c-header);
    border-top: 1px solid #1a1a1a;
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { width: 100%; text-align: center; }

  .cards { grid-template-columns: 1fr; gap: 26px; }

  .person { flex-direction: column; text-align: center; gap: 18px; }

  .footer__cols { grid-template-columns: 1fr; gap: 26px; }
  .footer__platforms { flex-wrap: wrap; gap: 14px; }
}

@media (max-width: 520px) {
  .slider { height: 460px; }
  .slide__buttons { flex-direction: column; align-items: center; gap: 10px; }
  .footer__platforms img { width: 44px; height: 44px; }
  .person__photo { width: 170px; height: 170px; }
}
