@import url('./tokens.css');

/* Sign-in: one centered card on the light page background, with the site's
   dot grid fading in from the right (the same texture as the landing hero,
   kept away from the form). */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(270deg, transparent 0, #000 38%);
  mask-image: linear-gradient(270deg, transparent 0, #000 38%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 23rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.8rem 2rem 1.3rem;
  box-shadow: 0 4px 24px rgba(28, 28, 30, 0.07);
}

/* Brand: centered shield above the name */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
}

.brand .brand-mark {
  display: grid;
  place-items: center;
}

.brand .brand-name {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.45rem;
  color: var(--ink);
  text-align: center;
}

.brand .mark {
  flex: none;
}

.login-card h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
  color: var(--ink);
  text-align: center;
}

.login-card p.sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.9rem;
  text-align: center;
}

/* Redirect hand-off (OIDC mode): the brand is the card's title; below it,
   one status row - spinner + destination - where the old second heading was.
   role="status" so screen readers announce the redirect. */
p.redirect-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin: 0.2rem 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.spinner {
  width: 0.9rem;
  height: 0.9rem;
  flex: none;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: login-spin 0.8s linear infinite;
}

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

label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0.75rem 0 0.3rem;
  color: var(--ink-2);
}

input {
  width: 100%;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition: border-color .12s, box-shadow .12s;
}

/* Password field with show/hide toggle */
.pw-wrap {
  position: relative;
}

.pw-wrap input {
  padding-right: 2.5rem;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 1.7rem;
  height: 1.7rem;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--faint);
  cursor: pointer;
}

.pw-toggle:hover {
  background: none;
  color: var(--ink);
}

.pw-toggle .ms-icon:nth-child(2) {
  display: none;
}

.pw-toggle[aria-pressed="true"] .ms-icon:nth-child(1) {
  display: none;
}

.pw-toggle[aria-pressed="true"] .ms-icon:nth-child(2) {
  display: inline-block;
}

input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

button[type="submit"] {
  width: 100%;
  margin-top: 1.1rem;
  padding: 0.72rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background .14s;
}

button[type="submit"]:hover {
  background: var(--accent-bright);
}

.error {
  background: var(--error-bg);
  color: var(--error-fg);
  border: 1px solid var(--error-border);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.foot {
  margin: 1.2rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--faint);
}

/* Theme toggle: fixed top-right so it clears the centered card */
.theme-toggle {
  position: fixed;
  top: 1.1rem;
  right: 1.2rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color .12s, background .12s;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.theme-toggle .ms-icon {
  display: none;
}

.theme-toggle.t-light .ms-icon:nth-child(2),
.theme-toggle.t-dark .ms-icon:nth-child(3),
.theme-toggle.t-auto .ms-icon:nth-child(1) {
  display: inline-block;
}
