/* ==========================================================================
   FeedLink Swine — LOADING screen (#authLoadingOverlay) "3D premium" skin
   Visual only. The show/hide behavior (.visible / .exiting, timers, redirect) stays in index.php's script.
   ========================================================================== */

body #authLoadingOverlay {
  background: radial-gradient(circle at 50% 46%, #ffffff 0%, #f1f6ee 55%, #e3ecde 100%);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
body #authLoadingOverlay .auth-loading-inner {
  --alo-size: clamp(124px, 38vw, 150px);
  gap: 0;
  padding: 22px;
}

/* ---- Coin scene: perspective on the parent, preserve-3d on every level ---- */
body .alo-scene {
  --alo-rx: 0deg;
  --alo-ry: 0deg;
  --alo-flip: 4.2s;
  position: relative;
  width: var(--alo-size);
  height: var(--alo-size);
  margin: 0 auto 30px;
  perspective: 900px;
  transform-style: preserve-3d;
}
body .alo-scene.is-fast { --alo-flip: 1.6s; }

/* mouse tilt (eases back to 0 when the pointer leaves) */
body .alo-tilt {
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--alo-rx)) rotateY(var(--alo-ry));
  transition: transform .25s ease-out;
}
/* gentle float: up 12px and back */
body .alo-float {
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  animation: aloFloat 3.2s ease-in-out infinite;
}
/* the flip: full turn on Y with short rests at 0deg and 180deg */
body .alo-coin {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  animation: aloFlip var(--alo-flip) ease-in-out infinite;
}
@keyframes aloFlip {
  0%, 10%  { transform: rotateY(0deg); }
  40%, 60% { transform: rotateY(180deg); }
  90%, 100% { transform: rotateY(360deg); }
}
@keyframes aloFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* thickness: 5 same-size circles stacked behind the face, dark -> mid green */
body .alo-layer {
  position: absolute; inset: 0;
  border-radius: 50%;
  transform-style: preserve-3d;
}
body .alo-l1 { background: #0f3319; transform: translateZ(-5px); }
body .alo-l2 { background: #17441f; transform: translateZ(-3px); }
body .alo-l3 { background: #1d4a2a; transform: translateZ(-1px); }
body .alo-l4 { background: #25603a; transform: translateZ(1px); }
body .alo-l5 { background: #2f7040; transform: translateZ(3px); }

/* front + back faces: white rim, 6px padding, soft shadow, hidden when facing away */
body .alo-face {
  position: absolute; inset: 0;
  display: block;
  padding: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15,51,25,.28), inset 0 0 0 1px rgba(29,74,42,.08);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}
body .alo-face img {
  display: block;
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
body .alo-front { transform: translateZ(4px); }
body .alo-back  { transform: rotateY(180deg) translateZ(6px); }   /* reads correctly when the coin is flipped */

/* transparent real button over the coin: "Flip faster" */
body .alo-flip-btn {
  position: absolute; inset: 0;
  z-index: 5;
  width: 100%; height: 100%;
  padding: 0; margin: 0;
  border: 0; border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body .alo-flip-btn:focus-visible {
  outline: 3px solid #3f9a52;
  outline-offset: 6px;
}

/* ---- Text ---- */
body #authLoadingOverlay .auth-loading-subtitle {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: #5b6676;
  line-height: 1.5;
}

/* ---- 3D progress bar (indeterminate: there is no real percentage) ---- */
body .alo-bar {
  position: relative;
  width: 220px; max-width: 70vw;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, #d5ddd0 0%, #e9efe5 100%);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.22), inset 0 -1px 0 rgba(255,255,255,.7), 0 1px 0 rgba(255,255,255,.9);
}
body .alo-bar i {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 42%;
  border-radius: 999px;
  background: linear-gradient(180deg, #8ad698 0%, #3f9a52 55%, #2c7a3d 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 2px 8px rgba(44,122,61,.45);
  animation: aloBar 1.5s ease-in-out infinite;
}
@keyframes aloBar {
  0%   { transform: translateX(-105%); }
  100% { transform: translateX(262%); }
}

/* ---- Fade / rise in when the screen appears (0.8s, 0.15s delay) ---- */
body #authLoadingOverlay.visible .auth-loading-subtitle,
body #authLoadingOverlay.visible .alo-bar {
  animation: aloRise .8s cubic-bezier(.22, 1, .36, 1) .15s both;
}
body #authLoadingOverlay.visible .alo-bar i { animation: aloBar 1.5s ease-in-out infinite; }  /* keep the bar loop (own animation) */
@keyframes aloRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Reduced motion: no flip, float, fade or bar loop ---- */
@media (prefers-reduced-motion: reduce) {
  body .alo-float, body .alo-coin { animation: none; }
  body .alo-tilt { transition: none; }
  body #authLoadingOverlay.visible .auth-loading-subtitle,
  body #authLoadingOverlay.visible .alo-bar { animation: none; }
  body .alo-bar i, body #authLoadingOverlay.visible .alo-bar i { animation: none; width: 55%; }
}

/* ---- Phones ---- */
@media (max-width: 480px) {
  body .alo-scene { margin-bottom: 24px; }
  body .alo-bar { width: min(220px, 64vw); }
}
