/* ================================
   🕊️ КНИГА ПАМ’ЯТІ — стабільна версія стилів
   ================================ */

/* ===== ШРИФТИ ===== */
@font-face {
  font-family: "Philosopher";
  src: url("../../fonts/philosopher/Philosopher-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Philosopher";
  src: url("../../fonts/philosopher/Philosopher-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

/* ===== ЗМІННІ ===== */
:root {
  --accent-blue: #0057b7;
  --accent-yellow: #ffd54a;
  --accent-silver: #e0e0e0;
  --text: #f3f4f8;
}

/* ================================
   ⚙️ БАЗА
   ================================ */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* ================================
   🌈 ОСНОВА
   ================================ */
body.memory {
  font-family: "Philosopher", sans-serif;
  background: #000;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: fadeIn 1s ease forwards;
  overflow-x: hidden !important;
}

/* ================================
   🇺🇦 ФОН-ПРАПОР
   ================================ */
.flag-bg {
  position: fixed;
  inset: 0;
  background: url("../img/flag-bg.png") center center / contain no-repeat;
  opacity: 0.95;
  z-index: -1;
  transition: background-size 0.5s ease;
}

/* ================================
   🕯️ ЗАГОЛОВОК
   ================================ */
.hero {
  text-align: center;
  padding-top: 2rem;
}

.sup {
  font-size: clamp(18px, 2vw, 24px);
  color: var(--text);
  margin-bottom: 6px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.title {
  color: var(--accent-yellow);
  font-size: clamp(30px, 4vw, 54px);
  font-weight: 700;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
  margin: 0.3rem 0 1.2rem;
}

/* ================================
   ⚔️ ЕМБЛЕМИ
   ================================ */
.wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  transform: translateY(-40px);
}

.hero-buttons {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(100px, 10vw, 200px);
  flex-wrap: wrap;
}

.hero-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-decoration: none;
  color: #000;
  font-weight: 700;
  font-size: clamp(20px, 3vw, 34px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s ease, color 0.25s ease;
}

.hero-link:hover {
  transform: scale(1.05);
  color: var(--accent-silver);
}

.hero-emblem {
  height: 220px;
  width: auto;
  margin-bottom: 10px;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.7));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.hero-link:hover .hero-emblem {
  transform: scale(1.1);
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.8));
}

/* ================================
   ⚓ ФУТЕР — НОВИЙ ЗОЛОТИЙ СТИЛЬ
   ================================ */
.footer {
  position: fixed;
  bottom: 25px;
  left: 0;
  width: 100%;
  padding: 0 25px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  pointer-events: none;
  z-index: 5000;
}

/* кнопки */
.footer a {
  pointer-events: auto;
  padding: 0.45rem 1.4rem;
  border-radius: 999px;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;

  color: #f5f5f5;
  border: 1px solid rgba(255, 214, 90, 0.7);
  background: radial-gradient(circle at top, rgba(255, 214, 90, 0.28), transparent 60%);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 12px rgba(255, 214, 90, 0.25);

  transition: 0.25s ease;
}

/* hover */
.footer a:hover {
  background: radial-gradient(circle at top, rgba(255, 214, 90, 0.45), transparent 65%);
  border-color: rgba(255, 214, 90, 0.95);
  box-shadow: 0 0 18px rgba(255, 214, 90, 0.55);
  transform: translateY(-2px);
}

/* active */
.footer a:active {
  transform: scale(0.96);
}

/* ================================
   ✨ АНІМАЦІЇ
   ================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(1.01);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ================================
   📱 МОБІЛЬНІ ВЕРСІЇ
   ================================ */

/* --- Вертикальна (portrait) --- */
@media screen and (orientation: portrait) {
  /* 1. Використовуємо "динамічну" висоту, щоб врахувати адресний рядок */
  body.memory {
    min-height: 100vh;
    min-height: 100dvh; /* dynamic viewport height - враховує приховані панелі */
  }

  .flag-bg {
    background-size: cover;
    background-position: center top;
  }

  .wrap {
    flex-direction: column;
    /* Трохи стискаємо відступи між елементами, щоб влізло */
    gap: 2vh;
    transform: translateY(0);

    /* Гігантський відступ знизу, щоб контент не ліз під кнопки */
    padding-bottom: 160px;
  }

  .hero-emblem {
    /* Робимо їх ще трохи компактнішими для Redmi */
    height: clamp(130px, 18vh, 170px) !important;
    width: auto;
  }

  .hero-link span {
    font-size: 20px;
    margin-top: 5px;
  }

  /* 2. РЯТУЄМО ФУТЕР — піднімаємо його над системними кнопками */
  .footer {
    position: fixed;
    /* Піднімаємо на 70px від низу екрана (це вище за будь-яку панель Android) */
    bottom: 70px !important;

    /* Додаємо врахування безпечних зон (для iPhone X та нових Android) */
    padding-bottom: env(safe-area-inset-bottom);

    background: transparent; /* Градієнт тут може заважати, краще прозорий */
    pointer-events: auto;
    width: 100%;
    justify-content: space-around; /* Рівномірно розкидаємо кнопки */
  }

  /* Твоя підказка повороту */
  .rotate-hint {
    display: block;
    position: fixed;
    /* Підказку теж піднімаємо, щоб не налізла на кнопки */
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    z-index: 9999;
  }

  /* Робимо кнопки більш контрастними на мобільному фоні */
  .footer a {
    /* Змінюємо світлий фон на темний напівпрозорий. 
       !important потрібен, щоб перебити основний стиль. */
    background: rgba(10, 10, 10, 0.75) !important;

    /* Робимо жовту рамку яскравішою (прибираємо прозорість) */
    border-color: rgba(255, 214, 90, 1) !important;

    /* Додаємо сильнішу тінь для тексту, щоб краще читався */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 1) !important;

    /* Підсилюємо зовнішнє світіння рамки */
    box-shadow: 0 0 15px rgba(255, 214, 90, 0.4) !important;

    /* Трохи збільшимо кнопки, щоб по них легше було попасти пальцем */
    padding: 0.6rem 1.6rem !important;
    font-weight: 700 !important;
  }
}

/* --- Горизонтальна (landscape) --- */
@media screen and (orientation: landscape) {
  html,
  body {
    overflow-y: hidden !important;
  }

  .flag-bg {
    background-size: contain;
  }

  .hero {
    padding-top: 1rem;
  }

  .title {
    font-size: clamp(26px, 3.5vw, 46px);
    margin-bottom: 0.8rem;
  }

  .wrap {
    height: calc(100vh - 240px);
    transform: translateY(-20px);
  }

  .hero-buttons {
    gap: 70px;
  }

  .hero-emblem {
    height: 180px;
    margin-bottom: 4px;
  }

  .hero-link span {
    font-size: clamp(18px, 2.3vw, 24px);
  }

  .rotate-hint {
    display: none !important;
  }
}

@media screen and (orientation: landscape) and (max-height: 500px) {
  .hero .sup {
    display: none; /* Ховаємо дрібний напис, щоб звільнити місце */
  }
  .hero {
    padding-top: 5px; /* Підтягуємо заголовок вище */
  }
}

/* ================================
   🖥️ ДЕСКТОП — збільшені емблеми
   ================================ */
@media screen and (min-width: 1024px) and (orientation: landscape) {
  .hero-emblem {
    height: 260px;
    margin-bottom: 8px;
  }

  .hero-buttons {
    gap: 240px;
  }

  .title {
    font-size: clamp(34px, 4vw, 60px);
    margin-bottom: 1rem;
  }

  .wrap {
    height: calc(100vh - 250px);
    transform: translateY(-30px);
  }
}

@media screen and (min-width: 1024px) and (orientation: landscape) {
  .hero-link span {
    font-size: clamp(22px, 2vw, 30px);
    color: #000;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.7), 0 0 6px rgba(255, 255, 255, 0.4);
  }

  .hero-link:hover span {
    color: var(--accent-silver);
    text-shadow: 0 2px 6px rgba(255, 255, 255, 0.8), 0 0 10px rgba(255, 255, 255, 0.6);
  }
}

/* ================================
   🎞️ ПЛАВНА ПОЯВА
   ================================ */
.hero,
.hero-link {
  opacity: 0;
  transform: translateY(20px) scale(0.97);
}

@keyframes smoothFadeUp {
  0% {
    opacity: 0;
    transform: translateY(25px) scale(0.96);
  }
  60% {
    opacity: 1;
    transform: translateY(5px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body.memory .hero {
  animation: smoothFadeUp 1.2s ease-out 0.2s forwards;
}

body.memory .hero-link:nth-child(1) {
  animation: smoothFadeUp 1.3s ease-out 0.6s forwards;
}

body.memory .hero-link:nth-child(2) {
  animation: smoothFadeUp 1.3s ease-out 0.9s forwards;
}

body.memory .footer {
  opacity: 0;
  transform: translateY(15px);
  animation: smoothFadeUp 1.2s ease-out 1.3s forwards;
}
