/* ============================================================
   Brata Media Press — preloader.css
   Branded full-screen preloader using real favicon / logo mark
   ============================================================ */

/* ── Preloader Backdrop ───────────────────────────────────── */
#bmp-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  /* Transition out */
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

#bmp-preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Deep dark backdrop that matches brand */
.preloader-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(208,2,27,0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 25%, rgba(208,2,27,0.07) 0%, transparent 45%),
    linear-gradient(160deg, #050507 0%, #0A0A0E 50%, #10101A 100%);
}

/* Subtle animated grid overlay */
.preloader-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(208,2,27,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(208,2,27,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: preloaderGrid 4s ease-in-out infinite;
}

@keyframes preloaderGrid {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ── Inner Container ──────────────────────────────────────── */
.preloader-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 280px;
}

/* ── Logo / Favicon Wrap ──────────────────────────────────── */
.preloader-logo-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

/* Outer spinning ring */
.preloader-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
}

.preloader-ring--outer {
  width: 120px;
  height: 120px;
  border-top-color: #D0021B;
  border-right-color: rgba(208, 2, 27, 0.3);
  border-bottom-color: rgba(208, 2, 27, 0.1);
  border-left-color: rgba(208, 2, 27, 0.3);
  animation: ringSpinOuter 1.4s linear infinite;
}

.preloader-ring--inner {
  width: 96px;
  height: 96px;
  border-top-color: rgba(208, 2, 27, 0.2);
  border-right-color: #D0021B;
  border-bottom-color: rgba(208, 2, 27, 0.4);
  border-left-color: rgba(208, 2, 27, 0.1);
  animation: ringSpinInner 1.8s linear infinite reverse;
}

@keyframes ringSpinOuter {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes ringSpinInner {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Favicon image inside the rings */
.preloader-favicon {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 50%;
  animation: preloaderFaviconPulse 2s ease-in-out infinite;
  position: relative;
  z-index: 2;
  /* Glow effect matching brand red */
  filter: drop-shadow(0 0 12px rgba(208,2,27,0.5));
}

@keyframes preloaderFaviconPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 12px rgba(208,2,27,0.5));
  }
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 24px rgba(208,2,27,0.8));
  }
}

/* Dot orbit around the favicon */
.preloader-logo-wrap::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: #D0021B;
  border-radius: 50%;
  top: 6px;
  left: 50%;
  margin-left: -5px;
  box-shadow: 0 0 8px rgba(208,2,27,0.8);
  animation: orbitDot 1.4s linear infinite;
  transform-origin: 5px 54px;
}

@keyframes orbitDot {
  0%   { transform: rotate(0deg) translateY(-54px); }
  100% { transform: rotate(360deg) translateY(-54px); }
}

/* ── Brand Name ───────────────────────────────────────────── */
.preloader-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: preloaderFadeIn 0.6s ease 0.2s both;
}

.preloader-brand-name {
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #FFFFFF;
  white-space: nowrap;
}

.preloader-brand-sub {
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(208,2,27,0.9);
}

/* ── Progress Track ───────────────────────────────────────── */
.preloader-progress-track {
  width: 240px;
  height: 2px;
  background: rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  animation: preloaderFadeIn 0.4s ease 0.3s both;
}

/* Ambient shimmer on the track */
.preloader-progress-track::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: progressShimmer 1.8s ease-in-out infinite;
}

@keyframes progressShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Actual progress bar fill */
.preloader-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #9B0015, #D0021B, #FF2040);
  border-radius: 2px;
  transition: width 0.12s ease-out;
  position: relative;
  /* Glowing right edge */
}
.preloader-progress-bar::after {
  content: '';
  position: absolute;
  right: 0; top: -2px;
  width: 4px; height: 6px;
  background: #FF4060;
  border-radius: 50%;
  box-shadow: 0 0 8px #D0021B, 0 0 16px rgba(208,2,27,0.6);
}

/* ── Percentage Counter ───────────────────────────────────── */
.preloader-percent {
  font-family: 'Bebas Neue', 'Barlow Condensed', sans-serif;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: rgba(208,2,27,0.7);
  min-width: 36px;
  text-align: center;
  animation: preloaderFadeIn 0.4s ease 0.4s both;
}

/* ── Shared Fade In ───────────────────────────────────────── */
@keyframes preloaderFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Preloader Exit Animation ─────────────────────────────── */
#bmp-preloader.exiting .preloader-inner {
  animation: preloaderExit 0.4s ease forwards;
}

@keyframes preloaderExit {
  0%   { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.94) translateY(-12px); }
}

/* ── Logo in header — overrides old text logo ─────────────── */
.site-logo-img {
  height: 44px;
  width: auto;
  display: block;
  object-fit: contain;
  /* Keep logo visible on both scrolled & un-scrolled states */
  filter: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.site-logo-img:hover {
  opacity: 0.88;
  transform: scale(0.98);
}

/* On un-scrolled state the header is transparent so ensure logo is readable */
.site-header:not(.scrolled) .site-logo-img {
  /* Logo has white background baked in — add subtle backdrop on unscrolled */
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.6));
}

/* Footer logo */
.footer-logo {
  display: inline-block;
  margin-bottom: 20px;
}
.footer-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  display: block;
  /* Ensure logo is visible on dark footer */
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

/* ── Mobile responsiveness for preloader ──────────────────── */
@media (max-width: 480px) {
  .preloader-inner { width: 240px; }
  .preloader-progress-track { width: 200px; }
  .preloader-brand-name { font-size: 15px; letter-spacing: 0.2em; }
  .preloader-logo-wrap { width: 100px; height: 100px; }
  .preloader-ring--outer { width: 100px; height: 100px; }
  .preloader-ring--inner { width: 80px; height: 80px; }
  .preloader-favicon { width: 58px; height: 58px; }
}
