/* Service Desk splash — Warm Filo (Warm Ink + Clay) */

:root {
  --sd-primary: #c4654a;
  --sd-primary-hover: #a8533c;
  --sd-primary-subtle: #f6ebe7;
  --sd-surface: #faf9f7;
  --sd-surface-raised: #ffffff;
  --sd-border: #e8e4df;
  --sd-ink: #1c1917;
  --sd-ink-muted: #57534e;
  --sd-ink-faint: #a8a29e;
}

html,
body {
  margin: 0;
  padding: 0;
}

body.app-splash-active {
  overflow: hidden;
  background-color: var(--sd-surface);
}

#app-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  color-scheme: light;
  background-color: var(--sd-surface);
  opacity: 1;
  will-change: opacity;
  transition: opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

#app-splash.app-splash--hide {
  opacity: 0;
  pointer-events: none;
}

#app-splash.app-splash--hide .app-splash__center {
  transform: scale(0.985);
  opacity: 0;
}

/* --- Background: waves + watermark + grain --- */
.app-splash__bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: var(--sd-surface);
}

.app-splash__waves {
  position: absolute;
  inset: -14%;
  width: 128%;
  height: 128%;
  transform: rotate(-16deg);
  transform-origin: center center;
  pointer-events: none;
  animation: splash-waves-drift 9s ease-in-out infinite;
}

.app-splash__ticket-mark {
  position: absolute;
  top: -8%;
  left: -10%;
  width: min(38vw, 300px);
  height: auto;
  opacity: 0.11;
  transform: rotate(-14deg);
  transform-origin: center center;
  pointer-events: none;
  animation: splash-ticket-float 7s ease-in-out infinite;
}

.app-splash__channels {
  position: absolute;
  right: max(20px, env(safe-area-inset-right, 0px) + 12px);
  bottom: max(36px, env(safe-area-inset-bottom, 0px) + 28px);
  display: flex;
  gap: 14px;
  align-items: flex-end;
  color: var(--sd-primary);
  opacity: 0.2;
  pointer-events: none;
  animation: splash-channels-enter 1s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both;
}

.app-splash__channel-icon {
  display: block;
  width: 56px;
  height: 56px;
}

.app-splash__channel-icon--form {
  transform: rotate(-6deg);
  animation: splash-channel-float-form 4.5s ease-in-out 0.8s infinite;
}

.app-splash__channel-icon--email {
  transform: rotate(8deg);
  animation: splash-channel-float-email 4.5s ease-in-out 1.1s infinite;
}

@media (min-width: 600px) {
  .app-splash__channel-icon {
    width: 68px;
    height: 68px;
  }
}

.app-splash__noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* --- Centered content --- */
.app-splash__stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: 1fr;
  min-height: 100%;
  min-height: 100dvh;
  pointer-events: none;
}

.app-splash__center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition:
    transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-splash__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 auto;
}

.app-splash__icon {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0;
  animation:
    splash-enter 0.9s cubic-bezier(0.22, 1, 0.36, 1) both,
    splash-icon-breathe 3.2s ease-in-out 1s infinite;
}

.app-splash__title {
  margin: 16px 0 0;
  padding: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  animation: splash-enter 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.app-splash__title-service {
  color: var(--sd-ink);
}

.app-splash__title-desk {
  color: var(--sd-primary);
}

.app-splash__status {
  margin: 20px 0 0;
  padding: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sd-ink-faint);
  animation: splash-fade-enter 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both;
}

.app-splash__footer {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: max(32px, env(safe-area-inset-bottom, 0px) + 24px);
  animation: splash-fade-enter 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both;
}

.app-splash__progress {
  width: 96px;
  height: 2px;
  border-radius: 999px;
  background-color: var(--sd-border);
  overflow: hidden;
}

.app-splash__version {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sd-ink-faint);
}

.app-splash__progress-bar {
  display: block;
  width: 36%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--sd-primary) 42%,
    var(--sd-primary-hover) 100%
  );
  animation: splash-progress-slide 1.35s ease-in-out infinite;
}

@media (min-width: 600px) {
  .app-splash__icon {
    width: 96px;
    height: 96px;
  }

  .app-splash__title {
    font-size: 2rem;
  }
}

/* Motion */
@keyframes splash-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes splash-progress-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(340%);
  }
}

@keyframes splash-waves-drift {
  0%,
  100% {
    transform: rotate(-16deg) scale(1);
  }
  50% {
    transform: rotate(-11deg) scale(1.025);
  }
}

@keyframes splash-ticket-float {
  0%,
  100% {
    transform: rotate(-14deg) translateY(0);
    opacity: 0.11;
  }
  50% {
    transform: rotate(-11deg) translateY(12px);
    opacity: 0.14;
  }
}

@keyframes splash-channels-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 0.2;
    transform: translateY(0);
  }
}

@keyframes splash-channel-float-form {
  0%,
  100% {
    transform: rotate(-6deg) translateY(0);
  }
  50% {
    transform: rotate(-4deg) translateY(-7px);
  }
}

@keyframes splash-channel-float-email {
  0%,
  100% {
    transform: rotate(8deg) translateY(0);
  }
  50% {
    transform: rotate(10deg) translateY(-9px);
  }
}

@keyframes splash-icon-breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(0) scale(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  #app-splash,
  #app-splash .app-splash__center,
  .app-splash__waves,
  .app-splash__ticket-mark,
  .app-splash__channels,
  .app-splash__channel-icon,
  .app-splash__icon,
  .app-splash__title,
  .app-splash__status,
  .app-splash__footer,
  .app-splash__progress {
    animation: none !important;
    transition-duration: 0.15s;
  }

  .app-splash__waves {
    transform: rotate(-16deg);
  }

  .app-splash__ticket-mark {
    transform: rotate(-14deg);
    opacity: 0.11;
  }

  .app-splash__channels {
    opacity: 0.2;
    transform: none;
  }

  .app-splash__channel-icon--form {
    transform: rotate(-6deg);
  }

  .app-splash__channel-icon--email {
    transform: rotate(8deg);
  }

  .app-splash__icon,
  .app-splash__title,
  .app-splash__status,
  .app-splash__footer,
  .app-splash__progress {
    opacity: 1;
    transform: none;
  }
}
