/* ForteFit login / accept-invite / reset — its own stylesheet.
   Deliberately self-contained: NOT an @import of public/styles.css, because
   this page is served anonymously and must not depend on a gated asset.
   Tokens are copied from styles.css so the page matches the app exactly.

   Dark, mobile-first, one-handed. Every tap target >= 44px, every input
   16px (anything smaller makes iOS Safari zoom on focus and the layout
   then scrolls sideways). No horizontal scroll at 375px. */

:root {
  --bg: #0b0e14;
  --bg2: #131823;
  --bg3: #1c2432;
  --border: #2b3444;
  --border2: #3a465a;
  --text: #e8edf4;
  --muted: #8b96a5;
  --accent: #58a6ff;
  --accent-dim: #1f5eb8;
  --accent-soft: rgba(88, 166, 255, .14);
  --accent-text: #06121f;
  --amber: #f2cc60;
  --amber-soft: rgba(242, 204, 96, .13);
  --danger: #ff7b72;
  --danger-soft: rgba(255, 123, 114, .12);
  --radius: 14px;
  --tap: 44px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* The `hidden` attribute must win over any author display rule. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
}

.wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

.card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, var(--bg2), #10141d);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
}

/* ---------- header ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .02em;
  color: var(--text);
  margin-bottom: 18px;
}
.brand img { border-radius: 7px; }

h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.lede {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .95rem;
}

/* ---------- already-signed-in block ---------- */

.session {
  border: 1px solid var(--accent-dim);
  background: var(--accent-soft);
  border-radius: 11px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.session-line { margin: 0 0 10px; font-size: .95rem; }
.session-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.session-actions .btn { flex: 1 1 auto; min-width: 130px; }

/* ---------- fields ---------- */

.field { margin-bottom: 14px; }

label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: 50px;                 /* > 44px tap target */
  font-family: inherit;
  font-size: 16px;                  /* NEVER smaller: iOS zooms on focus */
  line-height: 1.3;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px 14px;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder { color: #5d6675; }
input:focus-visible,
input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent-dim);
}
input:disabled { opacity: .55; }

/* password + show/hide */
.pw { position: relative; }
.pw input { padding-right: 82px; }

.pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  min-height: var(--tap);
  min-width: 72px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 0 11px 11px 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pw-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.hint {
  margin: 6px 0 0;
  font-size: .82rem;
  color: var(--muted);
}

/* ---------- messages ---------- */

.error {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #6b3330;
  background: var(--danger-soft);
  border-radius: 11px;
  color: var(--danger);
  font-size: .9rem;
}

.notice {
  margin: 0 0 18px;
  padding: 11px 13px;
  border: 1px solid #6a5a26;
  background: var(--amber-soft);
  border-radius: 11px;
  color: var(--amber);
  font-size: .9rem;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 11px;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, border-color .15s ease;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: scale(.985); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; min-height: 52px; font-size: 1.05rem; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: default; transform: none; }

/* ---------- links ---------- */

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 14px;
}
.links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--accent);
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none;
}
.links a:hover { text-decoration: underline; }
.links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.foot {
  margin: 6px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .84rem;
}

/* ---------- narrow phones ---------- */

@media (max-width: 380px) {
  .card { padding: 18px 15px 15px; }
  h1 { font-size: 1.28rem; }
  .session-actions .btn { min-width: 0; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;   /* load-bearing: without this a
                                                  looping animation becomes a
                                                  1ms strobe, not a stop */
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* consent checkbox on the accept-invite screen */
.field.consent { margin: 4px 0 10px; }
.consent-row { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: .95rem; }
.consent-row input { width: 20px; height: 20px; margin: 1px 0 0; flex: 0 0 auto; }
#link-privacy { margin-left: auto; }
