* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Quiet, neutral surface for a white-label product: the TechCore wordmark is
     monochrome, so the page is too — the primary action is the brightest
     thing on screen, not a brand colour. */
  --bg: #0a0a0c;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f4f2;
  --muted: #9a9ba1;
  --muted-dim: #66676d;
  --focus: rgba(255, 255, 255, 0.55);
  --danger: #ff8b80;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html { height: 100%; }

body {
  min-height: 100%;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A fine engineering grid, lit from the top and fading out toward the edges. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center -1px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 38%, #000 0%, transparent 75%);
  mask-image: radial-gradient(70% 60% at 50% 38%, #000 0%, transparent 75%);
}
body::after {
  background: radial-gradient(60% 45% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 70%);
}

/* Logo and card centred on the page; the footer sits at the bottom. On a
   short screen the page scrolls rather than squeezing the form. */
.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px 20px;
}

.stack {
  width: 100%;
  max-width: 392px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  animation: rise 0.5s var(--ease) backwards;
}

/* ============ brand ============ */
.brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.brand-logo { width: 220px; height: auto; display: block; }
.brand-tag {
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding-left: 0.3em;          /* letter-spacing trails the last letter; re-centre */
}

/* ============ card ============ */
.auth-form {
  position: relative;
  width: 100%;
  padding: 32px 30px 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 40px 80px -36px rgba(0, 0, 0, 0.95);
}

h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* ---- floating-label fields ---- */
.field { position: relative; margin-bottom: 14px; }

.field input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 10px;
  padding: 20px 14px 6px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

/* Explicit class rather than :has(.pw-toggle) — one less baseline
   requirement, and without it the value would run under the toggle. */
.field-pw input { padding-right: 46px; }

.field label {
  position: absolute;
  left: 15px;
  top: 16px;
  font-size: 15px;
  color: var(--muted);
  pointer-events: none;
  transform-origin: 0 0;
  transition: transform 0.18s var(--ease), color 0.18s var(--ease);
}

/* Float the label when the field has content or focus. :-webkit-autofill is
   listed too — Chrome fills the value without ever un-setting
   :placeholder-shown, which would otherwise leave the label overlapping. */
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field input:-webkit-autofill + label {
  transform: translateY(-10px) scale(0.75);
  color: var(--muted-dim);
}

.field input:hover { border-color: var(--line-strong); }
.field input:focus {
  border-color: var(--focus);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}
.field input:focus + label { color: var(--text); }

/* Chrome paints autofilled inputs opaque white — unreadable on this surface.
   The inset shadow is the only way to repaint the background. */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #17171b inset;
  caret-color: var(--text);
}

.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle .icon-off { display: none; }
.pw-toggle[aria-pressed="true"] .icon-on { display: none; }
.pw-toggle[aria-pressed="true"] .icon-off { display: block; }

.row-utility {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 20px;
}

.forgot-link, .signup-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s;
}
.forgot-link:hover { color: var(--text); }
.signup-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.signup-link:hover { text-decoration-color: currentColor; }

/* ---- primary action ---- */
.btn-signin {
  position: relative;
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 10px;
  background: var(--text);
  color: #0a0a0c;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 10px 26px -14px rgba(255, 255, 255, 0.45);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.btn-signin:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 14px 30px -14px rgba(255, 255, 255, 0.55);
}
.btn-signin:active:not(:disabled) { transform: translateY(0); background: #e4e4e1; }

/* auth.js disables the button for the duration of the request — that is the
   only signal available, so the busy state hangs off :disabled. */
.btn-signin:disabled { cursor: default; background: #c9c9c6; }
.btn-signin:disabled .btn-label { opacity: 0; }
.btn-signin .spinner { display: none; }
.btn-signin:disabled .spinner {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(10, 10, 12, 0.25);
  border-top-color: #0a0a0c;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.signup-row {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}
.signup-row .signup-link { font-size: 13.5px; }

/* consent line under the form, linking the legal pages */
.legal-row {
  margin-top: 12px;
  color: var(--muted-dim);
  font-size: 11.5px;
  line-height: 1.55;
  text-align: center;
}
.legal-row a, .foot-links a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.legal-row a:hover, .foot-links a:hover { color: var(--text); text-decoration-color: currentColor; }

/* auth.js sets display:block on this element, so its layout must work as a
   block — no flex here, or the inline style would fight the stylesheet. */
.error-msg {
  display: none;
  background: rgba(255, 107, 92, 0.10);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 92, 0.28);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 18px;
  animation: rise 0.28s var(--ease) both;
}

/* ============ footer ============ */
.foot {
  width: 100%;
  max-width: 392px;
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted-dim);
  font-size: 12.5px;
}
.foot-links { display: inline-flex; gap: 16px; }
.foot[hidden] { display: none; }   /* its display:flex would beat the attribute */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---- focus visibility ---- */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.field input:focus-visible { outline: none; }

@media (max-width: 420px) {
  .shell { padding-top: 28px; }
  .stack { gap: 24px; }
  .brand-logo { width: 184px; }
  .auth-form { padding: 28px 20px 22px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .stack, .error-msg { animation: none; }
  .btn-signin:hover:not(:disabled) { transform: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ============ "Request an account" dialog ============ */
.req-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 4, 6, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.req-backdrop[hidden] { display: none; }
.req-backdrop.show { opacity: 1; }

.req-dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 32px 30px 26px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #121215;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 40px 90px -30px rgba(0, 0, 0, 0.95);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.25s var(--ease);
}
.req-backdrop.show .req-dialog { transform: none; }
.req-dialog h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}
.req-dialog .subtitle { margin-bottom: 20px; }
.req-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.req-close:hover { color: var(--text); background: var(--surface-2); }
.req-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field-area textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 10px;
  padding: 24px 14px 8px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.field-area textarea:focus {
  border-color: var(--focus);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label {
  transform: translateY(-10px) scale(0.75);
  color: var(--muted-dim);
}
.field textarea:focus + label { color: var(--text); }
.req-dialog .btn-signin { margin-top: 6px; }
/* honeypot: off-screen, not display:none (some bots skip hidden fields) */
.req-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.req-done { text-align: center; padding: 10px 0 4px; }
.req-done .subtitle b { color: var(--text); font-weight: 600; }
.req-tick {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.req-tick svg { width: 26px; height: 26px; fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 520px) {
  .req-grid { grid-template-columns: 1fr; }
  .req-dialog { padding: 28px 20px 22px; }
}
