/* ==========================================================================
   Gate + direction modal. Same Machine Plate language as the document:
   graphite ground, hard 2px rules, enamel card, mono for anything that is a
   code or a figure, amber only on the thing that matters.

   NOTE: these rules consume the tokens defined in styles.css. When that
   palette changes, this file has to move with it - it silently rendered with
   undefined variables after the EVI-01 re-theme because it was left behind.
   ========================================================================== */

#gate, #selectModal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--graphite);
  /* A faint measured grid, so even the gate reads as engineered. */
  background-image:
    linear-gradient(rgba(236, 234, 229, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 234, 229, .035) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px;
}
#gate[hidden], #selectModal[hidden] { display: none; }

#selectModal { background: rgba(23, 27, 31, .84); backdrop-filter: blur(4px); }

.gate-card {
  width: 100%; max-width: 452px;
  background: var(--enamel);
  border: 2px solid var(--amber);
  padding: clamp(28px, 5vw, 44px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.gate-ey {
  font-family: var(--display); font-weight: 700; font-size: 15px;
  letter-spacing: .15em; text-transform: uppercase; color: var(--ink);
  padding-bottom: 16px; margin-bottom: 24px; border-bottom: 2px solid var(--rule-2);
}

.gate-step h2 {
  font-family: var(--display); font-weight: 700; font-size: 21px;
  line-height: 1.2; letter-spacing: -.015em; color: var(--ink);
}
.gate-step > p { font-size: 14.5px; color: var(--ink-2); margin-top: 12px; }
.gate-hint { display: block; margin-top: 8px; font-size: 13px; color: var(--ink-3); }

.gate-step form { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }

.gate-step input[type="email"], .gate-step input[type="text"] {
  flex: 1 1 190px; min-width: 0;
  font-family: var(--body); font-size: 15.5px; color: var(--ink);
  background: #fff; border: 2px solid var(--rule-hard); padding: 13px 14px;
  transition: border-color var(--fast) ease;
}
.gate-step input:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(18, 40, 63, .16); }
.gate-step input::placeholder { color: #9aa3ab; }

#codeInput {
  font-family: var(--mono); font-size: 24px; font-weight: 500;
  letter-spacing: .34em; text-align: center; padding: 12px 14px;
  font-variant-numeric: tabular-nums;
}

.gate-step button[type="submit"], #selClose, #selConfirmBtn, #acceptClose {
  appearance: none; cursor: pointer; flex: none;
  background: var(--ink); color: var(--enamel); border: 1px solid var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 10.5px;
  letter-spacing: .15em; text-transform: uppercase; padding: 14px 22px;
  transition: background var(--fast) ease, color var(--fast) ease;
}
.gate-step button[type="submit"]:hover, #selClose:hover, #selConfirmBtn:hover { background: var(--navy); border-color: var(--navy); }
.gate-step button[disabled] { opacity: .5; cursor: wait; }

.gate-secondary {
  appearance: none; cursor: pointer;
  background: transparent; color: var(--ink-2); border: 2px solid var(--rule-2);
  font-family: var(--display); font-weight: 700; font-size: 10.5px;
  letter-spacing: .15em; text-transform: uppercase; padding: 14px 22px;
}
.gate-secondary:hover { border-color: var(--ink); color: var(--ink); }

.gate-actions { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.gate-actions button { flex: 1 1 auto; }

.gate-msg { font-size: 13.5px; margin-top: 14px; min-height: 1.2em; color: var(--danger); }
.gate-msg.ok { color: var(--amber-deep); }

.gate-link {
  appearance: none; background: none; border: 0; cursor: pointer;
  font-family: var(--body); font-size: 13px; color: var(--ink-3);
  padding: 8px 0 0; margin-right: 18px; text-decoration: underline;
}
.gate-link:hover { color: var(--navy); }

.gate-ft {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: .04em;
}

.gate-as { font-size: 13px; color: var(--ink-3); margin-top: 16px; }

/* Direction modal extras */
.sel-summary {
  font-family: var(--mono); font-size: 13.5px; color: var(--ink);
  background: var(--enamel-2); border-left: 3px solid var(--amber);
  padding: 14px 16px; margin-top: 16px;
}
.sel-label {
  display: block; font-family: var(--display); font-weight: 600; font-size: 9.5px;
  letter-spacing: .15em; text-transform: uppercase; color: var(--ink-3); margin-top: 20px;
}
#selNote {
  width: 100%; margin-top: 9px; font-family: var(--body); font-size: 15px; color: var(--ink);
  background: #fff; border: 1px solid var(--rule-2); padding: 12px 13px; resize: vertical;
}
#selNote:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(18, 40, 63, .16); }
