/* ========================================================
   gyouji — auth.css
   Centered card layout · Gyouji brand palette · Trilingual
   ======================================================== */

:root {
  /* Gyouji primary — deep crimson */
  --brand:        #8a1724;
  --brand-dark:   #6b1019;
  --brand-mid:    #9e1e2c;
  --brand-light:  #fbeaec;

  /* Gyouji accent — warm gold */
  --gold:         #c6b67e;
  --gold-dark:    #a8965c;
  --gold-light:   #f5eedb;

  /* Page background — gyouji crimson */
  --page-bg:      #6e151e;

  /* Card greys — warm-tinted */
  --grey-50:  #fdf9f5;
  --grey-100: #f4ede5;
  --grey-200: #e5d8cc;
  --grey-300: #ccbfb0;
  --grey-400: #a0907f;
  --grey-500: #786960;
  --grey-600: #564a43;
  --grey-700: #3a2f2a;
  --grey-900: #1a1210;

  /* Radius */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-xl:   22px;
  --r-full: 100px;

  /* Shadows */
  --shadow-card:  0 0 0 1px rgba(255,255,255,0.07), 0 8px 32px rgba(0,0,0,0.35), 0 36px 88px rgba(0,0,0,0.55);
  --shadow-brand: 0 4px 20px rgba(138,23,36,0.38);
  --shadow-gold:  0 4px 20px rgba(198,182,126,0.38);

  /* Typography */
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t:    0.2s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--grey-900);
  min-height: 100vh;
  background: #6e151e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Abstract geometric SVG layer */
.bg-art {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── Lang bar (fixed top-right, light text on dark bg) ── */
.lang-bar {
  position: fixed;
  top: 20px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 100;
}

.lang-opt {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.28);
  cursor: pointer;
  padding: 4px 2px;
  transition: color var(--t) var(--ease);
}
.lang-opt:hover  { color: rgba(255,255,255,0.65); }
.lang-opt.active { color: var(--gold); font-weight: 600; }

.lang-divider {
  color: rgba(255,255,255,0.12);
  font-size: 0.72rem;
  user-select: none;
}

/* ── Auth shell ── */
.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ── Auth card ── */
.auth-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255,255,255,0.05);
  padding: 48px 48px 52px;
  overflow: hidden;
  animation: cardIn 0.4s var(--ease) both;
}

/* Gold-to-crimson accent bar at top */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--brand) 100%);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ── */
.auth-logo-wrap {
  display: flex;
  justify-content: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--grey-100);
  margin-bottom: 32px;
}
.auth-logo-wrap img {
  max-height: 72px;
  max-width: 240px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* ── Mobile notice ── */
.mobile-notice {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: var(--gold-light);
  border: 1px solid #e0d4aa;
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 0.78rem;
  color: #5a4520;
  line-height: 1.5;
  margin-bottom: 24px;
}
.mobile-notice-content { display: flex; gap: 8px; align-items: flex-start; flex: 1; }
.mobile-notice-content i { flex-shrink: 0; margin-top: 1px; }
.mobile-notice-close {
  background: none; border: none; color: #5a4520;
  cursor: pointer; padding: 0; font-size: 0.85rem;
  opacity: 0.55; flex-shrink: 0; line-height: 1;
}
.mobile-notice-close:hover { opacity: 1; }

/* ── Auth views ── */
.auth-view {
  display: none;
  flex-direction: column;
  animation: viewIn 0.28s var(--ease) both;
}
.auth-view.active { display: flex; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Form header ── */
.form-header { margin-bottom: 28px; }
.form-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--grey-900);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.form-sub {
  font-size: 0.875rem;
  color: var(--grey-400);
  line-height: 1.5;
}

/* ── Form ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--grey-600);
  letter-spacing: 0.01em;
}

.field-wrap { position: relative; display: flex; align-items: center; }

.field-icon {
  position: absolute; left: 14px;
  color: var(--grey-400); font-size: 0.875rem;
  pointer-events: none; transition: color var(--t) var(--ease);
}

.field-input {
  width: 100%; height: 46px; padding: 0 14px 0 40px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--r-md);
  background: var(--grey-50);
  font-family: var(--font-body); font-size: 0.9rem; color: var(--grey-900);
  outline: none; transition: all var(--t) var(--ease); appearance: none;
}
.field-input::placeholder { color: var(--grey-400); }
.field-input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-light);
}
.field-wrap:focus-within .field-icon { color: var(--brand); }

/* No icon variant */
#reg-last { padding-left: 14px; }

/* Select */
.select-wrap .field-input { padding-right: 38px; cursor: pointer; }
.select-chevron {
  position: absolute; right: 12px;
  color: var(--grey-400); font-size: 0.7rem; pointer-events: none;
}

/* Two-col */
.field-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Checkbox ── */
.checkbox-label {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; font-size: 0.82rem; color: var(--grey-600); line-height: 1.5;
}
.checkbox-input { display: none; }
.checkbox-custom {
  width: 17px; height: 17px; min-width: 17px;
  border: 1.5px solid var(--grey-300); border-radius: 5px;
  background: var(--grey-50);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t) var(--ease); margin-top: 1px;
}
.checkbox-input:checked + .checkbox-custom { background: var(--brand); border-color: var(--brand); }
.checkbox-input:checked + .checkbox-custom::after {
  content: ''; width: 9px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.link-inline { color: var(--brand); text-decoration: none; font-weight: 500; }
.link-inline:hover { text-decoration: underline; }

/* ── Buttons ── */
.btn-primary {
  width: 100%; height: 48px;
  border-radius: var(--r-md); border: none;
  background: linear-gradient(135deg, var(--brand-mid) 0%, var(--brand-dark) 100%);
  color: #fff;
  font-family: var(--font-body); font-size: 0.92rem; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--t) var(--ease);
  box-shadow: var(--shadow-brand);
  letter-spacing: 0.02em; margin-top: 4px;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(138,23,36,0.48);
}
.btn-primary:active { transform: translateY(0); }

.btn-primary.loading { pointer-events: none; opacity: 0.8; }
.btn-primary.loading::after {
  content: ''; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.6s linear infinite; margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Register CTA — warm gold, dark text */
.btn-register {
  height: 52px; font-size: 0.95rem;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--grey-900);
  box-shadow: var(--shadow-gold);
}
.btn-register:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(198,182,126,0.48);
  color: var(--grey-900);
}

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--r-md);
  border: 1.5px solid var(--grey-200); background: transparent;
  font-family: var(--font-body); font-size: 0.84rem; font-weight: 500;
  color: var(--grey-700); cursor: pointer; transition: all var(--t) var(--ease);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

.link-btn {
  background: none; border: none; font-family: var(--font-body);
  font-size: 0.84rem; font-weight: 500; color: var(--brand);
  cursor: pointer; padding: 0; transition: color var(--t) var(--ease);
}
.link-btn:hover { color: var(--brand-dark); }

.btn-create-account {
  display: block; width: 100%; height: 44px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--brand);
  background: transparent;
  font-family: var(--font-body); font-size: 0.88rem; font-weight: 600;
  color: var(--brand); cursor: pointer;
  transition: all var(--t) var(--ease); letter-spacing: 0.02em;
}
.btn-create-account:hover { background: var(--brand-light); transform: translateY(-1px); }

/* ── Form note ── */
.form-note {
  font-size: 0.74rem; color: var(--grey-400);
  text-align: center; line-height: 1.55; margin-top: -2px;
}

/* ── Error ── */
.error-msg {
  display: none;
  background: #fef2f2; border: 1px solid #fecaca;
  border-left: 3px solid #ef4444; border-radius: var(--r-sm);
  padding: 10px 14px; font-size: 0.82rem; color: #dc2626;
  line-height: 1.5; margin-top: 4px;
}

/* ── Magic link sent state ── */
.magic-sent {
  display: none; flex-direction: column; align-items: center;
  text-align: center; padding: 16px 0 8px; gap: 12px;
  animation: viewIn 0.35s var(--ease) both;
}
.magic-sent.visible { display: flex; }

.magic-sent-icon {
  width: 60px; height: 60px; border-radius: 18px;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--brand); margin-bottom: 4px;
}
.magic-sent-title {
  font-family: var(--font-display); font-size: 1.15rem;
  font-weight: 400; color: var(--grey-900);
}
.magic-sent-body { font-size: 0.875rem; color: var(--grey-500); line-height: 1.6; }
.magic-sent-body strong { color: var(--grey-900); }

/* ── Auth switch ── */
.auth-switch { margin-top: 24px; text-align: center; }
.auth-switch-label { font-size: 0.84rem; color: var(--grey-500); margin-bottom: 10px; }

.reg-switch {
  margin-top: 20px; text-align: center;
  font-size: 0.84rem; color: var(--grey-500);
}

/* ── Page entry ── */
.lang-bar { animation: fadeDown 0.4s var(--ease) 0.1s both; }
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */

@media (max-width: 640px) and (min-width: 481px) {
  .auth-card { padding: 44px 36px 48px; }
}

/* Mobile — full-width, white bg */
@media (max-width: 480px) {
  body {
    padding: 0;
    justify-content: flex-start;
    background: #fff;
  }
  .bg-art { display: none; }

  /* Swap lang bar to dark-on-white */
  .lang-bar { top: 16px; right: 16px; }
  .lang-opt { color: var(--grey-400); }
  .lang-opt:hover { color: var(--grey-700); }
  .lang-opt.active { color: var(--brand); }
  .lang-divider { color: var(--grey-300); }

  .auth-card {
    border-radius: 0; border: none; box-shadow: none;
    max-width: 100%; padding: 76px 22px 48px;
    min-height: 100svh; overflow: visible;
  }
  .auth-card::before {
    background: linear-gradient(90deg, var(--gold) 0%, var(--brand) 100%);
  }

  .auth-logo-wrap { padding-bottom: 28px; margin-bottom: 28px; }
  .auth-logo-wrap img { max-height: 60px; }

  .mobile-notice { display: flex; }
  .field-row.two-col { grid-template-columns: 1fr; gap: 16px; }
}
