/* =================================================================
   TrueCraft — complimentary task offer (editorial dark theme)
   ================================================================= */

.offer-popup {
  --offer-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --offer-duration: 0.85s;
  --offer-backdrop-duration: 0.55s;
  --offer-bg: #070707;
  --offer-surface: #111111;
  --offer-surface-raised: #181818;
  --offer-ink: #f4f4f2;
  --offer-muted: rgba(255, 255, 255, 0.62);
  --offer-faint: rgba(255, 255, 255, 0.38);
  --offer-line: rgba(255, 255, 255, 0.08);
  --offer-line-strong: rgba(255, 255, 255, 0.14);
  --offer-accent: #e8622a;
  --offer-accent-bright: #ff6a00;
  --offer-font-display: "Funnel Display", Georgia, "Times New Roman", serif;
  --offer-font-body: "Geist", "Inter", system-ui, sans-serif;
  --offer-radius: clamp(22px, 4vw, 32px);
  --offer-radius-sm: 12px;
  --offer-radius-pill: 999px;

  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 clamp(10px, 2.5vw, 20px);
  background: rgba(7, 7, 7, 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(7, 7, 7, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  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, 1.05fr) minmax(0, 0.95fr);
  border-radius: var(--offer-radius) var(--offer-radius) 0 0;
  background: var(--offer-surface);
  border: 1px solid var(--offer-line-strong);
  border-bottom: none;
  box-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.06) inset,
    0 -24px 80px rgba(0, 0, 0, 0.55);
  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: 14px;
  right: 14px;
  z-index: 6;
  width: 38px;
  height: 38px;
  border: 1px solid var(--offer-line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--offer-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    color 0.25s var(--offer-ease),
    border-color 0.25s var(--offer-ease),
    background 0.25s var(--offer-ease),
    transform 0.25s var(--offer-ease);
}

.offer-popup__close:hover {
  color: var(--offer-ink);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

/* —— Promo panel —— */
.offer-popup__promo {
  position: relative;
  padding: clamp(28px, 4vw, 40px) clamp(24px, 3.5vw, 36px);
  color: var(--offer-ink);
  background-color: var(--offer-bg);
  background-image:
    radial-gradient(
      ellipse 90% 80% at 100% 0%,
      rgba(255, 94, 0, 0.42) 0%,
      rgba(232, 98, 42, 0.16) 40%,
      transparent 72%
    ),
    radial-gradient(
      ellipse 70% 60% at 0% 100%,
      rgba(110, 132, 168, 0.12) 0%,
      transparent 68%
    ),
    linear-gradient(165deg, #0e0e0e 0%, var(--offer-bg) 100%);
  border-right: 1px solid var(--offer-line);
  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: 0.4rem 0.75rem;
  border-radius: var(--offer-radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--offer-line-strong);
  font-family: var(--offer-font-display);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--offer-faint);
}

.offer-popup__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--offer-accent);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(232, 98, 42, 0.55);
}

.offer-popup__title {
  margin: 0;
  font-family: var(--offer-font-display);
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--offer-ink);
}

.offer-popup__title em {
  display: block;
  margin-top: 0.04em;
  font-family: var(--offer-font-display);
  font-style: italic;
  font-weight: 300;
  color: var(--offer-accent);
}

.offer-popup__lead {
  margin: 0;
  font-family: var(--offer-font-body);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--offer-muted);
  max-width: 38ch;
}

.offer-popup__lead strong {
  font-weight: 500;
  color: var(--offer-ink);
}

.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.5;
  color: var(--offer-muted);
}

.offer-popup__perks li::before {
  content: "✓";
  flex-shrink: 0;
  width: 1.375rem;
  height: 1.375rem;
  margin-top: 0.05em;
  border-radius: 999px;
  background: rgba(232, 98, 42, 0.12);
  border: 1px solid rgba(232, 98, 42, 0.28);
  display: grid;
  place-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  color: var(--offer-accent);
}

.offer-popup__fine {
  margin: auto 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--offer-line);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--offer-faint);
}

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

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

.offer-popup__form-head h3 {
  margin: 0 0 6px;
  font-family: var(--offer-font-display);
  font-size: 1.375rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--offer-ink);
}

.offer-popup__form-head p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--offer-muted);
  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: var(--offer-ink);
}

.offer-popup__field span em {
  font-weight: 400;
  color: var(--offer-faint);
  font-style: normal;
}

.offer-popup__field input,
.offer-popup__field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--offer-radius-sm);
  border: 1px solid var(--offer-line-strong);
  background: rgba(0, 0, 0, 0.28);
  color: var(--offer-ink);
  font: inherit;
  font-size: 0.9375rem;
  transition:
    border-color 0.25s var(--offer-ease),
    box-shadow 0.25s var(--offer-ease),
    background 0.25s var(--offer-ease);
}

.offer-popup__field input::placeholder,
.offer-popup__field textarea::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.offer-popup__field input:focus,
.offer-popup__field textarea:focus {
  outline: none;
  border-color: rgba(232, 98, 42, 0.45);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(232, 98, 42, 0.14);
}

.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: var(--offer-radius-pill);
  font-family: var(--offer-font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: var(--offer-accent);
  box-shadow: 0 8px 24px rgba(232, 98, 42, 0.28);
  transition:
    background 0.25s var(--offer-ease),
    transform 0.25s var(--offer-ease),
    box-shadow 0.25s var(--offer-ease),
    opacity 0.25s var(--offer-ease);
}

.offer-popup__submit:hover:not(:disabled) {
  background: var(--offer-accent-bright);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(232, 98, 42, 0.36);
}

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

.offer-popup__dismiss {
  background: none;
  border: none;
  padding: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--offer-faint);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  align-self: center;
  transition: color 0.25s var(--offer-ease);
}

.offer-popup__dismiss:hover {
  color: var(--offer-muted);
}

.offer-popup__legal {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: var(--offer-faint);
  line-height: 1.45;
}

.offer-popup__legal a {
  color: var(--offer-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.offer-popup__legal a:hover {
  color: var(--offer-ink);
}

/* —— 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(7, 7, 7, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  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: var(--offer-radius);
  border: 1px solid var(--offer-line-strong);
  background: var(--offer-surface-raised);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  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: 0.35rem 0.75rem;
  border-radius: var(--offer-radius-pill);
  font-family: var(--offer-font-display);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--offer-accent);
  background: rgba(232, 98, 42, 0.1);
  border: 1px solid rgba(232, 98, 42, 0.22);
}

.offer-popup__overlay-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--offer-accent);
}

.offer-popup__overlay-icon {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  margin: 4px 0 2px;
  background: var(--offer-accent);
  box-shadow: 0 8px 24px rgba(232, 98, 42, 0.32);
}

.offer-popup__overlay-title {
  margin: 0;
  font-family: var(--offer-font-display);
  font-size: clamp(1.375rem, 3vw, 1.625rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--offer-ink);
  line-height: 1.15;
}

.offer-popup__overlay-title em {
  font-family: var(--offer-font-display);
  font-style: italic;
  font-weight: 300;
  color: var(--offer-accent);
}

.offer-popup__overlay-lead {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--offer-muted);
  max-width: 34ch;
}

.offer-popup__overlay-lead strong {
  color: var(--offer-ink);
  font-weight: 500;
}

.offer-popup__overlay-note {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--offer-faint);
  max-width: 36ch;
}

.offer-popup__overlay-timer {
  margin: 6px 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--offer-faint);
}

.offer-popup__overlay-bar {
  width: min(240px, 75%);
  height: 3px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.offer-popup__overlay-bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--offer-accent), var(--offer-accent-bright));
  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;
  border-radius: var(--offer-radius) var(--offer-radius) 0 0;
}

.offer-popup.offer-popup--mobile .offer-popup__promo {
  padding: 18px 16px 14px;
  flex-shrink: 0;
  border-right: none;
  border-bottom: 1px solid var(--offer-line);
  gap: 10px;
}

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

.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 {
    padding: 0;
  }

  .offer-popup__dialog {
    grid-template-columns: 1fr;
    max-height: min(90dvh, 90svh);
    border-radius: var(--offer-radius) var(--offer-radius) 0 0;
  }

  .offer-popup__promo {
    border-right: none;
    border-bottom: 1px solid var(--offer-line);
  }
}

@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);
  }
}
