/* Login popup, nav controls and the two mail-link pages (plans/PLAN_auth_accounts.md D8).
   Uses the tokens of /site/site.css (--card, --line, --accent...); verify.html and reset.html do
   not load it, so .auth-page sets the same values and the .btn look for them. The values must stay
   those of site.css: tests/landing/site-pages.unit.test.mjs compares the two. Text on the orange
   is dark (white on #ffa500 is under 4.5:1). */
.auth-page{
  --page:#0c0c0c; --card:#1a1a1a; --line:#333; --line-soft:#2e2e2e;
  --text:#fff; --muted:#bbb; --faint:#8a8a8a;
  --accent:#ffa500; --accent-text:#ffa500; --accent-strong:#ffa500; --accent-deep:#ffb733; --accent-on:#111;
  --font:"Helvetica Neue",Helvetica,Arial,system-ui,sans-serif;
  margin:0;min-height:100vh;min-height:100dvh;display:grid;place-items:center;padding:24px 16px;box-sizing:border-box;
  background:radial-gradient(ellipse at 50% 0%,#2a1f08 0%,#0c0c0c 60%);color:var(--text);font:16px/1.6 var(--font)
}
.auth-page *,.auth-page *::before,.auth-page *::after{box-sizing:border-box}
.auth-page :focus-visible{outline:2px solid var(--accent-text);outline-offset:3px;border-radius:6px}
.auth-page a{color:var(--accent-text)}
.auth-page .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:10px 22px;border-radius:9px;font:600 15px/1.2 var(--font);border:1px solid transparent;cursor:pointer;text-decoration:none;transition:background-color .18s,border-color .18s}
.auth-page .btn-p{background:var(--accent-strong);color:var(--accent-on)}
.auth-page .btn-p:hover{background:var(--accent-deep)}
.auth-page .btn-g{border-color:var(--line);background:none;color:var(--text)}
.auth-page .btn-g:hover{background:var(--line-soft)}
.auth-page .logo{display:inline-flex;align-items:center;gap:10px;min-height:44px;color:var(--text);text-decoration:none;font-weight:700;font-size:18px}
.auth-page .logo svg{width:28px;height:28px}
.auth-page .logo b{color:var(--accent-text)}
.auth-page .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.auth-page svg.i{width:1em;height:1em;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.auth-card{width:100%;max-width:440px;background:var(--card);border:1px solid var(--line);border-radius:16px;padding:24px}
.auth-card h1{font-size:22px;line-height:1.3;margin:14px 0 6px}
.auth-card p{color:var(--muted);margin:0 0 16px}

/* dialog: centred card on wide screens, full-width bottom sheet on phones */
/* margin:auto restates the UA centring that the landing page's * {margin:0} reset removes */
.auth-dlg{width:min(440px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);margin:auto;padding:0;border:1px solid var(--line);border-radius:16px;
  background:var(--card);color:var(--text);font:16px/1.55 var(--font);overflow:auto;overscroll-behavior:contain;box-shadow:0 24px 60px rgba(0,0,0,.55)}
.auth-dlg::backdrop{background:rgba(5,5,8,.74)}
.auth-dlg[open]{animation:auth-in .2s ease-out}
@keyframes auth-in{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.auth-box{padding:20px 24px 24px}
.auth-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px}
.auth-head h2{font-size:21px;line-height:1.3;font-weight:700;letter-spacing:-.2px}
.auth-x{display:inline-grid;place-items:center;width:44px;height:44px;margin-right:-10px;border:0;border-radius:10px;background:none;color:var(--muted);cursor:pointer;font-size:22px;transition:background-color .18s,color .18s}
.auth-x:hover{background:var(--line-soft);color:var(--text)}
.auth-x:active{background:var(--line)}

/* fields: 16 px text (no zoom on iOS) and at least 44 px high */
.auth-f{margin-top:14px}
.auth-f label{display:block;font-size:14.5px;font-weight:600;margin-bottom:6px;color:var(--text)}
.auth-f input{display:block;width:100%;min-height:48px;padding:11px 14px;border:1px solid #444;border-radius:10px;background:#111;color:var(--text);
  font:16px/1.4 var(--font);transition:border-color .18s}
.auth-f input:hover{border-color:var(--faint)}
.auth-f input:focus-visible{outline:2px solid var(--accent-text);outline-offset:1px;border-color:var(--accent)}
.auth-f input[aria-invalid=true]{border-color:#ff8a8a}
.auth-hint{margin-top:6px;font-size:13.5px;color:var(--muted)}
.auth-pw{position:relative}
.auth-pw input{padding-right:52px}
.auth-eye{position:absolute;top:2px;right:2px;display:grid;place-items:center;width:44px;height:44px;border:0;border-radius:8px;background:none;color:var(--muted);cursor:pointer;font-size:20px}
.auth-eye:hover{color:var(--text)}
.auth-eye:active{background:var(--line-soft)}
.auth-eye .off,.auth-eye[aria-pressed=true] .on{display:none}
.auth-eye[aria-pressed=true] .off{display:block}
.auth-err:empty,.auth-msg:empty{display:none}
.auth-err{display:flex;gap:6px;align-items:flex-start;margin-top:6px;font-size:14px;color:#ff9b9b}
.auth-err svg,.auth-msg svg{margin-top:.2em}
.auth-msg{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:flex-start;margin-top:10px;padding:10px 12px;border-radius:10px;font-size:14.5px;border:1px solid var(--line);background:#141414}
.auth-msg span{flex:1 1 200px}
.auth-msg.is-ok{border-color:#2f5c45;color:#9be8bd}
.auth-msg.is-error{border-color:#6b3434;color:#ffb0b0}
.auth-submit{width:100%;margin-top:18px}
.auth-submit:active,.auth-dlg .btn:active{transform:translateY(1px)}
.auth-submit:disabled{opacity:.75;cursor:progress}
.is-busy::before{content:"";width:16px;height:16px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:auth-spin .8s linear infinite}
@keyframes auth-spin{to{transform:rotate(360deg)}}
.auth-link{display:inline-flex;align-items:center;min-height:44px;padding:0 4px;border:0;background:none;color:var(--accent-text);font:600 14.5px var(--font);cursor:pointer;border-radius:6px}
.auth-link:hover{text-decoration:underline;text-underline-offset:3px}
.auth-link:active{color:#ffc966}
.auth-row{display:flex;justify-content:flex-end;margin-top:2px}
.auth-alt{margin-top:14px;padding-top:10px;border-top:1px solid var(--line-soft);font-size:14.5px;color:var(--muted);text-align:center}
/* Turnstile (plans/PLAN_turnstile_gate.md): centres the ~300x65 challenge when Cloudflare asks
   for a click; empty (script not loaded or widget idle) it takes no room. */
.auth-turnstile{display:flex;justify-content:center;margin-top:14px}
.auth-turnstile:empty{display:none}
.auth-resend,.auth-done{margin-top:14px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:#141414;font-size:14.5px;color:var(--muted)}
.auth-done p{color:var(--text);margin-bottom:10px}
.auth-done p:focus{outline:none}
.auth-resend .btn,.auth-done .btn{margin-top:10px;width:100%}
.auth-trap{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}

/* nav of the landing page */
.nav-auth{display:flex;align-items:center;gap:6px;min-width:0}
.nav-auth[hidden],.nav-auth [hidden]{display:none}
.navtxt{display:inline-flex;align-items:center;min-height:44px;padding:0 10px;border:0;border-radius:8px;background:none;color:var(--text);font:600 14.5px var(--font);white-space:nowrap;cursor:pointer;transition:background-color .18s}
.navtxt:hover{background:var(--card)}
.navtxt:active{background:var(--line-soft)}
/* the address, words only (the account is managed inside the app); it must not look bigger than the text */
.nav-user{min-width:0;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;color:var(--muted);text-decoration:none;border-radius:6px}
/* a failed logout says so under the nav, without moving the nav's own controls */
.nav-msg{position:absolute;top:calc(100% + 8px);right:16px;max-width:min(440px,calc(100% - 32px));margin:0}

@media(max-width:560px){
  .auth-dlg{width:100%;max-height:calc(100dvh - 12px);margin:auto 0 0;border-radius:16px 16px 0 0;border-width:1px 0 0}
  .auth-box{padding:16px max(16px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
  .auth-dlg[open]{animation-name:auth-up}
  @keyframes auth-up{from{transform:translateY(24px);opacity:0}to{transform:none;opacity:1}}
}
/* The nav must still fit once the login controls sit in it: with the "On thi" link down to 360 px,
   without it (landing.html hides it there) down to 320 px. Logged in, the address (the only way
   into the manage page) keeps the width it had before the link came: the name of the logo leaves
   earlier (landing.html hides it under 560 px for everyone, before this class is set), and from
   360 to 399 px the mark (a link to this very page) leaves too. */
@media(max-width:639px){
  .auth-ready nav:has(.nav-user:not([hidden])) .logo span{display:none}
}
@media(max-width:479px){
  .auth-ready nav .wrap{padding:0 12px;gap:6px}
  .auth-ready nav .btn{padding:10px 10px}
  .auth-ready nav .navlink,.auth-ready nav .navtxt{padding:0 6px}
}
@media(max-width:400px){
  .navtxt{padding:0 8px}
}
@media(min-width:360px) and (max-width:399px){
  .auth-ready nav:has(.nav-user:not([hidden])) .logo{display:none}
}
@media(max-width:359px){
  .nav-user{display:none}
}
@media(prefers-reduced-motion:reduce){
  .auth-dlg[open]{animation:none}
  .is-busy::before{animation:none;border-right-color:currentColor;opacity:.6}
  .auth-x,.auth-f input,.navtxt,.auth-page .btn{transition:none}
}
