/* ==========================================================================
   SIGN-IN DIALOG (1 Dec, user: the sign-in page becomes a popup the header's
   Log in button opens; the field says "Organization", not "Account")
   Native <dialog> — showModal() traps focus and answers Esc for free;
   ::backdrop dims the page behind. The card follows the header's menu-card
   recipe (header.css): the ember night ground, a bark hairline, the same
   near+far shadows. The field is the form-field recipe (form.css), kept
   scoped here because form.css ships only with the demo page and the dialog
   ships with every page.
   ========================================================================== */

.sign-in {
  --heading: var(--ember-cream);
  --ink: var(--ember-stone);
  --ink-muted: var(--ember-stone);
  --line: var(--ember-bark);
  --field-focus: var(--sage-green);
  --card-shadow-near: color-mix(in srgb, var(--night-deep) 56%, transparent);
  --card-shadow: color-mix(in srgb, var(--night-deep) 72%, transparent);

  width: min(480px, calc(100vw - var(--space-8)));
  padding: 0;
  border: none;
  background: var(--night-deep);
  color: var(--ink);
}
.sign-in::backdrop { background: color-mix(in srgb, var(--night-deep) 72%, transparent); }

.sign-in__card {
  position: relative;
  padding: var(--space-7);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--night-deep);
  /* A subtle drop shadow: a tight one for the edge, a soft one for lift — the menu-card's. */
  box-shadow: 0 var(--space-1) var(--space-2) var(--card-shadow-near),
              0 var(--space-4) var(--space-7) var(--card-shadow);
}
.sign-in h2 { margin: 0; font-size: var(--size-h3); line-height: 1.2; }   /* the card-heading scale (1 Dec, user): the hero scale dwarfed the card once the heading grew */

.sign-in__close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  width: 34px; height: 34px;
  border: var(--border-w) solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-muted);
  font: 500 18px/32px var(--font-body);
  cursor: pointer;
  transition: color var(--motion-base) var(--motion-ease),
              border-color var(--motion-base) var(--motion-ease);
}
.sign-in__close:hover { color: var(--heading); border-color: var(--line); }
.sign-in__close:focus-visible { outline: none; border-color: var(--field-focus); box-shadow: 0 0 0 1px var(--field-focus); }

/* The form-field recipe (form.css §fields), scoped to the dialog. */
.sign-in .form-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.sign-in .form-field__label {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3);
  font-size: 14px; line-height: 1.5; font-weight: 500;
  color: var(--heading);
}
.sign-in .form-field__input {
  width: 100%;
  min-height: 46px;
  padding: 0 var(--space-4);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--heading) 4%, var(--night-deep));
  font: 400 16px/1.5 var(--font-body);   /* 16px also stops iOS zooming in on focus */
  color: var(--heading);
  transition: border-color var(--motion-base) var(--motion-ease),
              box-shadow var(--motion-base) var(--motion-ease);
}
.sign-in .form-field__input::placeholder { color: var(--ink-muted); opacity: 0.72; }
.sign-in .form-field__input:hover { border-color: color-mix(in srgb, var(--heading) 32%, var(--night-deep)); }
/* The border carries focus; a second 1px ring keeps it visible at a glance. */
.sign-in .form-field__input:focus-visible {
  outline: none;
  border-color: var(--field-focus);
  box-shadow: 0 0 0 1px var(--field-focus);
}

.sign-in__form { display: grid; gap: var(--space-5); margin-top: var(--space-6); }
.sign-in__form .btn { justify-self: center; }   /* centered under the field (1 Dec, user) */

.sign-in__status { min-height: 1.5em; margin: var(--space-2) 0 0; font-size: 15px; color: var(--ink-muted); }
.sign-in__status[data-kind="error"] { color: var(--ember-orange); }
.sign-in__status[data-kind="ok"] { color: var(--heading); }

@media (prefers-reduced-motion: no-preference) {
  .sign-in[open] { animation: sign-in-rise var(--motion-base) var(--motion-ease); }
  @keyframes sign-in-rise { from { opacity: 0; transform: translateY(var(--space-3)); } }
}
