/* Login / registration / code screens (templates/accounts/auth_base.html).
   Self-contained: only .auth*, .otp* and body.auth-screen rules. */

/* the site chrome is not shown on auth screens (see base.html) */
body.auth-screen > header,
body.auth-screen > footer,
body.auth-screen > nav { display: none; }
body.auth-screen { background: #F1F3EA; }

.auth {
  --a-forest-deep: #17301E;
  --a-forest: #2A4A34;
  --a-moss: #4A6B3A;
  --a-sage: #B7C5A6;
  --a-terracotta: #B85040;
  --a-terracotta-dp: #8F3B2E;
  --a-terracotta-lt: #E8B8AC;
  --a-gold: #C9A24E;
  --a-ash: #6B7062;
  --a-bg: #F1F3EA;
  --a-line: rgba(23, 48, 30, .14);

  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--a-bg);
  color: var(--a-forest-deep);
  font-family: "Inter", system-ui, sans-serif;
}

/* ---------------- Hero (brand art or photo) ---------------- */
.auth__hero {
  position: relative;
  overflow: hidden;
  min-height: 36vh;
  color: #F1F3EA;
  background:
    radial-gradient(70% 60% at 85% 10%, rgba(201, 162, 78, .28), transparent 60%),
    radial-gradient(60% 60% at 10% 100%, rgba(184, 80, 64, .22), transparent 60%),
    radial-gradient(90% 70% at 50% 120%, rgba(74, 107, 58, .55), transparent 70%),
    linear-gradient(160deg, var(--a-forest) 0%, var(--a-forest-deep) 60%, #0F2014 100%);
}
.auth__hero--photo {
  background:
    linear-gradient(180deg, rgba(15, 32, 20, .25) 0%, rgba(15, 32, 20, .55) 55%, rgba(15, 32, 20, .88) 100%),
    var(--auth-photo) center / cover no-repeat,
    var(--a-forest-deep);
}
.auth__waves {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.auth__waves path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.auth__waves .w1 { stroke: #F1F3EA; stroke-width: 3; opacity: .55; }
.auth__waves .w2 { stroke: var(--a-sage); stroke-width: 3.5; opacity: .5; }
.auth__waves .w3 { stroke: #F1F3EA; stroke-width: 2; opacity: .3; }
.auth__waves .w4 { stroke: var(--a-sage); stroke-width: 2.5; opacity: .25; }
.auth__waves .ember { fill: var(--a-terracotta); filter: drop-shadow(0 0 6px rgba(232, 184, 172, .8)); }
.auth__hero--photo .auth__waves { opacity: .55; }

@media (prefers-reduced-motion: no-preference) {
  .auth__waves .w1, .auth__waves .w3 { animation: auth-breathe 9s ease-in-out infinite alternate; }
  .auth__waves .w2, .auth__waves .w4 { animation: auth-breathe 11s ease-in-out -3s infinite alternate; }
  .auth__waves .ember { animation: auth-glow 4s ease-in-out infinite alternate; }
}
@keyframes auth-breathe { from { transform: translateY(-6px); } to { transform: translateY(8px); } }
@keyframes auth-glow { from { opacity: .7; } to { opacity: 1; } }

.auth__hero-inner {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 22px 24px 48px;
}
.auth__hero-top {
  font-family: "Fraunces", Georgia, serif; font-size: 15px;
  letter-spacing: .32em; text-transform: uppercase; color: rgba(241, 243, 234, .8);
}
.auth__tagline {
  font-family: "Fraunces", Georgia, serif; font-style: italic; font-weight: 400;
  font-size: clamp(26px, 6vw, 52px); line-height: 1.05; letter-spacing: -.01em;
  margin: 0;
}
.auth__hero-text {
  margin: 12px 0 0; max-width: 34ch;
  font-size: 15px; line-height: 1.55; color: rgba(241, 243, 234, .82);
}
.auth__perks { display: none; }

/* ---------------- Panel / sheet ---------------- */
.auth__panel {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  margin-top: -28px;              /* the sheet slides over the hero on phones */
  z-index: 2;
}
.auth__sheet {
  width: 100%;
  flex: 1;
  background: #fff;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 30px rgba(23, 48, 30, .12);
  padding: 28px 24px 24px;
}
.auth__logo { display: inline-block; margin-bottom: 18px; }
.auth__logo img { height: 64px; width: auto; display: block; }
.auth__wordmark {
  font-family: "Fraunces", Georgia, serif; font-size: 28px; letter-spacing: .18em; font-weight: 500;
}
.auth__steps { display: flex; gap: 6px; margin-bottom: 14px; }
.auth__steps span { width: 28px; height: 4px; border-radius: 4px; background: #E0E4D4; }
.auth__steps span.is-on { background: var(--a-terracotta); }
.auth__title {
  font-family: "Fraunces", Georgia, serif; font-weight: 500;
  font-size: 30px; line-height: 1.1; letter-spacing: -.01em; margin: 0;
  color: var(--a-forest-deep);
}
.auth__subtitle { margin: 8px 0 22px; font-size: 15px; line-height: 1.5; color: var(--a-ash); }
.auth__inline-link { color: var(--a-terracotta-dp); text-decoration: underline; text-underline-offset: 3px; }

.auth__messages { display: grid; gap: 8px; margin-bottom: 16px; }
.auth__msg {
  border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.45;
  background: #EEF3F5; color: #2C3B43; border: 1px solid #DCE6EA;
}
.auth__msg--success { background: #E3EAD8; color: #2F4527; border-color: #CAD6B8; }
.auth__msg--warning { background: #F5EBCD; color: #6B5226; border-color: #ECD9A2; }
.auth__msg--error   { background: #F6E0DA; color: var(--a-terracotta-dp); border-color: #EDC3B9; }
.auth__msg ul { margin: 0; padding: 0; list-style: none; }

/* ---------------- Fields ---------------- */
.auth__form { display: grid; gap: 14px; }
.auth__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth__field { display: block; }
.auth__label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--a-ash);
}
.auth form .auth__field input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  font-size: 17px;              /* ≥16px: no zoom-on-focus on iOS */
  color: var(--a-forest-deep);
  background: #F7F8F2;
  border: 1.5px solid var(--a-line);
  border-radius: 16px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth form .auth__field input::placeholder { color: #A9AF9E; }
.auth form .auth__field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--a-forest);
  box-shadow: 0 0 0 4px rgba(42, 74, 52, .12);
}
.auth__field--error input { border-color: var(--a-terracotta) !important; background: #FFF8F6 !important; }
.auth__error { display: block; margin-top: 6px; font-size: 13px; color: var(--a-terracotta-dp); }
.auth__hint { margin: -2px 0 0; font-size: 13px; color: var(--a-ash); }

.auth__btn {
  margin-top: 6px;
  height: 56px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  font-size: 17px; font-weight: 600; letter-spacing: .01em;
  color: #fff;
  background: linear-gradient(180deg, #C25A49 0%, var(--a-terracotta) 55%, #A8483A 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 10px 22px rgba(184, 80, 64, .32);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.auth__btn:hover { filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 14px 28px rgba(184, 80, 64, .38); }
.auth__btn:active { transform: translateY(1px) scale(.995); }
.auth__btn:focus-visible { outline: 3px solid rgba(184, 80, 64, .35); outline-offset: 3px; }

.auth__alt { margin-top: 22px; text-align: center; font-size: 15px; color: var(--a-ash); }
.auth__alt a { color: var(--a-terracotta-dp); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(143, 59, 46, .3); }
.auth__alt a:hover { border-bottom-color: var(--a-terracotta-dp); }
.auth__back {
  display: block; text-align: center; padding: 14px 0 22px;
  font-size: 14px; color: var(--a-ash); background: #fff; width: 100%;
}
.auth__back:hover { color: var(--a-forest); }

/* ---------------- OTP boxes ---------------- */
.otp { position: relative; }
.auth .otp input { /* without JS: a normal big field */
  width: 100%; height: 60px; text-align: center;
  font-size: 26px; letter-spacing: .5em; font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--a-line); border-radius: 16px; background: #F7F8F2;
}
.otp__boxes { display: none; }
.auth .otp--js input {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  opacity: 0;                    /* still focusable, receives SMS autofill and paste */
  caret-color: transparent;
}
.otp--js .otp__boxes {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px;
}
.otp__box {
  height: 64px;
  display: grid; place-items: center;
  font-family: "Fraunces", Georgia, serif; font-size: 30px; font-weight: 500;
  color: var(--a-forest-deep);
  background: #F7F8F2;
  border: 1.5px solid var(--a-line);
  border-radius: 16px;
  transition: border-color .15s, box-shadow .15s, background .15s, transform .15s;
}
.otp__box.is-filled { background: #fff; border-color: rgba(42, 74, 52, .35); }
.otp__box.is-active {
  background: #fff;
  border-color: var(--a-forest);
  box-shadow: 0 0 0 4px rgba(42, 74, 52, .12);
}
.otp__box.is-active:empty::after {
  content: ""; width: 2px; height: 28px; background: var(--a-terracotta);
  animation: otp-caret 1s steps(1) infinite;
}
@keyframes otp-caret { 50% { opacity: 0; } }
.otp--error .otp__box { border-color: var(--a-terracotta); background: #FFF8F6; }

.auth__resend { margin-top: 14px; text-align: center; }
.auth__resend button {
  background: none; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--a-terracotta-dp);
}
.auth__resend button:disabled { color: #A9AF9E; font-weight: 500; cursor: default; }

/* ---------------- Tablet / desktop: side-by-side ---------------- */
@media (min-width: 900px) {
  .auth { flex-direction: row; padding: 16px; gap: 16px; }
  .auth__hero {
    flex: 1.1; min-height: auto;
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(23, 48, 30, .18);
  }
  .auth__hero-inner { padding: 36px 44px 48px; }
  .auth__hero-text { font-size: 17px; }
  .auth__perks {
    display: grid; gap: 10px; list-style: none; margin: 28px 0 0; padding: 0;
    font-size: 15px; color: rgba(241, 243, 234, .9);
  }
  .auth__perks span { color: var(--a-gold); margin-right: 8px; }
  .auth__panel { flex: 1; margin-top: 0; justify-content: center; }
  .auth__sheet {
    flex: none;
    max-width: 420px;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }
  .auth__logo img { height: 76px; }
  .auth__title { font-size: 38px; }
  .auth__back { background: transparent; position: absolute; bottom: 8px; left: 0; right: 0; }
  .auth form .auth__field input, .otp__box { background: #fff; }
}
