/* EgyBI — "Living Papyrus" interactive feature showcase & spotlight guide.
   Zero external libraries. Animates ONLY transform and opacity (zero CLS).
   Respects prefers-reduced-motion, RTL, 375px mobile, and hides in print. */

/* ---- 1. Home page "How EgyBI Works" showcase ----------------------------- */
.hiw-sec {
  position: relative;
  overflow: hidden;
}

.hiw-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.hiw-head h2 {
  margin: 0 0 6px;
}

.hiw-head .lead {
  margin: 0;
  max-width: 58ch;
}

.hiw-tour-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1.5px solid #C9A227;
  background: #1B1B18;
  color: #FBF8F1;
  font: 600 0.92rem/1.1 var(--font-sans, Inter, system-ui, sans-serif);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.22, 1, .36, 1), opacity 0.2s ease;
}

.hiw-tour-cta:hover,
.hiw-tour-cta:focus-visible {
  transform: translateY(-2px) scale(1.02);
  outline: 2px solid #C9A227;
  outline-offset: 2px;
}

.hiw-tour-cta svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  animation: hiw-bob 2.4s ease-in-out infinite;
}

.hiw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.hiw-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  border-radius: 14px;
  background: #FBF8F1;
  border: 1px solid rgba(27, 27, 24, 0.12);
  box-shadow: 0 2px 10px rgba(27, 27, 24, 0.04);
  transition: transform 0.28s cubic-bezier(.22, 1, .36, 1), opacity 0.25s ease;
  cursor: pointer;
}

.hiw-card:hover,
.hiw-card:focus-within,
.hiw-card.is-active {
  transform: translateY(-4px);
  border-color: #C9A227;
}

.hiw-card.is-pop {
  animation: hiw-pop 0.42s cubic-bezier(.22, 1, .36, 1);
}

.hiw-stage {
  height: 92px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1B1B18 0%, #26231C 62%, #1E2D3D 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.hiw-stage svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hiw-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7A5E10;
}

.hiw-card h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
  color: #1B1B18;
}

.hiw-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #3A372F;
  flex: 1 1 auto;
}

.hiw-tip {
  margin: 2px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(201, 162, 39, 0.12);
  border-inline-start: 3px solid #C9A227;
  font-size: 0.83rem;
  line-height: 1.45;
  color: #1B1B18;
}

.hiw-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1B5A96;
  text-decoration: none;
  margin-top: 2px;
}

.hiw-link:hover,
.hiw-link:focus-visible {
  text-decoration: underline;
}

/* ---- Signature inline SVG motion graphics (transform + opacity ONLY) ----- */
.hiw-dot-pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: hiw-pulse 2.2s ease-in-out infinite;
}

.hiw-dot-pulse-2 {
  transform-box: fill-box;
  transform-origin: center;
  animation: hiw-pulse 2.2s ease-in-out 0.65s infinite;
}

.hiw-dot-pulse-3 {
  transform-box: fill-box;
  transform-origin: center;
  animation: hiw-pulse 2.2s ease-in-out 1.3s infinite;
}

.hiw-sun-float {
  transform-box: fill-box;
  transform-origin: center;
  animation: hiw-float 3.2s ease-in-out infinite;
}

.hiw-bar-1 { transform-box: fill-box; transform-origin: bottom; animation: hiw-bar 2.8s ease-in-out infinite; }
.hiw-bar-2 { transform-box: fill-box; transform-origin: bottom; animation: hiw-bar 2.8s ease-in-out 0.35s infinite; }
.hiw-bar-3 { transform-box: fill-box; transform-origin: bottom; animation: hiw-bar 2.8s ease-in-out 0.7s infinite; }
.hiw-bar-4 { transform-box: fill-box; transform-origin: bottom; animation: hiw-bar 2.8s ease-in-out 1.05s infinite; }

.hiw-coin-flip {
  transform-box: fill-box;
  transform-origin: center;
  animation: hiw-tilt 3s ease-in-out infinite;
}

.hiw-radar-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: hiw-radar 2.6s ease-out infinite;
}

.hiw-stamp {
  transform-box: fill-box;
  transform-origin: center;
  animation: hiw-bob 2.6s ease-in-out infinite;
}

@keyframes hiw-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes hiw-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6px, -4px) scale(1.06); }
}

@keyframes hiw-pulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.38); opacity: 0.55; }
}

@keyframes hiw-bar {
  0%, 100% { transform: scaleY(0.82); opacity: 0.85; }
  50% { transform: scaleY(1.04); opacity: 1; }
}

@keyframes hiw-tilt {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50% { transform: rotate(5deg) scale(1.06); }
}

@keyframes hiw-radar {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(2.1); opacity: 0; }
}

@keyframes hiw-pop {
  0% { transform: translateY(-4px) scale(0.98); }
  55% { transform: translateY(-7px) scale(1.02); }
  100% { transform: translateY(-4px) scale(1); }
}

/* ---- 2. Floating "?" Guide button ---------------------------------------- */
.eg-guide-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid #C9A227;
  background: #1B1B18;
  color: #FBF8F1;
  font: 700 0.88rem/1 var(--font-sans, Inter, system-ui, sans-serif);
  box-shadow: 0 8px 24px rgba(20, 17, 12, 0.28);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.22, 1, .36, 1), opacity 0.2s ease;
}

[dir="rtl"] .eg-guide-fab {
  right: auto;
  left: 20px;
}

.eg-guide-fab:hover,
.eg-guide-fab:focus-visible {
  transform: translateY(-2px) scale(1.04);
  outline: 2px solid #E7C64C;
  outline-offset: 2px;
}

.eg-guide-fab .eg-fab-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #C9A227;
  color: #1B1B18;
  font-weight: 800;
  font-size: 0.85rem;
}

.eg-guide-fab.is-new::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 999px;
  border: 2px solid #E7C64C;
  pointer-events: none;
  animation: eg-halo 2.2s ease-out infinite;
}

@keyframes eg-halo {
  0% { transform: scale(0.96); opacity: 0.85; }
  100% { transform: scale(1.16); opacity: 0; }
}

/* ---- 3. Spotlight overlay & callout card --------------------------------- */
.eg-guide-scrim {
  position: fixed;
  inset: 0;
  z-index: 9992;
  background: rgba(20, 17, 12, 0.56);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.eg-guide-scrim.is-open {
  opacity: 1;
}

.eg-guide-ring {
  position: fixed;
  z-index: 9993;
  border-radius: 12px;
  border: 2.5px solid #E7C64C;
  box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.28), 0 12px 32px rgba(20, 17, 12, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.25s ease, transform 0.28s cubic-bezier(.22, 1, .36, 1);
}

.eg-guide-ring.is-open {
  opacity: 1;
  transform: scale(1);
}

.eg-guide-card {
  position: fixed;
  z-index: 9994;
  width: min(360px, calc(100vw - 24px));
  padding: 18px 18px 16px;
  border-radius: 16px;
  background: #FBF8F1;
  color: #1B1B18;
  border: 2px solid #C9A227;
  box-shadow: 0 18px 46px rgba(20, 17, 12, 0.36);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.24s ease, transform 0.28s cubic-bezier(.22, 1, .36, 1);
}

.eg-guide-card.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.eg-guide-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.eg-guide-mascot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #7A5E10;
}

.eg-guide-mascot svg {
  width: 22px;
  height: 22px;
  animation: hiw-bob 2.2s ease-in-out infinite;
}

.eg-guide-close {
  border: 0;
  background: rgba(27, 27, 24, 0.08);
  color: #1B1B18;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.eg-guide-close:hover,
.eg-guide-close:focus-visible {
  background: rgba(27, 27, 24, 0.16);
  outline: 2px solid #C9A227;
}

.eg-guide-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  line-height: 1.3;
  color: #1B1B18;
}

.eg-guide-body {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #3A372F;
}

.eg-guide-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.eg-guide-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.eg-guide-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(27, 27, 24, 0.2);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.eg-guide-dot.is-now {
  background: #C9A227;
  transform: scale(1.35);
}

.eg-guide-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eg-guide-btn {
  padding: 7px 13px;
  border-radius: 999px;
  font: 600 0.84rem/1.1 var(--font-sans, Inter, system-ui, sans-serif);
  cursor: pointer;
  border: 1px solid rgba(27, 27, 24, 0.2);
  background: #FBF8F1;
  color: #1B1B18;
}

.eg-guide-btn.eg-primary {
  background: #1B1B18;
  color: #FBF8F1;
  border-color: #C9A227;
}

.eg-guide-btn:hover,
.eg-guide-btn:focus-visible {
  outline: 2px solid #C9A227;
  outline-offset: 1px;
}

.eg-guide-btn[hidden] {
  display: none;
}

/* ---- 4. Mobile (375px), Reduced Motion & Print --------------------------- */
@media (max-width: 600px) {
  .eg-guide-fab {
    bottom: 14px;
    right: 14px;
    padding: 9px 13px;
    font-size: 0.82rem;
  }
  [dir="rtl"] .eg-guide-fab {
    right: auto;
    left: 14px;
  }
  .hiw-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hiw-tour-cta svg,
  .hiw-dot-pulse,
  .hiw-dot-pulse-2,
  .hiw-dot-pulse-3,
  .hiw-sun-float,
  .hiw-bar-1,
  .hiw-bar-2,
  .hiw-bar-3,
  .hiw-bar-4,
  .hiw-coin-flip,
  .hiw-radar-ring,
  .hiw-stamp,
  .eg-guide-fab.is-new::after,
  .eg-guide-mascot svg {
    animation: none !important;
  }
  .hiw-card,
  .hiw-tour-cta,
  .eg-guide-fab,
  .eg-guide-scrim,
  .eg-guide-ring,
  .eg-guide-card {
    transition: none !important;
  }
}

@media print {
  .eg-guide-fab,
  .eg-guide-scrim,
  .eg-guide-ring,
  .eg-guide-card,
  .hiw-tour-cta {
    display: none !important;
  }
}
