/**
 * /auth, /login, /signup — warm-paper sign-in on an Italian watercolor.
 *
 * The card is ALWAYS light parchment with an EXPLICIT palette (the `--ac-*`
 * vars below). It must never read `--ds-*`/`--dl-*` for ink/gold, because those
 * flip under `html.dark` (and the auth page defaults to dark chrome) — that was
 * the recurring "white text on a white card" bug. Self-contained = bulletproof.
 * 2026-06-21 rebuild.
 */

/* The Birmingham watercolor, softened by a pale white wash so it reads as a
   diffuse, airy backdrop (not a dark photo). An equally-specific `html.dark`
   selector wins over app.css's `html.dark .site-body` dark radial; column flex
   pins the footer to the very bottom (it used to float mid-screen). */
html.dark .site-body--auth,
.site-body--auth {
  /* core-layout's `html, body { height: 100% }` caps the body at one viewport,
     so the painting used to stop there and the dark html canvas showed below
     the fold. height:auto lets the body (and its painting) grow with content. */
  height: auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  color: #3a2f22; /* chrome text on the pale wash */
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.62) 0%, rgba(250, 244, 232, 0.7) 100%),
    url("/watercolor/birmingham-museums-trust-nbneQlI2M1A-unsplash.jpg") center / cover no-repeat;
  background-color: #f3ead8; /* fallback wash below the painting on tall pages */
}

/* The html canvas behind the body is dark (core-layout paints it var(--bg),
   near-black under html.dark). Match it to the wash so overscroll and any
   region past the body never flashes black under the watercolor. */
html:has(> .site-body--auth) {
  background: #f3ead8;
}

/* The header is the shared canonical bar (site-header.css). */

.auth-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Footer: a quiet legal line at the very bottom, readable on the pale wash. */
.site-body--auth .site-foot {
  flex: 0 0 auto;
  background: transparent;
  border-top: 1px solid rgba(90, 74, 52, 0.18);
  margin-top: 0;
}
.site-body--auth .site-foot-copy,
.site-body--auth .site-foot-link { color: rgba(58, 47, 34, 0.7); }
.site-body--auth .site-foot-link:hover { border-bottom-color: rgba(90, 74, 52, 0.4); }

.site-landing-dl-host {
  width: 100%;
  display: flex;
  justify-content: center;
}

.site-landing-dl-host > .auth-canvas,
.auth-canvas {
  /* Explicit parchment palette — never derived from theme tokens. */
  --ac-paper: #f8f2e7;
  --ac-paper-warm: #efe2cb;
  --ac-ink: #241a12;
  --ac-ink-soft: rgba(36, 26, 18, 0.66);
  --ac-ink-faint: rgba(36, 26, 18, 0.5);
  --ac-gold: #b8893b;
  --ac-gold-deep: #8a640f;
  --ac-rule: #cbb791;
  --ac-rule-soft: rgba(160, 132, 84, 0.34);
  --ac-rose: #cf6b46;
  --ac-error: #c2553f;
  --ac-success: #2f8f6a;
  --ac-info: #3c6ea8;
  --ac-serif: "Playfair Display", Georgia, serif;
  --ac-sans: "Inter", system-ui, sans-serif;
  --ac-mono: "JetBrains Mono", ui-monospace, monospace;

  --ac-rust: #c2683f;
  --ac-rust-deep: #a8512c;

  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 2.8rem 2.8rem 2.4rem;
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(203, 183, 145, 0.7);
  background: var(--ac-paper);
  color: var(--ac-ink);
  font-family: var(--ac-sans);
  /* soft, single shadow — the card floats on the pale wash without a heavy slab */
  box-shadow: 0 18px 50px rgba(58, 42, 24, 0.18);
}

/* ── head ─────────────────────────────────────────────────────────────── */
.auth-head {
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
}

.auth-kicker {
  display: inline-block;
  font-family: var(--ac-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ac-gold-deep);
  padding: 0.32rem 0.74rem;
  border-radius: 999px;
  background: rgba(184, 137, 59, 0.14);
  margin-bottom: 1rem;
}

.auth-head h1 {
  font-family: var(--ac-serif);
  font-size: 2.15rem;
  line-height: 1.08;
  margin: 0 0 0.55rem;
  color: var(--ac-ink);
  font-weight: 600;
}

.auth-sub {
  margin: 0 auto;
  max-width: 40ch;
  font-size: 0.97rem;
  line-height: 1.55;
  color: var(--ac-ink-soft);
}

/* ── tabs (two across, always on one row) ─────────────────────────────── */
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  margin: 1.7rem 0 1.3rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(160, 132, 84, 0.16);
}

.auth-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ac-ink-soft);
  padding: 0.62rem 0.4rem;
  border-radius: 999px;
  font-family: var(--ac-sans);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.auth-tab:hover {
  color: var(--ac-ink);
}

.auth-tab.is-active {
  background: #fffdf8;
  color: var(--ac-rust-deep);
  box-shadow: 0 4px 12px rgba(58, 42, 24, 0.12);
}

.auth-tab:focus-visible {
  outline: 2px solid var(--ac-gold);
  outline-offset: 3px;
}

/* ── form ─────────────────────────────────────────────────────────────── */
.auth-form {
  display: grid;
  gap: 1.05rem;
}

/* auth.js toggles sign-up-only fields via the `hidden` attribute, but the
   display:grid/flex on .auth-field/.auth-check overrides the UA's
   [hidden]{display:none} — which made Sign in show the full Sign up form. */
.auth-canvas [hidden] {
  display: none !important;
}

.auth-field {
  display: grid;
  gap: 0.4rem;
}

.auth-label {
  font-family: var(--ac-mono);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ac-gold-deep);
}

.auth-field input {
  appearance: none;
  width: 100%;
  border: 1px solid var(--ac-rule);
  background: #fffdf8;
  color: var(--ac-ink); /* explicit — never theme ink */
  font-family: var(--ac-sans);
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.auth-field input::placeholder {
  color: var(--ac-ink-faint);
}

.auth-field input:hover {
  border-color: var(--ac-gold);
}

.auth-field input:focus-visible {
  outline: none;
  border-color: var(--ac-gold);
  box-shadow: 0 0 0 3px rgba(184, 137, 59, 0.24);
}

.auth-hint {
  font-family: var(--ac-mono);
  font-size: 0.7rem;
  color: var(--ac-ink-faint);
  letter-spacing: 0.01em;
}

/* "Forgot your password?" — a quiet right-aligned line under the password field. */
.auth-forgot {
  margin: -0.55rem 0 0;
  text-align: right;
  font-size: 0.85rem;
  color: var(--ac-ink-faint);
}

/* Honeypot — off-screen (not display:none, which some bots skip), never tab-reachable. */
.auth-hp {
  position: absolute !important;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Terms agreement (sign-up only) */
.auth-check {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0.2rem 0 0.1rem;
  font-family: var(--ac-sans);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ac-ink-soft);
}
.auth-check input[type="checkbox"] {
  margin-top: 0.18rem;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  accent-color: var(--ac-terracotta, #cf6b46);
}
.auth-check a {
  color: var(--ac-terracotta, #cf6b46);
}

.auth-status {
  margin: 0.2rem 0 0.1rem;
  min-height: 1.25rem;
  font-size: 0.92rem;
  font-family: var(--ac-sans);
  line-height: 1.45;
  color: var(--ac-ink-soft);
}

.auth-status[data-tone="error"] { color: var(--ac-error); }
.auth-status[data-tone="success"] { color: var(--ac-success); }
.auth-status[data-tone="info"] { color: var(--ac-info); }

.auth-actions {
  display: grid;
  gap: 0.5rem;
}

.auth-submit {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 0.95rem 1.3rem;
  background: var(--ac-rust);
  color: #fff7f1;
  font-family: var(--ac-sans);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 140ms ease, transform 120ms ease, box-shadow 160ms ease, opacity 160ms ease;
  box-shadow: 0 8px 18px rgba(168, 81, 44, 0.22);
}

.auth-submit:hover:not(:disabled) {
  background: var(--ac-rust-deep);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(168, 81, 44, 0.3);
}

.auth-submit:active:not(:disabled) { transform: translateY(0); }

.auth-submit:disabled,
.auth-submit[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

.auth-submit:focus-visible {
  outline: 2px solid var(--ac-gold);
  outline-offset: 3px;
}

.auth-submit--secondary {
  background: transparent;
  color: var(--ac-gold-deep);
  border: 1px solid var(--ac-rule);
  box-shadow: none;
}

.auth-submit--secondary:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: none;
}

.auth-footnote {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ac-ink-soft);
  line-height: 1.5;
}

.auth-inline-link {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--ac-gold-deep);
  color: var(--ac-gold-deep);
  font: inherit;
  cursor: pointer;
  padding: 0 0 1px;
  margin: 0 2px;
}

.auth-inline-link:hover {
  color: var(--ac-rose);
  border-bottom-color: var(--ac-rose);
}

/* ── email-code sub-flow ──────────────────────────────────────────────── */
.auth-email-fields { margin-bottom: 0.25rem; }
.auth-email-actions { margin: 0.6rem 0 1rem; }

/* ── aside quote ──────────────────────────────────────────────────────── */
.auth-aside {
  margin-top: 1.9rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--ac-rule-soft);
  text-align: center;
  font-family: var(--ac-serif);
  color: var(--ac-ink-soft);
}

.auth-aside-line {
  margin: 0;
  font-style: italic;
  font-size: 0.98rem;
  line-height: 1.55;
}

.auth-aside-attr {
  margin: 0.45rem 0 0;
  font-family: var(--ac-mono);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ac-gold-deep);
}

/* ── responsive ───────────────────────────────────────────────────────── */
/* The marketing nav has too many links for a phone — it collided/wrapped on the
   auth page (§1.5). Drop it on narrow widths; the brand links home and the card
   IS the sign-in, so nothing is lost. */
@media (max-width: 720px) {
  .site-body--auth .site-nav { display: none; }
}
@media (max-width: 600px) {
  .auth-main { margin: 2rem auto 3rem; }
  .site-landing-dl-host > .auth-canvas,
  .auth-canvas { padding: 2rem 1.5rem; }
  .auth-head h1 { font-size: 1.7rem; }
  .auth-tab { font-size: 0.76rem; padding: 0.58rem 0.25rem; }
}
