/*
 * Admin sign-in.
 *
 * Standalone: templates/admin/login.html does not extend Jazzmin, so this is
 * the only stylesheet the page loads. No AdminLTE, no Bootstrap, no Font
 * Awesome, no webfont -- a door desk on venue wifi gets one CSS request and
 * the system font stack.
 *
 * The tokens are lifted from static/css/admin.css so both surfaces agree, and
 * the rules it states are kept:
 *
 *   - One accent carries identity and the primary action. Amber and red stay
 *     reserved for meaning. The accent is teal, which is close to the green
 *     that means "checked in", so the two are kept apart by hand -- see the
 *     note at the top of admin.css.
 *   - The page is dark at the top-left and light at the bottom-right, one
 *     unbroken field rather than two panels meeting at a seam. The pitch sits
 *     on the dark end and the form on the light end, so each gets its contrast
 *     from the ground it stands on rather than from a box drawn around it.
 *
 * The far end of that gradient is near-white in light mode and deep teal in
 * dark mode. The page is otherwise the same drawing in both: this is a door
 * somebody opens in a dim hall as often as at a desk, and a white quadrant at
 * 6am is the thing the pre-paint theme script in the template exists to avoid.
 */

:root {
  --ad-ink: #0f172a;
  --ad-paper: #f6f9fa;
  --ad-surface: #ffffff;
  --ad-line: #e4eaee;
  --ad-line-strong: #cbd5dd;
  /* Darker than the slate the rest of the admin uses for muted text. The
     panel is translucent, so what sits behind this type is anywhere between
     mid-teal and near-white depending on the viewport. #64748b measured
     3.2:1 against the darker end; this clears 4.5:1 across the whole range. */
  --ad-mute: #3c4c5c;

  --ad-accent: #0d9488;
  --ad-accent-deep: #0b7c72;
  --ad-accent-rgb: 13, 148, 136;

  --ad-stop: #be2f24;
  --ad-stop-wash: #fceceb;

  /* The other kind of message this page shows: being asked for a second
     factor, which is not a failure. The accent, darkened until it clears AA on
     its own wash -- --ad-accent-deep measured 4.52 there, too thin a margin for
     small type someone reads with a phone in the other hand. */
  --ad-ask: #0a736a;
  --ad-ask-wash: #e6f5f3;

  /* The ground, dark corner to light corner. */
  --lg-g1: #04141d;
  --lg-g2: #07303a;
  --lg-g3: #1d6b63;
  --lg-g4: #57a89b;
  --lg-g5: #e7f4ef;

  --lg-card: #10504a;
  --lg-card-line: rgba(255, 255, 255, 0.1);
  --lg-on-dark: #ffffff;
  --lg-on-dark-mute: #b6d3cd;

  --lg-panel: rgba(219, 240, 233, 0.72);
  --lg-panel-line: rgba(255, 255, 255, 0.6);
  --lg-foot-ink: #ffffff;

  --ad-field: #ffffff;
  --ad-on-accent: #ffffff;

  --ad-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --ad-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  --ad-radius: 14px;
  --ad-radius-sm: 9px;
  --ad-shadow-md: 0 2px 4px rgba(6, 26, 34, 0.06), 0 14px 40px rgba(6, 26, 34, 0.14);
}

/* The template writes data-bs-theme before first paint. This block is the
   no-JS fallback, and is scoped so an explicit light choice still wins. */
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) {
    --ad-ink: #e9f1ee;
    --ad-line: #23423f;
    --ad-line-strong: #315853;
    --ad-mute: #94b0ab;
    --ad-accent: #2dd4bf;
    --ad-accent-deep: #14b8a6;

    /* Both washes go dark here. admin-login.css had carried only the light
       pair, so an error on this page arrived as a pale pink box in the middle
       of a dark panel. Values are admin.css's, so the two surfaces agree. */
    --ad-stop: #f8776a;
    --ad-stop-wash: #2f1a18;
    --ad-ask: #5eead4;
    --ad-ask-wash: #10312f;

    --lg-g1: #020d12;
    --lg-g2: #05212a;
    --lg-g3: #0d4a46;
    --lg-g4: #146059;
    --lg-g5: #1d514a;

    --lg-card: #093733;
    --lg-card-line: rgba(164, 220, 209, 0.16);
    --lg-panel: rgba(14, 48, 47, 0.72);
    --lg-panel-line: rgba(148, 208, 197, 0.22);
    --lg-foot-ink: #9fc4bd;

    --ad-field: #0c2b2c;
    --ad-on-accent: #04231f;
    --ad-shadow-md: 0 2px 4px rgba(0, 0, 0, 0.32), 0 14px 40px rgba(0, 0, 0, 0.42);
  }
}

:root[data-bs-theme="dark"] {
  --ad-ink: #e9f1ee;
  --ad-line: #23423f;
  --ad-line-strong: #315853;
  --ad-mute: #94b0ab;
  --ad-accent: #2dd4bf;
  --ad-accent-deep: #14b8a6;

  --ad-stop: #f8776a;
  --ad-stop-wash: #2f1a18;
  --ad-ask: #5eead4;
  --ad-ask-wash: #10312f;

  --lg-g1: #020d12;
  --lg-g2: #05212a;
  --lg-g3: #0d4a46;
  --lg-g4: #146059;
  --lg-g5: #1d514a;

  --lg-card: #093733;
  --lg-card-line: rgba(164, 220, 209, 0.16);
  --lg-panel: rgba(14, 48, 47, 0.72);
  --lg-panel-line: rgba(148, 208, 197, 0.22);
  --lg-foot-ink: #9fc4bd;

  --ad-field: #0c2b2c;
  --ad-on-accent: #04231f;
  --ad-shadow-md: 0 2px 4px rgba(0, 0, 0, 0.32), 0 14px 40px rgba(0, 0, 0, 0.42);
}

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

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

body {
  margin: 0;
  font-family: var(--ad-sans);
  color: var(--ad-ink);
  background: var(--lg-g1);
}

/* ==========================================================================
   Shell
   ========================================================================== */

.lg {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background:
    radial-gradient(80% 70% at 4% 0%, var(--lg-g1) 0%, rgba(4, 20, 29, 0) 62%),
    linear-gradient(118deg,
      var(--lg-g1) 0%, var(--lg-g2) 26%, var(--lg-g3) 52%,
      var(--lg-g4) 74%, var(--lg-g5) 100%);
}

/* Decorative tracery over the light half. Kept faint on purpose -- it is
   texture, and the moment it competes with the form it has failed. */
.lg-tracery {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--lg-g3);
  opacity: 0.26;
  pointer-events: none;
}

.lg-inner {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  max-width: 78rem;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(19rem, 0.95fr);
  align-items: center;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  padding-block: clamp(1rem, 3vh, 2.5rem);
}

/* ---------------------------------------------------------- the pitch ---- */

/* Second in the source, first on the screen: the form is what someone came
   for, so it leads the document and this is placed around it. */
.lg-pitch {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  color: var(--lg-on-dark);
}

.lg-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.lg-brand-mark {
  width: 3.1rem;
  height: 1.75rem;
  flex: none;
}

.lg-brand-word {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--lg-on-dark);
}

.lg-brand-word span {
  color: #35c4b0;
}

.lg-headline {
  margin: clamp(1.25rem, 3vw, 2rem) 0 clamp(1.5rem, 3.5vw, 2.5rem);
  max-width: 15ch;
  font-size: clamp(1.9rem, 4.1vw, 3.2rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.022em;
  color: var(--lg-on-dark);
}

/* ---------------------------------------------------------- the steps ---- */

/* An ordered list because the numbering is real: an event is configured, then
   people arrive, then the day is reported on. The markers are written into the
   headings rather than generated, so they survive translation. */
.lg-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lg-step {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.1rem 0;
  border: 1px solid var(--lg-card-line);
  border-radius: var(--ad-radius);
  background: linear-gradient(165deg, color-mix(in srgb, var(--lg-card) 88%, #0a2b30), var(--lg-card));
  color: var(--lg-on-dark);
  overflow: hidden;
}

.lg-step-icon {
  width: 2rem;
  height: 2rem;
  color: var(--lg-on-dark-mute);
  margin-bottom: 0.85rem;
}

.lg-step-title {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.lg-step-copy {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--lg-on-dark-mute);
}

/* The illustration is the card's floor: it bleeds to the bottom edge so the
   card reads as a window onto the thing rather than a box with a picture in. */
.lg-art {
  display: block;
  width: 100%;
  height: auto;
  margin-top: auto;
  padding-top: 1.1rem;
  color: #6fd8c6;
  opacity: 0.72;
}

/* ---------------------------------------------------------- the panel ---- */

.lg-panel {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.lg-form {
  padding: clamp(1.5rem, 2.5vw, 2rem);
  border: 1px solid var(--lg-panel-line);
  border-radius: var(--ad-radius);
  background: var(--lg-panel);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  backdrop-filter: blur(16px) saturate(125%);
  box-shadow: var(--ad-shadow-md);
}

.lg-title {
  margin: 0 0 0.3rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ad-ink);
}

.lg-sub {
  margin: 0 0 1.4rem;
  font-size: 0.88rem;
  color: var(--ad-mute);
}

.lg-field + .lg-field {
  margin-top: 0.9rem;
}

.lg-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ad-ink);
}

/* The glyph sits inside the field rather than beside it, so the control is one
   object to hit -- which matters more on a phone at a door than it reads here. */
.lg-shell {
  position: relative;
  display: block;
}

.lg-glyph {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  width: 1.05rem;
  height: 1.05rem;
  transform: translateY(-50%);
  color: var(--ad-mute);
  pointer-events: none;
}

.lg-input {
  width: 100%;
  padding: 0.7rem 0.85rem 0.7rem 2.4rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ad-ink);
  background: var(--ad-field);
  border: 1px solid var(--ad-line-strong);
  border-radius: var(--ad-radius-sm);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.lg-input--peekable {
  padding-right: 2.7rem;
}

.lg-input::placeholder {
  color: var(--ad-mute);
  opacity: 0.85;
}

.lg-input:focus-visible,
.lg-input:focus {
  outline: none;
  border-color: var(--ad-accent);
  box-shadow: 0 0 0 3px rgba(var(--ad-accent-rgb), 0.24);
}

/* A one-time code is serial data, like the UUIDs and EK numbers the admin
   shows in mono elsewhere. Tracking it out makes a mistyped digit findable. */
.lg-input--code {
  font-family: var(--ad-mono);
  letter-spacing: 0.16em;
}

.lg-peek {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--ad-mute);
  background: none;
  border: 0;
  border-radius: var(--ad-radius-sm);
  cursor: pointer;
}

.lg-peek:hover {
  color: var(--ad-ink);
}

.lg-peek:focus-visible {
  outline: 2px solid var(--ad-accent);
  outline-offset: 1px;
}

.lg-peek svg {
  width: 1.1rem;
  height: 1.1rem;
}

.lg-peek .lg-peek-off {
  display: none;
}

.lg-peek[aria-pressed="true"] .lg-peek-on {
  display: none;
}

.lg-peek[aria-pressed="true"] .lg-peek-off {
  display: block;
}

/* django-otp renders the device selector itself, so this is matched on the
   element rather than on a class this file controls. */
.lg-field select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ad-ink);
  background: var(--ad-field);
  border: 1px solid var(--ad-line-strong);
  border-radius: var(--ad-radius-sm);
}

.lg-field select:focus-visible,
.lg-field select:focus {
  outline: none;
  border-color: var(--ad-accent);
  box-shadow: 0 0 0 3px rgba(var(--ad-accent-rgb), 0.24);
}

.lg-hint {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--ad-mute);
}

.lg-links {
  margin: 0.55rem 0 0;
  text-align: right;
  font-size: 0.8rem;
}

.lg-links a {
  color: var(--ad-accent-deep);
  text-decoration: none;
}

.lg-links a:hover {
  text-decoration: underline;
}

.lg-links a:focus-visible {
  outline: 2px solid var(--ad-accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.lg-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1.15rem;
  padding: 0.78rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ad-on-accent);
  background: var(--ad-accent-deep);
  border: 0;
  border-radius: var(--ad-radius-sm);
  cursor: pointer;
  transition: background-color 0.14s ease, transform 0.08s ease;
}

.lg-submit svg {
  width: 0.95rem;
  height: 0.95rem;
}

.lg-submit:hover {
  background: color-mix(in srgb, var(--ad-accent-deep) 86%, #000);
}

.lg-submit:active {
  transform: translateY(1px);
}

.lg-submit:focus-visible {
  outline: 2px solid var(--ad-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------- problems ------ */

.lg-alert {
  margin-bottom: 1.1rem;
  padding: 0.8rem 0.9rem;
  font-size: 0.85rem;
  color: var(--ad-stop);
  background: var(--ad-stop-wash);
  border: 1px solid color-mix(in srgb, var(--ad-stop) 30%, transparent);
  border-radius: var(--ad-radius-sm);
}

/* The second step is a prompt, not a fault: the password was accepted and the
   page is asking for the other factor. Red would report a failure that did not
   happen, so this one case takes the accent. A code that comes back rejected
   keeps the red. */

.lg-alert--prompt {
  color: var(--ad-ask);
  background: var(--ad-ask-wash);
  border-color: color-mix(in srgb, var(--ad-ask) 30%, transparent);
}

.lg-alert p {
  margin: 0;
}

.lg-alert p + p {
  margin-top: 0.35rem;
}

/* ----------------------------------------------------------- the foot ---- */

/* This line sits centred over the gradient, and which part of the gradient
   that is depends on the viewport: mid-teal at 1360px, near-pale at 1920px.
   No flat colour clears 4.5:1 against both -- dark ink measured 1.9:1 on the
   mid-teal -- so the text is white and carries its own shadow, which holds
   against the light end without drawing a box around itself. */

.lg-foot {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.75rem;
}

.lg-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--lg-foot-ink);
  text-shadow: 0 1px 3px rgba(3, 18, 24, 0.55);
}

/* Shown only when the server is actually enforcing a second factor. */
.lg-posture {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--lg-foot-ink);
  text-shadow: 0 1px 3px rgba(3, 18, 24, 0.55);
}

.lg-posture::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--ad-accent);
}

/* ==========================================================================
   Narrow screens
   ==========================================================================
   The form comes first, because it is the job. The pitch keeps its place
   underneath rather than disappearing: an usher signing in on a phone at a
   door should still see at a glance that they are in the right product. */

@media (max-width: 64rem) {
  .lg-inner {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 2rem;
  }

  .lg-panel {
    grid-column: 1;
    grid-row: 1;
    max-width: 26rem;
    margin-inline: auto;
    width: 100%;
  }

  .lg-pitch {
    grid-column: 1;
    grid-row: 2;
    text-align: center;
  }

  .lg-headline {
    margin-inline: auto;
    max-width: 22ch;
  }

  .lg-steps {
    text-align: left;
  }

  .lg-tracery {
    opacity: 0.12;
  }
}

@media (max-width: 46rem) {
  .lg-steps {
    grid-template-columns: minmax(0, 1fr);
    max-width: 26rem;
    margin-inline: auto;
  }

  /* The art is the first thing to go: three illustrations stacked turns the
     page into a scroll, and the headings carry the meaning without them. */
  .lg-art {
    display: none;
  }

  .lg-step {
    padding-bottom: 1.15rem;
  }
}

@media (max-width: 26rem) {
  .lg-title {
    font-size: 1.45rem;
  }

  .lg-form {
    padding: 1.25rem 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lg-input,
  .lg-submit {
    transition: none;
  }

  .lg-submit:active {
    transform: none;
  }
}
