/* =================================================================
   TrueCraft — complimentary task offer (Enterprise Carbon bottom sheet)
   ================================================================= */

.offer-popup {
  --offer-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --offer-duration: 0.85s;
  --offer-backdrop-duration: 0.55s;

  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(22, 22, 22, 0);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  opacity: 1;
  visibility: hidden;
  pointer-events: none;
  transition:
    background var(--offer-backdrop-duration) ease,
    backdrop-filter var(--offer-backdrop-duration) ease,
    -webkit-backdrop-filter var(--offer-backdrop-duration) ease,
    visibility 0s linear var(--offer-duration);
}

.offer-popup.is-open {
  visibility: visible;
  pointer-events: auto;
  background: rgba(22, 22, 22, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition:
    background var(--offer-backdrop-duration) ease,
    backdrop-filter var(--offer-backdrop-duration) ease,
    -webkit-backdrop-filter var(--offer-backdrop-duration) ease,
    visibility 0s;
}

.offer-popup__dialog {
  position: relative;
  isolation: isolate;
  width: min(920px, 100%);
  max-height: min(92vh, 720px);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-radius: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-bottom: none;
  box-shadow: 0 -8px 40px rgba(22, 22, 22, 0.12);
  transform: translateY(100%);
  transition: transform var(--offer-duration) var(--offer-ease);
  will-change: transform;
}

.offer-popup.is-open .offer-popup__dialog {
  transform: translateY(0);
}

.offer-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  width: 40px;
  height: 40px;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  background: #fff;
  color: #525252;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.offer-popup__close:hover {
  color: #161616;
  border-color: #0f62fe;
  background: #f4f4f4;
}

/* —— Promo panel —— */
.offer-popup__promo {
  position: relative;
  padding: clamp(28px, 4vw, 40px) clamp(24px, 3.5vw, 36px);
  color: #161616;
  background: #f2f4f8;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  overflow: auto;
}

.offer-popup__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #525252;
}

.offer-popup__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0f62fe;
  flex-shrink: 0;
}

.offer-popup__title {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: clamp(1.75rem, 3.8vw, 2.25rem);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #0f62fe;
}

.offer-popup__title em {
  font-style: normal;
  font-weight: 300;
  color: #0f62fe;
}

.offer-popup__lead {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #393939;
  max-width: 38ch;
}

.offer-popup__lead strong {
  font-weight: 600;
  color: #161616;
}

.offer-popup__perks {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.offer-popup__perks li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #525252;
}

.offer-popup__perks li::before {
  content: "✓";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 0.05em;
  border-radius: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  display: grid;
  place-items: center;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  color: #0f62fe;
}

.offer-popup__fine {
  margin: auto 0 0;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
  font-size: 0.75rem;
  color: #6f6f6f;
}

/* —— Form panel —— */
.offer-popup__form-wrap {
  padding: clamp(24px, 3.5vw, 36px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.offer-popup__form-head {
  margin-bottom: 18px;
  padding-right: 36px;
}

.offer-popup__form-head h3 {
  margin: 0 0 6px;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 1.375rem;
  font-weight: 400;
  color: #161616;
  letter-spacing: -0.01em;
}

.offer-popup__form-head p {
  margin: 0;
  font-size: 0.875rem;
  color: #525252;
  line-height: 1.55;
  max-width: 40ch;
}

.offer-popup__form {
  display: grid;
  gap: 14px;
}

.offer-popup__field span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #161616;
}

.offer-popup__field span em {
  font-weight: 400;
  color: #6f6f6f;
  font-style: normal;
}

.offer-popup__field input,
.offer-popup__field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 0;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #161616;
  font: inherit;
  font-size: 0.9375rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.offer-popup__field input::placeholder,
.offer-popup__field textarea::placeholder {
  color: #a8a8a8;
}

.offer-popup__field input:focus,
.offer-popup__field textarea:focus {
  outline: none;
  border-color: #0f62fe;
  box-shadow: inset 0 0 0 1px #0f62fe;
}

.offer-popup__field textarea {
  resize: vertical;
  min-height: 88px;
}

.offer-popup__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.offer-popup__submit {
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border: none;
  border-radius: 0;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  color: #fff;
  cursor: pointer;
  background: #0f62fe;
  box-shadow: none;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;
}

.offer-popup__submit:hover:not(:disabled) {
  background: #0043ce;
}

.offer-popup__submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.offer-popup__dismiss {
  background: none;
  border: none;
  padding: 6px;
  font-size: 0.8125rem;
  font-weight: 400;
  color: #525252;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-align: center;
  align-self: center;
}

.offer-popup__dismiss:hover {
  color: #0f62fe;
}

.offer-popup__legal {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: #6f6f6f;
  line-height: 1.45;
}

.offer-popup__legal a {
  color: #0f62fe;
  text-decoration: none;
}

.offer-popup__legal a:hover {
  text-decoration: underline;
}

/* —— Success overlay —— */
.offer-popup__overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 36px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0.4s;
}

.offer-popup__overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.offer-popup__overlay-inner {
  width: min(100%, 400px);
  padding: clamp(28px, 4vw, 36px) clamp(24px, 3vw, 32px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-radius: 0;
  border: 1px solid #e0e0e0;
  background: #fff;
  box-shadow: 0 12px 32px rgba(22, 22, 22, 0.08);
  animation: offerOverlayIn 0.5s var(--offer-ease) both;
}

@keyframes offerOverlayIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.offer-popup__overlay-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f62fe;
  background: rgba(15, 98, 254, 0.08);
  border: 1px solid rgba(15, 98, 254, 0.2);
}

.offer-popup__overlay-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0f62fe;
}

.offer-popup__overlay-icon {
  width: 48px;
  height: 48px;
  border-radius: 0;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  margin: 4px 0 2px;
  background: #0f62fe;
}

.offer-popup__overlay-title {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: #161616;
  line-height: 1.2;
}

.offer-popup__overlay-title em {
  font-style: normal;
  color: #0f62fe;
}

.offer-popup__overlay-lead {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #525252;
  max-width: 34ch;
}

.offer-popup__overlay-lead strong {
  color: #161616;
  font-weight: 600;
}

.offer-popup__overlay-note {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #6f6f6f;
  max-width: 36ch;
}

.offer-popup__overlay-timer {
  margin: 6px 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6f6f6f;
}

.offer-popup__overlay-bar {
  width: min(240px, 75%);
  height: 3px;
  margin-top: 8px;
  background: #f4f4f4;
  overflow: hidden;
}

.offer-popup__overlay-bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: #0f62fe;
  transform-origin: left center;
  transform: scaleX(0);
}

@keyframes offerOverlayProgress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.offer-popup.is-shake .offer-popup__dialog {
  animation: offerShake 0.45s ease;
}

@keyframes offerShake {
  0%,
  100% {
    transform: translateY(0);
  }
  20%,
  60% {
    transform: translateY(0) translateX(-6px);
  }
  40%,
  80% {
    transform: translateY(0) translateX(6px);
  }
}

body.offer-popup-open {
  overflow: hidden;
}

/* —— Mobile compact layout —— */
.offer-popup.offer-popup--mobile .offer-popup__dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  max-height: min(92dvh, 92svh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.offer-popup.offer-popup--mobile .offer-popup__promo {
  padding: 16px 16px 12px;
  flex-shrink: 0;
  border-right: none;
  border-bottom: 1px solid #e0e0e0;
  gap: 10px;
}

.offer-popup.offer-popup--mobile .offer-popup__title {
  font-size: 1.25rem;
}

.offer-popup.offer-popup--mobile .offer-popup__lead {
  font-size: 0.8125rem;
}

.offer-popup.offer-popup--mobile .offer-popup__perks {
  display: none;
}

.offer-popup.offer-popup--mobile .offer-popup__fine {
  margin-top: 4px;
  padding-top: 10px;
  font-size: 0.6875rem;
}

.offer-popup.offer-popup--mobile .offer-popup__form-wrap {
  padding: 16px;
}

.offer-popup.offer-popup--mobile .offer-popup__form-head {
  margin-bottom: 12px;
  padding-right: 28px;
}

.offer-popup.offer-popup--mobile .offer-popup__form-head h3 {
  font-size: 1.125rem;
}

.offer-popup.offer-popup--mobile .offer-popup__form {
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
  row-gap: 10px;
}

.offer-popup.offer-popup--mobile .offer-popup__field:nth-of-type(3),
.offer-popup.offer-popup--mobile .offer-popup__field:nth-of-type(4),
.offer-popup.offer-popup--mobile .offer-popup__actions,
.offer-popup.offer-popup--mobile .offer-popup__legal {
  grid-column: 1 / -1;
}

.offer-popup.offer-popup--mobile .offer-popup__field textarea {
  min-height: 72px;
}

@media (max-width: 900px) {
  .offer-popup__dialog {
    grid-template-columns: 1fr;
    max-height: min(90dvh, 90svh);
  }

  .offer-popup__promo {
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .offer-popup,
  .offer-popup__dialog,
  .offer-popup__overlay-inner {
    animation: none !important;
    transition: none !important;
  }

  .offer-popup.is-open .offer-popup__dialog {
    transform: translateY(0);
  }
}
