/* Registration popover ("Open account").
   Opening, closing, validation hints and the confirmation are declarative (popover API + CSS),
   so they also work where scripts are blocked; register-form.js adds inline messages
   and a personalised confirmation on top (html.reg-js). */

/* links without a destination are inactive */
a:not([href]) {
  cursor: default;
}

/* "Open account" buttons: the <a> keeps the site's look, a transparent button on top opens the form */
.reg-trigger-host {
  position: relative;
}
.reg-trigger {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: transparent;
  font: inherit;
  cursor: pointer;
  appearance: none;
}
.reg-trigger:focus-visible {
  outline: 2px solid #080707;
  outline-offset: 2px;
}

/* popover cards */
.reg-modal {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 48px;
  overflow-y: auto;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #080707;
  box-shadow: 0 24px 64px rgba(8, 7, 7, 0.18);
}
.reg-modal::backdrop {
  background: rgba(8, 7, 7, 0.55);
}
.reg-modal:popover-open {
  animation: reg-slide-in 0.3s ease;
}
html:has(.reg-modal:popover-open) {
  overflow: hidden;
}

.reg-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: #080707;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.reg-modal__close:hover,
.reg-modal__close:focus-visible {
  background-color: #F9F6F8;
  outline: none;
}

.reg-modal__title {
  margin: 0 0 16px;
  padding-right: 32px;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #080707;
}
.reg-modal__title .hightlight {
  color: #969394;
}
.reg-modal__lead {
  margin: 0 0 32px;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: #2C2A2B;
}

/* form */
.reg-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.reg-field {
  margin-bottom: 20px;
}
.reg-modal .reg-field label {
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: #2C2A2B;
}
.reg-modal .reg-field input {
  display: block;
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid #D9D6D7;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.3;
  color: #080707;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.reg-modal .reg-field input::placeholder {
  color: #ADAAAB;
}
.reg-modal .reg-field input:hover {
  border-color: #969394;
}
.reg-modal .reg-field input:focus {
  outline: none;
  border-color: #080707;
  box-shadow: inset 0 0 0 1px #080707;
}
.reg-modal .reg-field input[aria-invalid="true"],
html:not(.reg-js) .reg-modal .reg-field input:user-invalid {
  border-color: #E20016;
  box-shadow: inset 0 0 0 1px #E20016;
}
.reg-field__error,
.reg-field__hint {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #E20016;
}
.reg-field__error:empty {
  display: none;
}
/* without JS: static hints under fields the user got wrong */
.reg-field__hint {
  display: none;
}
html:not(.reg-js) .reg-field input:user-invalid ~ .reg-field__hint {
  display: block;
}

.reg-modal .reg-form__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  margin: 12px 0 0;
  padding: 0 24px;
  border: 2px solid #F47323;
  border-radius: 100px;
  background: #F47323;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: #080707;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.reg-modal .reg-form__submit:hover,
.reg-modal .reg-form__submit:focus-visible {
  background: #F9BC86;
  border-color: #F9BC86;
  outline: none;
}
/* without JS the button only becomes active once every field is valid */
html:not(.reg-js) .reg-form:invalid .reg-form__submit {
  opacity: 0.45;
  pointer-events: none;
}
.reg-form__note {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  color: #969394;
}

/* confirmation replaces the form card (the form's backdrop hides with it, the confirmation's dims the page) */
#register:has(~ #register-success:popover-open) {
  visibility: hidden;
}
.reg-modal--success {
  text-align: center;
}
.reg-modal--success .reg-modal__title {
  padding-right: 0;
}
.reg-success__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
  border-radius: 100px;
  background: #F47323;
  color: #080707;
}
.reg-success__name:has([data-reg-name]:empty),
.reg-success__email:has([data-reg-email]:empty) {
  display: none;
}
.reg-modal .reg-modal__done {
  display: inline-flex;
  width: auto;
  min-width: 160px;
  margin: 0 auto;
  background: #080707;
  border-color: #080707;
  color: #fff;
}
.reg-modal .reg-modal__done:hover,
.reg-modal .reg-modal__done:focus-visible {
  background: #2C2A2B;
  border-color: #2C2A2B;
}

@media (max-width: 639px) {
  .reg-modal {
    padding: 40px 20px 24px;
  }
  .reg-modal__title {
    font-size: 30px;
  }
  .reg-form__row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@keyframes reg-slide-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .reg-modal:popover-open {
    animation: none;
  }
}

/* phone: +1 fixed in front of the number */
.reg-phone {
  position: relative;
}
.reg-phone__code {
  position: absolute;
  top: 50%;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  line-height: 1;
  color: #080707;
  transform: translateY(-50%);
  pointer-events: none;
}
.reg-phone__code::after {
  content: "";
  width: 1px;
  height: 22px;
  background: #D9D6D7;
}
.reg-modal .reg-field .reg-phone input {
  padding-left: 58px;
}
/* the hint no longer sits right after the input, so it is found through the field */
html:not(.reg-js) .reg-modal .reg-field:has(input:user-invalid) .reg-field__hint {
  display: block;
}
