/* AstraVortex auth/account credential pages.
   Deliberately scoped so commerce/product forms are untouched. */
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) {
  --av-auth-border: color-mix(in srgb, var(--lightgray) 80%, transparent);
  --av-auth-panel: color-mix(in srgb, var(--light) 94%, var(--dark) 6%);
  --av-auth-panel-strong: color-mix(in srgb, var(--light) 89%, var(--dark) 11%);
  --av-auth-soft: color-mix(in srgb, var(--secondary) 13%, transparent);
  --av-auth-muted: color-mix(in srgb, var(--darkgray) 74%, transparent);
}

/* Auth pages are utility screens: keep them focused and consistent with /account. */
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) #quartz-root.page > #quartz-body > .right.sidebar {
  display: none !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .content-meta {
  display: none !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .center > .page-header,
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .center > article,
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .center > .popover-hint,
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .center > .popover-hint > article {
  box-sizing: border-box !important;
  width: min(calc(100vw - 2rem), 620px) !important;
  max-width: 620px !important;
  margin-right: auto !important;
  margin-left: auto !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .center > .page-header {
  margin-top: clamp(1.6rem, 5vh, 3.2rem) !important;
  margin-bottom: 1rem !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .article-title {
  margin: 1rem 0 0 !important;
  font-size: clamp(2rem, 5vw, 2.5rem) !important;
  letter-spacing: -0.035em;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .center article {
  padding: 0 !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .markdown-preview-view {
  width: 100% !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card {
  box-sizing: border-box;
  display: grid;
  gap: 0.55rem;
  width: 100%;
  margin: 0 0 3rem !important;
  padding: clamp(1.25rem, 3vw, 1.65rem);
  border: 1px solid var(--av-auth-border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 4% 0%, var(--av-auth-soft), transparent 34%),
    var(--av-auth-panel);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.06);
}

/* The Quartz page title already says Sign in/Create account/etc. Avoid a doubled heading
   while a live form is displayed, but keep success-state headings visible. */
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card:has(input) > h2:first-child {
  display: none;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card > h2 {
  margin: 0 0 0.35rem !important;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card > p:not(.auth-error):not(.auth-footer):not(.auth-hint):not(.auth-privacy-note) {
  margin: 0 0 0.65rem !important;
  color: var(--darkgray);
  line-height: 1.55;
  opacity: 0.82;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card > label:not(.auth-consent) {
  margin-top: 0.45rem;
  color: var(--dark);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card input:is([type="email"], [type="password"], [type="text"]) {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 2.85rem;
  margin: 0 !important;
  padding: 0.7rem 0.8rem !important;
  border: 1px solid color-mix(in srgb, var(--lightgray) 92%, transparent) !important;
  border-radius: 10px !important;
  outline: none;
  background: color-mix(in srgb, var(--light) 91%, var(--dark) 9%) !important;
  color: var(--dark) !important;
  font: inherit;
  line-height: 1.25;
  box-shadow: none !important;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card input:is([type="email"], [type="password"], [type="text"]):focus {
  border-color: var(--secondary) !important;
  background: var(--light) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--secondary) 17%, transparent) !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card button[type="submit"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.85rem;
  margin-top: 0.65rem;
  padding: 0.72rem 1rem;
  border: 1px solid color-mix(in srgb, var(--secondary) 72%, transparent);
  border-radius: 10px;
  background: var(--secondary);
  color: var(--light);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease, opacity 140ms ease;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) form.auth-card button[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-hint,
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-privacy-note {
  margin: 0.1rem 0 0 !important;
  color: var(--darkgray);
  font-size: 0.8rem;
  line-height: 1.45;
  opacity: 0.72;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-consent {
  box-sizing: border-box;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  gap: 0.65rem !important;
  align-items: start !important;
  margin: 0.75rem 0 0 !important;
  padding: 0.85rem;
  border: 1px solid var(--av-auth-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--secondary) 6%, transparent);
  color: var(--darkgray);
  font-size: 0.8rem !important;
  line-height: 1.45 !important;
  font-weight: 400 !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-consent input[type="checkbox"] {
  position: static !important;
  width: 1rem !important;
  height: 1rem !important;
  min-height: 0 !important;
  margin: 0.16rem 0 0 !important;
  padding: 0 !important;
  accent-color: var(--secondary);
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-error:not([hidden]) {
  display: block;
  box-sizing: border-box;
  margin: 0.45rem 0 0 !important;
  padding: 0.75rem 0.85rem;
  border: 1px solid color-mix(in srgb, #e05252 48%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, #e05252 10%, transparent);
  color: color-mix(in srgb, #e05252 82%, var(--dark) 18%);
  font-size: 0.82rem;
  line-height: 1.45;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-footer {
  margin: 0.25rem 0 0 !important;
  text-align: center;
  color: var(--darkgray);
  font-size: 0.82rem;
  line-height: 1.4;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-footer + .auth-footer {
  margin-top: -0.05rem !important;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-footer a,
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-consent a,
:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) .auth-privacy-note a {
  font-weight: 700;
  text-decoration: none;
}

:is(
  body[data-slug="login"],
  body[data-slug="register"],
  body[data-slug="forgot-password"],
  body[data-slug="reset-password"],
  body[data-slug="account/change-password"],
  body[data-slug="account/forgot-password"],
  body[data-slug="account/reset-password"],
  body[data-slug="account/set-new-password"]
) [id$="-turnstile"]:not([hidden]) {
  display: block;
  width: 100%;
  margin-top: 0.55rem;
  overflow: hidden;
  border-radius: 10px;
}

@media (max-width: 600px) {
  :is(
    body[data-slug="login"],
    body[data-slug="register"],
    body[data-slug="forgot-password"],
    body[data-slug="reset-password"],
    body[data-slug="account/change-password"],
    body[data-slug="account/forgot-password"],
    body[data-slug="account/reset-password"],
    body[data-slug="account/set-new-password"]
  ) .center > .page-header,
  :is(
    body[data-slug="login"],
    body[data-slug="register"],
    body[data-slug="forgot-password"],
    body[data-slug="reset-password"],
    body[data-slug="account/change-password"],
    body[data-slug="account/forgot-password"],
    body[data-slug="account/reset-password"],
    body[data-slug="account/set-new-password"]
  ) .center > article,
  :is(
    body[data-slug="login"],
    body[data-slug="register"],
    body[data-slug="forgot-password"],
    body[data-slug="reset-password"],
    body[data-slug="account/change-password"],
    body[data-slug="account/forgot-password"],
    body[data-slug="account/reset-password"],
    body[data-slug="account/set-new-password"]
  ) .center > .popover-hint {
    width: min(calc(100vw - 1.25rem), 620px) !important;
  }

  :is(
    body[data-slug="login"],
    body[data-slug="register"],
    body[data-slug="forgot-password"],
    body[data-slug="reset-password"],
    body[data-slug="account/change-password"],
    body[data-slug="account/forgot-password"],
    body[data-slug="account/reset-password"],
    body[data-slug="account/set-new-password"]
  ) form.auth-card {
    padding: 1.05rem;
    border-radius: 14px;
  }
}
