/**
 * FM-DS-002 — FikiriaMaisha Auth Experience
 * Ceremonial entrance: hierarchy, trust, depth, calm motion.
 */

:root {
  --fm-002-deep: #0e2a21;
  --fm-002-forest: #1a4032;
  --fm-002-forest-mid: #214f3b;
  --fm-002-sage: #8fa59a;
  --fm-002-graphite: #4b514e;
  --fm-002-ivory: #f4f0e6;
  --fm-002-ivory-deep: #ebe4d6;
  --fm-002-ink: #24302b;
  --fm-002-muted: #5c6861;
  --fm-002-cream-text: #f7f4ec;
  --fm-002-word-f: #4b514e;
  --fm-002-word-m: #1e4a38;
}

body.fm-ds-002-auth {
  --fm-auth-primary: var(--fm-002-forest-mid);
}

/* Deep institutional canvas — layered, not a spotlight */
body.fm-ds-002-auth #auth-session-overlay.fm-ds-001c-overlay,
body.fma-applicant-auth-only.fm-ds-002-auth #auth-session-overlay {
  position: fixed !important;
  inset: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: var(--fm-002-deep) !important;
  background-image:
    linear-gradient(152deg, rgba(14, 42, 33, 0.98) 0%, rgba(26, 64, 50, 0.92) 42%, rgba(58, 66, 62, 0.9) 72%, rgba(75, 81, 78, 0.94) 100%),
    linear-gradient(28deg, rgba(75, 81, 78, 0.55) 0%, transparent 48%),
    linear-gradient(210deg, rgba(143, 165, 154, 0.18) 0%, transparent 46%) !important;
  padding: 28px 20px 24px !important;
  z-index: 10050 !important;
}

/* Hide operational chrome while ceremonial auth is open */
body.fm-ds-002-auth.fm-ds-001c-auth #sidebar,
body.fm-ds-002-auth.fm-ds-001c-auth #main,
body.fm-ds-002-auth.fm-ds-001c-auth #sb-resize,
body.fm-ds-002-auth.fm-ds-001c-auth #cal-dock {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.fm-ds-002-auth #auth-session-overlay.fm-ds-001c-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(14, 42, 33, 0.35) 0%, transparent 28%),
    linear-gradient(0deg, rgba(14, 42, 33, 0.4) 0%, transparent 30%),
    linear-gradient(90deg, rgba(14, 42, 33, 0.32) 0%, transparent 26%),
    linear-gradient(270deg, rgba(75, 81, 78, 0.28) 0%, transparent 26%);
  z-index: 0;
}

/* Soft warm light wash behind card — diffuse bloom, not a spotlight */
body.fm-ds-002-auth #auth-session-overlay.fm-ds-001c-overlay::after {
  content: '';
  position: fixed;
  left: 50%;
  top: 48%;
  width: min(640px, 86vw);
  height: min(560px, 70vh);
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(244, 240, 230, 0.14) 0%, rgba(244, 240, 230, 0.05) 48%, transparent 74%);
  filter: blur(28px);
  opacity: 0.75;
  z-index: 0;
}

#fm-ds-001c-root.fm-ds-002-root {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
}

/* Giant institutional watermark behind the card */
.fm-ds-002-watermark {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(720px, 120vw);
  height: auto;
  transform: translate(-50%, -50%);
  opacity: 0.028;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  object-fit: contain;
}

.fm-ds-002-stage {
  position: relative;
  z-index: 1;
}

/* Premium paper card */
body.fm-ds-002-auth .fm-auth-card {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.55) 0%, transparent 28%),
    linear-gradient(180deg, var(--fm-002-ivory) 0%, var(--fm-002-ivory-deep) 100%);
  border: 1px solid rgba(52, 93, 71, 0.22);
  border-radius: 26px;
  padding: 32px 34px 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 1px 2px rgba(18, 40, 31, 0.06),
    0 28px 64px rgba(12, 32, 26, 0.22);
  overflow: hidden;
}
body.fm-ds-002-auth .fm-auth-card::before {
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(143, 165, 154, 0.7) 22%, rgba(33, 79, 59, 0.85) 50%, rgba(75, 81, 78, 0.65) 78%, transparent);
}

/* Hierarchy — bird is the emotional anchor (+25% size) */
body.fm-ds-002-auth .fm-auth-brand {
  gap: 8px;
  margin-bottom: 18px;
}
body.fm-ds-002-auth .fm-auth-mark {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
body.fm-ds-002-auth .fm-auth-mark {
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
}
body.fm-ds-002-auth .fm-auth-mark img {
  height: clamp(132px, 18vw, 168px) !important;
  max-height: none !important;
  max-width: min(210px, 54vw) !important;
  width: auto !important;
  object-fit: contain !important;
}

body.fm-ds-002-auth .fm-auth-name {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-size: 1.72rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 4px 0 0;
}
body.fm-ds-002-auth .fm-auth-name .wm-f { color: var(--fm-002-word-f); }
body.fm-ds-002-auth .fm-auth-name .wm-m { color: var(--fm-002-word-m); }

body.fm-ds-002-auth .fm-auth-tagline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px;
  font-style: italic;
  font-weight: 400;
  color: var(--fm-002-muted);
  margin: 4px 0 0;
  letter-spacing: 0.01em;
}

body.fm-ds-002-auth .fm-auth-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--fm-002-ink);
  margin: 18px 0 6px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
body.fm-ds-002-auth .fm-auth-title-sub {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #31453c;
  margin: 0 0 12px;
  text-align: center;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

body.fm-ds-002-auth .fm-auth-purpose {
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fm-002-muted);
  margin: 0 auto 18px;
  max-width: 30em;
}

/* Trust — quiet reassurance */
.fm-ds-002-trust {
  text-align: center;
  margin: 0 0 22px;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
}
.fm-ds-002-trust-line {
  margin: 0;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5f7268;
}
.fm-ds-002-trust-sub {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: #6a766f;
}

body.fm-ds-002-auth .fm-auth-actions {
  gap: 12px;
}

/* Primary — deep forest with quiet depth */
body.fm-ds-002-auth .fm-auth-btn-primary {
  background: linear-gradient(180deg, #2a5c45 0%, #214f3b 48%, #183d2e 100%);
  border: 1px solid #163528;
  color: var(--fm-002-cream-text);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 8px 18px rgba(16, 46, 36, 0.22);
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  font-weight: 650;
}
body.fm-ds-002-auth .fm-auth-btn-primary:hover {
  background: linear-gradient(180deg, #316a50 0%, #214f3b 55%, #163528 100%);
}
body.fm-ds-002-auth .fm-auth-btn-primary:active {
  background: #102e24;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

body.fm-ds-002-auth .fm-auth-btn-secondary {
  background: rgba(244, 240, 230, 0.95);
  color: var(--fm-002-forest-mid);
  border: 1.5px solid var(--fm-002-forest-mid);
  border-radius: 12px;
  box-shadow: none;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  font-weight: 650;
}
body.fm-ds-002-auth .fm-auth-btn-secondary:hover {
  background: rgba(143, 165, 154, 0.24);
}

/* Reduced footer weight */
body.fm-ds-002-auth .fm-auth-legal-footer {
  margin-top: 22px;
  font-size: 11px;
  color: #7a857e;
  letter-spacing: 0.01em;
}
body.fm-ds-002-auth .fm-auth-legal-footer .fm-auth-legal-links {
  margin-bottom: 6px;
  gap: 12px;
}
body.fm-ds-002-auth .fm-auth-legal-footer a,
body.fm-ds-002-auth .fm-auth-legal-footer button {
  color: #6d7a72;
  font-weight: 550;
  font-size: 11px;
}
body.fm-ds-002-auth .fm-auth-legal-copy {
  margin: 0;
  font-size: 10.5px;
  color: #87918b;
}

/* Entrance motion — fade upward, staggered, calm */
@media (prefers-reduced-motion: no-preference) {
  body.fm-ds-002-auth .fm-ds-002-enter {
    opacity: 0;
    transform: translateY(10px);
    animation: fmDs002Enter 340ms ease-out forwards;
  }
  body.fm-ds-002-auth .fm-ds-002-enter-1 { animation-delay: 40ms; }
  body.fm-ds-002-auth .fm-ds-002-enter-2 { animation-delay: 110ms; }
  body.fm-ds-002-auth .fm-ds-002-enter-3 { animation-delay: 180ms; }
  body.fm-ds-002-auth .fm-ds-002-enter-4 { animation-delay: 250ms; }
  body.fm-ds-002-auth .fm-ds-002-enter-5 { animation-delay: 300ms; }
  body.fm-ds-002-auth .fm-ds-002-enter-6 { animation-delay: 340ms; }
  body.fm-ds-002-auth .fm-ds-002-enter-7 { animation-delay: 380ms; }
}

@keyframes fmDs002Enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  body.fm-ds-002-auth .fm-ds-002-enter {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Signup / wizard family consistency */
body.fm-ds-002-auth.fma-applicant-shell.fm-ds-001c-applicant:not(.fma-crm-ready) #main,
body.fm-ds-002-auth.fm-ds-001c-applicant:not(.fma-crm-ready) #main {
  background-color: var(--fm-002-deep) !important;
  background-image:
    linear-gradient(152deg, rgba(14, 42, 33, 0.98) 0%, rgba(26, 64, 50, 0.9) 50%, rgba(75, 81, 78, 0.92) 100%) !important;
}
body.fm-ds-002-auth #fm-ds-001c-wizard .fm-wiz-card {
  background: linear-gradient(180deg, #f7f3ea 0%, #ebe4d6 100%);
  border-color: rgba(52, 93, 71, 0.22);
  border-radius: 22px;
}
body.fm-ds-002-auth #fm-ds-001c-wizard .fm-auth-btn-primary {
  background: linear-gradient(180deg, #2a5c45 0%, #214f3b 50%, #183d2e 100%);
  color: var(--fm-002-cream-text);
}

@media (max-width: 640px) {
  body.fm-ds-002-auth .fm-auth-card {
    padding: 28px 18px 22px;
    border-radius: 20px;
  }
  body.fm-ds-002-auth .fm-auth-mark img {
    height: clamp(120px, 28vw, 148px) !important;
    max-height: none !important;
  }
  body.fm-ds-002-auth .fm-auth-title { font-size: 1.7rem; }
  body.fm-ds-002-auth .fm-auth-title-sub { font-size: 1.05rem; }
  body.fm-ds-002-auth .fm-auth-actions .fm-auth-btn { width: 100%; }
  .fm-ds-002-watermark { width: 140vw; opacity: 0.022; }
}
