/* "Devam" — the persistent scroll button (js/devam.js).
 * Fixed, bottom centre, on every screen. One click plays the page on to the next stop; the label names it.
 * States (classes set from JS):  is-on   shown (fades in shortly after load)
 *                                is-up   nothing left below → "Başa dön", chevron turned around
 *                                is-busy the page is travelling
 *                                is-nudge idle for a moment → chevrons and ripple invite */
:root {
  /* the button's box; other sections read these to keep clear of it (eserler.css: its year ticks sit just above) */
  --devam-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(16px, 3.8vh, 34px));
  --devam-h: 46px;
}
.devam {
  position: fixed;
  left: 50%;
  bottom: var(--devam-bottom);
  z-index: 72; /* above the rail (70), under the header (80) */
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 14px;
  height: var(--devam-h);
  min-width: min(84vw, 276px);
  max-width: min(92vw, 380px);
  padding: 0 7px 0 22px;
  border: 1px solid rgba(231, 200, 120, 0.36);
  border-radius: 999px;
  background: rgba(10, 8, 7, 0.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  color: #f6ecd0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: opacity 0.6s ease, transform 0.6s var(--ease-out), visibility 0s linear 0.6s, background-color 0.25s, border-color 0.25s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.devam.is-on {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
.devam:hover {
  border-color: rgba(231, 200, 120, 0.78);
  background: rgba(24, 18, 10, 0.78);
}
.devam:active {
  transform: translate(-50%, 1px) scale(0.985);
}
.devam:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 4px;
}
/* the mobile menu is a full overlay: stay out of its way */
body:has(.nav__links.is-open) .devam {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.devam__label {
  display: block;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  padding-left: 4px;
}
.devam__label.swap {
  animation: devam-swap 0.38s var(--ease-out);
}
.devam.is-busy .devam__label {
  opacity: 0.72;
}

/* the chevron disc */
.devam__icon {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(231, 200, 120, 0.14);
  transition: background-color 0.25s, transform 0.55s var(--ease-expo);
}
.devam:hover .devam__icon {
  background: rgba(231, 200, 120, 0.28);
}
.devam__icon::before {
  /* a slow ripple: only while idle */
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid rgba(231, 200, 120, 0.72);
  border-radius: 50%;
  opacity: 0;
}
.devam__icon i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -6px 0 0 -4px;
  border-right: 2px solid #f3d992;
  border-bottom: 2px solid #f3d992;
  transform: translateY(-2px) rotate(45deg);
}
.devam__icon i:nth-child(2) {
  opacity: 0.45;
  transform: translateY(4px) rotate(45deg);
}
.devam.is-up .devam__icon {
  transform: rotate(180deg);
}

.devam.is-nudge .devam__icon::before {
  animation: devam-ripple 2.6s ease-out infinite;
}
.devam.is-nudge .devam__icon i {
  animation: devam-chev 1.7s ease-in-out infinite;
}
.devam.is-nudge .devam__icon i:nth-child(2) {
  animation-delay: 0.28s;
}
.devam.is-busy .devam__icon i {
  animation: devam-chev 0.85s linear infinite;
}
.devam.is-busy .devam__icon i:nth-child(2) {
  animation-delay: 0.18s;
}

@keyframes devam-chev {
  0% {
    opacity: 0;
    transform: translateY(-6px) rotate(45deg);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(7px) rotate(45deg);
  }
}
@keyframes devam-ripple {
  0% {
    opacity: 0.85;
    transform: scale(0.7);
  }
  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}
@keyframes devam-swap {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 560px) {
  :root {
    --devam-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    --devam-h: 44px;
  }
  .devam {
    min-width: min(84vw, 252px);
    gap: 10px;
    padding: 0 6px 0 18px;
    font-size: 11px;
    letter-spacing: 0.22em;
  }
}
@media (hover: none) {
  .devam:hover {
    border-color: rgba(231, 200, 120, 0.36);
    background: rgba(10, 8, 7, 0.6);
  }
  .devam:hover .devam__icon {
    background: rgba(231, 200, 120, 0.14);
  }
}
@media (prefers-reduced-motion: reduce) {
  .devam,
  .devam__icon {
    transition-duration: 0.01s;
  }
  .devam__label.swap,
  .devam.is-nudge .devam__icon::before,
  .devam.is-nudge .devam__icon i,
  .devam.is-busy .devam__icon i {
    animation: none;
  }
  .devam.is-nudge .devam__icon::before {
    opacity: 0.55;
  }
}
@media print {
  .devam {
    display: none;
  }
}
