/*
 * Grunnstil for innloggingen og «opprett konto» (HK.Plugin.Custom.AuthFlow). Temaet tilpasser med
 * variablene under, f.eks. .hk-auth { --hk-auth-accent: #1fb5f9; }. Variablene står under :where() (null
 * spesifisitet), så temaets regler vinner selv om denne fila lastes sist.
 */
:where(.hk-auth) {
  --hk-auth-max-width: 1100px;
  --hk-auth-text: #1a1a1a;
  --hk-auth-muted: rgba(0, 0, 0, 0.6);
  --hk-auth-border: rgba(0, 0, 0, 0.2);
  --hk-auth-surface: rgba(0, 0, 0, 0.04);
  --hk-auth-accent: #1a1a1a;
  --hk-auth-accent-text: #fff;
  --hk-auth-error: #c0392b;
  --hk-auth-success: #1e7e34;
  --hk-auth-font: inherit;
  --hk-auth-heading-font: inherit;
  --hk-auth-radius: 6px;
  --hk-auth-input-height: 48px;
}

.hk-auth {
  color: var(--hk-auth-text);
  font-family: var(--hk-auth-font);
  text-align: left;
}

/* Temaer som setter display på svg/p overstyrer ellers hidden-attributtet. */
.hk-auth [hidden] {
  display: none !important;
}

.hk-auth *,
.hk-auth *::before,
.hk-auth *::after {
  box-sizing: border-box;
}

/* Skall: skjema til venstre, fordeler til høyre. Stables på mobil. */
.hk-auth__shell {
  display: grid;
  gap: 2rem;
  max-width: var(--hk-auth-max-width);
  margin: 2.5rem auto;
  padding: 0 16px;
  text-align: left;
}

.hk-auth__shell:not(.has-benefits) {
  max-width: 520px;
}

@media (min-width: 1001px) {
  .hk-auth__shell.has-benefits {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 4rem;
  }
}

.hk-auth__main {
  min-width: 0;
  max-width: 560px;
}

/* Fremdrift 1 → 2 → 3 */
.hk-auth__progress {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.hk-auth__step {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--hk-auth-muted);
  font-size: 0.9rem;
}

.hk-auth__step:not(:last-child)::after {
  content: "";
  width: 20px;
  height: 1px;
  margin-left: 0.5rem;
  background: var(--hk-auth-border);
}

.hk-auth__step.is-active {
  color: var(--hk-auth-text);
}

.hk-auth__step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hk-auth-surface);
  font-size: 0.85rem;
  font-weight: 700;
}

.hk-auth__step.is-active .hk-auth__step-num,
.hk-auth__step.is-done .hk-auth__step-num {
  background: var(--hk-auth-accent);
  color: var(--hk-auth-accent-text);
}

@media (max-width: 480px) {
  .hk-auth__step-label {
    display: none;
  }
}

.hk-auth__title {
  margin: 0 0 0.5rem;
  font-family: var(--hk-auth-heading-font);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
}

.hk-auth__subtitle {
  margin: 0 0 1.5rem;
  color: var(--hk-auth-muted);
  line-height: 1.5;
}

.hk-auth__subtitle strong {
  color: var(--hk-auth-text);
}

.hk-auth__link {
  color: inherit;
  font-weight: 500;
  text-decoration: underline;
}

.hk-auth__error:empty,
.hk-auth .validation-summary-valid {
  display: none;
}

.hk-auth__error {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--hk-auth-radius);
  background: color-mix(in srgb, var(--hk-auth-error) 8%, transparent);
  color: var(--hk-auth-error);
  font-size: 0.9rem;
}

.hk-auth__error ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hk-auth__success {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: var(--hk-auth-radius);
  background: color-mix(in srgb, var(--hk-auth-success) 10%, transparent);
  color: var(--hk-auth-success);
}

/* Skjema */
.hk-auth__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hk-auth__field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Dobbel klasse: mange temaer har flytende etiketter på «form label» / «div label». */
.hk-auth .hk-auth__field label {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  margin: 0;
  pointer-events: auto;
  font-size: 0.9rem;
  font-weight: 500;
  height: auto;
  line-height: 1.3;
}

/* Dobbel klasse: slår temaregler som «form input[type=email]». */
.hk-auth .hk-auth__field input {
  width: 100%;
  height: var(--hk-auth-input-height);
  margin: 0;
  padding: 0 1rem;
  border: 1px solid var(--hk-auth-border);
  border-radius: var(--hk-auth-radius);
  background: #fff;
  color: var(--hk-auth-text);
  font: inherit;
}

.hk-auth .hk-auth__field input:focus {
  border-color: var(--hk-auth-accent);
  outline: 2px solid color-mix(in srgb, var(--hk-auth-accent) 25%, transparent);
  outline-offset: 0;
}

.hk-auth .hk-auth__field--password input {
  padding-right: 3rem;
}

.hk-auth__field .field-validation-error {
  color: var(--hk-auth-error);
  font-size: 0.85rem;
}

.hk-auth__pw-toggle {
  position: absolute;
  right: 0.5rem;
  bottom: calc((var(--hk-auth-input-height) - 36px) / 2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hk-auth-muted);
  cursor: pointer;
}

.hk-auth__field--password:has(.field-validation-error:not(:empty)) .hk-auth__pw-toggle {
  bottom: auto;
  top: calc(1.35rem + 0.35rem + (var(--hk-auth-input-height) - 36px) / 2);
}

.hk-auth__row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.hk-auth .hk-auth__checkbox {
  position: static;
  pointer-events: auto;
}

.hk-auth__checkbox {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  cursor: pointer;
}

.hk-auth__checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--hk-auth-accent);
}

.hk-auth__button {
  display: block;
  width: 100%;
  min-height: var(--hk-auth-input-height);
  margin: 0.5rem 0 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--hk-auth-accent);
  border-radius: var(--hk-auth-radius);
  background: var(--hk-auth-accent);
  color: var(--hk-auth-accent-text);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.hk-auth__button:hover {
  filter: brightness(0.95);
}

.hk-auth__button:disabled {
  opacity: 0.6;
  cursor: default;
}

.hk-auth__button--secondary {
  margin-top: 0.75rem;
  background: transparent;
  color: var(--hk-auth-text);
  border-color: var(--hk-auth-border);
}

/* Passordregler */
.hk-auth__rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--hk-auth-muted);
  font-size: 0.85rem;
}

.hk-auth__rule::before {
  content: "○";
  margin-right: 0.35rem;
}

.hk-auth__rule.is-met {
  color: var(--hk-auth-success);
}

.hk-auth__rule.is-met::before {
  content: "✓";
}

/* Fordeler */
.hk-auth__benefits-heading {
  margin: 0 0 1.25rem;
  color: var(--hk-auth-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.hk-auth__benefits-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hk-auth__benefit {
  display: flex;
  gap: 0.8rem;
}

.hk-auth__benefit-icon {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  height: 36px;
  border-radius: var(--hk-auth-radius);
  background: var(--hk-auth-surface);
  color: var(--hk-auth-accent);
}

.hk-auth__benefit-title {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
}

.hk-auth__benefit-text {
  margin: 0;
  color: var(--hk-auth-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* «Opprett konto» på takkesiden */
.hk-auth-guest {
  max-width: 560px;
  margin: 2rem auto;
  padding: 1.5rem;
  border: 1px solid var(--hk-auth-border);
  border-radius: var(--hk-auth-radius);
  text-align: left;
}

.hk-auth-guest__title {
  margin: 0 0 0.5rem;
  font-family: var(--hk-auth-heading-font);
  font-size: 1.3rem;
  font-weight: 700;
  text-align: left;
}

.hk-auth-guest__text {
  margin: 0 0 1rem;
  color: var(--hk-auth-muted);
  line-height: 1.5;
}
