/* Tilfully login gate — agricultural sunrise + topographic contours.
   Everything is scoped under #loginView so none of it leaks into the app view. */

#loginView {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  color: #fff;
  font-family: var(--t-sans);
  -webkit-font-smoothing: antialiased;
  background: var(--t-gradient);
}

#loginView .auth-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#loginView #authTopo { position: absolute; inset: 0; width: 100%; height: 100%; }
#loginView .auth-scrim { position: absolute; inset: 0; background: rgba(4, 14, 10, 0.42); }

#loginView .auth-brand {
  position: absolute; z-index: 2;
  top: max(16px, env(safe-area-inset-top)); left: clamp(20px, 5vw, 44px);
  font-family: var(--t-serif);
  font-weight: 600; font-size: 1.4rem; letter-spacing: 0.005em; text-shadow: 0 1px 18px rgba(0, 0, 0, 0.35);
}

#loginView .auth-wrap {
  /* height:100% (not just min-height) so this is the bounded scroller — the
     parent #loginView is fixed+overflow:hidden, so without a height cap this
     wrapper grew to the card's height and its overflow-y:auto never engaged,
     clipping the card's lower half on short viewports (Josh, 2026-07-16). */
  position: relative; z-index: 1; height: 100%; min-height: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: max(84px, calc(env(safe-area-inset-top) + 70px)) 22px max(58px, calc(env(safe-area-inset-bottom) + 52px));
  overflow-y: auto;
}

#loginView .auth-card {
  width: 100%; max-width: 400px; margin: auto 0;
  background: var(--t-glass); border: 1px solid var(--t-glass-line); border-radius: 24px;
  padding: 30px 28px 26px;
  -webkit-backdrop-filter: blur(20px) saturate(1.1); backdrop-filter: blur(20px) saturate(1.1);
  box-shadow: 0 40px 90px -46px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  display: flex; flex-direction: column; gap: 18px;
}
#loginView .auth-h { margin: 0; font-family: var(--t-serif); font-size: clamp(1.9rem, 6.4vw, 2.3rem); font-weight: 600; letter-spacing: -0.005em; }
#loginView .auth-sub { margin: -8px 0 2px; font-size: 0.9375rem; color: rgba(255, 255, 255, 0.72); }

#loginView form { display: flex; flex-direction: column; gap: 15px; }
#loginView .fieldrow { display: flex; flex-direction: column; gap: 7px; }
#loginView label { font-size: 0.8125rem; font-weight: 500; color: rgba(255, 255, 255, 0.78); }
#loginView input {
  height: 50px; padding: 0 15px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--t-glass-line); border-radius: 12px;
  color: #fff; font-family: inherit; font-size: 1rem;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
#loginView input::placeholder { color: var(--t-glass-line-hi); }
#loginView input:hover { border-color: var(--t-glass-line-hi); }
#loginView input:focus { outline: none; border-color: rgba(255, 255, 255, 0.6); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.13); background: rgba(255, 255, 255, 0.13); }

#loginView .pass { position: relative; display: flex; }
#loginView .pass input { flex: 1; padding-right: 44px; }
#loginView .peek {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px;
  display: grid; place-items: center; background: transparent; border: 0; color: rgba(255, 255, 255, 0.55); cursor: pointer; border-radius: 8px; transition: color 140ms ease;
}
#loginView .peek:hover { color: #fff; }
#loginView .peek:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.13); }
#loginView .peek svg { width: 18px; height: 18px; }
#loginView .hint { font-size: 0.75rem; line-height: 1.3; }
#loginView .hint.caps { color: rgba(255, 222, 150, 0.92); }

#loginView .loginrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 0; }
#loginView .remember { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.82); cursor: pointer; user-select: none; }
#loginView .remember input { width: 16px; height: 16px; min-height: 0; accent-color: var(--t-accent); cursor: pointer; }
#loginView .forgotlink { color: #fff; text-decoration: none; font-size: 0.8125rem; opacity: 0.85; white-space: nowrap; }
#loginView .forgotlink:hover { opacity: 1; }

#loginView .btn-primary {
  margin-top: 4px; height: 50px; width: 100%; border: 0; border-radius: 999px; background: #fff; color: var(--t-ink);
  font-family: inherit; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; cursor: pointer;
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.6);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
#loginView .btn-primary:hover { transform: translateY(-1px); background: #f4f2ee; box-shadow: 0 20px 42px -16px rgba(0, 0, 0, 0.65); }
#loginView .btn-primary:active { transform: translateY(0); }
#loginView .btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55); }

#loginView #loginMessage { min-height: 1em; margin: 6px 0 0; font-size: 0.8125rem; text-align: center; color: rgba(255, 255, 255, 0.82); }
#loginView #loginMessage.error { color: #ffcf9a; }

#loginView .auth-alt { margin: 16px 0 0; text-align: center; font-size: 0.875rem; color: rgba(255, 255, 255, 0.78); }
#loginView .auth-alt a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, 0.4); padding-bottom: 1px; }
#loginView .auth-alt a:hover { border-bottom-color: #fff; }

#loginView .auth-copy {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); text-align: center; pointer-events: none;
  font-size: 0.6875rem; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.52); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

/* First-production-login finding (Josh, 2026-07-30): on short viewports the
   absolutely-positioned copyright sat ON TOP of the Log in button. The wrap now
   reserves the footer's lane and the view scrolls instead of colliding. */
#loginView { overflow-y: auto; }
#loginView .auth-wrap { padding-bottom: 64px; }

@media (prefers-reduced-motion: reduce) {
  #loginView .btn-primary, #loginView input, #loginView .peek { transition: none; }
}
