/*
 * The sign-in page (web/index.html) — and only it.
 *
 * A coloured band with the Libesole mark; a card rising over it with "Welcome
 * back", who is signing in, the School ID and password, and the button. (The
 * floating "Aa" text size control is styled in components.css, as it is on
 * every page.)
 *
 * Its own class names (signin-*), so the other pages that share
 * the old auth-* styles — resetting a password, the app download — are not
 * touched by any of this.
 */

/* Its colours (--signin-band and the circles) are in tokens.css, light and
   dark, with every other colour on the site. */

.signin-page { background: var(--bg); }

.signin {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- the band */

.signin-band {
  position: relative;
  overflow: hidden;
  padding: calc(env(safe-area-inset-top, 0px) + 40px) 16px 76px;
  background: var(--signin-band);
  color: var(--white);
  text-align: center;
}
/* Soft circles, as light falling across the band. */
.signin-band::before,
.signin-band::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.signin-band::before {
  width: 260px; height: 260px; left: -90px; top: -110px;
  background: var(--signin-circle);
}
.signin-band::after {
  width: 200px; height: 200px; right: -60px; bottom: -40px;
  background: var(--signin-circle-strong);
}

.signin-logo.auth-logo {
  position: relative;
  z-index: 1;
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: var(--white);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.55);
}
.signin-logo svg { width: 50px; height: 50px; }

.signin-wordmark {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.signin-wordmark::before,
.signin-wordmark::after {
  content: "";
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, 0.7);
}

/* ---------------------------------------------------------------- the card */

.signin-card {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: -44px auto 0;
  padding: 26px 20px calc(env(safe-area-inset-bottom, 0px) + 32px);
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  box-shadow: 0 -10px 40px -24px rgba(0, 0, 0, 0.45);
}

@media (min-width: 600px) {
  .signin-band { padding-bottom: 104px; }
  .signin-card {
    flex: none;
    margin: -72px auto 48px;
    padding: 32px 32px 28px;
    border-radius: 28px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
  }
}

.signin-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.signin-head-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}
.signin-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.signin-sub {
  margin: 4px 0 0;
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- who */

.signin-roles {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.signin-roles legend {
  margin-bottom: 10px;
  padding: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  color: var(--ink-soft);
}
.signin-role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 340px) {
  .signin-role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.signin-role { position: relative; display: block; min-width: 0; }
/* A choice that would sit alone on the last row takes the whole row, its icon
   beside its name — seven choices in rows of three (or two). */
.signin-role:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
.signin-role:last-child:nth-child(3n + 1) .signin-role-face { flex-direction: row; min-height: 52px; gap: 10px; }
@media (max-width: 340px) {
  .signin-role:last-child:nth-child(3n + 1) { grid-column: auto; }
  .signin-role:last-child:nth-child(2n + 1) { grid-column: 1 / -1; }
  .signin-role:last-child:nth-child(2n + 1) .signin-role-face { flex-direction: row; min-height: 52px; gap: 10px; }
}
.signin-role input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.signin-role-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 68px;
  padding: 10px 6px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-align: center;
  line-height: 1.2;
  overflow-wrap: anywhere;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.signin-role input:hover + .signin-role-face { border-color: var(--primary); color: var(--ink); }
.signin-role input:checked + .signin-role-face {
  border-color: transparent;
  background-color: var(--primary-solid);
  background-image: var(--primary-fill);
  color: var(--on-primary);
  box-shadow: var(--primary-glow);
}
.signin-role input:focus-visible + .signin-role-face {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- fields */

.signin-input { position: relative; display: grid; }
.signin-input input {
  min-height: 52px;
  padding-right: 3.25rem;
  border-radius: 14px;
}
.signin-input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  color: var(--ink-muted);
  pointer-events: none;
}
.signin-eye {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  width: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}
.signin-eye:hover { background: var(--primary-soft); color: var(--primary); }
.signin-eye:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.signin-eye .eye-shut { display: none; }
.signin-eye[aria-pressed="true"] .eye-open { display: none; }
.signin-eye[aria-pressed="true"] .eye-shut { display: block; }

/* An error line takes room only when there is an error in it, so each hint
   sits right under its box. */
.signin-card .field-error:empty { display: none; }

.signin-forgot {
  margin: -6px 0 16px;
  text-align: right;
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
}

.signin-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  border-radius: 16px;
}

.signin-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-align: center;
}
.signin-secure svg { flex: none; color: var(--success); }

.signin-foot {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .signin-role-face { transition: none; }
}
