/* ==========================================================================
   BIKERS PALACE — 3D LOADING SCREEN (vanilla CSS, no frameworks)
   Shown once per browser session on the storefront; see loader.js
   ========================================================================== */
:root {
  --bp-yellow: #facc15;
  --bp-sky: #60a5fa;
  --bp-red: #ef4444;
  --bp-dark: #06080e;
  --bp-slate: #94a3b8;
}

html.bp-loading,
html.bp-loading body {
  overflow-y: hidden !important;
}

html.bp-skip-loader #bpLoader {
  display: none !important;
}

#bpLoader {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background: var(--bp-dark);
  color: #f8fafc;
  font-family: 'Inter', 'Outfit', system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1), transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

#bpLoader.bp-exit {
  opacity: 0;
  transform: scale(1.12);
  pointer-events: none;
}

#bpLoader .bp-racing {
  font-family: 'Chakra Petch', 'Outfit', system-ui, sans-serif;
}

/* Background speed tunnel + vignette */
#bpLoaderCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#bpLoader .bp-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 25%, rgba(4, 6, 11, 0.88) 100%);
}

/* ---------- Top HUD ---------- */
#bpLoader .bp-hud-top {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 896px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
}

#bpLoader .bp-brand-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #cbd5e1;
}

#bpLoader .bp-brand-line strong {
  color: var(--bp-yellow);
}

#bpLoader .bp-ping {
  position: relative;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

#bpLoader .bp-ping::before,
#bpLoader .bp-ping::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--bp-yellow);
}

#bpLoader .bp-ping::after {
  animation: bpPing 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes bpPing {
  75%, 100% { transform: scale(2.2); opacity: 0; }
}

#bpLoader .bp-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--bp-sky);
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #1e293b;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

#bpLoader .bp-pill strong { color: var(--bp-yellow); }
#bpLoader .bp-pill .bp-sep { color: #475569; }

/* ---------- Centre 3D stage ---------- */
#bpLoader .bp-stage {
  position: relative;
  z-index: 2;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 1100px;
  perspective-origin: 50% 46%;
}

#bpLoader .bp-ring-1,
#bpLoader .bp-ring-2 {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform-style: preserve-3d;
  pointer-events: none;
  will-change: transform;
}

#bpLoader .bp-ring-1 {
  width: 340px;
  height: 340px;
  margin: -170px 0 0 -170px;
  border: 2px solid rgba(250, 204, 21, 0.22);
  border-top: 3px solid var(--bp-yellow);
  border-bottom: 3px solid rgba(96, 165, 250, 0.75);
  box-shadow: 0 0 28px rgba(250, 204, 21, 0.25), inset 0 0 22px rgba(250, 204, 21, 0.15);
}

#bpLoader .bp-ring-2 {
  width: 400px;
  height: 400px;
  margin: -200px 0 0 -200px;
  border: 1.5px dashed rgba(96, 165, 250, 0.35);
  border-left: 3px solid var(--bp-sky);
  border-right: 3px solid rgba(250, 204, 21, 0.65);
  box-shadow: 0 0 24px rgba(96, 165, 250, 0.25);
}

#bpLoader .bp-emblem {
  position: relative;
  width: 230px;
  height: 324px;
  transform-style: preserve-3d;
  will-change: transform;
}

@media (min-width: 640px) {
  #bpLoader .bp-emblem { width: 268px; height: 377px; }
}

#bpLoader .bp-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  backface-visibility: visible;
}

#bpLoader .bp-bevel {
  filter: brightness(0.28) sepia(1) hue-rotate(8deg) saturate(3.5) drop-shadow(0 0 1px rgba(250, 204, 21, 0.55));
}

#bpLoader .bp-bevel-deep {
  filter: brightness(0.14) contrast(1.5) drop-shadow(0 0 2px rgba(96, 165, 250, 0.35));
}

#bpLoader .bp-front {
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.85));
}

/* Specular shine sweep, masked to the emblem shape */
#bpLoader .bp-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg,
    transparent 20%,
    rgba(255, 255, 255, 0) 38%,
    rgba(255, 255, 255, 0.55) 48%,
    rgba(250, 204, 21, 0.35) 52%,
    rgba(255, 255, 255, 0) 62%,
    transparent 80%);
  background-size: 240% 240%;
  mix-blend-mode: overlay;
  -webkit-mask: url('assets/loader_emblem.webp') center / contain no-repeat;
  mask: url('assets/loader_emblem.webp') center / contain no-repeat;
  animation: bpShine 2.8s infinite ease-in-out;
  pointer-events: none;
  transform: translateZ(1px);
}

@keyframes bpShine {
  0% { background-position: 180% 0%; }
  60%, 100% { background-position: -60% 0%; }
}

#bpLoader .bp-floor {
  width: 240px;
  height: 36px;
  margin-top: 12px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(250, 204, 21, 0.42) 0%, rgba(96, 165, 250, 0.18) 45%, transparent 75%);
  filter: blur(8px);
}

/* ---------- Bottom tachometer HUD ---------- */
#bpLoader .bp-hud-bottom {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 448px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#bpLoader .bp-readout {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 4px;
}

#bpLoader .bp-gear-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

#bpLoader .bp-gear {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #0f172a;
  border: 2px solid rgba(250, 204, 21, 0.8);
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#bpLoader .bp-gear small {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--bp-slate);
  line-height: 1;
}

#bpLoader .bp-gear span {
  font-size: 20px;
  font-weight: 700;
  color: var(--bp-yellow);
  line-height: 1.15;
}

#bpLoader .bp-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bp-slate);
}

#bpLoader .bp-rpm {
  font-size: 16px;
  font-weight: 700;
  color: var(--bp-sky);
}

#bpLoader .bp-rpm small {
  font-size: 12px;
  color: var(--bp-slate);
}

#bpLoader .bp-right { text-align: right; }

#bpLoader .bp-percent {
  font-size: 30px;
  font-weight: 700;
  color: var(--bp-yellow);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

#bpLoader .bp-segments {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
}

#bpLoader .bp-seg {
  flex: 1;
  height: 12px;
  transform: skewX(-18deg);
  border-radius: 2px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(71, 85, 105, 0.35);
  transition: background-color 0.08s ease, box-shadow 0.08s ease, transform 0.08s ease;
}

#bpLoader .bp-seg.low { background: var(--bp-sky); box-shadow: 0 0 10px rgba(96, 165, 250, 0.7); }
#bpLoader .bp-seg.mid { background: var(--bp-yellow); box-shadow: 0 0 12px rgba(250, 204, 21, 0.85); }
#bpLoader .bp-seg.red { background: var(--bp-red); box-shadow: 0 0 14px rgba(239, 68, 68, 0.95); transform: skewX(-18deg) scaleY(1.18); }

#bpLoader .bp-track {
  width: 100%;
  height: 6px;
  padding: 1px;
  border-radius: 999px;
  background: #0f172a;
  border: 1px solid #1e293b;
  overflow: hidden;
}

#bpLoader .bp-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bp-sky), var(--bp-yellow), var(--bp-red));
}

#bpLoader .bp-skip {
  margin-top: 4px;
  background: transparent;
  border: 0;
  color: #64748b;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 12px;
}

#bpLoader .bp-skip:hover,
#bpLoader .bp-skip:focus-visible { color: #e2e8f0; }

/* ---------- Small phones ---------- */
@media (max-width: 480px) {
  #bpLoader .bp-brand-line { font-size: 11px; letter-spacing: 0.12em; }
  #bpLoader .bp-pill { font-size: 10px; padding: 3px 10px; }
  #bpLoader .bp-ring-1 { width: 290px; height: 290px; margin: -145px 0 0 -145px; }
  #bpLoader .bp-ring-2 { width: 340px; height: 340px; margin: -170px 0 0 -170px; }
  #bpLoader .bp-emblem { width: 200px; height: 281px; }
  #bpLoader .bp-percent { font-size: 26px; }
}

@media (max-height: 640px) {
  #bpLoader .bp-emblem { width: 170px; height: 239px; }
  #bpLoader .bp-ring-1 { width: 250px; height: 250px; margin: -125px 0 0 -125px; }
  #bpLoader .bp-ring-2 { width: 290px; height: 290px; margin: -145px 0 0 -145px; }
}

/* ---------- Reduced motion: calm, static version ---------- */
@media (prefers-reduced-motion: reduce) {
  #bpLoader .bp-shine,
  #bpLoader .bp-ping::after { animation: none; }
  #bpLoader .bp-ring-1,
  #bpLoader .bp-ring-2 { display: none; }
  #bpLoader { transition: opacity 0.2s linear; }
  #bpLoader.bp-exit { transform: none; }
}
