/*
 * Sign-in page. Colours mirror the shared Lookout tokens (src/lookout/ui/tokens.css, UI-2);
 * tokens.test.mjs keeps every --lk value below equal to the source. This page is served before
 * sign-in, so it cannot import tokens.css; the two self-hosted font files are public (UI-3b) and are
 * declared here exactly as in tokens.css, with system fonts as the fallback.
 */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/source-serif-4-latin.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --lk-ground: #F4F2ED;
  --lk-panel: #FFFFFF;
  --lk-ink: #1E2830;
  --lk-muted: #4A5963;
  --lk-line: #DDD7C8;
  --lk-line-strong: #857C68;
  --lk-accent: #1F6F78;
  --lk-accent-strong: #15525A;
  --lk-on-accent: #FFFFFF;
  --lk-link: #15525A;
  --lk-focus: #B4661A;
  --lk-ok: #2A6F46;
  --lk-danger: #A23B2F;
  --lk-header-bg: #1E2830;
  --lk-header-ink: #F4F2ED;
  --lk-header-muted: #C9D2D6;
  --lk-header-line: #5B6B75;
  --login-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --login-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-family: var(--login-sans);
  color: var(--lk-ink);
  background: var(--lk-ground);
  font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --lk-ground: #111A20;
    --lk-panel: #18242C;
    --lk-ink: #E6EDF1;
    --lk-muted: #A9B8C2;
    --lk-line: #2E3E48;
    --lk-line-strong: #6E8290;
    --lk-accent: #5FB3BC;
    --lk-accent-strong: #7CC7CF;
    --lk-on-accent: #0C1418;
    --lk-link: #7CC7CF;
    --lk-focus: #E0A15A;
    --lk-ok: #7CCB9A;
    --lk-danger: #F08A7E;
    --lk-header-bg: #0B1115;
    --lk-header-ink: #E6EDF1;
    --lk-header-muted: #AEBAC2;
    --lk-header-line: #3A4A55;
  }
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body { margin: 0; min-width: 320px; background: var(--lk-ground); }

button, input { font: inherit; }

a { color: var(--lk-link); text-underline-offset: 0.2em; }

:focus-visible { outline: 3px solid var(--lk-focus); outline-offset: 3px; }

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(420px, 0.82fr);
  min-height: 100vh;
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3rem;
  padding: clamp(2rem, 4.5vw, 4.75rem);
  color: var(--lk-header-muted);
  background: var(--lk-header-bg);
}

.brand-lockup,
.mobile-lockup {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.brand-mark { object-fit: contain; }

.brand-owner,
.eyebrow,
.brand-tagline,
.scope-list,
.mobile-lockup small {
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-owner {
  margin: 0 0 0.18rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.brand-lockup .brand-name {
  margin: 0;
  color: var(--lk-header-ink);
  font-size: clamp(2rem, 3.25vw, 3.55rem);
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 0.95;
}

.brand-tagline {
  margin: 0.62rem 0 0;
  font-size: 0.7rem;
  font-weight: 700;
}

.brand-copy { max-width: 720px; }

.eyebrow {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.brand-copy .eyebrow { color: var(--lk-header-muted); }

.brand-copy h2 {
  margin: 0;
  color: var(--lk-header-ink);
  font-family: var(--login-serif);
  font-size: clamp(2.5rem, 5vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.brand-copy > p:last-child {
  max-width: 590px;
  margin: 1.65rem 0 0;
  font-size: clamp(1rem, 1.25vw, 1.12rem);
  line-height: 1.7;
}

.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.8rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--lk-header-line);
  font-size: 0.7rem;
  font-weight: 700;
}

.form-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem clamp(2rem, 5vw, 5.5rem);
  background: var(--lk-ground);
}

.login-card {
  width: min(100%, 430px);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--lk-line);
  border-radius: 10px;
  background: var(--lk-panel);
}

.mobile-lockup { display: none; margin-bottom: 2rem; }

.mobile-lockup strong {
  display: block;
  font-size: 1.45rem;
  letter-spacing: 0.08em;
}

.mobile-lockup small {
  display: block;
  margin-top: 0.25rem;
  color: var(--lk-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.login-card .eyebrow { color: var(--lk-accent-strong); }

.login-card h1 {
  margin: 0;
  font-family: var(--login-serif);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-intro {
  margin: 0.8rem 0 1.75rem;
  color: var(--lk-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

form { display: grid; }

label {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

label:not(:first-child) { margin-top: 1.2rem; }

.field-wrap { position: relative; }

input {
  width: 100%;
  height: 48px;
  padding: 0 1rem;
  color: var(--lk-ink);
  border: 1px solid var(--lk-line-strong);
  border-radius: 6px;
  background: var(--lk-panel);
  transition: border-color 150ms ease;
}

input::placeholder { color: var(--lk-muted); }

input:hover { border-color: var(--lk-ink); }

input:focus-visible { border-color: var(--lk-accent); }

.password-wrap input { padding-right: 5rem; }

.show-password {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0.4rem 0.6rem;
  color: var(--lk-link);
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.show-password:hover { text-decoration: underline; }

.login-status {
  min-height: 1.4rem;
  margin: 0.8rem 0 0.65rem;
  color: var(--lk-danger);
  font-size: 0.875rem;
  line-height: 1.4;
}

.login-status[data-state="working"] { color: var(--lk-muted); }

.login-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 50px;
  padding: 0 1.15rem 0 1.35rem;
  color: var(--lk-on-accent);
  border: 1px solid var(--lk-accent);
  border-radius: 6px;
  background: var(--lk-accent);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 150ms ease;
}

.login-submit:hover:not(:disabled) { background: var(--lk-accent-strong); border-color: var(--lk-accent-strong); }

.login-submit:disabled { cursor: wait; opacity: 0.72; }

.login-submit span:last-child { font-size: 1.3rem; line-height: 1; }

.account-help {
  margin: 1.2rem 0 0;
  color: var(--lk-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.security-note {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.75rem;
  padding-top: 1rem;
  color: var(--lk-muted);
  border-top: 1px solid var(--lk-line);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.security-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lk-ok);
}

.legal {
  width: min(100%, 430px);
  margin: 2rem 0 0;
  color: var(--lk-muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

@media (max-width: 880px) {
  .login-shell { display: block; min-height: 100dvh; }
  .brand-panel { display: none; }
  .form-panel { min-height: 100dvh; padding: 2rem 1.4rem; }
  .mobile-lockup { display: flex; }
}

@media (max-width: 440px) {
  .form-panel { justify-content: flex-start; padding: 1.5rem 1rem; }
  .login-card { padding: 1.25rem; }
  .login-card h1 { font-size: 1.75rem; }
  .legal { margin-top: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
