/* ============================================================
   Meridian ID — Secure Access Gateway
   Palette: deep navy #162638 / panel #0f1c2b / gold #af915f
   ============================================================ */

:root {
  --bg: #162638;
  --bg-deep: #0f1c2b;
  --bg-abyss: #0b1521;
  --ink: #ffffff;
  --ink-soft: #fce1b6;
  --muted: #8fa3b8;
  --gold: #af915f;
  --gold-bright: #c9ab74;
  --gold-line: rgba(175, 145, 95, 0.28);
  --error: #d96a5a;
  --error-bg: rgba(217, 106, 90, 0.1);
  --field-bg: rgba(255, 255, 255, 0.04);
  --field-line: rgba(143, 163, 184, 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(--gold); }

/* ============================== 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(175, 145, 95, 0.12), transparent 55%),
    radial-gradient(100% 80% at 90% 100%, rgba(84, 130, 175, 0.10), transparent 60%),
    var(--bg);
  overflow: hidden;
}

.brand-grid-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(143, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 163, 184, 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(175, 145, 95, 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(--gold);
  text-decoration: none;
}

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

.logo-word-light { color: var(--gold); font-weight: 400; }

.brand-locale {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  border: 1px solid var(--field-line);
  padding: 0.35em 0.9em;
  border-radius: 100px;
}

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

/* rotating seal */
.seal {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 3.2rem;
}

.seal-ring {
  position: absolute;
  inset: 0;
  animation: seal-spin 36s linear infinite;
}

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

.seal-text {
  fill: var(--gold);
  font-size: 11.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-weight: 500;
}

.seal-core {
  position: absolute;
  inset: 0;
  margin: auto;
  color: var(--ink-soft);
  opacity: 0.9;
}

.brand-headline {
  font-size: clamp(2.4rem, 4.2vw, 3.9rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 30%, #8fa3b8 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.6rem;
}

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

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

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

.stat-num {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

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

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

.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  border-left: 1px solid var(--gold-line);
  padding: 4rem 3.4vw;
}

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

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

.auth-eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.9rem;
}

.auth-title {
  font-size: 1.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.55rem;
}

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

/* alert */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.4rem;
  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: 4px;
}

.auth-alert[hidden] { display: none; }
.auth-alert svg { flex-shrink: 0; margin-top: 0.1em; }

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

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

/* fields */
.field { margin-bottom: 1.35rem; }

.field label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.field input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--field-line);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.field input::placeholder { color: rgba(143, 163, 184, 0.45); }

.field input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(175, 145, 95, 0.06);
  box-shadow: 0 0 0 3px rgba(175, 145, 95, 0.12);
}

.field.is-invalid input {
  border-color: rgba(217, 106, 90, 0.6);
  animation: field-shake 0.4s var(--ease);
}

@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.field-password { position: relative; }

.field-password input { padding-right: 3rem; }

.field-toggle {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.3s var(--ease);
}

.field-toggle:hover, .field-toggle:focus-visible { color: var(--gold-bright); outline: none; }

.field-hint {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* row: remember + forgot */
.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.4rem 0 1.7rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  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: 3px;
  background: var(--field-bg);
  transition: all 0.25s var(--ease);
  position: relative;
}

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

.checkbox input:checked + .checkbox-box::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid var(--bg-abyss);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox input:focus-visible + .checkbox-box {
  box-shadow: 0 0 0 3px rgba(175, 145, 95, 0.25);
}

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

.link-btn {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.82rem;
  color: var(--gold);
  cursor: pointer;
  padding: 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.link-btn:hover { color: var(--gold-bright); border-bottom-color: var(--gold-bright); }

/* submit */
.submit {
  position: relative;
  width: 100%;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bg-abyss);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: none;
  border-radius: 4px;
  padding: 1rem 1.4rem;
  cursor: pointer;
  overflow: hidden;
  transition: filter 0.3s var(--ease), transform 0.15s var(--ease);
}

.submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}

.submit:hover::before { transform: translateX(120%); }
.submit:hover { filter: brightness(1.07); }
.submit:active { transform: scale(0.985); }
.submit:focus-visible { outline: 2px solid var(--ink-soft); outline-offset: 3px; }

.submit.is-loading { pointer-events: none; filter: saturate(0.75); }
.submit.is-loading .submit-label { opacity: 0.55; }

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

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

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

.auth-alt {
  margin-top: 1.6rem;
  font-size: 0.78rem;
  line-height: 1.6;
  color: rgba(143, 163, 184, 0.75);
  text-align: center;
}

/* auth footer */
.auth-foot {
  margin-top: 3.4rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(143, 163, 184, 0.14);
}

.auth-links {
  display: flex;
  gap: 1.4rem;
  margin-bottom: 0.9rem;
}

.auth-links a {
  font-size: 0.76rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.auth-links a:hover { color: var(--gold-bright); border-bottom-color: var(--gold-bright); }

.auth-legal {
  font-size: 0.72rem;
  line-height: 1.65;
  color: rgba(143, 163, 184, 0.55);
}

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

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 11, 18, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(26rem, calc(100vw - 3rem));
  background: var(--bg);
  border: 1px solid var(--gold-line);
  border-radius: 6px;
  padding: 2rem 2.1rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: modal-in 0.4s var(--ease) both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-card h3 {
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}

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

.modal-card strong { color: var(--ink); font-weight: 600; }

.modal-close {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  background: none;
  border: 1px solid var(--gold-line);
  border-radius: 4px;
  padding: 0.65rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.modal-close:hover { background: var(--gold); color: var(--bg-abyss); }

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

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

  .brand {
    padding: 1.6rem 1.5rem 2.2rem;
    gap: 2rem;
  }

  .brand-center { display: flex; align-items: center; gap: 1.6rem; max-width: none; }
  .seal { width: 92px; height: 92px; margin-bottom: 0; flex-shrink: 0; }
  .seal-ring { width: 92px; height: 92px; }
  .seal-text { font-size: 13px; letter-spacing: 0.28em; }
  .seal-core { width: 26px; height: 26px; }

  .brand-headline { font-size: 1.5rem; margin-bottom: 0.5rem; }
  .brand-sub { display: none; }
  .brand-bottom { display: none; }

  .auth { border-left: none; border-top: 1px solid var(--gold-line); padding: 3rem 1.5rem 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .seal-ring { animation: none; }
  .submit::before { display: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
