/* ─────────────────────────  styles/login.css  ────────────────────────
   Login / Forgot / Reset password pages.

   Brand tokens (color/space/type/shadow/radius) come from tokens.css.
   This file is purely the visual treatment for these auth surfaces.

   Layout: split-pane on ≥lg (verse left, form right). Stacked on small.
   Verse pane carries the brand voice; form pane is calm and tactile.
   ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ek-bg);
  color: var(--ek-fg);
}

/* ── Container: stacked on mobile, side-by-side on ≥lg ──────────────── */
.ek-login-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (min-width: 992px) {
  .ek-login-container {
    flex-direction: row;
  }
}

/* ─────────────────────────  VERSE PANE  ───────────────────────────────
   Sanctuary moment. Members arrive here under load — the visual job is
   to communicate "you're somewhere meaningful" in under a second.
   Gradient is mid-deep green (not near-black) so it reads as sanctuary
   light, not gloom. A radial gold tint top-left adds warmth without
   competing. A dotted texture suggests stained-glass without literal-ising.
   ─────────────────────────────────────────────────────────────────── */
.ek-login-verse {
  position: relative;
  flex: none;
  color: #fff;
  text-align: center;
  padding: var(--ek-space-10) var(--ek-space-6);
  background:
    radial-gradient(ellipse at top left,
        rgba(199, 164, 74, .18), transparent 55%),
    radial-gradient(ellipse at bottom right,
        rgba(255, 140, 84, .10), transparent 60%),
    linear-gradient(165deg,
        var(--ek-green-600) 0%,
        var(--ek-green-700) 55%,
        var(--ek-green-800) 100%);
  overflow: hidden;
  isolation: isolate;
}

/* Subtle dotted texture — implies depth without distracting from copy */
.ek-login-verse::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 14px 14px;
  pointer-events: none;
  z-index: -1;
  mask-image: radial-gradient(circle at center, #000 30%, transparent 80%);
}

@media (min-width: 992px) {
  .ek-login-verse {
    flex: 1;
    padding: var(--ek-space-16) var(--ek-space-12);
  }
}

/* Logo in the verse pane — confident size, soft glow */
.ek-login-logo {
  width: 96px;
  height: 96px;
  border-radius: var(--ek-radius-xl);
  background: #fff;
  padding: var(--ek-space-3);
  margin: 0 auto var(--ek-space-8);
  box-shadow:
    var(--ek-shadow-lg),
    0 0 0 1px rgba(255, 255, 255, .08);
  object-fit: contain;
}
@media (min-width: 768px) { .ek-login-logo { width: 120px; height: 120px; } }
@media (min-width: 992px) { .ek-login-logo { width: 140px; height: 140px; } }

/* The verse itself — Fraunces serif, optical sized for display.
   Members see this every login; it deserves the warmest typography. */
.ek-verse {
  font-family: var(--ek-font-display);
  font-weight: var(--ek-weight-medium);
  font-style: italic;
  font-optical-sizing: auto;
  font-size: clamp(1.25rem, 2vw + 0.75rem, 1.75rem);
  line-height: var(--ek-leading-snug);
  letter-spacing: var(--ek-track-tight);
  margin: 0 auto var(--ek-space-4);
  max-width: 28ch;
  color: #fff;
}

.ek-verse-ref {
  display: block;
  margin-top: var(--ek-space-3);
  font-family: var(--ek-font-ui);
  font-style: normal;
  font-weight: var(--ek-weight-semibold);
  font-size: var(--ek-text-sm);
  letter-spacing: var(--ek-track-wide);
  text-transform: uppercase;
  color: var(--ek-gold-200);
  opacity: .92;
}

/* Mission strap — calmer body voice */
.ek-mission {
  font-family: var(--ek-font-ui);
  font-size: var(--ek-text-base);
  line-height: var(--ek-leading-relaxed);
  margin: var(--ek-space-10) auto 0;
  max-width: 36ch;
  color: rgba(255, 255, 255, .82);
}

/* ─────────────────────────  FORM PANE  ────────────────────────────────
   Calm, tactile, warm-tinted background (not pure white) so members feel
   they're inside a finished room, not on a scratch page.
   ─────────────────────────────────────────────────────────────────── */
.ek-login-form {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--ek-space-8) var(--ek-space-6);
  background:
    radial-gradient(ellipse at top right,
        var(--ek-peach-50) 0%, transparent 55%),
    var(--ek-bg);
}

@media (min-width: 992px) {
  .ek-login-form {
    padding: var(--ek-space-16) var(--ek-space-12);
  }
}

/* Card wrapper — bigger radius, lifted shadow, hairline border for definition */
.ek-card {
  width: 100%;
  max-width: 440px;
  background: var(--ek-bg-elevated);
  border: 1px solid var(--ek-border);
  border-radius: var(--ek-radius-xl);
  box-shadow: var(--ek-shadow-lg);
  overflow: visible;
}

.ek-card .card-body {
  padding: var(--ek-space-10) var(--ek-space-8);
}
@media (min-width: 576px) {
  .ek-card .card-body {
    padding: var(--ek-space-12) var(--ek-space-10);
  }
}

/* Tiny header logo on form side so branding feels balanced */
.ek-form-mark {
  display: flex;
  justify-content: center;
  margin-bottom: var(--ek-space-6);
}
.ek-form-mark img {
  width: 56px;
  height: 56px;
  border-radius: var(--ek-radius-md);
  object-fit: contain;
  background: var(--ek-bg-elevated);
  border: 1px solid var(--ek-border);
  padding: var(--ek-space-2);
}

/* Welcome heading — Fraunces, restrained but warm */
.ek-form-title {
  font-family: var(--ek-font-display);
  font-weight: var(--ek-weight-semibold);
  font-optical-sizing: auto;
  font-size: var(--ek-text-3xl);
  line-height: var(--ek-leading-tight);
  letter-spacing: var(--ek-track-tight);
  color: var(--ek-fg);
  margin: 0 0 var(--ek-space-2);
  text-align: center;
}

.ek-form-subtitle {
  text-align: center;
  font-size: var(--ek-text-base);
  color: var(--ek-fg-muted);
  margin: 0 0 var(--ek-space-8);
}

/* ── Inputs — bigger, calmer, easier on thumbs ─────────────────────── */
.ek-card .form-label {
  font-weight: var(--ek-weight-medium);
  font-size: var(--ek-text-sm);
  color: var(--ek-fg-muted);
  margin-bottom: var(--ek-space-2);
  letter-spacing: var(--ek-track-wide);
}

.ek-input,
.ek-card .form-control {
  width: 100%;
  height: auto;
  padding: var(--ek-space-3) var(--ek-space-4);
  font-family: var(--ek-font-ui);
  font-size: var(--ek-text-base);
  line-height: 1.4;
  color: var(--ek-fg);
  background: var(--ek-bg-elevated);
  border: 1.5px solid var(--ek-border-strong);
  border-radius: var(--ek-radius-md);
  transition:
    border-color var(--ek-duration-fast) var(--ek-ease),
    box-shadow var(--ek-duration-fast) var(--ek-ease),
    background var(--ek-duration-fast) var(--ek-ease);
  appearance: none;
}

.ek-input:hover,
.ek-card .form-control:hover {
  border-color: var(--ek-gray-400);
}

.ek-input:focus,
.ek-card .form-control:focus {
  outline: none;
  border-color: var(--ek-green-500);
  box-shadow: 0 0 0 4px rgba(31, 102, 81, .14);
  background: var(--ek-bg-elevated);
}

/* Password input with reveal-toggle button overlay */
.ek-pwd {
  position: relative;
}
.ek-pwd .ek-input { padding-right: 2.75rem; }
.ek-pwd-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--ek-fg-subtle);
  border-radius: var(--ek-radius-sm);
  cursor: pointer;
  transition: color var(--ek-duration-fast) var(--ek-ease),
              background var(--ek-duration-fast) var(--ek-ease);
}
.ek-pwd-toggle:hover {
  color: var(--ek-fg);
  background: var(--ek-bg-muted);
}
.ek-pwd-toggle:focus-visible {
  outline: 2px solid var(--ek-gold-400);
  outline-offset: 2px;
}

/* ── Remember-me checkbox — bigger tap target ──────────────────────── */
.ek-card .form-check {
  padding: 0;
  margin-bottom: var(--ek-space-6);
  display: flex;
  align-items: center;
  gap: var(--ek-space-3);
  min-height: 24px;
}
.ek-card .form-check-input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  margin-top: 0;
  border-radius: 6px;
  border: 1.5px solid var(--ek-border-strong);
  cursor: pointer;
  flex-shrink: 0;
}
.ek-card .form-check-input:checked {
  background-color: var(--ek-green-700);
  border-color: var(--ek-green-700);
}
.ek-card .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(31, 102, 81, .2);
  border-color: var(--ek-green-500);
}
.ek-card .form-check-label {
  font-size: var(--ek-text-sm);
  color: var(--ek-fg-muted);
  cursor: pointer;
  margin: 0;
}

/* ── Primary CTA — confident green, not yellow ─────────────────────── */
.btn-ek-gold,
.ek-card .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ek-space-2);
  width: 100%;
  padding: var(--ek-space-4) var(--ek-space-5);
  font-family: var(--ek-font-ui);
  font-size: var(--ek-text-base);
  font-weight: var(--ek-weight-semibold);
  letter-spacing: var(--ek-track-wide);
  color: #fff;
  background: linear-gradient(180deg,
      var(--ek-green-600) 0%,
      var(--ek-green-700) 100%);
  border: 1px solid var(--ek-green-800);
  border-radius: var(--ek-radius-md);
  box-shadow:
    var(--ek-shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, .08);
  transition:
    transform var(--ek-duration-fast) var(--ek-ease),
    box-shadow var(--ek-duration-fast) var(--ek-ease),
    background var(--ek-duration-fast) var(--ek-ease);
  cursor: pointer;
}

.btn-ek-gold:hover,
.ek-card .btn-primary:hover {
  background: linear-gradient(180deg,
      var(--ek-green-700) 0%,
      var(--ek-green-800) 100%);
  box-shadow: var(--ek-shadow-md);
  color: #fff;
  transform: translateY(-1px);
}

.btn-ek-gold:active,
.ek-card .btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--ek-shadow-xs);
}

.btn-ek-gold:focus-visible,
.ek-card .btn-primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(199, 164, 74, .35),
    var(--ek-shadow-sm);
}

/* ── Forgot-password link — calm, not loud ─────────────────────────── */
.ek-forgot-link {
  display: inline-block;
  margin-top: var(--ek-space-4);
  font-size: var(--ek-text-sm);
  font-weight: var(--ek-weight-medium);
  color: var(--ek-fg-muted);
  text-decoration: none;
  transition: color var(--ek-duration-fast) var(--ek-ease);
}
.ek-forgot-link:hover,
.ek-forgot-link:focus {
  color: var(--ek-green-700);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ── Validation feedback ───────────────────────────────────────────── */
.was-validated .form-control:invalid,
.ek-card .form-control.is-invalid {
  border-color: var(--ek-danger-500);
}
.was-validated .form-control:invalid:focus {
  box-shadow: 0 0 0 4px rgba(217, 45, 32, .14);
}
.invalid-feedback {
  font-size: var(--ek-text-xs);
  color: var(--ek-danger-600);
  margin-top: var(--ek-space-1);
}

/* ── Alert tweaks (login error pane) ───────────────────────────────── */
.ek-card .alert {
  border-radius: var(--ek-radius-md);
  font-size: var(--ek-text-sm);
  padding: var(--ek-space-3) var(--ek-space-4);
  border: 1px solid transparent;
  margin-bottom: var(--ek-space-6);
}
.ek-card .alert-danger {
  background: var(--ek-peach-50);
  border-color: rgba(180, 35, 24, .15);
  color: var(--ek-danger-600);
}
.ek-card .alert-info {
  background: var(--ek-green-50);
  border-color: rgba(20, 74, 58, .15);
  color: var(--ek-green-700);
}

/* ── Verse + form panes share full height on ≥lg ───────────────────── */
@media (min-width: 992px) {
  .ek-login-verse,
  .ek-login-form {
    min-height: 100vh;
  }
}

/* ── PWA install toast — subtler treatment ─────────────────────────── */
#pwaToast {
  background: var(--ek-green-800) !important;
  color: #fff !important;
  border-radius: var(--ek-radius-md) !important;
  box-shadow: var(--ek-shadow-lg) !important;
  font-size: var(--ek-text-sm);
}
#pwaToast .btn-ek-gold {
  width: auto;
  padding: var(--ek-space-2) var(--ek-space-3);
  font-size: var(--ek-text-xs);
  border: 0;
  background: var(--ek-gold-400);
  color: var(--ek-green-900);
}
#pwaToast .btn-ek-gold:hover {
  background: var(--ek-gold-300);
  transform: none;
}

/* ── Permanent-login hint + register footer link ──────────────────── */
.ek-form-hint {
  margin: var(--ek-space-2) 0 var(--ek-space-4);
  font-size: var(--ek-text-xs);
  color: var(--ek-fg-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ek-form-hint i { color: var(--ek-green-700); }
.ek-login-foot {
  margin-top: var(--ek-space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ek-space-2);
  flex-wrap: wrap;
  font-size: var(--ek-text-sm);
}
.ek-foot-sep { color: var(--ek-fg-subtle); }
.ek-register-link {
  color: var(--ek-green-700);
  text-decoration: none;
  font-weight: var(--ek-weight-semibold);
}
.ek-register-link:hover { text-decoration: underline; }
