/*
 * Shared chrome for the four pages you can reach without a session:
 * index.html (sign in), forgot-password.html, reset-password.html,
 * accept-invitation.html.
 *
 * Added 2026-08-30. Before this, the sign-in page was in the new design
 * language and the three password pages were still the old dark-navy portal
 * with an emoji logo, so resetting a password threw you between two products.
 *
 * Colours resolve in this order:
 *   1. the neutral defaults below, painted immediately
 *   2. the school's own --brand / --accent, applied by utils/brand.js once
 *      GET /api/settings/public answers
 * so the page is never blank, never flashes an unstyled form, and still works
 * with the API unreachable.
 */

:root {
  --bg:      oklch(0.98 0.005 60);
  --surface: #ffffff;
  --border:  oklch(0.92 0.008 60);
  --ink:     oklch(0.22 0.01 60);
  --ink-mute: oklch(0.58 0.01 60);
  --danger:  oklch(0.60 0.14 25);
  --ok:      oklch(0.52 0.11 155);

  /* Overwritten by utils/brand.js with the school's settings. */
  --brand:      oklch(0.32 0.08 320);
  --on-brand:   #ffffff;
  --brand-text: oklch(0.32 0.08 320);
  --accent:     oklch(0.74 0.14 65);
  --on-accent:  oklch(0.28 0.06 65);

  --font-ui: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --radius: 8px;
  --shadow: 0 1px 3px oklch(0.5 0.02 60 / 0.08), 0 6px 24px -12px oklch(0.3 0.04 60 / 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  padding: 36px 32px 32px;
}

/* --- masthead ----------------------------------------------------------- */

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

/* The fallback mark, shown until (or unless) a logo is configured.
   utils/brand.js replaces its contents with an <img> when there is one. */
.auth-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent) 0%, var(--brand) 140%);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: inset 0 -1px 0 oklch(0.3 0.05 30 / .35);
}
.auth-brand-mark:empty::before {
  content: "";
  width: 16px; height: 16px;
  border-radius: 50%;
  background: oklch(0.20 0.015 60);
  box-shadow: 0 0 0 3px oklch(0.96 0.04 65 / .8);
}
/* A real logo is usually a wide lockup, not a square avatar: let it size to its
   own aspect ratio and drop the placeholder tile's gradient and rounding. */
.auth-brand-mark.has-logo {
  width: auto;
  max-width: 132px;
  height: 40px;
  background: none;
  border-radius: 0;
  box-shadow: none;
  display: block;
}
.auth-brand-mark.has-logo img {
  height: 100%;
  width: auto;
  max-width: 132px;
  object-fit: contain;
  display: block;
}

.auth-brand-text .title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -.005em;
  line-height: 1.1;
  color: var(--ink);
}
.auth-brand-text .sub {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 2px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.auth-heading {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -.015em;
  margin-bottom: 6px;
  color: var(--ink);
}
.auth-sub {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* --- form --------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-mute);
  font-weight: 500;
}
.field input {
  height: 40px;
  padding: 0 14px;
  border: 1px solid oklch(0.88 0.01 60);
  border-radius: var(--radius);
  background: oklch(0.98 0.003 60);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus {
  border-color: var(--brand);
  background: var(--surface);
}
.field .hint {
  font-size: 11.5px;
  color: var(--ink-mute);
}

.btn-auth {
  width: 100%;
  height: 42px;
  background: var(--brand);
  color: var(--on-brand);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 6px;
  transition: filter .15s, transform .05s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-auth:hover { filter: brightness(1.12); }
.btn-auth:active { transform: translateY(1px); }
.btn-auth:disabled { opacity: .6; cursor: not-allowed; }

/* --- messages ----------------------------------------------------------- */

.msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: none;
  line-height: 1.45;
}
.msg.visible { display: block; }
.msg.error {
  background: oklch(0.96 0.04 25);
  color: oklch(0.45 0.14 25);
  border: 1px solid oklch(0.88 0.06 25);
}
.msg.success {
  background: oklch(0.96 0.04 155);
  color: oklch(0.38 0.10 155);
  border: 1px solid oklch(0.86 0.06 155);
}

.info-box {
  margin-top: 20px;
  padding: 12px 14px;
  background: oklch(0.97 0.004 60);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink-mute);
  line-height: 1.5;
}
.info-box strong { color: var(--ink); font-weight: 600; }
.info-box ul { margin: 6px 0 0 16px; }
.info-box li { margin: 3px 0; }
.info-box code {
  font-family: "Geist Mono", ui-monospace, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink);
}

/* --- footer ------------------------------------------------------------- */

.auth-help {
  margin-top: 14px;
  text-align: center;
  font-size: 12.5px;
}
.auth-help a {
  color: var(--ink-mute);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color .15s, border-color .15s;
}
.auth-help a:hover { color: var(--brand-text); border-color: var(--brand); }

.auth-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-mute);
  text-align: center;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid oklch(0.8 0.02 320);
  border-top-color: var(--on-brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
