/* =====================================================================
   auth.css — Login + Register (clay redesign, 2026-12-05)
   Royal clay: brand blue #0940a5 slab, porcelain clay card, inset wells.
   Markup contract (ids, names, data-eye, #pageLoader.is-visible) is the
   one the page scripts already use — only the look lives here.
   ===================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/auth/bricolage-latin.woff2") format("woff2");
  font-weight: 600 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/assets/fonts/auth/figtree-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  /* colour */
  --royal: #0940a5;
  --royal-deep: #0c3a93;
  --royal-hi: #3672da;
  --sky: #e8eefb;
  --porcelain: #f7f9fe;
  --well: #edf1fa;
  --a-ink: #13203f;
  --slate: #66708a;
  --a-line: #d9e1f2;

  /* type */
  --f-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-mark: clamp(30px, 8.6vw, 40px);
  --fs-h1: 24px;
  --fs-body: 15px;
  --fs-small: 13px;
  --fs-label: 13.5px;
  --fw-body: 450;
  --fw-label: 600;
  --fw-strong: 700;
  --fw-display: 800;
  --lh-tight: 1.08;
  --lh-body: 1.5;

  /* shape + depth */
  --r-card: 30px;
  --r-well: 18px;
  --r-btn: 20px;
  --clay-card:
    0 1px 0 rgba(255,255,255,.9) inset,
    0 -6px 14px rgba(9,64,165,.06) inset,
    0 2px 4px rgba(12,32,80,.06),
    0 14px 28px -8px rgba(12,32,80,.16),
    0 34px 60px -24px rgba(9,64,165,.32);
  --clay-well:
    inset 0 2px 5px rgba(12,32,80,.10),
    inset 0 -2px 3px rgba(255,255,255,.95);
  --clay-btn:
    inset 0 2px 1px rgba(255,255,255,.28),
    inset 0 -5px 10px rgba(4,22,70,.35),
    0 3px 0 #082f7a,
    0 12px 22px -6px rgba(9,64,165,.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--sky);
  color: var(--a-ink);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}
input, button { font-family: inherit; }
a { color: inherit; }

.auth {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--sky);
  overflow-x: hidden;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

/* ---------- royal slab ---------- */
.slab {
  position: relative;
  padding: calc(34px + env(safe-area-inset-top)) 26px 92px;
  background:
    radial-gradient(120% 80% at 85% 0%, rgba(255,255,255,.16), transparent 55%),
    linear-gradient(165deg, var(--royal-hi) -30%, var(--royal) 45%, var(--royal-deep) 100%);
  border-radius: 0 0 44px 44px;
  box-shadow:
    inset 0 -10px 24px rgba(3,20,64,.35),
    inset 0 2px 0 rgba(255,255,255,.18);
  color: #fff;
}
.slab__row { display: flex; align-items: center; gap: 12px; }
.emblem {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #ffffff, #dfe8fb);
  color: var(--royal);
  box-shadow:
    inset 0 -4px 8px rgba(9,64,165,.18),
    inset 0 2px 0 #fff,
    0 8px 16px -4px rgba(2,14,48,.45);
  overflow: hidden;
}
.emblem img { width: 100%; height: 100%; object-fit: cover; }
.emblem svg { width: 26px; height: 26px; }
.slab__note {
  font-size: var(--fs-small);
  font-weight: var(--fw-label);
  color: rgba(255,255,255,.78);
  line-height: 1.3;
}
.wordmark {
  margin: 26px 0 0;
  font-family: var(--f-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-mark);
  line-height: var(--lh-tight);
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 2px 0 rgba(3,20,64,.25);
  word-break: break-word;
}
.slab__sub {
  margin: 8px 0 0;
  max-width: 30ch;
  color: rgba(255,255,255,.82);
  font-size: var(--fs-body);
}

/* ---------- clay card ---------- */
.card {
  position: relative;
  margin: -64px 16px 0;
  padding: 22px 20px 24px;
  background: linear-gradient(180deg, #ffffff 0%, var(--porcelain) 100%);
  border-radius: var(--r-card);
  box-shadow: var(--clay-card);
  animation: rise .55s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Login / Register switch — the one memorable piece */
.switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  border-radius: 18px;
  background: var(--well);
  box-shadow: var(--clay-well);
}
.switch__knob {
  position: absolute;
  top: 5px; bottom: 5px; left: 5px;
  width: calc(50% - 5px);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f1f5fd);
  box-shadow:
    inset 0 -3px 6px rgba(9,64,165,.10),
    0 1px 0 rgba(255,255,255,.9) inset,
    0 6px 12px -4px rgba(12,32,80,.25);
  transition: transform .35s cubic-bezier(.3,1.4,.5,1);
}
.switch--register .switch__knob { transform: translateX(100%); }
.switch__item {
  position: relative;
  z-index: 1;
  display: block;
  padding: 11px 0;
  text-align: center;
  text-decoration: none;
  font-weight: var(--fw-strong);
  font-size: 15px;
  color: var(--slate);
  border-radius: 14px;
}
.switch__item.is-active { color: var(--royal); }

.card__title {
  margin: 22px 0 4px;
  font-family: var(--f-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-h1);
  line-height: 1.15;
  letter-spacing: -.01em;
}
.card__lead { margin: 0 0 18px; color: var(--slate); font-size: var(--fs-small); }

/* ---------- fields ---------- */
.fields { display: grid; gap: 14px; }
.field__label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 0 6px 4px;
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  color: var(--a-ink);
}
.field__hint { font-weight: 500; color: var(--slate); font-size: 12px; margin-right: 4px; }
.field__box {
  display: flex; align-items: center; gap: 10px;
  height: 54px;
  padding: 0 14px;
  border-radius: var(--r-well);
  background: var(--well);
  box-shadow: var(--clay-well);
  border: 1.5px solid transparent;
  transition: border-color .2s, background-color .2s;
}
.field__box:focus-within { border-color: rgba(9,64,165,.45); background: #f3f6fd; }
.field__icon { flex: none; width: 20px; height: 20px; color: var(--royal); opacity: .8; }
.field__code {
  flex: none;
  font-weight: var(--fw-strong);
  color: var(--a-ink);
  padding-right: 10px;
  border-right: 1.5px solid var(--a-line);
}
.field__box input {
  flex: 1; min-width: 0;
  height: 100%;
  border: 0; outline: 0; background: transparent;
  font-size: 16px;
  font-weight: 500;
  color: var(--a-ink);
}
.field__box input::placeholder { color: #98a1b8; font-weight: 450; }
.field__eye {
  flex: none;
  width: 36px; height: 36px; margin-right: -8px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--slate);
  cursor: pointer;
}
.field__eye svg { width: 20px; height: 20px; }
.field__eye .eye-open { display: none; }
.field__eye.is-visible .eye-open { display: block; }
.field__eye.is-visible .eye-shut { display: none; }
.field__eye:focus-visible { outline: 2px solid var(--royal); outline-offset: 1px; }

/* ---------- button ---------- */
.submit {
  width: 100%;
  height: 56px;
  margin-top: 22px;
  border: 0;
  border-radius: var(--r-btn);
  background: linear-gradient(180deg, var(--royal-hi) -40%, var(--royal) 55%, var(--royal-deep) 100%);
  box-shadow: var(--clay-btn);
  color: #fff;
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: var(--fw-display);
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, filter .2s;
}
.submit:active { transform: translateY(3px); box-shadow: inset 0 2px 1px rgba(255,255,255,.2), inset 0 -3px 8px rgba(4,22,70,.35), 0 0 0 #082f7a, 0 6px 12px -6px rgba(9,64,165,.5); }
.submit:disabled { filter: saturate(.6) brightness(1.08); cursor: default; }
.submit:focus-visible, .switch__item:focus-visible, .alt a:focus-visible, .terms a:focus-visible { outline: 2px solid var(--royal); outline-offset: 3px; }

.terms { margin: 14px 4px 0; text-align: center; font-size: 12.5px; color: var(--slate); }
.terms a { color: var(--royal); font-weight: var(--fw-label); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.alt { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--slate); }
.alt a { color: var(--royal); font-weight: var(--fw-strong); text-decoration: none; }

/* ---------- loader (contract: #pageLoader.is-visible) ---------- */
.loader {
  position: fixed; inset: 0; z-index: 9000;
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 12px;
  background: rgba(232,238,251,.72);
  backdrop-filter: blur(2px);
}
.loader.is-visible { display: flex; }
.loader__spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid rgba(9,64,165,.18); border-top-color: var(--royal);
  animation: spin .8s linear infinite;
}
.loader__label { font-weight: var(--fw-label); color: var(--royal); font-size: var(--fs-small); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .card, .loader__spinner { animation: none; }
  .switch__knob, .submit { transition: none; }
}
@media (max-width: 340px) {
  .slab { padding-left: 20px; padding-right: 20px; }
  .card { margin-left: 10px; margin-right: 10px; padding-left: 16px; padding-right: 16px; }
}

/* ---------- one-colour clay button (overrides config/brand_buttons.php on these two pages only) ---------- */
.auth #loginButton.submit,
.auth #registerButton.submit {
  background: #0940a5;
  background-image: none;
  color: #fff;
  text-shadow: none;
  border-radius: var(--r-btn);
  animation: none;
  filter: none;
  box-shadow:
    0 4px 0 #0940a5,
    0 4px 0 rgba(0,0,0,.22),
    0 14px 24px -8px rgba(9,64,165,.45);
  transition: transform .12s ease, box-shadow .12s ease;
}
.auth #loginButton.submit::before, .auth #loginButton.submit::after,
.auth #registerButton.submit::before, .auth #registerButton.submit::after { content: none; display: none; }
.auth #loginButton.submit:active,
.auth #registerButton.submit:active {
  transform: translateY(4px);
  filter: none;
  box-shadow:
    0 0 0 #0940a5,
    0 0 0 rgba(0,0,0,.22),
    0 6px 12px -6px rgba(9,64,165,.45);
}
.auth #loginButton.submit:disabled,
.auth #registerButton.submit:disabled { background: #0940a5; opacity: .7; transform: none; }

/* ---------- slab background photo (owner 2026-12-05), kept faint under the blue ---------- */
.slab { isolation: isolate; overflow: hidden; }
.slab::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: url("/uploads/eliments/auth-bg.webp") center 62% / cover no-repeat;
  opacity: .28;
  pointer-events: none;
}

/* title moved into the slab (2026-12-05): space between switch and first field */
.switch + form { margin-top: 20px; }

/* ---------- submit button v3 (2026-12-05): one colour, real clay thickness, icon ---------- */
.auth #loginButton.submit,
.auth #registerButton.submit {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 58px;
  margin-top: 26px;
  border-radius: 18px;
  background: #0940a5;
  font-size: 17.5px;
  letter-spacing: .02em;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.24),
    inset 0 -2px 0 rgba(3,22,66,.22),
    0 5px 0 #06307e,
    0 7px 2px rgba(3,22,66,.18),
    0 18px 28px -10px rgba(9,64,165,.6);
  transition: transform .1s ease, box-shadow .1s ease;
}
.auth #loginButton.submit:active,
.auth #registerButton.submit:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.18),
    inset 0 -1px 0 rgba(3,22,66,.22),
    0 0 0 #06307e,
    0 1px 1px rgba(3,22,66,.18),
    0 6px 12px -8px rgba(9,64,165,.5);
}
.auth #loginButton.submit:focus-visible,
.auth #registerButton.submit:focus-visible { outline: 3px solid rgba(9,64,165,.35); outline-offset: 4px; }
.submit__icon { width: 21px; height: 21px; flex: none; }
