/* Yüzen alt dock — mobil hızlı iletişim (1024px ve üzerinde gizli; orada header'da Ara butonu var)
   Solda WhatsApp, ortada adadan taşan büyük ARA, sağda Yol tarifi. */

.dock {
  position: fixed;
  left: var(--space-md);
  right: var(--space-md);
  bottom: calc(var(--space-sm) + env(safe-area-inset-bottom));
  z-index: var(--z-dock);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-xs);
  height: var(--dock-height);
  padding: 0 var(--space-xs);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-glass);
  box-shadow: var(--shadow-up);
  animation: dock-in 0.9s var(--ease-spring) 0.4s backwards;
}

@keyframes dock-in {
  from { opacity: 0; transform: translateY(160%); }
  to { opacity: 1; transform: none; }
}

/* Butonlar sırayla yükselir */
.dock > * {
  animation: rise 0.7s var(--ease-out) backwards;  /* backwards: bitince :active transform serbest kalsın */
}

.dock > :nth-child(1) { animation-delay: 0.8s; }
.dock > :nth-child(2) { animation-delay: 0.7s; }
.dock > :nth-child(3) { animation-delay: 0.9s; }

/* ---------- Yan butonlar ---------- */
.dock-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  height: calc(var(--dock-height) - var(--space-sm));
  padding: 0 var(--space-xs);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  text-decoration: none;
  overflow: hidden;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.dock-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.dock-btn:active {
  transform: scale(0.95);
}

.dock-map {
  flex-direction: row-reverse;
  text-align: right;
}

.dock-ic {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--dock-icon-size);
  height: var(--dock-icon-size);
  border-radius: var(--radius-full);
  color: var(--color-on-accent);
}

.dock-ic svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

.dock-wa .dock-ic { background: var(--color-whatsapp); }
.dock-map .dock-ic { background: var(--color-secondary); }

.dock-tx {
  white-space: nowrap;
}

.dock-tx small {
  display: block;
  margin-top: var(--space-2xs);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

/* Aralıklı eğik parlama */
.dock-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, var(--color-transparent) 30%, var(--color-shine) 50%, var(--color-transparent) 70%);
  transform: translateX(-120%);
  animation: dock-shine 7s var(--ease-out) 2.5s infinite;
  pointer-events: none;
}

.dock-map::after {
  animation-delay: 4.5s;
}

@keyframes dock-shine {
  0% { transform: translateX(-120%); }
  14%, 100% { transform: translateX(120%); }
}

/* ---------- Ortadaki ARA ---------- */
.dock-call {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  width: var(--dock-call-size);
  height: var(--dock-call-size);
  top: var(--dock-call-lift);        /* transform değil: giriş animasyonu transform'u kullanıyor */
  border: var(--border-width-thick) solid var(--color-bg);
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-black);
  letter-spacing: var(--letter-spacing-wide);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.dock-call:hover {
  background: var(--color-primary-hover);
  color: var(--color-text-inverse);
}

.dock-call:active {
  transform: scale(0.92);
}

.dock-call svg {
  width: var(--icon-size-lg);
  height: var(--icon-size-lg);
  animation: phone-ring 4s ease-in-out 1.6s infinite;
}

/* Dalga halkaları */
.dock-call::before,
.dock-call::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--border-width-thick));
  border: var(--border-width-thick) solid var(--color-primary);
  border-radius: var(--radius-full);
  opacity: 0;
  animation: dock-ping 2.4s var(--ease-out) 1.4s infinite;
  pointer-events: none;
}

.dock-call::after {
  animation-delay: 2.6s;
}

@keyframes dock-ping {
  0% { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.7); }
}

/* Telefon "çalıyor" sallantısı: 4 saniyede bir kısa titreşim */
@keyframes phone-ring {
  0%, 12%, 100% { transform: rotate(0); }
  2%, 6%, 10% { transform: rotate(-14deg); }
  4%, 8% { transform: rotate(14deg); }
}

/* Çok dar ekranlar (≤359px, ör. iPhone SE 1. nesil): yan butonlarda yalnızca ikon.
   Yazı ekran okuyucular için erişilebilir kalır (görsel olarak gizlenir). */
@media (max-width: 359px) {
  .dock-btn,
  .dock-map {
    justify-content: center;
  }

  .dock-tx {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .dock-ic {
    width: var(--touch-target);
    height: var(--touch-target);
  }
}

/* İçerik dock'un arkasında kalmasın */
.has-dock {
  padding-bottom: calc(var(--dock-reserve) + env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  .dock {
    display: none;
  }

  .has-dock {
    padding-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dock,
  .dock > *,
  .dock-btn::after,
  .dock-call svg,
  .dock-call::before,
  .dock-call::after {
    animation: none;
  }
}
