/* ==========================================================================
   Storage Station — offer-popup.css (index.html only)
   The offer window (components/OfferPopup.astro, js/offer-popup.js).
   Desktop: a white card, the offer on the right, a blue panel on the left with
   the gift sloth standing on the card's bottom edge and peeking over its top.
   Phone: a bottom sheet; the sloth peeks over the sheet, the head is a blue band.
   Built from base.css tokens. Above the floating call / WhatsApp / a11y buttons
   because a modal <dialog> lives in the top layer.
   ========================================================================== */

html.offer-open { overflow: hidden; }

.offer {
  width: min(900px, calc(100% - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  overflow: visible;
}
.offer::backdrop { background: rgba(3, 27, 51, 0.62); }
.offer[open] { animation: offer-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.15) both; }
.offer[open]::backdrop { animation: offer-fade 0.3s ease both; }
.offer.is-closing { animation: offer-out 0.2s ease both; }
.offer.is-closing::backdrop { animation: offer-fade 0.2s ease reverse both; }

@keyframes offer-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes offer-out {
  to { opacity: 0; transform: translateY(16px) scale(0.98); }
}
@keyframes offer-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes offer-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-1.2deg); }
}

.offer__card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;   /* RTL: offer on the right, panel on the left */
  min-height: 500px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: 0 28px 70px rgba(3, 27, 51, 0.35);
}
.offer__card:focus { outline: none; }    /* takes the first focus on open; Tab goes on to the close button */

.offer__art {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  background: var(--gradient-hero);
  border-start-end-radius: var(--radius-xl);
  border-end-end-radius: var(--radius-xl);
}
.offer__cubes {
  position: absolute;
  top: 26px;
  inset-inline-start: -46px;
  width: 210px;
  height: auto;
  opacity: 0.9;
}

.offer__sloth {
  position: absolute;
  z-index: 2;
  bottom: 0;
  inset-inline-end: -8px;
  width: 346px;
  height: auto;
  pointer-events: none;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 14px 18px rgba(3, 27, 51, 0.35));
  animation: offer-bob 4.2s ease-in-out 0.6s infinite;
}

.offer__close {
  position: absolute;
  z-index: 3;
  top: 16px;
  inset-inline-start: 16px;                /* = right in RTL; the sloth is on the left */
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-blue-dark);
  transition: background-color var(--transition);
}
.offer__close::before,
.offer__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 2.4px;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}
.offer__close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.offer__close:hover { background: var(--color-bg-tint); }
.offer__close:focus-visible,
.offer__submit:focus-visible { outline: 3px solid var(--color-main); outline-offset: 2px; }

.offer__scroll {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 58px 44px 30px;
}

.offer__eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 16px;
  border-radius: 999px;
  background: var(--color-blue-dark);
  font-size: 15px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
  color: var(--color-white);
}
.offer__title {
  font-size: clamp(30px, 3vw, 40px);
  font-weight: var(--fw-bold);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--color-blue-dark);
}
.offer__text {
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.35;
  color: var(--color-gray);
}

.offer__main { display: flex; flex-direction: column; gap: 18px; }

.offer__deals {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.offer-deal {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  gap: 6px;
  padding: 16px 12px 15px;
  border: 2px solid var(--color-secondary);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  text-align: center;
}
.offer-deal__tag {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--color-bg-tint);
  font-size: 14px;
  font-weight: var(--fw-medium);
  color: var(--color-blue-dark);
}
.offer-deal__big {
  font-size: 28px;
  font-weight: var(--fw-black);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-main);
}
.offer-deal__num { font-size: 1.35em; }
.offer-deal__text {
  font-size: 15px;
  line-height: 1.3;
  color: var(--color-dark);
}
.offer__or {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-blue-dark);
  font-size: 16px;
  font-weight: var(--fw-bold);
  color: var(--color-white);
}

.offer__form { display: flex; flex-direction: column; gap: 10px; }
.offer__label {
  font-size: 17px;
  font-weight: var(--fw-medium);
  color: var(--color-blue-dark);
}
.offer__row { display: flex; gap: 10px; }
.offer__phone {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 54px;
  padding-inline: 18px;
  font-size: 18px;
  text-align: right;                       /* typed left-to-right, placeholder lines up with Hebrew */
}
.offer__submit {
  flex: none;
  min-height: 54px;
  padding: 0 24px;
  border-radius: 10px;
  font-size: 19px;
}
.offer__submit:disabled { opacity: 0.6; cursor: progress; transform: none; }
.offer__consent { gap: 8px; font-size: 12.5px; line-height: 1.4; color: var(--color-gray); }
.offer__consent .consent__box { width: 20px; height: 20px; }
.offer__status { font-size: 15px; }

/* "או" between the callback form and WhatsApp */
.offer__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block: -4px;
  font-size: 14px;
  font-weight: var(--fw-medium);
  color: var(--color-gray);
}
.offer__divider::before,
.offer__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #D5E3EE;
}

/* WhatsApp: darker than the brand #25D366 so white text keeps 5:1 contrast */
.offer__wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 10px;
  background: #15803D;
  font-size: 18px;
  font-weight: var(--fw-medium);
  color: var(--color-white);
  transition: background-color var(--transition), transform var(--transition);
}
.offer__wa:hover { background: #116B33; transform: translateY(-1px); }
.offer__wa:focus-visible { outline: 3px solid var(--color-main); outline-offset: 2px; }
.offer__wa-icon {
  flex: none;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask: url("../assets/common/icon-whatsapp-glyph.svg") center / contain no-repeat;
          mask: url("../assets/common/icon-whatsapp-glyph.svg") center / contain no-repeat;
}

.offer__fine { margin-top: -8px; font-size: 13px; color: var(--color-gray); text-align: center; }   /* right under the two deals */

/* desktop: two more rows than the first version — keep the card inside short screens */
@media (min-width: 769px) {
  .offer__scroll { max-height: calc(100dvh - 32px); overflow-y: auto; padding-top: 54px; gap: 18px; }
  .offer__main { gap: 14px; }
}

/* --------------------------------------------------------------------------
   Phone: bottom sheet
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .offer {
    width: 100%;
    margin: auto 0 0;                      /* pinned to the bottom of the screen */
  }
  .offer[open] { animation: offer-up 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
  .offer.is-closing { animation: offer-down 0.22s ease both; }

  .offer__card {
    display: block;
    min-height: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .offer__art { display: none; }

  .offer__sloth {
    top: -92px;
    bottom: auto;
    inset-inline-end: 6px;                 /* = left in RTL */
    width: 144px;
  }

  .offer__close {
    top: -52px;                            /* outside the sheet, over the backdrop */
    inset-inline-start: 14px;
    width: 40px;
    height: 40px;
    background: var(--color-white);
    box-shadow: 0 4px 12px rgba(3, 27, 51, 0.3);
  }

  .offer__scroll {
    gap: 0;
    max-height: calc(100dvh - 96px);
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: inherit;
  }

  .offer__head {
    padding: 20px 20px 18px;
    padding-inline-end: 158px;             /* room for the sloth on the left */
    background: var(--gradient-hero);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .offer__eyebrow {
    margin-bottom: 8px;
    padding: 3px 12px;
    background: var(--color-white);
    font-size: 13px;
    color: var(--color-blue-dark);
  }
  .offer__title { font-size: 26px; color: var(--color-white); }
  .offer__text { margin-top: 6px; font-size: 15px; color: rgba(255, 255, 255, 0.88); }

  .offer__main {
    gap: 14px;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .offer__deals { gap: 6px; }
  .offer-deal { gap: 4px; padding: 11px 6px 10px; border-radius: var(--radius-md); }
  .offer-deal__tag { padding: 2px 9px; font-size: 12px; }
  .offer-deal__big { font-size: 21px; }
  .offer-deal__text { font-size: 13px; }
  .offer__or { width: 32px; height: 32px; font-size: 13px; }

  .offer__label { font-size: 15px; }
  .offer__row { gap: 8px; }
  .offer__phone { min-height: 50px; padding-inline: 14px; font-size: 17px; }
  .offer__submit { min-height: 50px; padding: 0 16px; font-size: 17px; }
  .offer__consent { font-size: 12px; }
  .offer__divider { font-size: 13px; }
  .offer__wa { min-height: 48px; font-size: 17px; }
  .offer__fine { font-size: 12px; }
}

/* short phones (iPhone SE and the like): the label repeats the placeholder and the button —
   hidden from the eye only, the screen reader still reads it as the field's name */
@media (max-width: 768px) and (max-height: 740px) {
  .offer__head { padding-block: 16px 14px; }
  .offer__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .offer__main { gap: 12px; }
}

@media (max-width: 359.98px) {
  .offer__row { flex-direction: column; }
  .offer__head { padding-inline-end: 128px; }
  .offer__sloth { width: 118px; top: -74px; }
}

@keyframes offer-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@keyframes offer-down {
  to { transform: translateY(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .offer[open],
  .offer[open]::backdrop,
  .offer.is-closing,
  .offer.is-closing::backdrop,
  .offer__sloth { animation: none; }
}
