/* ---------- Min konto's login form and "Glemt adgangskode" (body.spireli-login, Checkout\Side::iLogin) ----------
   The yellow table, all seven sorts as a bouquet, and Woo's own form on a crooked slip of paper in front of it.
   Every plate (the slip, the fields, the button) is a small SVG with four corners that never quite meet at 90
   degrees, drawn on a pseudo-element, so Woo's markup stays Woo's. login.js lets a sprout grow from a field's top
   edge per character and marks the form .sp-klar when its fields are filled. */

body.spireli-login {
  --kort-top: clamp(150px, calc(50svh - 268px), 320px);
  --bundt: clamp(430px, 47vw, 600px);
  /* Where the stems meet, behind the slip. */
  --rod: calc(var(--kort-top) + .563 * var(--bundt));
  position: relative;
  min-height: 100svh;
  background: var(--sp-bord);
}

/* Gul is invisible on the table: links outside the slip are painted Lys. */
body.spireli-login > :is(.sp-top, .sp-bund) a:not(.sp-logo) {
  background-image: linear-gradient(var(--sp-lys), var(--sp-lys));
}

body.spireli-login .sp-top {
  position: relative;
  z-index: 2;
  width: auto;
  margin: 0;
}

/* The wordmark is Blad, too light on the table: Skov here. */
body.spireli-login .sp-logo img {
  filter: brightness(0) saturate(100%) invert(25%) sepia(17%) saturate(1180%) hue-rotate(75deg);
}

body.spireli-login main.sp-konto {
  position: relative;
  width: auto;
  margin: 0;
  padding: var(--kort-top) 16px 110px;
}

body.spireli-login .sp-buket {
  position: absolute;
  inset: -80px 0 0; /* from the top of the page: .sp-top is 80 px */
  overflow: clip;
  pointer-events: none;
}

body.spireli-login .sp-buket img {
  position: absolute;
  top: calc(80px + var(--rod) - .9 * var(--bundt));
  left: calc(50% - .08 * var(--bundt));
  width: var(--bundt);
  max-width: none;
  height: auto;
  transform: rotate(calc(var(--v) - 43deg));
  transform-origin: 8% 90%;
  filter: drop-shadow(0 10px 12px rgb(80 60 0 / .2));
}

@media (prefers-reduced-motion: no-preference) {
  body.spireli-login .sp-buket img {
    animation: sp-fold 1.1s var(--sp-ease-enter) backwards;
  }
}

@keyframes sp-fold {
  from {
    transform: rotate(-43deg) scale(.6);
  }
}

/* ---------- The slip ---------- */

body.spireli-login .sp-login-kort {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: min(504px, 100%);
  min-height: calc(.563 * var(--bundt) + 110px); /* a short slip ("Mailen er sendt") still hides the stems */
  margin: 0 auto;
  padding: 40px 42px 42px;
}

body.spireli-login .sp-login-kort::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: -1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M2.5 1.6C30 1.2 70 2.4 98.2 1.2C98.9 34 97.6 68 98.6 98.2C70 98.9 34 97.6 1.3 98.6C1.1 66 2.9 34 2.5 1.6Z' fill='%23FBFCF1' stroke='%232C4A2E' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  transform: rotate(-1.1deg);
  filter: drop-shadow(0 22px 26px rgb(80 60 0 / .2));
}

body.spireli-login .sp-login-kort .sp-titel {
  height: auto;
  margin: 0;
  padding: 0;
  font-size: 48px;
  line-height: 1;
  text-wrap: balance;
}

body.spireli-login.spireli-konto main.sp-konto > .sp-login-kort > .woocommerce {
  max-width: none;
  padding: 0;
}

/* "Min konto" over it says enough; Woo's "Log ind" stays for screen readers. */
body.spireli-login .woocommerce > h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

body.spireli-login .sp-login-kort .woocommerce :is(.woocommerce-error, .woocommerce-message, .woocommerce-info) {
  margin: 20px 0 18px;
  outline: none; /* Woo focuses it so it is read out */
}

body.spireli-login .sp-login-kort .woocommerce-error li {
  margin: 0;
  padding: 0;
  border: 0;
}

body.spireli-login .sp-login-kort form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 20px;
  margin: 0;
  padding: 0;
  border: 0;
}

body.spireli-login .sp-login-kort form > * {
  grid-column: 1 / -1;
}

body.spireli-login .sp-login-kort form > p:not(.form-row, .lost_password) {
  margin: 18px 0 0;
}

body.spireli-login .sp-login-kort form > .clear {
  display: none;
}

/* ---------- The fields ---------- */

body.spireli-login .sp-login-kort .form-row:has(input.input-text) {
  position: relative;
  isolation: isolate;
  float: none;
  width: auto;
  min-height: 74px;
  margin: 46px 0 0;
  padding: 0;
}

body.spireli-login .sp-login-kort .form-row:has(input.input-text)::before {
  content: "";
  position: absolute;
  inset: -4px -4px auto;
  z-index: -1;
  display: block;
  height: 82px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M1.5 12C26 7 62 14 98.6 6C99.1 38 98.4 70 98.9 90C70 95 32 90 1 95C.9 66 1.8 38 1.5 12Z' fill='%23F4F6E6' stroke='%232C4A2E' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}

@media (hover: hover) {
  body.spireli-login .sp-login-kort .form-row:has(input.input-text):hover::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M1.5 12C26 7 62 14 98.6 6C99.1 38 98.4 70 98.9 90C70 95 32 90 1 95C.9 66 1.8 38 1.5 12Z' fill='%23fff' stroke='%232C4A2E' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  }
}

body.spireli-login .sp-login-kort .form-row:has(input.input-text:focus)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M1.5 12C26 7 62 14 98.6 6C99.1 38 98.4 70 98.9 90C70 95 32 90 1 95C.9 66 1.8 38 1.5 12Z' fill='%23fff' stroke='%232C4A2E' stroke-width='3' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}

/* The second field is cut the other way. */
body.spireli-login .sp-login-kort .form-row:has(input.input-text) + .form-row::before {
  transform: scaleX(-1);
}

body.spireli-login .sp-login-kort .form-row:has(input.input-text) label {
  position: absolute;
  top: 12px;
  left: 20px;
  z-index: 1;
  margin: 0;
  color: var(--sp-skov);
  font: 500 15px/1.2 var(--sp-sans);
  pointer-events: none;
}

body.spireli-login .sp-login-kort .form-row .required {
  display: none;
}

body.spireli-login .sp-login-kort .form-row input.input-text {
  display: block;
  width: 100%;
  height: 74px;
  margin: 0;
  padding: 28px 20px 4px;
  border: 0;
  background: none;
  box-shadow: none;
  font: 400 20px/1.3 var(--sp-sans);
  outline: 2px solid transparent; /* shown in forced colours */
  outline-offset: -2px;
}

body.spireli-login .sp-login-kort .form-row input[type="password"],
body.spireli-login .sp-login-kort .form-row .password-input input {
  padding-right: 64px;
}

/* Saved passwords: no blue box over the paper. The animation tells login.js that the browser filled the field. */
body.spireli-login .sp-login-kort .form-row input.input-text:autofill {
  -webkit-text-fill-color: var(--sp-skov);
  transition: background-color 99999s;
  animation: sp-udfyldt 1ms;
}

@keyframes sp-udfyldt {
  from {
    outline-color: transparent;
  }
}

body.spireli-login .sp-login-kort .password-input {
  position: static;
  display: block;
}

body.spireli-login .sp-login-kort .show-password-input {
  position: absolute;
  top: 15px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

body.spireli-login .sp-login-kort .show-password-input::before {
  content: none;
}

body.spireli-login .sp-login-kort .show-password-input::after {
  content: "";
  width: 26px;
  height: 26px;
  background: var(--sp-skov);
  -webkit-mask: var(--oeje) center / contain no-repeat;
  mask: var(--oeje) center / contain no-repeat;
  --oeje: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Cpath d='M2 13s3.9-7.5 11-7.5S24 13 24 13s-3.9 7.5-11 7.5S2 13 2 13Z'/%3E%3Ccircle cx='13' cy='13' r='3.2'/%3E%3C/svg%3E");
}

body.spireli-login .sp-login-kort .show-password-input.display-password::after {
  --oeje: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Cpath d='M2 13s3.9-7.5 11-7.5S24 13 24 13s-3.9 7.5-11 7.5S2 13 2 13Z'/%3E%3Ccircle cx='13' cy='13' r='3.2'/%3E%3Cpath d='M4.5 22.5l17-19'/%3E%3C/svg%3E");
}

/* A new password's strength, under its field. */
body.spireli-login .sp-login-kort :is(.woocommerce-password-strength, .woocommerce-password-hint) {
  display: block;
  margin: 10px 0 0;
  padding: 0;
  background: none;
  color: var(--sp-skov);
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
}

/* The sprouts (login.js) stand behind the field's top edge. */
body.spireli-login .sp-skud {
  position: absolute;
  inset: 0 0 auto;
  z-index: -2;
  display: block;
  height: 8px;
  isolation: isolate;
  pointer-events: none;
}

body.spireli-login .sp-skud img {
  position: absolute;
  bottom: -6px;
  width: auto;
  max-width: none;
  height: var(--h);
  margin: 0 0 0 calc(var(--o) * var(--h) * -1);
  transform: rotate(var(--r)) scale(0);
  transform-origin: calc(var(--o) * var(--h)) 100%;
}

body.spireli-login .sp-skud img.sp-op {
  transform: rotate(var(--r));
}

@media (prefers-reduced-motion: no-preference) {
  body.spireli-login .sp-skud img {
    transition: transform .16s ease-in;
  }

  body.spireli-login .sp-skud img.sp-op {
    transition: transform .7s var(--sp-ease-enter);
  }
}

/* ---------- "Har du glemt din adgangskode?", "Husk mig" and the button ---------- */

/* Woo keeps "Husk mig" and the button in one paragraph, and the link after it. */
body.spireli-login .sp-login-kort .woocommerce-form-login > .form-row:has(.woocommerce-form-login__submit) {
  display: contents;
}

body.spireli-login .sp-login-kort .form-row:has(button[type="submit"])::before,
body.spireli-login .sp-login-kort .form-row:has(button[type="submit"])::after {
  content: none;
}

body.spireli-login .sp-login-kort .lost_password {
  grid-column: 1;
  order: 1;
  align-self: center;
  margin: 16px 0 20px;
  font-size: 16px;
}

/* The product page's step badge (Trinmaerke "active"): -7 degrees, 16/54 round, its three shadows, 320 ms. */
body.spireli-login.spireli-konto .sp-login-kort .woocommerce-form-login__rememberme {
  grid-column: 2;
  order: 2;
  display: flex;
  flex-direction: row-reverse;
  gap: 14px;
  align-items: center;
  min-height: 48px;
  margin: 16px 0 20px;
  padding-right: 4px;
  color: var(--sp-skov);
  font: 400 17px/1.4 var(--sp-sans);
  white-space: nowrap;
}

body.spireli-login.spireli-konto .sp-login-kort .woocommerce-form__input-checkbox {
  position: relative;
  flex: none;
  box-sizing: border-box;
  width: 34px;
  height: 34px;
  margin: 0;
  border: 1.5px solid var(--sp-skov);
  border-radius: 10px 9px 11px 8px;
  background: var(--sp-creme);
  appearance: none;
  transform: rotate(-4deg);
}

body.spireli-login .sp-login-kort .woocommerce-form__input-checkbox::after {
  content: "";
  position: absolute;
  inset: 4.5px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4.5 10.5l3.8 3.8L15.5 6.5' fill='none' stroke='%23FBFCF1' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  clip-path: inset(0 100% 0 0);
}

body.spireli-login .sp-login-kort .woocommerce-form__input-checkbox:checked {
  background: var(--sp-skov);
  transform: rotate(-7deg);
}

body.spireli-login .sp-login-kort .woocommerce-form__input-checkbox:checked::after {
  clip-path: inset(0);
}

body.spireli-login .sp-login-kort .woocommerce-form__input-checkbox:focus {
  outline: none;
}

body.spireli-login .sp-login-kort .woocommerce-form__input-checkbox:focus-visible {
  outline: 3px solid var(--sp-skov);
  outline-offset: 4px;
}

@media (hover: hover) {
  body.spireli-login.spireli-konto .sp-login-kort .woocommerce-form-login__rememberme:hover .woocommerce-form__input-checkbox {
    transform: translateY(-4px) rotate(-7deg) scale(1.22);
    box-shadow: 0 2px 4px rgb(44 74 46 / .14), 0 10px 20px -6px rgb(44 74 46 / .32), 0 24px 40px -18px rgb(44 74 46 / .38);
  }

  body.spireli-login .sp-login-kort .woocommerce-form-login__rememberme:hover .woocommerce-form__input-checkbox:not(:checked) {
    background: #fff;
  }
}

body.spireli-login.spireli-konto .sp-login-kort .woocommerce-form-login__rememberme:active .woocommerce-form__input-checkbox {
  transform: translateY(-1px) rotate(-7deg) scale(1.08);
}

/* A line until the fields are filled, then painted from the left. #order_review is only there to outweigh
   konto.css' buttons, whose list has it too. */
body.spireli-login :is(#order_review, .sp-login-kort) form button[type="submit"]:not(.sp-fl *) {
  position: relative;
  isolation: isolate;
  grid-column: 1 / -1;
  order: 3;
  display: flex;
  justify-content: center;
  float: none;
  width: 100%;
  min-height: 64px;
  margin: 0;
  border: 0;
  background: none;
  color: var(--sp-skov);
  font-size: 20px;
}

body.spireli-login .sp-login-kort .lost_reset_password .form-row:has(button[type="submit"]) {
  float: none;
  width: auto;
  margin: 24px 0 0;
  padding: 0;
}

body.spireli-login :is(#order_review, .sp-login-kort) form button[type="submit"]::before,
body.spireli-login :is(#order_review, .sp-login-kort) form button[type="submit"]::after {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: -1;
  display: block;
  width: auto;
  height: auto;
  margin: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M1.4 10C34 5 66 11 98.8 6C98.3 38 99 68 98.6 92C64 96 34 91 1.1 95C1.7 64 .9 38 1.4 10Z' fill='none' stroke='%232C4A2E' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}

body.spireli-login :is(#order_review, .sp-login-kort) form button[type="submit"]::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M1.4 10C34 5 66 11 98.8 6C98.3 38 99 68 98.6 92C64 96 34 91 1.1 95C1.7 64 .9 38 1.4 10Z' fill='%232C4A2E' stroke='%232C4A2E' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  clip-path: inset(0 100% 0 0);
}

body.spireli-login :is(#order_review, .sp-login-kort) form button[type="submit"]:not(.sp-fl *):is(:hover, :focus-visible) {
  background: none;
}

body.spireli-login :is(#order_review, .sp-login-kort) form.sp-klar button[type="submit"]:enabled:not(.sp-fl *) {
  color: var(--sp-lys);
}

body.spireli-login :is(#order_review, .sp-login-kort) form.sp-klar button[type="submit"]:enabled::after {
  clip-path: inset(0);
}

body.spireli-login :is(#order_review, .sp-login-kort) form.sp-klar button[type="submit"]:enabled:not(.sp-fl *):is(:hover, :focus-visible) {
  color: var(--sp-skov);
}

body.spireli-login :is(#order_review, .sp-login-kort) form.sp-klar button[type="submit"]:enabled:is(:hover, :focus-visible)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M1.4 10C34 5 66 11 98.8 6C98.3 38 99 68 98.6 92C64 96 34 91 1.1 95C1.7 64 .9 38 1.4 10Z' fill='%23FFC200' stroke='%23FFC200' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}

body.spireli-login .sp-login-kort button[type="submit"]:focus-visible {
  outline: 3px solid var(--sp-skov);
  outline-offset: 5px;
}

@media (prefers-reduced-motion: no-preference) {
  body.spireli-login .sp-login-kort .woocommerce-form__input-checkbox {
    transition: transform .32s var(--sp-ease-enter), background-color .32s var(--sp-ease-enter), box-shadow .32s var(--sp-ease-enter);
  }

  body.spireli-login .sp-login-kort .woocommerce-form__input-checkbox::after {
    transition: clip-path .34s var(--sp-ease-enter) .1s;
  }

  body.spireli-login :is(#order_review, .sp-login-kort) form button[type="submit"]:not(.sp-fl *) {
    transition: color .2s;
  }

  body.spireli-login :is(#order_review, .sp-login-kort) form button[type="submit"]::after {
    transition: clip-path .5s var(--sp-ease-enter);
  }
}

/* ---------- The texts on the table, beside the slip ---------- */

body.spireli-login .sp-bund {
  position: absolute;
  inset: auto 64px 44px;
  display: grid;
  --side: calc(50vw - 252px - 64px - 40px); /* what is left beside the slip */
  grid-template-columns: min(350px, var(--side)) min(290px, var(--side));
  justify-content: space-between;
  align-items: end;
  gap: 6px 40px;
  width: auto;
  margin: 0;
  padding: 0;
  font-size: 17px;
  pointer-events: none;
}

body.spireli-login .sp-bund > * {
  grid-column: 2;
  text-wrap: pretty;
}

body.spireli-login .sp-bund p:first-child {
  padding: 0;
  border: 0;
}

body.spireli-login .sp-bund a {
  pointer-events: auto;
}

body.spireli-login .sp-bund .sp-signatur {
  color: var(--sp-skov);
}

body.spireli-login .sp-bund .sp-login-tekst {
  grid-row: 1 / span 3;
  grid-column: 1;
  font: 600 23px/1.25 var(--sp-head);
  letter-spacing: -.015em;
}

/* Too narrow for texts beside the slip: they come under it. */
@media (max-width: 1260px) {
  body.spireli-login main.sp-konto {
    padding-bottom: 40px;
  }

  body.spireli-login .sp-bund {
    position: static;
    grid-template-columns: minmax(0, 1fr);
    box-sizing: border-box;
    width: min(504px, 100%);
    margin: 0 auto;
    padding: 0 20px 56px;
  }

  body.spireli-login .sp-bund > *,
  body.spireli-login .sp-bund .sp-login-tekst {
    grid-row: auto;
    grid-column: 1;
  }

  body.spireli-login .sp-bund .sp-login-tekst {
    margin-bottom: 12px;
  }
}

@media (max-width: 900px) {
  body.spireli-login {
    --kort-top: 132px;
    --bundt: clamp(240px, 70vw, 340px);
    --rod: calc(var(--kort-top) + 150px);
  }
}

@media (max-width: 520px) {
  body.spireli-login .sp-login-kort {
    padding: 34px 24px 32px;
  }

  body.spireli-login .sp-login-kort .sp-titel {
    font-size: 40px;
  }

  /* One line each: "Husk mig" to the right, the link under the button. */
  body.spireli-login.spireli-konto .sp-login-kort .woocommerce-form-login__rememberme {
    grid-column: 1 / -1;
    justify-self: end;
  }

  body.spireli-login .sp-login-kort .lost_password {
    grid-column: 1 / -1;
    order: 4;
    margin: 22px 0 0;
  }
}
