/* Login page (login.html): an animated night scene of the network (canvas, js/login.js) behind a
   frosted card. The scene stays dark in both themes, like the console's top bar; the card follows
   the theme. Colours come from the tokens of style.css plus the few below. */
:root {
  --scene-1: #101a2e;          /* deep blue, top left */
  --scene-2: #0b0f19;          /* near black, bottom right */
  --scene-glow: #4572A7;       /* UnveilTech primary, glow of the hub */
  --scene-net: #ffffff;        /* white: downloads from the Internet (not red: red reads as danger) */
  --scene-text: #eef2f8;
  --scene-dim: rgba(238, 242, 248, .68);
  --card-bg: rgba(255, 255, 255, .88);
  --card-border: rgba(255, 255, 255, .6);
  --card-shadow: 0 24px 60px rgba(4, 8, 20, .55), 0 2px 8px rgba(4, 8, 20, .3);
  --logo-plate: transparent;
  --field-bg: #f3f5f9;
  --btn-text: #ffffff;
  --qr-bg: #ffffff;            /* a QR code stays dark on white, in both themes (phone cameras need it) */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --card-bg: rgba(32, 34, 54, .82);
    --card-border: rgba(255, 255, 255, .1);
    --logo-plate: rgba(255, 255, 255, .92);
    --field-bg: rgba(255, 255, 255, .06);
  }
}
:root[data-theme="dark"] {
  --card-bg: rgba(32, 34, 54, .82);
  --card-border: rgba(255, 255, 255, .1);
  --logo-plate: rgba(255, 255, 255, .92);
  --field-bg: rgba(255, 255, 255, .06);
}

body.login {
  min-height: 100vh; min-height: 100dvh; margin: 0; overflow-x: hidden;
  background: radial-gradient(120% 90% at 20% 10%, var(--scene-1), var(--scene-2));
  color: var(--scene-text);
}
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.login-wrap {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
  align-items: center; gap: 48px;
  max-width: 1180px; margin: 0 auto; padding: 48px 32px 72px;
}

/* Hero text, left: it sits over the hub of the scene, hence the soft shadow. */
/* At the top of its column: the hub of the scene takes the space under it (js/login.js). */
.hero { align-self: start; margin-top: 9vh; text-shadow: 0 2px 18px rgba(4, 8, 20, .7); animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero-kicker { margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--scene-dim); }
.hero h1 { margin: 0; font-size: clamp(34px, 4.6vw, 58px); line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.hero h1 span {
  background: linear-gradient(90deg, var(--success), var(--info));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-text { max-width: 34em; margin: 20px 0 22px; font-size: 16px; line-height: 1.6; color: var(--scene-dim); }
.hero-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13.5px; color: var(--scene-dim); }
.hero-legend li { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.hit { background: var(--success); box-shadow: 0 0 12px var(--success); }
.dot.miss { background: var(--scene-net); box-shadow: 0 0 12px var(--scene-net); }

/* The card. */
.login-card {
  background: var(--card-bg); color: var(--text);
  border: 1px solid var(--card-border); border-radius: 18px; box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  padding: 30px 30px 28px;
  animation: rise .9s .12s cubic-bezier(.2, .7, .2, 1) both;
}
.login-card.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
.login-logo { display: inline-block; background: var(--logo-plate); border-radius: 10px; padding: 6px 10px; margin: -6px 0 14px -10px; }
.login-logo img { height: 38px; width: auto; display: block; }
.login-card h2 { margin: 0; font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
.login-sub { margin: 2px 0 22px; color: var(--text-2); font-size: 14px; }

.lfield { display: grid; gap: 6px; margin-bottom: 14px; }
.lfield > span:first-child { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.linput {
  display: flex; align-items: center; gap: 10px;
  background: var(--field-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0 6px 0 12px; transition: border-color .2s, box-shadow .2s;
}
.linput:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent); }
.linput > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; }
.linput:focus-within > svg { stroke: var(--primary); }
.linput input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: 15px/1.2 var(--sans); padding: 12px 0;
}
.peek { border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 8px; display: flex; color: var(--text-3); }
.peek svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.peek:hover, .peek[aria-pressed="true"] { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.peek:focus-visible { outline: 2px solid var(--primary); }
/* Compulsory two-factor sign-in set up here (QR code, then the recovery codes). */
.tfa-setup { margin: 0 0 14px; font-size: 13.5px; color: var(--text-2); }
.tfa-setup p { margin: 0 0 10px; }
.tfa-lead b { color: var(--text); }
.tfa-expired { color: var(--warning); font-weight: 600; }
.tfa-qr { display: block; margin: 4px auto 10px; border-radius: 8px; background: var(--qr-bg); padding: 6px; image-rendering: pixelated; }
.tfa-key b { color: var(--text); word-break: break-all; }
.tfa-codes { margin: 0 0 4px; padding: 10px 12px 10px 34px; columns: 2; column-gap: 28px; border-radius: 10px;
  background: var(--field-bg); border: 1px solid var(--border); color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.tfa-codes li { padding: 2px 0; }
.caps { margin: -6px 0 10px; font-size: 12.5px; color: var(--warning); font-weight: 600; }
.login-err { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }

.login-btn {
  position: relative; width: 100%; margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 10px; padding: 13px 18px; cursor: pointer;
  font: 600 15.5px var(--sans); color: var(--btn-text);
  background: linear-gradient(100deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--info)));
  background-size: 160% 100%; background-position: 0 0;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 40%, transparent);
  transition: background-position .4s, transform .15s, box-shadow .2s;
}
.login-btn:hover { background-position: 100% 0; box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 55%, transparent); }
.login-btn:active { transform: translateY(1px); }
.login-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.login-btn .arrow { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.login-btn:hover .arrow { transform: translateX(3px); }
.login-btn .spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--btn-text) 35%, transparent); border-top-color: var(--btn-text); animation: spin .8s linear infinite; }
.login-btn.busy { pointer-events: none; }
.login-btn.busy .arrow { display: none; }
.login-btn.busy .spinner { display: block; }
.login-btn.done { background: var(--success); box-shadow: 0 8px 22px color-mix(in srgb, var(--success) 45%, transparent); }

.login-foot {
  position: fixed; z-index: 1; left: 0; right: 0; bottom: 0; padding: 14px 24px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center; gap: 12px; font-size: 12.5px; color: var(--scene-dim);
}
.login-foot a { color: inherit; text-decoration: none; }
.login-foot a:hover { color: var(--scene-text); }
/* The language of this browser (js/i18n.js): quiet, like the footer's text. */
.lang-pick {
  font: inherit; color: inherit; background: transparent; border: 1px solid color-mix(in srgb, var(--scene-dim) 45%, transparent);
  border-radius: 3px; padding: 1px 6px; cursor: pointer; margin-inline-start: 6px;
}
.lang-pick:hover, .lang-pick:focus-visible { color: var(--scene-text); outline: none; border-color: var(--scene-text); }
.lang-pick option { color: #1e1e1e; background: #ffffff; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }

/* Tablets and phones: the card alone, centred over the scene; the hero keeps its title. */
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: minmax(0, 420px); justify-content: center; gap: 22px; padding: 28px 16px 64px; align-content: center; }
  .hero { text-align: center; align-self: auto; margin-top: 0; }
  .hero-kicker { margin-bottom: 8px; }
  .hero h1 { font-size: 30px; }
  .hero-text, .hero-legend { display: none; }
  .login-card { padding: 24px 20px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero, .login-card { animation: none; }
}
