/* Подарок за e-mail «60 фраз для життя в Німеччині»: блок с формой.
   Подключается на главной (style.css) и на внутренних страницах (standalone.css):
   берёт их общие переменные --ink, --blue, --lavender, --line, --soft/--ink-soft.
   Форму оживляет gift-form.js → /api/gift. */

.gift-box {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  margin: 48px 0;
  padding: 28px;
  color: var(--ink);
  background: var(--lavender);
  border-radius: var(--radius-lg, 28px);
}

.gift-box-cover {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(24, 49, 80, 0.16);
}

.gift-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gift-box h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.gift-box h2 + p {
  margin: 0 0 18px;
  color: var(--soft, var(--ink-soft));
  font-size: 16px;
  line-height: 1.55;
}

.gift-form {
  margin: 0;
}

.gift-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gift-form input[type="email"] {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
}

.gift-form input[type="email"]:focus {
  outline: 3px solid rgba(74, 99, 216, 0.25);
  border-color: var(--blue);
}

.gift-form button[type="submit"] {
  flex: 0 0 auto;
  min-height: 52px;
  padding: 0 22px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.2s ease;
}

.gift-form button[type="submit"]:hover {
  background: var(--blue-dark);
}

.gift-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: progress;
}

.gift-note {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.gift-consent {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 14px 0 0;
  color: var(--soft, var(--ink-soft));
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
}

.gift-consent input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.gift-privacy {
  margin: 10px 0 0;
  font-size: 13px;
}

.gift-privacy a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gift-status {
  margin: 8px 0 0;
  min-height: 0;
  color: #b3261e;
  font-size: 14px;
  font-weight: 700;
}

.gift-status:empty {
  display: none;
}

/* ловушка для ботов: людям не видна, боты заполняют */
.gift-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* после отправки: «Залишився один крок» */
.gift-done {
  padding: 18px 20px;
  background: #fff;
  border-radius: 16px;
}

.gift-done h3 {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.25;
}

.gift-done p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

.gift-done button {
  padding: 0;
  text-align: left;
  color: var(--blue);
  background: none;
  border: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* страница /60-fraz: превью страниц PDF */
.gift-pages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0 0;
}

.gift-pages img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(24, 49, 80, 0.1);
}

.gift-topics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: gift;
}

.gift-topics li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: baseline;
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
}

.gift-topics li::before {
  counter-increment: gift;
  content: counter(gift, decimal-leading-zero);
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

/* главная: блок как отдельная секция */
.gift-band .gift-box {
  margin: 0;
}

@media (max-width: 700px) {
  .gift-box {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 22px 18px;
    margin: 36px 0;
  }

  .gift-box-cover {
    width: 150px;
  }

  .gift-form button[type="submit"] {
    width: 100%;
  }

  .gift-pages {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .gift-topics {
    gap: 0 14px;
  }

  .gift-topics li {
    grid-template-columns: 26px minmax(0, 1fr);
    padding: 9px 0;
    font-size: 15px;
  }
}

/* главная: тот же ритм, что у соседних блоков (~60 px между ними) */
main > .gift-band.section {
  padding-top: 60px;
  padding-bottom: 0;
}

@media (max-width: 600px) {
  main > .gift-band.section {
    padding-top: 36px;
    padding-bottom: 0;
  }

  main > .gift-band .gift-box {
    margin: 0;
  }
}

/* ---------- спливаюче вікно (gift-popup.js) ---------- */
.gift-popup {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: var(--lavender);
  border: 0;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(24, 49, 80, 0.3);
  overflow: auto;
  animation: gift-pop-in 0.25s ease-out;
}

.gift-popup::backdrop {
  background: rgba(17, 31, 53, 0.45);
}

.gift-popup-inner {
  position: relative;
  padding: 28px;
}

.gift-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 400 24px/1 Arial, sans-serif;
  cursor: pointer;
}

.gift-popup-close:hover {
  background: var(--cream, #fbfaf7);
}

.gift-popup-head {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin: 0 36px 18px 0;
}

.gift-popup-head img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(24, 49, 80, 0.16);
}

.gift-popup h2 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.gift-popup-head p:not(.gift-kicker) {
  margin: 0;
  color: var(--soft, var(--ink-soft));
  font-size: 15px;
  line-height: 1.5;
}

.gift-popup .gift-consent {
  font-size: 13px;
}

@keyframes gift-pop-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* телефон: панель знизу екрана */
@media (max-width: 600px) {
  .gift-popup {
    width: 100%;
    max-height: 88dvh;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    animation-name: gift-sheet-in;
  }

  .gift-popup-inner {
    padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  }

  .gift-popup-head {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
    margin-right: 40px;
    margin-bottom: 14px;
  }

  .gift-popup h2 {
    font-size: 21px;
  }

  .gift-popup-head p:not(.gift-kicker) {
    display: none;
  }

  .gift-popup .gift-kicker {
    margin-bottom: 4px;
  }

  .gift-popup .gift-note {
    font-size: 13px;
  }

  .gift-popup .gift-consent {
    font-size: 12.5px;
  }
}

@keyframes gift-sheet-in {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gift-popup {
    animation: none;
  }
}
