/*
 * login.css — the FOLIO cover: one warm page floating in the dark reading
 * room. The brand is the cover's letterhead, the inputs are quiet writing
 * lines, and the sign-in button is the screen's one warm-ink commitment
 * (the report seal's sibling). Steel never touches the page. Tokens only;
 * no animation beyond the submit spinner. Coherent in BOTH themes.
 */

.login-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg0);
  color: var(--med-text);
  font-family: var(--font-primary);
  overflow-x: hidden;
}
/* the dark reading room: the same near-black floor as the image viewer */
html.dark .login-body {
  background: var(--med-viewer);
}

/* ---- layout -------------------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
}
.login-pane {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- the cover ------------------------------------------------------------ */
.login-card {
  width: 100%;
  background: var(--page);
  border: 1px solid var(--page-edge);
  border-radius: 3px;
  box-shadow: 0 10px 30px rgba(60, 54, 38, 0.12);
  padding: 28px 30px 26px;
  color: var(--page-ink);
}
html.dark .login-card {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.login-card ::selection {
  background: rgba(180, 165, 120, 0.3);
}

/* ---- letterhead (the brand, ON the cover) --------------------------------- */
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 0 0 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--page-edge);
}
.login-mark {
  width: 40px;
  height: 40px;
  /* steel never touches the page — the aperture mark inks itself warm */
  color: var(--page-ink-2);
  margin-bottom: 12px;
}
.login-mark svg {
  width: 100%;
  height: 100%;
}
.login-name {
  margin: 0;
  /* The cover is a manuscript: the brand speaks the FOLIO serif. */
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--page-ink);
}
.login-name__ai {
  color: var(--page-ink-2);
  font-weight: 500;
}
/* the posture line speaks record */
.login-posture {
  margin: 10px 0 0;
  max-width: 300px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.8;
  color: var(--page-ink-muted);
}

/* ---- the opener (the report page's section-label idiom) ------------------- */
.login-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
  color: var(--page-ink-2);
}
.login-card .hint {
  margin: 0 0 18px;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--page-ink-muted);
}

.login-card form {
  display: flex;
  flex-direction: column;
}

/* ---- writing lines -------------------------------------------------------- */
.login-card label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--page-ink-muted);
  margin-bottom: 2px;
}
.login-card label + input {
  margin-bottom: 18px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 2px 8px;
  font-size: 15px;
  font-family: var(--font-ui);
  color: var(--page-ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--page-edge);
  border-radius: 0;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  caret-color: var(--page-ink);
}
.login-card input::placeholder {
  color: var(--page-ink-muted);
}
/* focus = the writing line inks + a faint warm wash; no steel on the page */
.login-card input:focus {
  border-bottom-color: var(--page-ink-2);
  background: var(--page-wash);
  box-shadow: none;
}
.login-card input:focus-visible {
  outline: 2px solid var(--page-ink-2);
  outline-offset: 0;
}
/* autofill must not paint graphite on the page */
.login-card input:-webkit-autofill {
  -webkit-text-fill-color: var(--page-ink);
  -webkit-box-shadow: 0 0 0 60px var(--page) inset;
  transition: background-color 9999s ease-out;
}

/* caps-lock warning (JS toggles [hidden]) — semantic --warn, record voice */
.capslock-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -8px 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--warn);
}
.capslock-hint svg {
  width: 13px;
  height: 13px;
  flex: none;
}

/* ---- the seal — the ONE filled commitment, pressed in warm ink ------------ */
.login-card button[type="submit"] {
  margin-top: 8px;
  width: 100%;
  height: 42px;
  font-size: var(--text-md);
  background: var(--page-ink);
  border-color: var(--page-ink);
  color: var(--page);
  letter-spacing: 0.02em;
}
.login-card button[type="submit"]:hover {
  background: var(--page-ink);
  border-color: var(--page-ink);
  filter: brightness(1.08);
}
.login-card button[type="submit"]:focus-visible {
  outline: 2px solid var(--page-ink-2);
  outline-offset: 2px;
}
.login-card button[type="submit"].is-authenticating {
  pointer-events: none;
  background: color-mix(in srgb, var(--page-ink) 82%, var(--page));
  border-color: transparent;
  color: var(--page);
  filter: none;
}
.login-card button[type="submit"].is-authenticating .login-submit__label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.login-card button[type="submit"].is-authenticating .login-submit__label::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: var(--radius-pill);
  border: 2px solid color-mix(in srgb, var(--page) 30%, transparent);
  border-top-color: var(--page);
  animation: spin 0.7s linear infinite;
}

/* ---- alerts: outline chips on the page ------------------------------------ */
.login-card .alert {
  font-size: var(--text-sm);
  line-height: 1.5;
  padding: 9px 12px;
  border-radius: 3px;
  margin-bottom: 16px;
  border: 1px solid var(--page-edge);
  background: transparent;
}
.login-card .alert.error {
  color: var(--stat);
  border-color: color-mix(in srgb, var(--stat) 45%, transparent);
  background: transparent;
}
.login-card .alert.notice {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: transparent;
}
.login-card .alert code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--page-ink);
}

/* ---- the record foot (room ink, outside the cover) ------------------------ */
.login-foot {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---- narrow viewports ------------------------------------------------------ */
@media (max-width: 480px) {
  .login-shell {
    padding: 36px 16px;
    align-items: start;
  }
  .login-shell {
    padding-top: 12vh;
  }
  .login-card {
    padding: 24px 20px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-card button[type="submit"].is-authenticating .login-submit__label::before {
    animation: none;
  }
}

/* ==========================================================================
   THE READING ROOM (2026-08-15) — premium pass. The dark around the cover
   stops being empty: a vast aperture iris inscribed in the black (barely
   there, turning imperceptibly) and a pool of lamplight the page floats in.
   The cover arrives like a page set on a desk: one quiet rise, letterhead
   first. All decoration is aria-hidden; motion honors reduced-motion.
   ========================================================================== */
.login-shell {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.login-room {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.login-room__iris {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(1240px, 175vmax);
  height: min(1240px, 175vmax);
  transform: translate(-50%, -50%);
  color: var(--med-text-muted);
  opacity: 0.05;
  animation: login-iris-turn 240s linear infinite;
}
html.dark .login-room__iris { opacity: 0.07; }
.login-room__lamp {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 720px;
  height: 720px;
  transform: translate(-50%, -54%);
  background: radial-gradient(
    closest-side,
    rgba(214, 197, 152, 0.09),
    rgba(214, 197, 152, 0.03) 55%,
    transparent 72%
  );
}
@keyframes login-iris-turn {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* The page catches the lamp: a hairline top highlight + deeper floor shadow. */
.login-card {
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(30, 26, 16, 0.1),
    0 14px 44px rgba(40, 34, 20, 0.16);
}
html.dark .login-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 240, 0.06),
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 24px 70px rgba(0, 0, 0, 0.55);
}

/* Arrival: the cover rises once; the letterhead settles first, then the form.
   One choreographed moment — not scattered micro-motion. */
@media (prefers-reduced-motion: no-preference) {
  .login-card {
    animation: login-settle 0.5s cubic-bezier(0.22, 0.7, 0.3, 1) both;
  }
  .login-brand,
  .login-card h3,
  .login-card .hint,
  .login-card form,
  .login-card .alert {
    animation: login-ink 0.45s cubic-bezier(0.22, 0.7, 0.3, 1) both;
  }
  .login-brand { animation-delay: 0.08s; }
  .login-card h3 { animation-delay: 0.16s; }
  .login-card .hint { animation-delay: 0.2s; }
  .login-card .alert { animation-delay: 0.22s; }
  .login-card form { animation-delay: 0.24s; }
}
@keyframes login-settle {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes login-ink {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* The seal commits under the hand: lift on hover, press on click. */
.login-card .btn--primary {
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}
.login-card .btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(40, 34, 20, 0.22);
  filter: brightness(1.04);
}
.login-card .btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(40, 34, 20, 0.18);
  filter: brightness(0.99);
}

/* ==========================================================================
   COOL INSTRUMENT PALETTE (2026-08-15) — the login leaves the FOLIO paper.
   The cover is now a precision instrument in the reading room: deep slate
   glass, ice-signal accent, the serif wordmark with a mono "AI" chip, and a
   quiet living pulse. One accent, small motion — an AI feel, not a light
   show. Scoped to .login-body only; report/FOLIO tokens untouched.
   ========================================================================== */
.login-body {
  --lg-card: linear-gradient(178deg, #151b23 0%, #10161d 60%, #0e141a 100%);
  --lg-edge: rgba(126, 184, 205, 0.16);
  --lg-ink: #e9eff3;
  --lg-ink-2: #c2cfd8;
  --lg-muted: #8b9aa5;
  --lg-accent: #6fd3e8;
  --lg-accent-soft: rgba(111, 211, 232, 0.14);
  background: #0a0e13;
}
html.dark .login-body { background: #090d11; }

.login-card {
  background: var(--lg-card);
  border-color: var(--lg-edge);
  border-radius: 10px;
  color: var(--lg-ink);
  box-shadow:
    inset 0 1px 0 rgba(190, 225, 240, 0.07),
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 26px 80px rgba(0, 0, 0, 0.55);
}
.login-card ::selection { background: var(--lg-accent-soft); }

/* Room: the iris and lamp go cool to match the instrument. */
.login-room__iris { color: #9fd2e2; opacity: 0.06; }
html.dark .login-room__iris { opacity: 0.075; }
.login-room__lamp {
  background: radial-gradient(
    closest-side,
    rgba(111, 211, 232, 0.075),
    rgba(111, 211, 232, 0.025) 55%,
    transparent 72%
  );
}

/* Wordmark: serif "Aperture", a mono AI chip in the signal color. */
.login-brand { border-bottom-color: rgba(126, 184, 205, 0.12); }
.login-mark { color: var(--lg-accent); opacity: 0.85; }
.login-name { font-size: 26px; letter-spacing: 0; color: var(--lg-ink); }
.login-name__ai {
  font-family: var(--font-mono);
  font-size: 0.58em;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--lg-accent);
  vertical-align: 0.16em;
  margin-left: 3px;
}
.login-posture { color: var(--lg-muted); }
.login-card h3 { color: var(--lg-ink-2); }
.login-card .hint { color: var(--lg-muted); }

/* The living pulse: assistive systems, breathing quietly. */
.login-live {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  margin-right: 7px;
  vertical-align: 1px;
  background: var(--lg-accent);
  box-shadow: 0 0 6px rgba(111, 211, 232, 0.7);
}
@media (prefers-reduced-motion: no-preference) {
  .login-live { animation: login-breathe 2.6s ease-in-out infinite; }
}
@keyframes login-breathe {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(111, 211, 232, 0.7); }
  50% { opacity: 0.35; box-shadow: 0 0 2px rgba(111, 211, 232, 0.25); }
}

/* Writing lines on glass: cool underlines, signal focus. */
.login-card label { color: var(--lg-muted); }
.login-card input[type="text"],
.login-card input[type="password"] {
  color: var(--lg-ink);
  border-bottom-color: rgba(139, 154, 165, 0.35);
  caret-color: var(--lg-accent);
}
.login-card input::placeholder { color: var(--lg-muted); }
.login-card input:focus {
  border-bottom-color: var(--lg-accent);
  background: rgba(111, 211, 232, 0.05);
}
.login-card input:focus-visible { outline-color: var(--lg-accent); }
.login-card input:-webkit-autofill {
  -webkit-text-fill-color: var(--lg-ink);
  -webkit-box-shadow: 0 0 0 60px #131920 inset;
}

/* The commitment: an ice-signal seal with dark ink. */
.login-card button[type="submit"].btn--primary {
  background: linear-gradient(180deg, #d8f1f8 0%, #b3e2ee 100%);
  border: 1px solid rgba(111, 211, 232, 0.5);
  color: #0c1318;
  font-weight: 650;
}
.login-card button[type="submit"].btn--primary:hover {
  box-shadow: 0 6px 20px rgba(111, 211, 232, 0.22);
  filter: none;
}
.login-card button[type="submit"].btn--primary:active { box-shadow: 0 2px 8px rgba(111, 211, 232, 0.18); }
