@font-face {
  font-family: "cairo";
  src: url("Cairo-Regular.ttf") format("truetype");
}

:root {
  --brand: #006495;
  --stage: #ffffff;
  --ink: #0b2a3a;
  --muted: #5b7180;
  --card-bg: #ffffff;
  --page-bg: #f4f8fb;
  --card-border: rgba(0, 100, 149, 0.12);
  --stage-border: transparent;
  --card-shadow: 0 24px 60px -20px rgba(0, 100, 149, 0.22);
  --dot-idle: rgba(0, 100, 149, 0.22);
  color-scheme: light;
}

#loading-page {
  position: fixed;
  inset: 0;
  background-color: var(--page-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: "cairo";
  direction: rtl;
}

#card {
  width: min(680px, 92vw);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  padding: 32px 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#brand-name {
  font-size: 20px;
  font-weight: bold;
  color: var(--brand);
  margin: 0 0 22px;
  text-align: center;
}

/* Carousel stage — hugs the image with light padding, not the full card width */
#stage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 12px;
  background: var(--stage);
  border: 1px solid var(--stage-border);
  border-radius: 18px;
  overflow: hidden;
}

#slide-img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Caption — fixed min-height reserves space for a 2-line subtitle so the
   dots/progress below never shift between slides */
#caption {
  text-align: center;
  min-height: 84px;
  margin-top: 18px;
  transition: opacity 0.3s ease;
}

#slide-title {
  font-size: 24px;
  font-weight: bold;
  color: var(--ink);
  margin: 0 0 6px;
}

#slide-sub {
  font-size: 18px;
  font-weight: bold;
  color: var(--brand);
  margin: 0;
}

/* Fade state applied during slide swap */
.fade #slide-img,
.fade #caption {
  opacity: 0;
}

.fade #slide-img {
  transform: scale(0.98);
}

/* Dots */
#dots {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

#dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-idle);
  transition: width 0.3s ease, background 0.3s ease;
}

#dots span.active {
  width: 22px;
  border-radius: 6px;
  background: var(--brand);
}

/* Loading row */
#loading-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}

#loading-text {
  font-size: 14px;
  font-weight: bold;
  color: var(--muted);
}

/* Indeterminate progress bar */
#progress {
  position: relative;
  width: 220px;
  max-width: 70%;
  height: 4px;
  border-radius: 100px;
  background: var(--dot-idle);
  overflow: hidden;
}

#progress::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  height: 100%;
  width: 40%;
  border-radius: 100px;
  background: var(--brand);
  /* Animate transform (GPU-composited) — never `left`/`inset` — so the bar
     doesn't force a layout/reflow every frame while the engine boots. */
  animation: indeterminate 1.3s ease-in-out infinite;
  will-change: transform;
}

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

/* Responsive */
@media (max-width: 520px) {
  #card { padding: 24px 18px 22px; border-radius: 20px; }
  #slide-img { max-height: 200px; }
  #brand-name { font-size: 18px; }
  #slide-title { font-size: 20px; }
  #slide-sub { font-size: 16px; }
}

/* Respect users who prefer reduced motion: no fades, no marching bar */
@media (prefers-reduced-motion: reduce) {
  #slide-img,
  #caption,
  #dots span {
    transition: none;
  }
  #progress::before {
    animation: none;
    width: 0;
  }
}
