/* Shared entrance motion and loading feedback for the console and public pages. */
:root {
  --hf-motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hf-loader-accent: var(--accent, var(--md-primary, #cfb1f2));
  --hf-loader-surface: var(--surface, var(--md-surface-container-high, #282330));
  --hf-loader-ink: var(--text, var(--fg, var(--md-on-surface, #eee9f5)));
  --hf-loader-border: var(--border, var(--line, var(--md-outline-variant, #3b3345)));
}

.hf-loading[hidden] {
  display: none !important;
}

.hf-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.hf-loading__track {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  overflow: hidden;
  background: color-mix(in srgb, var(--hf-loader-accent) 12%, transparent);
}

.hf-loading__track::after {
  content: "";
  display: block;
  width: 35%;
  height: 100%;
  background: var(--hf-loader-accent);
  box-shadow: 0 0 10px var(--hf-loader-accent);
}

.hf-loader {
  position: absolute;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 12px;
  border: 1px solid var(--hf-loader-border);
  border-radius: 16px;
  background: var(--hf-loader-surface);
  color: var(--hf-loader-ink);
  box-shadow: 0 8px 32px #0002;
  font: 500 12px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}

.hf-loader__mark {
  width: 36px;
  height: 40px;
  flex: none;
  overflow: visible;
  color: var(--hf-loader-accent);
}

.hf-loader__outline {
  fill: color-mix(in srgb, var(--hf-loader-accent) 8%, transparent);
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.3;
}

.hf-loader__trace {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 26 74;
}

.hf-loader__letter {
  fill: currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  [data-hf-enter] {
    animation: hf-enter 340ms var(--hf-motion-ease) backwards;
    animation-delay: var(--hf-enter-delay, 0ms);
  }

  [data-hf-enter="fade"] {
    animation-name: hf-fade;
  }

  .hf-loader {
    animation: hf-enter 220ms var(--hf-motion-ease) backwards;
  }

  .hf-loading__track::after {
    animation: hf-loading-track 1.4s ease-in-out infinite;
  }

  .hf-loader__trace {
    animation: hf-loading-trace 1.8s linear infinite;
  }

  .hf-loader__letter {
    animation: hf-loading-breathe 1.8s ease-in-out infinite;
  }
}

@keyframes hf-enter {
  from { opacity: 0; translate: 0 8px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes hf-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hf-loading-track {
  from { transform: translateX(-100%); }
  to { transform: translateX(390%); }
}

@keyframes hf-loading-trace {
  to { stroke-dashoffset: -100; }
}

@keyframes hf-loading-breathe {
  50% { opacity: 0.55; }
}

@media (max-width: 600px) {
  .hf-loader {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}
