/* Auth Studio — world-class login / register / password screens
   Scoped to body.auth-studio */

html:has(body.auth-studio) {
  overflow-x: hidden;
  max-width: 100%;
}

body.auth-studio {
  --as-ink: #3A2A1C;
  --as-ink-2: #2F2218;
  --as-teal: #0f9c8a;
  --as-teal-deep: #0b7a6c;
  --as-amber: #3A2A1C;
  --as-paper: #F8F5EE;
  --as-text: #3A2A1C;
  --as-muted: #5b6b82;
  --as-line: rgba(15, 28, 46, 0.1);
  --as-display: "Outfit", system-ui, sans-serif;
  --as-body: "Lexend", system-ui, sans-serif;

  margin: 0;
  min-height: 100vh;
  font-family: var(--as-body);
  color: var(--as-text);
  background: var(--as-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.auth-studio > section {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 !important;
  padding: 0 !important;
}

.as-shell,
.as-brand,
.as-panel,
.as-card {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.as-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.as-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px 48px;
  color: #fff;
  background:
    radial-gradient(700px 380px at 18% 18%, rgba(15, 156, 138, 0.42), transparent 60%),
    radial-gradient(560px 320px at 88% 8%, rgba(58, 42, 28, 0.22), transparent 55%),
    linear-gradient(145deg, #3A2A1C 0%, #2F2218 52%, #0a1a2c 100%);
}

.as-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 88%);
  pointer-events: none;
}

.as-brand-top,
.as-brand-body,
.as-brand-foot {
  position: relative;
  z-index: 1;
}

.as-brand-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.as-back-home {
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.72) !important;
  font-family: var(--as-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none !important;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.as-back-home:hover {
  color: #fff !important;
}

.as-back-home-panel {
  display: none;
  margin: 0 0 18px;
  color: var(--as-muted) !important;
}

.as-back-home-panel:hover {
  color: var(--as-ink) !important;
}

.as-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff !important;
  text-decoration: none !important;
  font-family: var(--as-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.as-logo img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.as-cfm-logo {
  display: block;
  width: min(240px, 58vw);
}

.as-cfm-logo .cfm-wordmark,
.as-cfm-logo svg {
  display: block;
  width: 100%;
  height: auto;
}

.as-kicker {
  display: inline-flex;
  margin: 0 0 18px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 156, 138, 0.18);
  color: #5eead4;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.as-brand-title {
  font-family: var(--as-display);
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 16px;
  max-width: 12ch;
}

.as-brand-title span {
  background: linear-gradient(90deg, #5eead4, #f5d76e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.as-brand-copy {
  margin: 0;
  max-width: 34ch;
  font-size: 15.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.72);
}

.as-brand-foot {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
}

.as-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 48px 32px;
  background:
    radial-gradient(520px 260px at 100% 0%, rgba(15, 156, 138, 0.08), transparent 60%),
    #f7f9fc;
}

.as-card {
  width: 100%;
  max-width: 420px;
}

.as-req {
  color: #9a6b16;
  font-size: 12px;
  font-weight: 600;
}

.as-card-head {
  margin-bottom: 28px;
}

.as-card-head h1 {
  font-family: var(--as-display);
  font-size: clamp(28px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: var(--as-ink);
}

.as-card-head p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--as-muted);
}

.as-alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
}

.as-alert-error {
  background: rgba(185, 28, 28, 0.08);
  color: #991b1b;
  border: 1px solid rgba(185, 28, 28, 0.15);
}

.as-alert-success {
  background: rgba(15, 156, 138, 0.1);
  color: var(--as-teal-deep);
  border: 1px solid rgba(15, 156, 138, 0.2);
}

.as-field {
  margin-bottom: 16px;
}

.as-field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--as-text);
}

.as-field input[type="text"],
.as-field input[type="email"],
.as-field input[type="password"],
.as-field input[type="phone"],
.as-field input[type="file"],
.as-field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--as-line);
  background: #fff;
  color: var(--as-ink);
  font-family: var(--as-body);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.as-field input:focus,
.as-field textarea:focus {
  border-color: rgba(15, 156, 138, 0.55);
  box-shadow: 0 0 0 4px rgba(15, 156, 138, 0.12);
}

.as-field .as-error {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: #b91c1c;
}

.as-field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--as-muted);
}

.as-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 22px;
  font-size: 13.5px;
}

.as-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--as-muted);
  cursor: pointer;
  user-select: none;
}

.as-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--as-teal);
}

.as-link {
  color: var(--as-teal-deep) !important;
  font-weight: 600;
  text-decoration: none !important;
}

.as-link:hover {
  text-decoration: underline !important;
}

.as-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 18px;
  border: 0;
  border-radius: 999px;
  font-family: var(--as-body);
  font-size: 14.5px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.as-btn:hover {
  transform: translateY(-1px);
}

.as-btn-primary {
  background: linear-gradient(135deg, var(--as-teal), var(--as-teal-deep));
  color: #fff !important;
  box-shadow: 0 12px 28px rgba(15, 156, 138, 0.28);
}

.as-btn-ghost {
  margin-top: 10px;
  background: transparent;
  color: var(--as-text) !important;
  border: 1px solid var(--as-line);
}

.as-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 14px;
  color: var(--as-muted);
}

.as-instructor {
  margin: 8px 0 18px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(15, 156, 138, 0.06);
  border: 1px solid rgba(15, 156, 138, 0.14);
}

.as-instructor > .as-check {
  margin-bottom: 0;
  color: var(--as-text);
  font-weight: 600;
}

.as-instructor-fields {
  margin-top: 14px;
}

.as-instructor-fields.d-none {
  display: none !important;
}

@media (max-width: 991.98px) {
  .as-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .as-brand {
    min-height: auto;
    width: 100%;
    padding:
      max(28px, calc(16px + env(safe-area-inset-top)))
      calc(24px + env(safe-area-inset-right))
      32px
      calc(24px + env(safe-area-inset-left));
  }

  .as-brand-title {
    max-width: none;
    font-size: 32px;
  }

  .as-brand-foot {
    display: none;
  }

  .as-panel {
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    padding:
      28px
      calc(20px + env(safe-area-inset-right))
      max(48px, calc(24px + env(safe-area-inset-bottom)))
      calc(20px + env(safe-area-inset-left));
  }

  .as-card {
    max-width: 100%;
    width: 100%;
  }

  .as-brand-top .as-back-home {
    display: none;
  }

  .as-back-home-panel {
    display: inline-flex;
    align-self: flex-start;
    margin: 0 0 20px;
    max-width: 100%;
    white-space: normal;
  }
}

@media (max-width: 767.98px) {
  .as-brand {
    padding:
      max(18px, calc(10px + env(safe-area-inset-top)))
      calc(18px + env(safe-area-inset-right))
      18px
      calc(18px + env(safe-area-inset-left));
  }

  .as-brand-body,
  .as-brand-foot {
    display: none;
  }

  .as-logo {
    font-size: 17px;
  }

  .as-logo img {
    max-width: min(180px, 65vw);
    height: 30px;
  }

  .as-panel {
    padding:
      26px
      calc(18px + env(safe-area-inset-right))
      max(40px, calc(20px + env(safe-area-inset-bottom)))
      calc(18px + env(safe-area-inset-left));
  }

  .as-card-head {
    margin-bottom: 22px;
  }

  .as-card-head h1 {
    font-size: clamp(27px, 8vw, 32px);
  }

  /* Prevent Safari from zooming the page when a form field receives focus. */
  .as-field input[type="text"],
  .as-field input[type="email"],
  .as-field input[type="password"],
  .as-field input[type="phone"],
  .as-field input[type="file"],
  .as-field textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .as-row {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .as-btn {
    min-height: 48px;
  }
}

/* Galaxy Fold cover display and other extra-narrow devices. */
@media (max-width: 374.98px) {
  .as-panel {
    padding-right: calc(14px + env(safe-area-inset-right));
    padding-left: calc(14px + env(safe-area-inset-left));
  }

  .as-field {
    margin-bottom: 14px;
  }

  .as-instructor {
    padding: 12px;
  }

  .as-foot {
    font-size: 13px;
  }
}

@media (max-width: 991.98px) and (orientation: landscape) and (max-height: 520px) {
  .as-brand {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 12px;
  }

  .as-brand-body,
  .as-brand-foot {
    display: none;
  }

  .as-panel {
    padding-top: 20px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .as-link,
  .as-check {
    min-height: 44px;
    align-items: center;
  }

  .as-btn:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .as-shell *,
  .as-shell *::before,
  .as-shell *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Authority continuity — espresso palette */
body.auth-studio.home-template-authority {
  --as-ink: #3A2A1C;
  --as-ink-2: #2F2218;
  --as-teal: #3A2A1C;
  --as-teal-deep: #2F2218;
  --as-amber: #F1E9DE;
  --as-paper: #F8F5EE;
  --as-text: #3A2A1C;
  --as-muted: #8A7F72;
  --as-line: rgba(58, 42, 28, 0.12);
  --as-display: "Instrument Serif", Georgia, serif;
  --as-body: "Manrope", system-ui, sans-serif;
}

body.auth-studio.home-template-authority .as-brand {
  background:
    radial-gradient(640px 340px at 20% 10%, rgba(201, 191, 178, 0.16), transparent 58%),
    radial-gradient(480px 280px at 90% 0%, rgba(241, 233, 222, 0.08), transparent 50%),
    linear-gradient(160deg, #3A2A1C 0%, #2F2218 55%, #3A2A1C 100%);
}

body.auth-studio.home-template-authority .as-brand::before {
  opacity: 0.35;
  background-image:
    radial-gradient(circle at center, transparent 48%, rgba(201, 191, 178, 0.08) 49%, transparent 50%);
  background-size: 420px 420px;
}

body.auth-studio.home-template-authority .as-kicker {
  color: #F1E9DE;
  border-color: rgba(201, 191, 178, 0.35);
  background: rgba(201, 191, 178, 0.08);
}

body.auth-studio.home-template-authority .as-brand-title span {
  background: linear-gradient(90deg, #F1E9DE, #C9BFB2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.auth-studio.home-template-authority .as-btn-primary,
body.auth-studio.home-template-authority .as-link {
  --as-btn: #3A2A1C;
}

body.auth-studio.home-template-authority .as-btn-primary {
  color: #F1E9DE !important;
  background: #3A2A1C !important;
  border-radius: 0;
  box-shadow: none;
}

body.auth-studio.home-template-authority .as-btn-primary:hover {
  background: #4A3726 !important;
  color: #F1E9DE !important;
}
