/* ==========================================================================
   AnimateShort: the sign up / log in window (scripts/auth.js)
   Self-contained so it looks the same on the landing page and in the dashboard. A light card in the middle of the
   screen over a dimmed, blurred page; tabs for Sign up and Log in; Continue with Google; email and password.
   ========================================================================== */

.as-auth {
  --a-bg: #FFFFFF;
  --a-text: #1C1A17;
  --a-muted: #6B655E;
  --a-line: #E6E2DD;
  --a-line-strong: #D3CDC5;
  --a-soft: #F6F2EC;
  --a-accent: #C8792C;          /* the site's amber */
  --a-accent-hover: #D98A3C;
  --a-on-accent: #000000;       /* black text on amber (6.2:1) */
  --a-error: #B91C1C;
  --a-error-soft: #FDECEC;
  --a-ok: #15803D;
  --a-focus: #2A1A3F;

  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: 0;
  background: transparent;
  color: var(--a-text);
  font-family: Geist, ui-sans-serif, system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overflow: auto;
}
.as-auth[open] { display: grid; place-items: center; }
.as-auth::backdrop { background: rgba(26, 18, 12, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.as-auth:not([open]) { display: none; }

.as-auth__card {
  position: relative;
  width: min(420px, 100%);
  background: var(--a-bg);
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 30px 80px rgba(20, 12, 6, 0.35), 0 2px 8px rgba(20, 12, 6, 0.12);
  animation: as-auth-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes as-auth-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .as-auth__card { animation: none; } }

.as-auth__close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--a-muted);
  cursor: pointer;
}
.as-auth__close:hover { background: var(--a-soft); color: var(--a-text); }
.as-auth__close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
.as-auth--locked .as-auth__close { display: none; }

.as-auth__brand {   /* the wordmark: text only, in the site's orange */
  margin-bottom: 18px;
  text-align: center;
  color: var(--a-accent);
  font-family: "Bricolage Grotesque", ui-sans-serif, system-ui, "Segoe UI", Arial, sans-serif;
  font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em;
}

/* tabs */
.as-auth__tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin-bottom: 20px;
  border-radius: 10px; background: var(--a-soft);
}
.as-auth__tabs[hidden] { display: none; }
.as-auth__tab {
  min-height: 40px; border: 0; border-radius: 7px;
  background: transparent; color: var(--a-muted);
  font: inherit; font-weight: 600; font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 140ms, color 140ms, box-shadow 140ms;
}
.as-auth__tab:hover { color: var(--a-text); }
.as-auth__tab[aria-selected="true"] { background: var(--a-bg); color: var(--a-text); box-shadow: 0 1px 3px rgba(20, 12, 6, 0.12); }

/* panel text */
.as-auth h2 {
  margin: 0 0 4px;
  font-family: "Bricolage Grotesque", ui-sans-serif, system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15;
}
.as-auth__lede { margin: 0 0 18px; color: var(--a-muted); font-size: 0.95rem; }
.as-auth__lede strong { color: var(--a-text); font-weight: 600; }

/* buttons */
.as-auth__btn {
  width: 100%; min-height: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 16px;
  border: 1px solid transparent; border-radius: 9px;
  font: inherit; font-weight: 600; font-size: 0.98rem;
  cursor: pointer;
  transition: background-color 140ms, border-color 140ms, transform 140ms;
}
.as-auth__btn:active { transform: scale(0.98); }
.as-auth__btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.as-auth__btn--primary { background: var(--a-accent); color: var(--a-on-accent); }
.as-auth__btn--primary:hover { background: var(--a-accent-hover); }
.as-auth__btn--google { background: var(--a-bg); color: var(--a-text); border-color: var(--a-line-strong); display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem; }
.as-auth__g { width: 18px; height: 18px; flex: none; }
.as-auth__btn--google:hover { background: var(--a-soft); border-color: var(--a-muted); }
.as-auth__btn--quiet { background: transparent; color: var(--a-text); border-color: var(--a-line-strong); }

.as-auth__or {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0; color: var(--a-muted); font-size: 0.85rem;
}
.as-auth__or::before, .as-auth__or::after { content: ""; flex: 1; height: 1px; background: var(--a-line); }

/* fields */
.as-auth__field { margin-bottom: 14px; }
.as-auth__field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
.as-auth__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.as-auth__input-wrap { position: relative; }
.as-auth input {
  width: 100%; min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--a-line-strong); border-radius: 9px;
  background: var(--a-bg); color: var(--a-text);
  font: inherit; font-size: 1rem;
  box-sizing: border-box;
  transition: border-color 140ms, box-shadow 140ms;
}
.as-auth input:hover { border-color: var(--a-muted); }
.as-auth input:focus { outline: none; border-color: var(--a-focus); box-shadow: 0 0 0 3px rgba(42, 26, 63, 0.15); }
.as-auth input[aria-invalid="true"] { border-color: var(--a-error); }
.as-auth__input-wrap input { padding-right: 48px; }
.as-auth__peek {   /* the eye: show or hide the password */
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 36px;
  display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--a-muted);
  cursor: pointer;
}
.as-auth__peek:hover { background: var(--a-soft); color: var(--a-text); }
.as-auth__peek svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* password strength: a bar along the bottom edge of the box that grows left to right and turns from red to green,
   with the rating word underneath */
.as-auth__strength {
  position: absolute; left: 1px; right: 1px; bottom: 1px; height: 4px;
  border-radius: 0 0 8px 8px; overflow: hidden; pointer-events: none;
}
.as-auth__strength > span {
  display: block; height: 100%; width: 0; background: transparent;
  transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1), background-color 320ms;
}
.as-auth__input-wrap[data-score="1"] .as-auth__strength > span { width: 25%; background: #D64545; }
.as-auth__input-wrap[data-score="2"] .as-auth__strength > span { width: 50%; background: #E08A1E; }
.as-auth__input-wrap[data-score="3"] .as-auth__strength > span { width: 75%; background: #7FA82E; }
.as-auth__input-wrap[data-score="4"] .as-auth__strength > span { width: 100%; background: #15803D; }
@media (prefers-reduced-motion: reduce) { .as-auth__strength > span { transition: none; } }
.as-auth__meter { margin-top: 6px; min-height: 18px; }
.as-auth__meter-label { color: var(--a-muted); font-size: 0.8rem; line-height: 1.3; }
.as-auth__meter[data-score="1"] .as-auth__meter-label { color: var(--a-error); }
.as-auth__meter[data-score="2"] .as-auth__meter-label { color: #9A5B0E; }
.as-auth__meter[data-score="3"] .as-auth__meter-label { color: #4D7A12; }
.as-auth__meter[data-score="4"] .as-auth__meter-label { color: var(--a-ok); }
.as-auth__hint { margin: 6px 0 0; color: var(--a-muted); font-size: 0.82rem; }

.as-auth__link {
  padding: 0; border: 0; background: none;
  color: var(--a-text); font: inherit; font-size: 0.88rem; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--a-line-strong);
  cursor: pointer;
}
.as-auth__link:hover { text-decoration-color: currentColor; }
.as-auth__link[disabled] { color: var(--a-muted); font-weight: 500; text-decoration: none; cursor: default; }

/* the 6-digit code: six boxes, one digit each */
.as-auth__digits { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.as-auth input.as-auth__digit {   /* slightly taller than wide */
  width: 100%; min-width: 0; min-height: 0; aspect-ratio: 5 / 6; padding: 0;
  text-align: center; font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums;
  border-radius: 10px;
}
.as-auth input.as-auth__digit::placeholder { color: var(--a-line-strong); font-weight: 400; }
.as-auth input.as-auth__digit:not(:placeholder-shown) { border-color: var(--a-muted); }
.as-auth input.as-auth__digit[aria-invalid="true"] { border-color: var(--a-error); background: var(--a-error-soft); }

.as-auth__error {
  margin: 0 0 14px; padding: 10px 12px;
  border-radius: 9px; background: var(--a-error-soft); color: var(--a-error);
  font-size: 0.9rem;
}
.as-auth__error[hidden] { display: none; }
.as-auth__switch { margin: 16px 0 0; text-align: center; color: var(--a-muted); font-size: 0.9rem; }
.as-auth__fine { margin: 14px 0 0; text-align: center; color: var(--a-muted); font-size: 0.8rem; }

.as-auth code { font-size: 0.85em; background: var(--a-soft); padding: 1px 5px; border-radius: 4px; }

.as-auth :focus-visible { outline: 2px solid var(--a-focus); outline-offset: 2px; }

@media (max-width: 420px) {
  .as-auth { padding: 10px; }
  .as-auth__card { padding: 22px 18px 18px; }
}
