/* ============================================
   Diwali Offer Popup  (desktop + mobile)
   ============================================ */

.dw-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(20, 38, 64, 0.86), rgba(4, 10, 20, 0.94));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.dw-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ---------- Card ---------- */
.dw-card {
  /* Width follows the viewport HEIGHT as well, so the whole 2:3 poster
     plus the button bar always fits on screen (no cropping). */
  --dw-reserve: 164px;          /* button bar + gaps */
  position: relative;
  width: min(440px, 100%, calc((100vh - var(--dw-reserve)) * 0.6667));
  width: min(440px, 100%, calc((100dvh - var(--dw-reserve)) * 0.6667));
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: #0b1a2e;
  border: 1.5px solid #d99a3f;
  box-shadow:
    0 0 0 6px rgba(217, 154, 63, 0.12),
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 90px rgba(217, 154, 63, 0.25);
  overflow: hidden;
  transform: translateY(40px) scale(0.92);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.18, 1.1, 0.3, 1), opacity 0.45s ease;
}

.dw-overlay.is-open .dw-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ---------- Poster ---------- */
.dw-poster {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #0b1a2e;
}

.dw-poster img {
  display: block;
  width: 100%;
  height: auto;
}

/* soft glow sweep over the poster */
.dw-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 220, 150, 0.18) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: dw-shine 4.5s ease-in-out 1.2s infinite;
  pointer-events: none;
}

@keyframes dw-shine {
  0%   { transform: translateX(-120%); }
  45%, 100% { transform: translateX(120%); }
}

/* ---------- Action bar ---------- */
.dw-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(180deg, #0f2240, #0b1a2e);
  border-top: 1px solid rgba(217, 154, 63, 0.35);
}

.dw-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.dw-btn:hover,
.dw-btn:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.dw-btn-call {
  background: linear-gradient(135deg, #f2b95a, #d99a3f);
  color: #1b1204;
  box-shadow: 0 6px 18px rgba(217, 154, 63, 0.4);
}

.dw-btn-wa {
  background: #1d9d47;
  color: #fff;
  box-shadow: 0 6px 18px rgba(29, 157, 71, 0.35);
}

.dw-btn-visit {
  grid-column: 1 / -1;
  min-height: 42px;
  background: transparent;
  color: #f2c777;
  border: 1px solid rgba(242, 199, 119, 0.55);
}

.dw-btn:focus-visible,
.dw-close:focus-visible,
.dw-pill:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ---------- Close ---------- */
.dw-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(8, 16, 30, 0.7);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease;
}

.dw-close:hover {
  background: #d99a3f;
  color: #1b1204;
  transform: rotate(90deg);
}

/* ---------- Floating sparkles ---------- */
.dw-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.dw-sparkles i {
  position: absolute;
  bottom: -10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffd98a;
  box-shadow: 0 0 10px 3px rgba(255, 200, 100, 0.8);
  opacity: 0;
  animation: dw-rise 6s linear infinite;
}

.dw-sparkles i:nth-child(1) { left: 8%;  animation-delay: 0s;   }
.dw-sparkles i:nth-child(2) { left: 22%; animation-delay: 1.4s; animation-duration: 7s; }
.dw-sparkles i:nth-child(3) { left: 40%; animation-delay: 3s;   }
.dw-sparkles i:nth-child(4) { left: 58%; animation-delay: 0.8s; animation-duration: 8s; }
.dw-sparkles i:nth-child(5) { left: 74%; animation-delay: 2.2s; }
.dw-sparkles i:nth-child(6) { left: 90%; animation-delay: 4s;   animation-duration: 7s; }

@keyframes dw-rise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  15%  { opacity: 0.9; }
  100% { transform: translateY(-460px) scale(1.1); opacity: 0; }
}

/* ---------- Re-open pill ---------- */
.dw-pill {
  position: fixed;
  left: 16px;
  bottom: 20px;
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid #d99a3f;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f2240, #0b1a2e);
  color: #f2c777;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(217, 154, 63, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
  animation: dw-pulse 2.6s ease-out infinite;
}

.dw-pill.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@keyframes dw-pulse {
  0%   { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(217, 154, 63, 0.55); }
  70%  { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 14px rgba(217, 154, 63, 0); }
  100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(217, 154, 63, 0); }
}

body.dw-lock {
  overflow: hidden;
}

/* ---------- Desktop: roomier ---------- */
@media (min-width: 992px) {
  .dw-card { width: min(470px, 100%, calc((100vh - var(--dw-reserve)) * 0.6667)); }
}

/* ---------- Small phones ---------- */
@media (max-width: 480px) {
  .dw-overlay { padding: 12px; }
  .dw-card { border-radius: 18px; }
  .dw-actions { padding: 12px; gap: 8px; }
  .dw-btn { font-size: 0.88rem; min-height: 44px; }
  .dw-pill { left: 12px; bottom: 16px; padding: 10px 15px; font-size: 0.85rem; }
}

/* ---------- Short portrait screens: drop the 3rd button to save height ---------- */
@media (max-height: 640px) and (orientation: portrait) {
  .dw-card { --dw-reserve: 108px; }
  .dw-btn-visit { display: none; }
}

/* ---------- Landscape phones: poster left, buttons right ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .dw-overlay { padding: 10px; }
  .dw-card {
    --dw-reserve: 0px;
    flex-direction: row;
    width: auto;
    max-width: 100%;
    height: calc(100vh - 20px);
    height: calc(100dvh - 20px);
    border-radius: 16px;
  }
  .dw-poster { flex: 0 0 auto; height: 100%; }
  .dw-poster img { width: auto; height: 100%; }
  .dw-actions {
    grid-template-columns: 1fr;
    align-content: center;
    width: clamp(170px, 26vw, 230px);
    padding: 14px;
    border-top: 0;
    border-left: 1px solid rgba(217, 154, 63, 0.35);
  }
  .dw-btn-visit { display: flex; grid-column: auto; }
  .dw-close { top: 8px; right: 8px; width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .dw-card, .dw-overlay, .dw-pill { transition: opacity 0.2s ease; }
  .dw-poster::after, .dw-sparkles i, .dw-pill { animation: none; }
  .dw-sparkles { display: none; }
}
