/* =========================================================
   V21 — floating back-to-top dock
   Appears from the work section onward, never over overlays.
   ========================================================= */

.back-dock {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(48px, calc(env(safe-area-inset-bottom) + 24px));
  z-index: 260;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 7px 0 15px;
  border-radius: 999px;
  color: #171b1a;
  background:
    radial-gradient(120% 100% at 10% -30%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.19), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.92),
    inset 0 -1px 1px rgba(255, 255, 255, 0.14),
    0 16px 48px rgba(25, 54, 47, 0.12);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.96);
  -webkit-backdrop-filter: blur(42px) saturate(215%) brightness(1.04);
  backdrop-filter: blur(42px) saturate(215%) brightness(1.04);
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease,
    transform 0.42s var(--ease),
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

.back-dock::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 13%;
  right: 13%;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.90), transparent);
  pointer-events: none;
}

.back-dock i {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #ffffff;
  background: #1d1d1f;
  font-family: var(--sans);
  font-size: 12px;
  font-style: normal;
  line-height: 1;
  transition: transform 0.3s var(--ease), background-color 0.25s ease;
}

.back-dock:hover {
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.98),
    inset 0 -1px 1px rgba(255, 255, 255, 0.16),
    0 18px 52px rgba(25, 54, 47, 0.15);
}

/* On the dark contact photograph, adapt the label while keeping the clear glass. */
.back-dock.is-on-dark {
  color: #f5f8f6;
  border-color: rgba(255, 255, 255, 0.30);
  background:
    radial-gradient(120% 100% at 10% -30%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg, rgba(30, 39, 37, 0.46), rgba(10, 14, 13, 0.28));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08),
    0 16px 48px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(42px) saturate(170%) brightness(0.96);
  backdrop-filter: blur(42px) saturate(170%) brightness(0.96);
}

.back-dock.is-on-dark::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.48), transparent);
}

.back-dock.is-on-dark i {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.back-dock.is-on-dark:hover {
  border-color: rgba(255, 255, 255, 0.46);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.30),
    0 18px 52px rgba(0, 0, 0, 0.28);
}

.back-dock:hover i {
  transform: translateY(-2px);
}

.back-dock:focus-visible {
  outline: 2px solid rgba(0, 113, 227, 0.58);
  outline-offset: 3px;
}

.back-dock.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Toasts and full-screen surfaces take over the bottom edge. */
body.is-locked .back-dock,
body.is-fullscreen .back-dock {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.96);
}

@media (max-width: 760px) {
  .back-dock {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(36px, calc(env(safe-area-inset-bottom) + 18px));
    height: 40px;
    gap: 7px;
    padding: 0 6px 0 13px;
    font-size: 9px;
  }

  .back-dock i {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .back-dock,
  .back-dock i {
    transition: none;
  }
}
