/* ============================================================
   BUREAU OF LOST TIMELINES — ACCESS TERMINAL SHEET
   Version: 2.0 (Dossier system)

   auth.html and verify.html are the two pages where the Bureau speaks
   for itself: a console that either lets you in or tells you why it
   did not. So the form is a bolted-down panel on the desk (ink-1 on
   the page floor, a red rail along its top edge like a file spine),
   the action is the only red thing, and green is kept for the one
   machine readout that earns it — ACCESS GRANTED.

   Every colour here is a token from css/tokens.css. The password
   meter is data, so it is allowed phosphor; the error line is a
   refusal, so it is allowed alert. Nothing else on this sheet glows.
   ============================================================ */

.auth-body {
  min-height: 100vh;
}

.auth-container {
  max-width: 470px;
  margin: var(--s-6) auto var(--s-8);
  padding: 0 var(--gutter);
}

/* ---------- the tab rail: three ways into one console ---------- */
.auth-tabs {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-4);
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  padding: 11px var(--s-1);
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease);
}

.auth-tab:hover {
  color: var(--paper);
}

.auth-tab.active {
  color: var(--paper-bright);
  border-bottom-color: var(--alert);
}

.auth-tab:focus-visible,
.auth-btn:focus-visible,
.rg-link:focus-visible,
.auth-form input:focus-visible {
  outline: 2px solid var(--alert-bright);
  outline-offset: 2px;
}

/* ---------- the panel ---------- */
.auth-form {
  display: none;
  position: relative;
  background: var(--ink-1);
  background-image: var(--fibre);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-1), var(--shadow-inset);
  padding: var(--s-5) var(--s-4);
  overflow: hidden;
}

/* The spine of the file: a 3px red rail across the top edge, the same
   device that marks a dossier row in the archive. */
.auth-form::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--spine);
  background: var(--alert);
}

.auth-form.active {
  display: block;
  animation: fadeIn var(--dur-3) var(--ease);
}

.auth-form h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-h3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-bright);
  text-align: center;
  margin-bottom: var(--s-1);
}

.auth-hint {
  font-family: var(--font-my);
  font-size: var(--fs-label);
  line-height: 1.7;
  color: var(--paper-dim);
  text-align: center;
  margin-bottom: var(--s-4);
}

/* ---------- fields ---------- */
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  display: block;
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  color: var(--paper);
  padding: 11px var(--s-2);
  font-family: var(--font-body);
  font-size: var(--fs-label);
  margin-bottom: var(--s-1);
  outline: none;
  box-shadow: var(--shadow-inset);
  transition: border-color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}

.auth-form input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.auth-form input:hover {
  border-color: var(--ink-4);
}

.auth-form input:focus {
  border-color: var(--alert);
  box-shadow: 0 0 0 3px var(--alert-wash);
}

/* The verification code is read out of a terminal, so it is set as one:
   mono, wide-tracked, centred in its own well. The selector has to beat
   the field rules above, hence the element in it. */
.auth-form input.auth-code {
  font-family: var(--font-mono);
  font-size: var(--fs-h4);
  letter-spacing: 0.5em;
  text-align: center;
  text-transform: uppercase;
  color: var(--paper-bright);
  margin: var(--s-2) 0 var(--s-3);
}

/* ---------- the action ---------- */
.auth-btn {
  display: block;
  width: 100%;
  background: var(--alert);
  color: var(--ink-0);
  border: 1px solid var(--alert);
  border-radius: var(--r-1);
  padding: 13px var(--s-3);
  min-height: 44px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-label);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  margin-top: var(--s-1);
  transition: background var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}

.auth-btn:hover {
  background: var(--alert-bright);
  border-color: var(--alert-bright);
  box-shadow: 0 8px 24px var(--alert-glow);
}

/* A secondary action: still a Bureau control, but it does not claim the
   red. Used by RESEND CODE on the verification sheet. */
.auth-btn--ghost {
  background: transparent;
  color: var(--paper-dim);
  border-color: var(--line-strong);
  box-shadow: none;
}

.auth-btn--ghost:hover {
  background: var(--ink-2);
  color: var(--paper-bright);
  border-color: var(--alert);
  box-shadow: none;
}

/* ---------- the refusal ---------- */
.auth-error {
  font-family: var(--font-my);
  font-size: var(--fs-label);
  line-height: 1.7;
  color: var(--alert-bright);
  text-align: center;
  margin-top: var(--s-2);
}

/* Only a refusal gets the red well — an empty error line must stay
   invisible, so the wash hangs off :not(:empty). */
.auth-error:not(:empty) {
  background: var(--alert-wash);
  border-left: var(--spine) solid var(--alert);
  padding: var(--s-1) var(--s-2);
}

/* …and a counter that succeeded is a machine readout, not a warning. */
.auth-error.is-ok {
  color: var(--phosphor);
}

.auth-error.is-ok:not(:empty) {
  background: var(--phosphor-wash);
  border-left-color: var(--phosphor-dim);
}

.auth-footer {
  margin-top: var(--s-4);
  padding-top: var(--s-2);
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
}

.auth-footer a {
  color: var(--muted-strong);
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--paper-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.owner-note {
  margin-top: var(--s-2);
  font-family: var(--font-my);
  font-size: var(--fs-micro);
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}

.owner-note code {
  font-family: var(--font-mono);
  color: var(--folklore);
  background: var(--folklore-wash);
  border: 1px solid var(--folklore-line);
  padding: 2px 6px;
  border-radius: var(--r-1);
}

/* ---------- the password meter ---------- */
.password-strength {
  margin: var(--s-1) 0 var(--s-2);
}

.strength-bar {
  height: 4px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-bottom: 5px;
}

.strength-fill {
  height: 100%;
  width: 0%;
  background: var(--alert);
  transition: width var(--dur-2) var(--ease),
              background var(--dur-2) var(--ease);
}

/* The score is computed in auth.html; the colour it paints is decided
   here, off the token palette. Red refuses, amber warns, phosphor is
   the meter reading a healthy value. */
.strength-fill[data-score="0"],
.strength-fill[data-score="1"] { background: var(--alert); }
.strength-fill[data-score="2"]   { background: var(--folklore); }
.strength-fill[data-score="3"]   { background: var(--phosphor-dim); }
.strength-fill[data-score="4"]   { background: var(--phosphor); }
.strength-fill[data-score="5"]   { background: var(--phosphor-bright); }

.strength-text {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- the posting order on ENLIST ----------
   The one part of enlistment that is not a credential: a division and the territory
   you stand in. It is boxed as a sub-form because it is filed as one — the Bureau
   keeps the posting on the operative's record, not next to their password. */
.posting-choice {
  border: 1px solid var(--line-strong);
  border-left: var(--spine) solid var(--cat-timeline);
  border-radius: var(--r-1);
  background: var(--ink-2);
  padding: var(--s-3) var(--s-2) var(--s-2);
  margin: var(--s-2) 0 var(--s-3);
}

.posting-choice legend {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--cat-timeline);
  padding: 0 var(--s-1);
}

.pc-lead {
  font-size: var(--fs-label);
  line-height: var(--lh-body);
  color: var(--muted-strong);
  margin-bottom: var(--s-2);
}

.pc-lead .my {
  display: block;
  font-family: var(--font-my);
  line-height: 1.7;
  color: var(--paper-dim);
  margin-top: 3px;
}

.posting-choice label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--muted-strong);
  margin-bottom: 4px;
}

.posting-choice select {
  display: block;
  width: 100%;
  background: var(--ink-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  color: var(--paper);
  padding: 10px var(--s-2);
  font-family: var(--font-my);
  font-size: var(--fs-label);
  margin-bottom: var(--s-2);
  outline: none;
  box-shadow: var(--shadow-inset);
  transition: border-color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}

.posting-choice select:hover { border-color: var(--ink-4); }

.posting-choice select:focus {
  border-color: var(--alert);
  box-shadow: 0 0 0 3px var(--alert-wash);
}

.pc-rule {
  font-size: var(--fs-label);
  line-height: var(--lh-body);
  color: var(--paper-dim);
  border-top: 1px solid var(--line-hair);
  padding-top: var(--s-1);
}

.pc-rule .my {
  display: block;
  font-family: var(--font-my);
  line-height: 1.7;
  color: var(--muted-strong);
  margin-top: 2px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-1);
  font-family: var(--font-my);
  font-size: var(--fs-label);
  line-height: 1.7;
  color: var(--muted-strong);
  margin-bottom: var(--s-2);
  cursor: pointer;
}

.checkbox-row input {
  margin-top: 3px;
  accent-color: var(--alert);
}

.checkbox-row a {
  color: var(--paper);
}

/* ---------- the standing-rules gate ---------- */
/* The line between a stranger and the ENLIST button: SHEET 18/18. It states
   the same fact twice, in the two hands the Bureau keeps — a mono form number
   for the file, a Burmese sentence for the person. js/rules.js flips
   data-read; nothing here decides anything. */
.rules-gate {
  display: grid;
  gap: var(--s-1);
  background: var(--ink-1);
  background-image: var(--alert-wash);
  border: 1px solid var(--line-strong);
  border-left: var(--spine) solid var(--alert);
  border-radius: var(--r-2);
  padding: var(--s-3);
  margin: var(--s-2) 0 var(--s-3);
}

.rules-gate .rg-k {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--paper-dim);
}

.rules-gate .rg-my {
  font-family: var(--font-my);
  font-size: var(--fs-label);
  line-height: 1.7;
  color: var(--alert-bright);
}

.rules-gate .rg-link {
  font-family: var(--font-my);
  font-size: var(--fs-label);
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px solid var(--line-red);
  justify-self: start;
  padding-bottom: 1px;
}

.rules-gate .rg-link:hover {
  color: var(--alert-bright);
  border-bottom-color: var(--alert-bright);
}

.rules-gate .rg-link:focus-visible {
  outline: 2px solid var(--alert-bright);
  outline-offset: 2px;
}

/* Read: the sheet stops holding the door, so it stops shouting about it. */
.rules-gate[data-read='1'] {
  background-image: none;
  border-left-color: var(--muted-strong);
}

.rules-gate[data-read='1'] .rg-my {
  color: var(--paper);
}

/* A control the Bureau has not released. It keeps its shape and loses its
   colour: withheld, not broken. Declared after .auth-btn:hover so the same
   specificity resolves in its favour. */
.auth-btn:disabled {
  background: var(--ink-3);
  border-color: var(--line-strong);
  color: var(--muted-strong);
  cursor: not-allowed;
  box-shadow: none;
}

.auth-btn:disabled:hover {
  background: var(--ink-3);
  border-color: var(--line-strong);
  color: var(--muted-strong);
  box-shadow: none;
}

/* ---------- ACCESS GRANTED: the one green on this sheet ---------- */
.auth-success {
  border: 1px solid var(--phosphor-dim);
  border-radius: var(--r-2);
  padding: var(--s-6) var(--s-4);
  text-align: center;
  background: var(--ink-1);
  background-image: var(--fibre), var(--phosphor-wash);
  box-shadow: var(--shadow-1);
  animation: fadeIn var(--dur-4) var(--ease-out);
}

.success-icon {
  font-family: var(--font-mono);
  font-size: 40px;
  line-height: 1;
  color: var(--phosphor);
  text-shadow: 0 0 18px rgba(51, 255, 102, 0.45);
  margin-bottom: var(--s-3);
  animation: pulse 2.4s var(--ease) infinite;
}

.auth-success h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-h3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-bright);
  margin-bottom: var(--s-2);
}

.auth-success p {
  font-size: var(--fs-label);
  color: var(--paper-dim);
  margin-bottom: var(--s-1);
}

.auth-success p.my {
  font-family: var(--font-my);
  line-height: 1.7;
  color: var(--muted-strong);
}

.auth-success .auth-btn {
  margin-top: var(--s-4);
  width: auto;
  display: inline-block;
  padding: 12px var(--s-6);
}

/* ---------- the mock mail slip ---------- */
.mock-code-box {
  border: 1px dashed var(--folklore-line);
  border-radius: var(--r-1);
  background: var(--folklore-wash);
  padding: var(--s-3);
  margin-bottom: var(--s-3);
  text-align: center;
}

.mock-code-label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
  color: var(--folklore);
  margin-bottom: var(--s-1);
}

.mock-code-value {
  font-family: var(--font-mono);
  font-size: var(--fs-h3);
  font-weight: 500;
  letter-spacing: 0.4em;
  color: var(--paper-bright);
  margin-bottom: 5px;
}

.mock-code-note {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-mono);
  color: var(--muted);
}

/* ---------- small screens, and a calmer one ---------- */
@media (max-width: 520px) {
  .auth-container {
    margin-top: var(--s-4);
  }

  .auth-form {
    padding: var(--s-4) var(--s-3);
  }

  .auth-tab {
    letter-spacing: 0.08em;
    padding: 11px 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-form.active,
  .auth-success {
    animation: none;
  }

  .success-icon {
    animation: none;
  }

  .strength-fill,
  .auth-btn,
  .auth-tab {
    transition: none;
  }
}
