/**
 * Celbert Grocery Ordering System
 * Phone splash screen (3 seconds, then the storefront)
 */

.cb-splash {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  align-items: center;
  justify-content: center;
  margin: 0;
  box-sizing: border-box;
  padding: 32px 32px 160px;
  overflow: hidden;
  background:
    radial-gradient(circle at 112% -8%, rgba(251, 192, 45, 0.34), transparent 36%),
    radial-gradient(circle at -18% 112%, rgba(46, 125, 50, 0.16), transparent 34%),
    #fefdff;
  color: #202a33;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

html.celbert-splash-on,
html.celbert-splash-on body {
  margin: 0;
  height: 100%;
  overflow: hidden !important;
  background: #fefdff;
}

html.celbert-splash-on .cb-splash {
  display: block;
}

.cb-splash-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cb-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}

.cb-orb-gold {
  top: -130px;
  right: -130px;
  width: 230px;
  height: 230px;
  background: radial-gradient(circle, rgba(251, 192, 45, 0.5), rgba(251, 192, 45, 0) 68%);
  animation: cbDrift 7s ease-in-out infinite;
}

.cb-orb-green {
  left: -150px;
  bottom: -20px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(46, 125, 50, 0.2), rgba(46, 125, 50, 0) 70%);
  animation: cbDrift 8.5s ease-in-out infinite reverse;
}

.cb-ring {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border: 1.5px solid rgba(198, 40, 40, 0.14);
  border-radius: 50%;
  animation: cbRing 2.8s ease-out infinite;
}

.cb-splash-card {
  position: absolute;
  z-index: 1;
  top: 46%;
  left: 50%;
  box-sizing: border-box;
  width: min(280px, calc(100% - 64px));
  transform: translate(-50%, -54%);
}

.cb-logo-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.cb-splash-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(18px) scale(0.92);
}

.cb-splash-logo.is-ready {
  animation: cbLogoIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cb-gold-line {
  width: 74px;
  height: 3px;
  margin: 4px auto 0;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #fbc02d 20%, #f9a825 80%, transparent);
  transform: scaleX(0);
  animation: cbLine 0.7s ease 0.45s forwards;
}

.cb-splash-tagline {
  margin: 16px 0 0;
  color: #202a33;
  font-size: clamp(1.15rem, 4.5vw, 1.38rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.18;
  opacity: 0;
  animation: cbRise 0.7s ease 0.32s forwards;
}

.cb-splash-tagline span {
  color: #c62828;
}

.cb-progress {
  width: 132px;
  height: 3px;
  margin: 26px auto 0;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(198, 40, 40, 0.12);
}

.cb-progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef5350, #c62828);
  box-shadow: 0 0 12px rgba(198, 40, 40, 0.35);
  animation: cbFill 3s linear forwards;
}

.cb-splash-foot {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-sizing: border-box;
  height: clamp(124px, 24%, 200px);
  padding: 0 16px max(16px, env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.cb-splash-foot svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.cb-splash-foot p {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: clamp(0.78rem, 3.5vw, 0.95rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(120, 16, 16, 0.25);
  opacity: 0;
  animation: cbRise 0.7s ease 0.48s forwards;
}

.cb-splash-foot svg.cb-truck {
  position: static;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.cb-splash-fallback {
  margin: 0;
  color: #c62828;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.cb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cb-splash.is-leaving {
  pointer-events: none;
  animation: cbSplashOut 0.38s ease forwards;
}

@keyframes cbLogoIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.92);
  }
  70% {
    opacity: 1;
    transform: translateY(0) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cbRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cbLine {
  to {
    transform: scaleX(1);
  }
}

@keyframes cbFill {
  to {
    width: 100%;
  }
}

@keyframes cbDrift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, 14px, 0);
  }
}

@keyframes cbRing {
  0% {
    opacity: 0.55;
    transform: scale(0.72);
  }
  100% {
    opacity: 0;
    transform: scale(1.7);
  }
}

@keyframes cbSplashOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@media (max-height: 700px) {
  .cb-splash-foot {
    height: clamp(112px, 20%, 150px);
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
}

@media (max-height: 560px) {
  .cb-splash {
    padding: 20px 24px 96px;
  }

  .cb-splash-card {
    top: 42%;
    width: min(230px, calc(100% - 48px));
  }

  .cb-splash-tagline {
    font-size: 1.05rem;
  }

  .cb-splash-foot {
    height: 108px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  .cb-splash-foot p {
    font-size: 0.76rem;
  }
}

@media (max-height: 460px) {
  .cb-splash-card {
    top: 38%;
  }

  .cb-splash-foot {
    height: 84px;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  }

  .cb-splash-foot p {
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-orb,
  .cb-ring,
  .cb-splash-logo,
  .cb-splash-logo.is-ready,
  .cb-gold-line,
  .cb-splash-tagline,
  .cb-splash-foot p,
  .cb-progress > span,
  .cb-splash.is-leaving {
    animation: none !important;
    transform: none !important;
  }

  .cb-splash-logo.is-ready,
  .cb-gold-line,
  .cb-splash-tagline,
  .cb-splash-foot p {
    opacity: 1;
  }

  .cb-progress > span {
    width: 100%;
  }

  .cb-splash.is-leaving {
    opacity: 0;
  }
}
