/* =========================
   FLOATING DOCK: «Наверх» + Max (template-parts/floating-dock.php)
   Desktop: column, Наверх above Max. Mobile: row, Наверх left of Max.
   z-index below the mobile menu (999), header (9999), lightbox and modal.
========================= */

.gz-dock {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 990;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none; /* only the buttons themselves are clickable */
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.gz-dock > * {
  pointer-events: auto;
}

/* Over a form field, a map/video, the footer's last line; while typing; menu open. */
.gz-dock.is-hidden,
body.menu-open .gz-dock {
  opacity: 0;
  visibility: hidden;
}

.gz-dock.is-hidden > *,
body.menu-open .gz-dock > * {
  pointer-events: none;
}

/* ---------- Наверх: 48×48 ---------- */

.gz-dock__top {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(103, 111, 46, 0.28);
  border-radius: 50%;
  background: #fff;
  color: var(--color-accent-text, #676F2E);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.gz-dock__top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.gz-dock__top:hover {
  background: var(--color-accent-text, #676F2E);
  color: #fff;
}

.gz-dock__top:active {
  background: var(--color-accent-text-active, #4A5021);
  color: #fff;
}

.gz-dock__top:focus-visible,
.gz-dock__max:focus-visible {
  outline: 2px solid var(--color-accent-text, #676F2E);
  outline-offset: 3px;
}

/* ---------- Max: 56×56 ---------- */

.gz-dock__max {
  position: relative;
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 14px; /* same rounding as the Max icon */
  box-shadow: 0 6px 18px rgba(51, 51, 238, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gz-dock__max img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.gz-dock__max:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(51, 51, 238, 0.34);
}

/* Hint on the left, for mouse users only (the link has its own aria-label). */
.gz-dock__tip {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .gz-dock__tip {
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    background: #393939;
    color: #fff;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translate(6px, -50%);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
  }

  .gz-dock__max:hover .gz-dock__tip,
  .gz-dock__max:focus-visible .gz-dock__tip {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
  }
}

/* Room under the footer's last line, so at the very bottom of the page the dock
   sits on empty footer background instead of covering text or a button. */
.gz-footer .footer-last-text {
  padding-bottom: 24px;
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
  .gz-dock {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
  }

  .gz-footer .footer-last-text {
    padding-bottom: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gz-dock,
  .gz-dock__top,
  .gz-dock__max,
  .gz-dock__tip {
    transition: none;
  }
}

@media print {
  .gz-dock {
    display: none;
  }
}
