@keyframes popup-layer-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes popup-modal-rise-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popup-step-slide-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes popup-word-slide-in {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateX(-14px) translateY(18px) skewY(4deg);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) skewY(0);
  }
}

@keyframes popup-word-slide-in-alt {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateX(14px) translateY(18px) skewY(-4deg);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateX(0) translateY(0) skewY(0);
  }
}

@keyframes popup-label-sweep {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popup-choice-pop-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.popup-layer {
  --popup-ink: #0f172a;
  --popup-muted: #5f6f89;
  --popup-line: #d7e5f8;
  --popup-paper: #fafdff;
  --popup-blue: #2563eb;
  --popup-blue-dark: #1e40af;
  --popup-shadow: 0 24px 90px rgba(15, 23, 42, .24);

  position: fixed;
  inset: 0;
  z-index: 80;
  color: var(--popup-ink);
  font-family: "Lato",sans-serif;
  pointer-events: none;
}

.popup-layer,
.popup-layer *,
.popup-layer *::before,
.popup-layer *::after {
  box-sizing: border-box;
}

.popup-layer .popup-state {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.popup-layer .popup-shell {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}

.popup-layer #sleep-popup-toggle:checked ~ .popup-shell,
.popup-layer #sleep-step-email:checked ~ .popup-shell, 
.popup-layer #sleep-step-phone:checked ~ .popup-shell, 
.popup-layer #sleep-step-thanks:checked ~ .popup-shell {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: popup-layer-fade-in .24s ease both;
}

.popup-layer .popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .58);
  cursor: pointer;
}

.popup-layer .popup-modal {
  position: relative;
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-columns: minmax(260px, .85fr) minmax(320px, 1fr);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 8px;
  background: var(--popup-paper);
  box-shadow: var(--popup-shadow);
  transform-origin: center;
}

.popup-layer #sleep-popup-toggle:checked ~ .popup-shell .popup-modal,
.popup-layer #sleep-step-email:checked ~ .popup-shell .popup-modal,
.popup-layer #sleep-step-phone:checked ~ .popup-shell .popup-modal,
.popup-layer #sleep-step-thanks:checked ~ .popup-shell .popup-modal {
  animation: popup-modal-rise-in .34s cubic-bezier(.18, .86, .32, 1.08) both;
}

.popup-layer .guide-panel {
  position: relative;
  background: #738cdb;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  overflow: hidden;
}

.popup-layer .guide-panel > div {
  min-height: 540px;
  padding: 28px;
  display: grid;
  justify-content: center;
  align-content: center;
  gap: 28px;
  color: #ffffff;
  position: relative;
  z-index: 1;
}

.popup-layer .guide-panel:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background: url(./../images/np-img-4.webp) top left no-repeat;
    background-size: cover;
    z-index: 0;
    opacity: 0.8;
}

.popup-layer .brand {
  display: inline-grid;
  grid-template-columns: auto;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 900;
}

.popup-layer .brand img {
  width: 100%;
  max-width: 160px;
  margin: 0 auto;
}

.popup-layer .ep-offer-img {
  max-width: 250px;
  margin: 0 auto;
  width: 100%;
}

.popup-layer .panel-note {
  margin: 0;
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
  line-height: 1.45;
  text-wrap: balance;
  text-align: center;
}

.popup-layer .popup-content {
  position: relative;
  padding: 60px 34px 34px;
  display: grid;
  align-content: center;
}

.popup-layer .close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--popup-line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: var(--popup-ink);
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease;
}

.popup-layer .close-button:hover,
.popup-layer .close-button:focus-visible {
  border-color: var(--popup-blue);
  transform: rotate(90deg);
}

.popup-layer .step-label {
  margin: 0 0 12px;
  color: var(--popup-blue);
  font-size: 13px;
  font-weight: 900;
  animation: popup-label-sweep .28s ease both;
}

.popup-layer .step h2 {
  max-width: 430px;
  margin: 0;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.02;
  letter-spacing: 0;
  font-weight: 900;
}

.popup-layer .step p {
  max-width: 410px;
  margin: 14px 0 0;
  color: var(--popup-muted);
  font-size: 18px;
  line-height: 1.55;
}

.popup-layer .word-reveal {
  display: flex;
  flex-wrap: wrap;
  gap: .14em .28em;
}

.popup-layer .word-reveal span {
  --popup-word-animation: popup-word-slide-in;
  --popup-word-delay: 0s;

  display: inline-block;
  opacity: 0;
  transform-origin: left bottom;
}

.popup-layer .word-reveal span:nth-child(even) {
  --popup-word-animation: popup-word-slide-in-alt;
}

.popup-layer .word-reveal span:nth-child(1) {
  --popup-word-delay: .04s;
}

.popup-layer .word-reveal span:nth-child(2) {
  --popup-word-delay: .08s;
}

.popup-layer .word-reveal span:nth-child(3) {
  --popup-word-delay: .12s;
}

.popup-layer .word-reveal span:nth-child(4) {
  --popup-word-delay: .16s;
}

.popup-layer .word-reveal span:nth-child(5) {
  --popup-word-delay: .2s;
}

.popup-layer .word-reveal span:nth-child(6) {
  --popup-word-delay: .24s;
}

.popup-layer .word-reveal span:nth-child(7) {
  --popup-word-delay: .28s;
}

.popup-layer .word-reveal span:nth-child(8) {
  --popup-word-delay: .32s;
}

.popup-layer .word-reveal span:nth-child(9) {
  --popup-word-delay: .36s;
}

.popup-layer .word-reveal span:nth-child(10) {
  --popup-word-delay: .4s;
}

.popup-layer .word-reveal span:nth-child(11) {
  --popup-word-delay: .44s;
}

.popup-layer .word-reveal span:nth-child(12) {
  --popup-word-delay: .48s;
}

.popup-layer .word-reveal span:nth-child(13) {
  --popup-word-delay: .52s;
}

.popup-layer .word-reveal span:nth-child(14) {
  --popup-word-delay: .56s;
}

.popup-layer .word-reveal span:nth-child(15) {
  --popup-word-delay: .6s;
}

.popup-layer .word-reveal span:nth-child(16) {
  --popup-word-delay: .64s;
}

.popup-layer .word-reveal span:nth-child(17) {
  --popup-word-delay: .68s;
}

.popup-layer .word-reveal span:nth-child(18) {
  --popup-word-delay: .72s;
}

.popup-layer .word-reveal span:nth-child(19) {
  --popup-word-delay: .76s;
}

.popup-layer #sleep-popup-toggle:checked ~ .popup-shell .step-quiz .word-reveal span,
.popup-layer #sleep-step-email:checked ~ .popup-shell .step-email .word-reveal span,
.popup-layer #sleep-step-phone:checked ~ .popup-shell .step-phone .word-reveal span,
.popup-layer #sleep-step-thanks:checked ~ .popup-shell .step-thanks .word-reveal span {
  animation: var(--popup-word-animation) .48s cubic-bezier(.18, .86, .32, 1.08) both;
  animation-delay: var(--popup-word-delay);
}

.word-reveal .blue {
  color: var(--popup-blue);
  text-shadow: 0 10px 24px rgba(37, 99, 235, .18);
}

.popup-layer .word-reveal-copy {
  gap: .08em .24em;
}

.popup-layer .choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.popup-layer .choice-grid label {
  min-height: 58px;
  border: 1px solid var(--popup-line);
  border-radius: 6px;
  padding: 12px 14px;
  display: grid;
  align-items: center;
  background: #ffffff;
  color: var(--popup-ink);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  animation: popup-choice-pop-in .32s ease both;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.popup-layer .choice-grid label:hover,
.popup-layer .choice-grid label:focus-visible {
  border-color: var(--popup-blue);
  outline: 2px solid rgba(37, 99, 235, .2);
  outline-offset: 2px;
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, .08);
}

.popup-layer .choice-grid label:nth-child(2) {
  animation-delay: .04s;
}

.popup-layer .choice-grid label:nth-child(3) {
  animation-delay: .08s;
}

.popup-layer .choice-grid label:nth-child(4) {
  animation-delay: .12s;
}

.popup-layer .optin-form {
  margin-top: 24px;
  display: grid;
  gap: 8px;
}

.popup-layer .optin-form label {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  padding-left: 5px;
}

.input-field {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--popup-line);
  border-radius: 6px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--popup-ink);
  font: inherit;
  font-size: 16px;
}

.input-field:focus {
  border-color: var(--popup-blue);
  outline: 3px solid rgba(37, 99, 235, .18);
}

.popup-layer .phone-field {
  display: grid;
  gap: 8px;
}

.popup-layer .optin-form .phone-input {
  margin-bottom: 0;
}

.popup-layer .phone-field .iti {
  width: 100%;
  --iti-border-color: var(--popup-line);
  --iti-dialcode-color: var(--popup-muted);
  --iti-dropdown-bg: #ffffff;
  --iti-hover-color: rgba(37, 99, 235, .08);
}

.popup-layer .phone-field .iti__tel-input {
  min-height: 54px;
  border-radius: 6px;
  padding-right: 14px;
}

.popup-layer .phone-field .iti__selected-country {
  border-radius: 6px 0 0 6px;
  padding-right: 12px;
  transition: background .18s ease;
  cursor: pointer;
  background: #f4f4f4;
}

.popup-layer .phone-field .iti__selected-country:hover,
.popup-layer .phone-field .iti__selected-country:focus-visible {
  background: rgba(37, 99, 235, .08);
}

.popup-layer .iti__selected-country-primary:hover, .popup-layer .iti__selected-country[aria-expanded=true] .iti__selected-country-primary { 
  background: none !important;
}

.popup-layer .phone-field .iti__selected-dial-code {
  color: var(--popup-ink);
  font-weight: 900;
  font-size: 16px;
}

.popup-layer .iti__search-input {
  font-size: 16px;
}

.popup-layer .phone-field .iti__arrow {
  border-top-color: var(--popup-muted);
}

.popup-layer .phone-field .iti__dropdown-content {
  border: 1px solid var(--popup-line);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
  overflow: hidden;
}

.popup-layer .phone-field .iti__country-list {
  max-height: 230px;
  background: #fff;
}

.popup-layer .phone-field .iti__country {
  min-height: 40px;
  font-size: 14px;
}

.popup-layer .phone-field .iti__country.iti__highlight {
  background: rgba(37, 99, 235, .08);
}

.popup-layer .phone-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  color: var(--popup-muted);
  font-size: 13px;
  line-height: 1.35;
}

.popup-layer .field-error {
  min-height: 18px;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 800;
}

.popup-layer .phone-field.is-invalid .phone-input {
  border-color: #dc2626;
  outline: 3px solid rgba(220, 38, 38, .14);
}

.ep-btn, .done-btn {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  background: linear-gradient(45deg, #28c96c, #17914e, #16894b);
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.ep-btn:hover, .done-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, .16);
}

.done-btn {
  margin-top: 20px;
}

.popup-layer .fine-print {
  margin: 12px 0 0;
  color: var(--popup-muted);
  font-size: 14px;
  line-height: 1.45;
  font-style: italic;
}

.popup-layer .step-email,
.popup-layer .step-phone,
.popup-layer .step-thanks {
  display: none;
}

.popup-layer #sleep-popup-toggle:checked ~ .popup-shell .step-quiz {
  animation: popup-step-slide-in .28s ease both;
}

.popup-layer #sleep-step-email:checked ~ .popup-shell .step-quiz,
.popup-layer #sleep-step-phone:checked ~ .popup-shell .step-quiz,
.popup-layer #sleep-step-thanks:checked ~ .popup-shell .step-quiz {
  display: none;
}


.popup-layer #sleep-step-email:checked ~ .popup-shell .step-email {
  display: block;
  animation: popup-step-slide-in .32s cubic-bezier(.2, .8, .2, 1) both;
}

.popup-layer #sleep-step-phone:checked ~ .popup-shell .step-phone {
  display: block;
  animation: popup-step-slide-in .32s cubic-bezier(.2, .8, .2, 1) both;
}

.popup-layer #sleep-step-thanks:checked ~ .popup-shell .step-thanks {
  display: block;
  animation: popup-step-slide-in .32s cubic-bezier(.2, .8, .2, 1) both;
}

@media (max-width: 760px) {
  .popup-layer .popup-shell {
    align-items: end;
    padding: 10px;
  }

  .popup-layer .popup-modal {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 20px);
  }

  .popup-layer .guide-panel {
    display: none;
  }

  .popup-layer .popup-content {
    padding: 60px 18px 20px;
  }

  .popup-layer .choice-grid {
    grid-template-columns: 1fr;
  }

}

@media (prefers-reduced-motion: reduce) {
  .popup-layer,
  .popup-layer *,
  .popup-layer *::before,
  .popup-layer *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

.popup-layer .discount-card {
  width: min(255px, 100%);
  aspect-ratio: 3.2 / 4;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 8px;
  box-shadow: 12px 14px 0 rgba(0, 0, 0, .18), 0 0 34px rgba(147, 197, 253, .28);
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(232, 244, 255, .96)),
    #ffffff;
  color: var(--popup-ink);
  text-align: center;
}

.popup-layer .discount-card-inner {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.popup-layer .discount-kicker {
  color: var(--popup-blue-dark);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.popup-layer .discount-value {
  color: var(--popup-blue);
  font-size: clamp(58px, 8vw, 78px);
  line-height: .9;
  font-weight: 900;
}

.popup-layer .discount-label {
  color: var(--popup-ink);
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.popup-layer .discount-note {
  max-width: 180px;
  color: var(--popup-muted);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 800;
}
