/* DigiShoe — exit-intent discount offer.
   Desktop: centred modal. Mobile: bottom sheet that slides up. */

/* The theme's base styles set display on generic divs, which beats the plain
   [hidden] UA rule — force it, or the banner flashes on every page load. */
.ds-exit[hidden] { display: none !important; }

.ds-exit {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ds-exit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 22, .68);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .3s ease;
}

.ds-exit.is-open .ds-exit-overlay { opacity: 1; }

/* ===== Panel ===== */

.ds-exit-panel {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 34px 26px 22px;
  text-align: center;
  /* Short viewports (landscape phones) must scroll the panel rather than push
     the CTA off-screen. overflow-x stays hidden so the confetti can't widen it. */
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 50% 0%, #eaf9ff 0%, rgba(255, 255, 255, 0) 60%),
    #fff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .34), 0 0 0 1px rgba(0, 0, 0, .05);
  transform: translateY(24px) scale(.94);
  opacity: 0;
  transition: transform .42s cubic-bezier(.2, .9, .28, 1.25), opacity .3s ease;
}

.ds-exit.is-open .ds-exit-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Coloured arc behind the gift, gives the panel a "ticket" feel. */
.ds-exit-panel::before {
  content: '';
  position: absolute;
  top: -120px;
  left: 50%;
  width: 320px;
  height: 220px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 100%, rgba(0, 180, 216, .28), transparent 70%);
  pointer-events: none;
}

.ds-exit-grip { display: none; }

.ds-exit-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 0;
  background: rgba(255, 255, 255, .7);
  font-size: 24px;
  line-height: 1;
  color: #7c8698;
  cursor: pointer;
  border-radius: 50%;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.ds-exit-close:hover { background: #eef1f6; color: #1b2233; transform: rotate(90deg); }

/* ===== Confetti burst ===== */

.ds-exit-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ds-exit-burst i {
  position: absolute;
  top: -12px;
  left: calc(var(--n) * 9.5%);
  width: 7px;
  height: 11px;
  border-radius: 2px;
  opacity: 0;
  background: #00b4d8;
}

.ds-exit-burst i:nth-child(3n)   { background: #ffb703; }
.ds-exit-burst i:nth-child(3n+1) { background: #0aa06e; }
.ds-exit-burst i:nth-child(4n)   { background: #ef476f; width: 6px; height: 6px; border-radius: 50%; }

.ds-exit.is-open .ds-exit-burst i {
  animation: dsFall 2.6s linear infinite;
  animation-delay: calc(var(--n) * .22s);
}

@keyframes dsFall {
  0%   { transform: translateY(0) rotate(0deg);     opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(420px) rotate(520deg); opacity: 0; }
}

/* ===== Header ===== */

.ds-exit-top {
  position: relative;
  z-index: 2;
  margin-bottom: 12px;
}

.ds-exit-gift {
  font-size: 46px;
  line-height: 1;
  margin-bottom: 10px;
}

.ds-exit.is-open .ds-exit-gift { animation: dsGift 2.2s ease-in-out .35s infinite; }

@keyframes dsGift {
  0%, 100%  { transform: translateY(0) rotate(0deg); }
  15%       { transform: translateY(-9px) rotate(-9deg); }
  30%       { transform: translateY(0) rotate(9deg); }
  45%       { transform: translateY(-4px) rotate(-4deg); }
  60%       { transform: translateY(0) rotate(0deg); }
}

.ds-exit-badge {
  display: inline-block;
  padding: 5px 15px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff1d0, #ffdf9e);
  color: #8a5600;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .2px;
}

.ds-exit.is-open .ds-exit-badge { animation: dsBadge 2.4s ease-in-out infinite; }

@keyframes dsBadge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 183, 3, .55); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 183, 3, 0); }
}

.ds-exit-title {
  position: relative;
  z-index: 2;
  margin: 0 0 14px;
  font-size: 21px;
  line-height: 1.4;
  font-weight: 700;
  color: #101828;
}

/* ===== Discount hero ===== */

.ds-exit-amount {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  box-shadow: 0 12px 26px rgba(0, 119, 182, .32);
}

.ds-exit.is-open .ds-exit-amount { animation: dsPop .55s cubic-bezier(.2, .9, .3, 1.5) .12s both; }

@keyframes dsPop {
  0%   { transform: scale(.5); opacity: 0; }
  70%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.ds-exit-amount-value {
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.ds-exit-amount-label {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 255, 255, .92);
}

.ds-exit-text {
  position: relative;
  z-index: 2;
  margin: 0 0 16px;
  font-size: 14.5px;
  line-height: 1.7;
  color: #4a5568;
}

/* ===== Countdown ===== */

.ds-exit-timer {
  position: relative;
  z-index: 2;
  margin-bottom: 18px;
}

.ds-exit-timer-label {
  display: block;
  margin-bottom: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: #8a93a5;
}

.ds-exit-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.ds-exit-digit {
  min-width: 52px;
  padding: 8px 6px;
  border-radius: 11px;
  background: linear-gradient(180deg, #263043, #161d2b);
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35);
}

.ds-exit-digit.is-tick { animation: dsTick .45s ease; }

@keyframes dsTick {
  0%   { transform: translateY(-3px) scale(1.07); background: linear-gradient(180deg, #37455e, #202a3c); }
  100% { transform: translateY(0) scale(1); }
}

.ds-exit-colon {
  font-size: 23px;
  font-weight: 800;
  color: #263043;
  animation: dsBlink 1s steps(1) infinite;
}

@keyframes dsBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .25; } }

/* Last 30 seconds — turn the clock red and quicken the pulse. */
.ds-exit-timer.is-urgent .ds-exit-digit {
  background: linear-gradient(180deg, #e5484d, #b42318);
  animation: dsUrgent .9s ease-in-out infinite;
}

.ds-exit-timer.is-urgent .ds-exit-colon { color: #e5484d; }

@keyframes dsUrgent {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* ===== CTA ===== */

.ds-exit-cta {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 16px 20px;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(135deg, #00c2a8, #0aa06e);
  color: #fff;
  font-size: 16.5px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(10, 160, 110, .38);
  transition: transform .16s ease, box-shadow .16s ease;
}

.ds-exit.is-open .ds-exit-cta { animation: dsCta 2.3s ease-in-out .8s infinite; }

@keyframes dsCta {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

.ds-exit-cta:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 15px 32px rgba(10, 160, 110, .48);
  color: #fff;
  animation-play-state: paused;
}

.ds-exit-cta:active { transform: translateY(0) scale(.99); }

/* Light sweep across the button. */
.ds-exit-cta-shine {
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  transform: skewX(-22deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .42), transparent);
}

.ds-exit.is-open .ds-exit-cta-shine { animation: dsShine 2.6s ease-in-out 1.1s infinite; }

@keyframes dsShine {
  0%        { left: -60%; }
  55%, 100% { left: 130%; }
}

.ds-exit-cta-text { position: relative; z-index: 1; }

.ds-exit-cta-arrow {
  position: relative;
  z-index: 1;
  transition: transform .18s ease;
}

.ds-exit-cta:hover .ds-exit-cta-arrow { transform: translateX(5px); }

.ds-exit-dismiss {
  position: relative;
  z-index: 2;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: #97a0b0;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 8px;
}

.ds-exit-dismiss:hover { color: #4a5568; }

body.ds-exit-open { overflow: hidden; }

/* ===== Active-offer ribbon ===== */

.ds-fd-ribbon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 14px;
  background: linear-gradient(135deg, #0aa06e, #06784f);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  animation: dsRibbon .45s ease both;
}

@keyframes dsRibbon {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.ds-fd-ribbon-icon { font-size: 16px; }

.ds-fd-ribbon-timer {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.ds-fd-ribbon-timer:empty { display: none; }

/* ===== Mobile: bottom sheet ===== */

@media (max-width: 560px) {
  .ds-exit {
    align-items: flex-end;
    padding: 0;
  }

  .ds-exit-panel {
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    padding: 20px 18px 18px;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%) scale(1);
    transition: transform .4s cubic-bezier(.2, .85, .3, 1), opacity .25s ease;
  }

  .ds-exit.is-open .ds-exit-panel { transform: translateY(0); }

  /* Drag-handle affordance, so it reads as a sheet. */
  .ds-exit-grip {
    display: block;
    width: 42px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 99px;
    background: #d7dce5;
  }

  .ds-exit-close { top: 6px; right: 8px; background: transparent; }
  .ds-exit-gift { font-size: 40px; }
  .ds-exit-title { font-size: 18.5px; margin-bottom: 12px; }
  .ds-exit-amount { padding: 8px 18px; margin-bottom: 12px; }
  .ds-exit-amount-value { font-size: 33px; }
  .ds-exit-text { font-size: 13.5px; margin-bottom: 14px; }
  .ds-exit-digit { min-width: 46px; font-size: 22px; padding: 7px 5px; }
  .ds-exit-cta { padding: 15px 18px; font-size: 15.5px; }
  .ds-fd-ribbon { font-size: 12.5px; padding: 8px 10px; }
}

/* Short viewports (landscape phones) — keep everything reachable. */
@media (max-height: 620px) {
  .ds-exit-panel { padding: 16px 22px 14px; }
  .ds-exit-gift { font-size: 30px; margin-bottom: 4px; }
  .ds-exit-top { margin-bottom: 8px; }
  .ds-exit-title { font-size: 17px; margin-bottom: 10px; }
  .ds-exit-amount { padding: 6px 16px; margin-bottom: 10px; }
  .ds-exit-amount-value { font-size: 26px; }
  .ds-exit-text { display: none; }
  .ds-exit-timer { margin-bottom: 12px; }
  .ds-exit-timer-label { margin-bottom: 4px; }
  .ds-exit-digit { font-size: 20px; padding: 6px 5px; min-width: 44px; }
  .ds-exit-cta { padding: 13px 18px; }
  .ds-exit-dismiss { margin-top: 8px; }
}

/* ===== Reduced motion ===== */

@media (prefers-reduced-motion: reduce) {
  .ds-exit-panel,
  .ds-exit-overlay { transition-duration: .01ms; }

  .ds-exit.is-open .ds-exit-burst i,
  .ds-exit.is-open .ds-exit-gift,
  .ds-exit.is-open .ds-exit-badge,
  .ds-exit.is-open .ds-exit-amount,
  .ds-exit.is-open .ds-exit-cta,
  .ds-exit.is-open .ds-exit-cta-shine,
  .ds-exit-colon,
  .ds-exit-digit.is-tick,
  .ds-exit-timer.is-urgent .ds-exit-digit,
  .ds-fd-ribbon {
    animation: none !important;
  }

  .ds-exit-burst { display: none; }
}

/* ===== Discount countdown in the order summary =====
   Lives in the discount row's label. Only ever rendered while a claim is live,
   and this stylesheet only loads while the exit offer is enabled, so it can
   safely sit here rather than in main.css. */
.so-disc-timer {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(10, 160, 110, .12);
  color: #0aa06e;
  font-size: 12px;
  font-weight: 700;
  /* Same width per digit, or the row jiggles on every tick. */
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  vertical-align: middle;
}

.so-disc-timer.is-urgent {
  background: rgba(220, 38, 38, .12);
  color: #dc2626;
  animation: so-disc-pulse 1s ease-in-out infinite;
}

@keyframes so-disc-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.09); }
}

@media (prefers-reduced-motion: reduce) {
  .so-disc-timer.is-urgent { animation: none !important; }
}

/* Countdown on the confirm button — same clock, where the eyes already are. */
.so-btn-timer {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  vertical-align: middle;
}

.so-btn-timer.is-urgent {
  background: rgba(255, 255, 255, .92);
  color: #dc2626;
  animation: so-disc-pulse 1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .so-btn-timer.is-urgent { animation: none !important; }
}
