/* Shared stylesheet for the static /login pages (public/auth/index.html,
 * public/auth/staff/index.html, public/auth/callback/index.html). These are
 * plain static files served by server.js under `style-src 'self'` with no
 * unsafe-inline, so styling must live in a self-hosted stylesheet -- never an
 * inline <style> or style="" (see csp-config.spec.js and
 * src/lib/static-auth-pages.spec.ts).
 *
 * Darky design system: colours, type and fonts come from /design/tokens.css
 * (copied from packages/shared/design by scripts/sync-design-tokens.mjs).
 * Class names are part of the pages' scripts' contract -- keep them.
 */
@import url('/design/tokens.css');

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--dk-font-sans);
  font-size: var(--dk-text-base);
  line-height: 1.55;
  background: rgb(var(--dk-bg));
  color: rgb(var(--dk-text));
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

/* Wordmark above the card: the Darky mark rendered from CSS so the pages
 * need no extra markup. */
body::before {
  content: '';
  display: block;
  width: 28px;
  height: 28px;
  margin-bottom: 20px;
  background: url('/design/mark.svg') center / contain no-repeat;
  align-self: end;
}

.card {
  width: min(100%, 400px);
  border-radius: var(--dk-radius-xl);
  border: 1px solid rgb(var(--dk-border));
  background: rgb(var(--dk-surface));
  padding: 32px;
  align-self: start;
}

/* Small label above the title ("Darky account"). */
.badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  color: rgb(var(--dk-text-tertiary));
  font-size: var(--dk-text-sm);
  font-weight: 500;
}

h1 {
  margin: 0 0 6px;
  font-size: var(--dk-text-2xl);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.012em;
}

p {
  margin: 0;
}

.muted {
  margin: 0 0 24px;
  color: rgb(var(--dk-text-secondary));
  font-size: var(--dk-text-sm);
  line-height: 1.55;
}

.alert {
  display: none;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--dk-radius-md);
  font-size: var(--dk-text-sm);
  line-height: 1.5;
  border: 1px solid transparent;
}

.alert.error {
  display: block;
  background: rgb(var(--dk-danger) / 0.08);
  border-color: rgb(var(--dk-danger) / 0.4);
  color: rgb(var(--dk-text));
}

.alert.info {
  display: block;
  background: rgb(var(--dk-accent) / 0.08);
  border-color: rgb(var(--dk-accent) / 0.45);
  color: rgb(var(--dk-text));
}

/* Used only by the noscript fallback notice. */
.alert.static-notice {
  margin-top: 12px;
}

.actions {
  display: grid;
  gap: 8px;
}

a.btn-primary,
a.link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  border-radius: var(--dk-radius-md);
  font-weight: 500;
  font-size: var(--dk-text-base);
  text-decoration: none;
  transition: background-color var(--dk-duration-fast) var(--dk-ease), border-color var(--dk-duration-fast) var(--dk-ease);
}

a.btn-primary {
  border: 1px solid transparent;
  background: rgb(var(--dk-accent));
  color: rgb(var(--dk-on-accent));
  cursor: pointer;
}

a.btn-primary:hover {
  background: rgb(var(--dk-accent-hover));
}

a.btn-primary[aria-disabled='true'] {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

a.link {
  border: 1px solid rgb(var(--dk-border-strong));
  background: rgb(var(--dk-surface-raised));
  color: rgb(var(--dk-text));
}

a.link:hover {
  background: rgb(var(--dk-surface-hover));
}

a:focus-visible {
  outline: none;
  box-shadow: var(--dk-focus-ring);
}

.footer {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgb(var(--dk-border));
  color: rgb(var(--dk-text-tertiary));
  font-size: var(--dk-text-xs);
  line-height: 1.5;
}

.footer a {
  color: rgb(var(--dk-accent-text));
}

.build-tag {
  margin-top: 12px;
  color: rgb(var(--dk-text-tertiary));
  font-family: var(--dk-font-mono);
  font-size: 10px;
}

/* Callback page: "Signing you in" with a spinner, or an error. */
.spinner {
  width: 18px;
  height: 18px;
  margin: 0 0 16px;
  border-radius: 999px;
  border: 2px solid rgb(var(--dk-border-strong));
  border-top-color: rgb(var(--dk-accent-text));
  animation: dk-spin 0.8s linear infinite;
}

.error {
  margin-top: 12px;
  color: rgb(var(--dk-danger));
  font-size: var(--dk-text-sm);
}

@keyframes dk-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  a.btn-primary, a.link { transition: none; }
}

@media (max-width: 480px) {
  body { padding-top: 24px; }
  .card { padding: 24px 20px; }
}
