/* ============================================================
   Northgate ID — Secure Access Gateway
   Palette: graphite #161b21 / panel #0e1216 / steel #7aa5c6
   ============================================================ */

:root {
  --bg: #161b21;
  --bg-deep: #0e1216;
  --bg-abyss: #0a0d10;
  --ink: #ffffff;
  --ink-soft: #d7e4ee;
  --muted: #8b98a5;
  --steel: #7aa5c6;
  --steel-bright: #9cc0da;
  --steel-line: rgba(122, 165, 198, 0.28);
  --error: #d96a5a;
  --error-bg: rgba(217, 106, 90, 0.1);
  --field-bg: rgba(255, 255, 255, 0.04);
  --field-line: rgba(139, 152, 165, 0.28);
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
}

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

html { height: 100%; }

body {
  min-height: 100%;
  font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
  background: var(--bg-abyss);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { color: var(--bg-abyss); background: var(--steel); }

/* ============================== SHELL ============================== */

.shell {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  min-height: 100vh;
}

/* ============================== BRAND ============================== */

.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3.2vw 3.6vw;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(122, 165, 198, 0.12), transparent 55%),
    radial-gradient(100% 80% at 90% 100%, rgba(70, 100, 125, 0.12), transparent 60%),
    var(--bg);
  overflow: hidden;
}

.brand-grid-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 152, 165, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 152, 165, 0.055) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(80% 80% at 40% 45%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(80% 80% at 40% 45%, #000 30%, transparent 100%);
}

.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 26px,
    rgba(122, 165, 198, 0.025) 26px 27px
  );
}

.brand-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--steel);
  text-decoration: none;
}

.logo-mark { display: block; }

.logo-word {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.logo-word-light {
  margin-left: 0.35em;
  font-weight: 400;
  color: var(--steel);
}

.brand-locale {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  border: 1px solid var(--steel-line);
  border-radius: 4px;
  padding: 0.25em 0.55em;
}

/* ---------- brand center ---------- */

.brand-center {
  position: relative;
  z-index: 1;
  max-width: 30rem;
}

.seal {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 2.2rem;
}

.seal-ring { display: block; }

.seal-text {
  fill: var(--steel);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.75;
}

.seal-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--steel);
}

.brand-headline {
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin-bottom: 1rem;
}

.brand-sub {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 26rem;
}

/* ---------- brand bottom ---------- */

.brand-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--steel-line);
}

.brand-stat { display: flex; flex-direction: column; gap: 0.2rem; }

.stat-num {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================== AUTH ============================== */

.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  padding: 3rem 2.5rem;
}

.auth-inner { width: 100%; max-width: 23.5rem; }

.auth-head { margin-bottom: 1.6rem; }

.auth-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 0.7rem;
}

.auth-title {
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 0.45rem;
}

.auth-desc {
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- alert ---------- */

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid rgba(217, 106, 90, 0.35);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1.2rem;
  opacity: 0;
  transform: translateY(-4px);
}

.auth-alert svg { flex: none; margin-top: 1px; }

.auth-alert.is-shown {
  animation: alert-in 0.35s var(--ease) forwards;
}

@keyframes alert-in {
  to { opacity: 1; transform: translateY(0); }
}

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

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--field-line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.field input::placeholder { color: rgba(139, 152, 165, 0.55); }

.field input:focus {
  border-color: var(--steel);
  background: rgba(122, 165, 198, 0.06);
}

.field.is-invalid input[type="text"],
.field.is-invalid input[type="password"] {
  border-color: var(--error);
  animation: shake 0.35s ease;
}

@keyframes shake {
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

.field-password { position: relative; }

.field-password input { padding-right: 2.8rem !important; }

.field-toggle {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.3rem;
  line-height: 0;
  transition: color 0.2s;
}

.field-toggle:hover { color: var(--steel-bright); }

.field-hint {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #c9a15e;
}

/* ---------- row: remember / forgot ---------- */

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-box {
  width: 16px;
  height: 16px;
  border: 1px solid var(--field-line);
  border-radius: 4px;
  background: var(--field-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.checkbox input:checked + .checkbox-box {
  background: var(--steel);
  border-color: var(--steel);
}

.checkbox input:checked + .checkbox-box::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid var(--bg-abyss);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.checkbox input:focus-visible + .checkbox-box { border-color: var(--steel-bright); }

.checkbox-label { font-size: 0.83rem; color: var(--muted); }

.link-btn {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.83rem;
  color: var(--steel);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.link-btn:hover { color: var(--steel-bright); text-decoration: underline; }

/* ---------- submit ---------- */

.submit {
  position: relative;
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--bg-abyss);
  background: var(--steel);
  border: none;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.submit:hover { background: var(--steel-bright); }

.submit.is-loading { pointer-events: none; }

.submit.is-loading .submit-label { visibility: hidden; }

.submit-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(10, 13, 16, 0.25);
  border-top-color: var(--bg-abyss);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.submit.is-loading .submit-spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.auth-alt {
  margin-top: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* ---------- auth footer ---------- */

.auth-foot {
  margin-top: 2.4rem;
  padding-top: 1.3rem;
  border-top: 1px solid rgba(139, 152, 165, 0.15);
  text-align: center;
}

.auth-links {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 0.8rem;
}

.auth-links a {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.auth-links a:hover { color: var(--steel-bright); }

.auth-legal {
  font-size: 0.72rem;
  line-height: 1.55;
  color: rgba(139, 152, 165, 0.65);
}

/* ============================== MODAL ============================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 12, 0.72);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 24rem;
  background: var(--bg);
  border: 1px solid var(--steel-line);
  border-radius: 12px;
  padding: 1.6rem 1.5rem 1.4rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.modal-card h3 {
  font-size: 1.1rem;
  font-weight: 650;
  margin-bottom: 0.7rem;
}

.modal-card p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 1.3rem;
}

.modal-card strong { color: var(--ink-soft); }

.modal-close {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--bg-abyss);
  background: var(--steel);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-close:hover { background: var(--steel-bright); }

/* ============================== RESPONSIVE ============================== */

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }

  .brand {
    padding: 1.8rem 1.5rem;
    gap: 2rem;
  }

  .brand-center { max-width: none; }

  .seal { display: none; }

  .brand-bottom { gap: 1.4rem; flex-wrap: wrap; }

  .auth { padding: 2.2rem 1.5rem 3rem; }
}
