/* Sign-in screen.
 *
 * Direction: the previous version was a 380px card centred on flat near-black
 * with one teal accent — which is the default look, and on a 1920px monitor it
 * was a stamp in the middle of an empty field.
 *
 * What replaces it comes from the subject rather than from a template. travada
 * is about market data and, more than that, about being honest when the data is
 * not there. So:
 *
 *   - Duotone, not monotone. Two washes in --accent and --down: the two colours
 *     this product already uses to mean something (up and down). Not a random
 *     second hue.
 *   - A gridded field behind it, at the spacing of chart gridlines.
 *   - A price line drawn across the left panel, low contrast, as texture.
 *   - The left panel's proof rows include one that says the product does not
 *     know something. Marketing pages do not usually advertise ignorance; this
 *     one is the product's actual character and is the thing worth remembering.
 *
 * Everything draws from the theme roles, so all four themes still work.
 */

/* The belt to js/main.js braces. main.js does not import js/app.js until a
   user is hydrated, so while signed out no dashboard code has run and there is
   nothing to leak -- but the shell markup is still in index.html, and an empty
   chrome flashing before the card looks broken. */
body.signed-out > .suite-bar,
body.signed-out > .suite-content,
body.signed-out > #themeDropdown,
body.signed-out > #bgCustomizer,
body.signed-out > .overlay,
body.signed-out > #onboardingOverlay { display: none !important; }

body.signed-in > #auth-screen { display: none; }

#auth-screen {
  position: fixed; inset: 0; z-index: 10000;
  display: grid; place-items: center;
  padding: 32px; overflow-y: auto;
  background: var(--bg);
}

/* Colour and grid, layered. Pointer-events off so it never eats a click. */
#auth-screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60vw 60vh at 12% 18%,
      color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(55vw 55vh at 88% 82%,
      color-mix(in srgb, var(--down) 13%, transparent), transparent 70%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface) 55%, transparent), transparent 45%);
}
#auth-screen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(70% 70% at 50% 40%, #000 30%, transparent 100%);
}

.auth-layout {
  position: relative; z-index: 1;
  display: grid; gap: clamp(32px, 5vw, 96px);
  grid-template-columns: 1fr;
  width: 100%; max-width: 1460px; align-items: center;
}

/* Two columns once there is room for both to breathe. The card does not
   stretch — extra width goes to the argument on the left, not to padding. */
@media (min-width: 950px) {
  .auth-layout { grid-template-columns: minmax(0, 1.25fr) 440px; }
}

/* ── left: what this is ───────────────────────────────────────────────────── */

.auth-pitch { position: relative; }

.auth-wordmark {
  font-family: var(--font); font-weight: 700; letter-spacing: -.02em;
  font-size: clamp(44px, 6vw, 82px); line-height: .95; color: var(--text);
}
.auth-wordmark em { font-style: normal; color: var(--accent); }

.auth-thesis {
  font-family: var(--font); font-weight: 400;
  font-size: clamp(17px, 1.5vw, 22px); line-height: 1.55;
  color: var(--text); opacity: .9;
  margin: 24px 0 0; max-width: 24ch;
}

/* The price line. Texture, not a chart: no axes, no labels, nothing to read. */
.auth-spark {
  display: block; width: 100%; height: clamp(70px, 9vw, 120px);
  margin: 30px 0 26px; overflow: visible;
}
.auth-spark path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.auth-spark .line { stroke: var(--accent); stroke-width: 2; opacity: .55; }
.auth-spark .fill { fill: url(#sparkfill); stroke: none; }

/* Proof rows. Mono, because these are readings. */
.auth-proof { display: grid; gap: 1px; background: var(--border-soft); border-radius: 10px;
              overflow: hidden; border: 1px solid var(--border-soft); max-width: 560px; }
.auth-proof-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 18px;
  padding: 13px 16px; background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.auth-proof-label {
  font-family: var(--font); font-size: 14px; color: var(--text);
}
.auth-proof-value {
  font-family: var(--mono); font-size: 14px; color: var(--up); white-space: nowrap;
}
.auth-proof-value.is-down { color: var(--down); }
/* The row that says the product does not know. Deliberately muted, and the
   dash is the point: it is what an unmeasured reading looks like in the app. */
.auth-proof-value.is-unknown { color: var(--text-muted); }

/* ── right: the card ──────────────────────────────────────────────────────── */

.auth-card {
  width: 100%;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 18px; padding: clamp(26px, 2.4vw, 38px);
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.auth-card-title {
  font-family: var(--font); font-size: 20px; font-weight: 700;
  color: var(--text); margin-bottom: 4px;
}
.auth-card-sub {
  font-family: var(--font); font-size: 14px; color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-google {
  width: 100%; height: 50px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-family: var(--font); font-size: 15px; font-weight: 600;
  transition: background .15s, transform .08s;
}
.auth-google:hover { background: color-mix(in srgb, var(--accent) 27%, transparent); }
.auth-google:active { transform: translateY(1px); }

.auth-or {
  display: flex; align-items: center; gap: 12px; margin: 22px 0;
  font-family: var(--font); font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.auth-or::before, .auth-or::after {
  content: ''; flex: 1; height: 1px; background: var(--border-soft);
}

.auth-title {
  font-family: var(--font); font-size: 15px; font-weight: 700;
  color: var(--text); margin-bottom: 16px;
}

.auth-label {
  display: block; font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
}

.auth-input {
  width: 100%; box-sizing: border-box; height: 46px; padding: 0 14px;
  margin-bottom: 16px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; transition: border-color .15s;
}
.auth-input:focus { border-color: var(--accent); outline: none; }
.auth-input::placeholder { color: var(--text-muted); }

.auth-submit {
  width: 100%; height: 46px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-family: var(--font); font-size: 15px;
  font-weight: 600; transition: border-color .15s, color .15s;
}
.auth-submit:hover { border-color: var(--accent); color: var(--accent); }

.auth-links { display: flex; justify-content: space-between; margin-top: 16px; gap: 12px; }
.auth-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--font); font-size: 13px; color: var(--text-muted);
  transition: color .15s;
}
.auth-link:hover { color: var(--accent); }

/* Load-bearing: the only place a setup mistake or a refused sign-in is
   visible. It does not fade and does not auto-dismiss. */
.auth-msg {
  font-family: var(--font); font-size: 13px; line-height: 1.65; margin-top: 18px;
}
.auth-msg.is-error { color: var(--down); }
.auth-msg.is-info  { color: var(--text); }

.auth-busy {
  font-family: var(--font); font-size: 13px; color: var(--text-muted); margin-top: 14px;
}
.is-busy .auth-submit, .is-busy .auth-input { opacity: .5; pointer-events: none; }

.auth-note {
  font-family: var(--font); font-size: 13px; line-height: 1.7;
  color: var(--text-muted); margin-top: 22px;
  padding-top: 18px; border-top: 1px solid var(--border-soft);
}
.auth-privacy { color: var(--accent); }

/* Visible keyboard focus everywhere, not just on inputs. */
#auth-screen :focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .auth-google, .auth-submit, .auth-input, .auth-link { transition: none; }
}

@media (max-width: 949px) {
  /* Card first on a phone: the pitch is not what someone returning came for. */
  .auth-layout { max-width: 460px; }
  .auth-pitch { order: 2; }
  .auth-card { order: 1; }
  .auth-spark { display: none; }
}
