/* =========================================================================
   imaliyami — sign in / sign up / verify
   Banknote palette: off-white paper, British racing green, gold.
   The hero photo goes in /img/auth.jpg; until then the engraved rosette
   and green/gold glow underneath it are what you see.
   ========================================================================= */
:root {
  --paper: #efeadb;          /* off-white, like banknote paper */
  --paper-2: #e2dcc8;
  --racing: #0b3d2a;         /* British racing green */
  --racing-deep: #072116;
  --ink: #08130e;            /* near-black with a green cast */
  --panel: rgba(9, 19, 14, 0.9);
  --gold: #c8a24e;
  --gold-soft: rgba(200, 162, 78, 0.18);
  --text: #efeadb;
  --text-2: rgba(239, 234, 219, 0.66);
  --text-3: rgba(239, 234, 219, 0.42);
  --line: rgba(239, 234, 219, 0.12);
  --line-strong: rgba(239, 234, 219, 0.22);
  --danger: #e8a598;
  --radius-card: 28px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-color: var(--ink);
  /* Photo on top (when present), then the engraved fallback and colour glow */
  background-image:
    url('/img/auth.png'),
    url('/img/guilloche.svg'),
    radial-gradient(900px 600px at 28% 38%, rgba(200, 162, 78, 0.22), transparent 60%),
    radial-gradient(1200px 900px at 70% 80%, rgba(11, 61, 42, 0.95), transparent 70%),
    linear-gradient(160deg, #0d2a1e 0%, #06120c 100%);
  background-size: cover, 1180px 1180px, auto, auto, auto;
  /* centres the rosette inside the glass window (frame is 1100px wide) */
  background-position: center, calc(50% - 230px) 50%, center, center, center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
/* Film grain over everything, like the reference */
body::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0.13; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Gentle darkening so the panel always reads well over a busy photo */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg, rgba(6, 14, 10, 0.05) 0%, rgba(6, 14, 10, 0.45) 100%);
}

button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.auth-stage {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 40px 24px;
}
.auth-frame {
  width: 100%; max-width: 1100px; min-height: 680px;
  display: grid; grid-template-columns: 1fr 460px;
  border-radius: var(--radius-card);
}
/* Left: a glass window onto the photo */
.auth-window {
  position: relative;
  border-radius: var(--radius-card) 0 0 var(--radius-card);
  background: rgba(239, 234, 219, 0.035);
  border: 1px solid rgba(239, 234, 219, 0.09);
  border-right: 0;
  backdrop-filter: brightness(1.12) saturate(1.08);
  -webkit-backdrop-filter: brightness(1.12) saturate(1.08);
  display: flex; align-items: flex-end;
  padding: 36px 40px;
}
.auth-caption { color: var(--paper); opacity: 0.85; max-width: 340px; }
.auth-caption .kicker { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.auth-caption .line { font-size: 22px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.3; }

/* Right: the solid panel */
.auth-panel {
  position: relative;
  background: var(--panel);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  padding: 44px 48px 36px;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.auth-body { margin: auto 0; padding: 40px 0 24px; }

/* ---------- Brand ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 19px; letter-spacing: -0.02em; color: var(--paper); text-decoration: none; }
.wordmark .dot { color: var(--gold); }
.mark { width: 30px; height: 30px; flex-shrink: 0; }

/* ---------- Type ---------- */
.auth-panel h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 6px; line-height: 1.15; }
.lede { color: var(--text-2); margin: 0 0 28px; }

/* ---------- Form ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.input {
  width: 100%; height: 48px; padding: 0 16px;
  background: rgba(239, 234, 219, 0.05);
  border: 1px solid var(--line);
  border-radius: 10px; outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: var(--line-strong); }
.input:focus { border-color: rgba(200, 162, 78, 0.7); background: rgba(239, 234, 219, 0.07); box-shadow: 0 0 0 3px var(--gold-soft); }
/* Stop Chrome painting autofilled fields bright yellow */
.input:-webkit-autofill { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 40px #17221c inset; caret-color: var(--text); }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--text-3); cursor: pointer;
  font-size: 12px; font-weight: 500; padding: 8px 10px; border-radius: 8px;
}
.pw-toggle:hover { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 48px; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: 15px; border: 1px solid transparent;
  transition: background .15s, transform .05s, box-shadow .15s, border-color .15s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--paper); color: var(--racing-deep); margin-top: 12px; }
.btn-primary:hover { background: #f7f3e7; box-shadow: 0 0 0 4px var(--gold-soft); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: rgba(239, 234, 219, 0.06); }
.btn:focus-visible, .link-btn:focus-visible, .pw-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.msg { font-size: 14px; margin: -8px 0 18px; padding: 10px 14px; border-radius: 10px; }
.msg-error { color: var(--danger); background: rgba(232, 165, 152, 0.08); border: 1px solid rgba(232, 165, 152, 0.18); }
.msg-ok { color: var(--paper); background: var(--gold-soft); border: 1px solid rgba(200, 162, 78, 0.3); }
#resendInline { margin: -6px 0 18px; }

/* ---------- Footer ---------- */
.auth-foot { text-align: center; font-size: 14px; color: var(--text-2); }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--paper); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(200, 162, 78, 0.7); }
.link-btn:hover { color: #fff; text-decoration-color: var(--gold); }

/* ---------- Inbox / verify states ---------- */
.state-icon {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 22px;
  display: grid; place-items: center;
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid rgba(200, 162, 78, 0.25);
}
.email-chip { display: inline-block; font-weight: 600; color: var(--paper); padding: 2px 0; border-bottom: 1px solid rgba(200, 162, 78, 0.55); word-break: break-all; }
.fine { color: var(--text-3); font-size: 13px; margin: 18px 0 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--gold-soft); border-top-color: var(--gold); animation: spin .8s linear infinite; margin-bottom: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Soft entrance */
.auth-frame { animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-frame, .spinner { animation: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth-frame { grid-template-columns: 1fr; max-width: 460px; min-height: 0; }
  .auth-window { display: none; }
  .auth-panel { border-radius: var(--radius-card); min-height: 600px; }
}
@media (max-width: 520px) {
  .auth-stage { padding: 0; place-items: stretch; }
  .auth-frame { max-width: none; }
  .auth-panel { border-radius: 0; min-height: 100vh; min-height: 100dvh; padding: 28px 22px 28px; background: rgba(9, 19, 14, 0.86); }
  .auth-panel h1 { font-size: 27px; }
  .input { font-size: 16px; } /* stops iOS zooming into fields */
}
