/* West Modular · Standardized Design Tokens & Login Gate
   Zero external dependencies. Supports light/dark via light-dark() and [data-theme]. */

:root {
  color-scheme: light dark;

  --wm-bg: light-dark(#F9F8F6, #16181B);
  --wm-surface: light-dark(#FFFFFF, #1E2125);
  --wm-sunk: light-dark(#F1EFEA, #23272C);

  --wm-ink: light-dark(#2E2E30, #ECEAE5);
  --wm-ink2: light-dark(#58585A, #B9B7B0);
  --wm-muted: light-dark(#77777A, #93918B);

  --wm-line: light-dark(#D4D4CD, #373B40);
  --wm-line2: light-dark(#E7E5DF, #2C3035);

  --wm-gold: #B3A684;
  --wm-gold-d: light-dark(#7A6F4F, #D2C6A4);
  --wm-gold-s: light-dark(#F1ECDD, #2F2B20);

  --wm-ok: light-dark(#1E7A4C, #6FD3A0);
  --wm-ok-s: light-dark(#E2F3EA, #16301F);
  --wm-warn: light-dark(#9A6700, #F0C35A);
  --wm-warn-s: light-dark(#FBF1D9, #3A2F13);
  --wm-bad: light-dark(#A63A2B, #F0A194);
  --wm-bad-s: light-dark(#F8E4E0, #3A1E1A);
  --wm-info: light-dark(#2B5C8A, #8EC1EE);
  --wm-info-s: light-dark(#E3EDF7, #16283A);

  --wm-f-d: "Barlow Semi Condensed", "Arial Narrow", Arial, sans-serif;
  --wm-f-b: Inter, "Segoe UI", Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--wm-bg);
  color: var(--wm-ink);
  font: 14px/1.5 var(--wm-f-b);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--wm-gold);
  outline-offset: 2px;
}

/* ==========================================================================
   Login Gate (.wm-gate)
   ========================================================================== */

.wm-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--wm-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
}

.wm-gate[hidden] {
  display: none !important;
}

.wm-gate-card {
  width: 100%;
  max-width: 420px;
  margin: auto;
  background: var(--wm-surface);
  color: var(--wm-ink);
  border: 1px solid var(--wm-line);
  border-top: 3px solid var(--wm-gold);
  border-radius: 12px;
  padding: clamp(20px, 5vw, 32px);
  box-shadow: 0 18px 48px light-dark(rgba(46, 46, 48, 0.12), rgba(0, 0, 0, 0.45));
}

.wm-gate-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
}

.wm-gate-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--wm-gold-s);
  color: var(--wm-gold-d);
  border: 1px solid color-mix(in srgb, var(--wm-gold) 35%, transparent);
  font: 700 11px/1.2 var(--wm-f-d);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wm-gate-head h1,
.wm-gate-head h2,
.wm-gate-title {
  margin: 0;
  font: 700 clamp(22px, 4vw, 26px)/1.15 var(--wm-f-d);
  letter-spacing: 0.01em;
  color: var(--wm-ink);
}

.wm-gate-head p,
.wm-gate-subtitle {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--wm-ink2);
}

.wm-gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wm-gate-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wm-gate-field label {
  font: 600 12px/1.2 var(--wm-f-d);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wm-ink2);
}

.wm-gate-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--wm-sunk);
  color: var(--wm-ink);
  border: 1px solid var(--wm-line);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.3;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.wm-gate-field input::placeholder {
  color: var(--wm-muted);
}

.wm-gate-field input:hover {
  border-color: var(--wm-gold);
}

.wm-gate-field input:focus {
  outline: none;
  background: var(--wm-surface);
  border-color: var(--wm-gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wm-gold) 22%, transparent);
}

.wm-gate-err {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--wm-bad-s);
  color: var(--wm-bad);
  border: 1px solid color-mix(in srgb, var(--wm-bad) 30%, transparent);
  font-size: 13px;
  line-height: 1.4;
}

.wm-gate-err:empty,
.wm-gate-err[hidden] {
  display: none;
}

.wm-gate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  padding: 10px 18px;
  border: 1px solid var(--wm-gold-d);
  border-radius: 8px;
  background: var(--wm-gold);
  color: #1A1A1C;
  font: 700 15px/1.2 var(--wm-f-d);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.wm-gate-btn:hover:not(:disabled) {
  background: var(--wm-gold-d);
  border-color: var(--wm-gold-d);
  color: var(--wm-bg);
}

.wm-gate-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.wm-gate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.wm-gate-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--wm-line2);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.wm-gate-foot a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 12px;
  color: var(--wm-gold-d);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.wm-gate-foot a:hover {
  color: var(--wm-ink);
  background: var(--wm-gold-s);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 640px) {
  .wm-gate-field input {
    font-size: 14.5px;
  }
}
