/* =========================================================================
   LOGIN — Integralis Design System (2026-08)
   ---------------------------------------------------------------------
   All tokens (color / spacing / type / radii / motion) come from the single
   source: `student_detail.css` (.sd scope) — this file invents NO new values.
   Units: rem + clamp() for type & spacing; % for widths; px ONLY for
   hairline borders and hard shadows.
   ========================================================================= */

/* -------------------------------------------------------------------------
   Minimal reset — the login screen is standalone (it does NOT extend base.html,
   so Tailwind's preflight is absent): without this, inputs are content-box and
   headings carry UA margins, which breaks both the card width and the rhythm.
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: #f9f5f2; }
h1, h2, h3, p, figure, hr { margin: 0; }
button { font: inherit; color: inherit; }
input { font: inherit; }
svg { display: block; }
img { display: block; max-width: 100%; }

/* The page body carries `.sd` (tokens + palette + rtl + Heebo); this modifier
   re-purposes its padding for a centered, single-card screen (no bottom nav). */
.sd--login {
  min-height: 100svh;
  padding-block: clamp(var(--space-5), 6vh, var(--space-7));
  padding-inline: clamp(var(--space-4), 5vw, 4.25rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* definite column → `%` widths inside
                                              resolve against it, and min-content
                                              can't blow the card past the card */
  place-items: center;
  position: relative;
  isolation: isolate;
}

/* =========================================================================
   DECOR — brutalist pastel shapes on the beige field (same language as the
   guardianship cards: flat pastel + 1.5px ink hairline).
   ========================================================================= */
.lg-deco { display: none; position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.lg-deco span {
  position: absolute;
  display: block;
  border: var(--border-brutal);
  border-radius: 50%;
  opacity: 0.5;
  will-change: transform;
  animation: lg-float 14s var(--ease-out) infinite alternate;
}
/* Pink / yellow family only — the system's two lead accents (+ peach, which
   bridges them). No purple / blue / green here. */
.lg-deco span:nth-child(1) { inset-block-start: 8%;  inset-inline-start: 9%;  width: 7rem;   aspect-ratio: 1; background: #fe8bac;        animation-duration: 15s; }
.lg-deco span:nth-child(2) { inset-block-start: 14%; inset-inline-end: 12%;  width: 4.5rem; aspect-ratio: 1; background: #f7c460;      animation-duration: 12s; animation-delay: -4s; }
.lg-deco span:nth-child(3) { inset-block-end: 12%;   inset-inline-start: 16%; width: 5.5rem; aspect-ratio: 1; background: var(--color-yellow-soft); animation-duration: 17s; animation-delay: -8s; }
.lg-deco span:nth-child(4) { inset-block-end: 9%;    inset-inline-end: 10%;   width: 8rem;   aspect-ratio: 1; background: var(--color-pink-soft);   animation-duration: 19s; animation-delay: -2s; }
.lg-deco span:nth-child(5) {
  inset-block-start: 46%; inset-inline-end: 4%; width: 3rem; aspect-ratio: 1;
  background: var(--color-peach); border-radius: var(--radius-lg);
  animation-duration: 13s; animation-delay: -6s;
}
.lg-deco span:nth-child(6) {
  inset-block-end: 38%; inset-inline-start: 5%; width: 2.5rem; aspect-ratio: 1;
  background: #fe8bac; border-radius: var(--radius-lg);
  animation-duration: 16s; animation-delay: -10s;
}
/* transform / opacity only → composited, 60fps */
@keyframes lg-float {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to   { transform: translate3d(0, -1.75rem, 0) rotate(6deg); }
}
/* the shapes stay decorative — hide the smallest ones where space is tight */
@media (max-width: 40rem) {
  .lg-deco span:nth-child(5), .lg-deco span:nth-child(6) { display: none; }
  .lg-deco span { opacity: 0.42; }
}

/* =========================================================================
   SHELL — card + footnote, stacked and centered
   ========================================================================= */
.lg {
  width: min(23rem, 100%);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

/* ---- The card ---- */
.lg__card {
  --card-pad: clamp(var(--space-5), 4vw, var(--space-6));
  width: 100%;
  min-width: 0;
  background: var(--color-surface);
  border: var(--border-brutal);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-brutal);
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* ---- Brand block ---- */
.lg__brand { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; }
.lg__logo {
  width: clamp(3.5rem, 3rem + 2vw, 4.25rem);
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #fe8bac, #f7c460);
  border: var(--border-brutal);
  box-shadow: var(--shadow-brutal);
  display: grid;
  place-items: center;
  transform: rotate(-4deg);
  transition: transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out);
}
.lg__card:hover .lg__logo { transform: rotate(-4deg) translate(-2px, -2px); box-shadow: 6px 6px 0 0 #5c5c5c; }
.lg__logo span { font-family: var(--font-num); font-size: clamp(1.5rem, 1.2rem + 1vw, 1.85rem); font-weight: 800; color: #5c5c5c; line-height: 1; }
/* ---- Brand artwork (static/img/…) — replaces the tile + wordmark ---- */
.lg__logo-wrap { display: block; width: 100%; }
.lg__logo-img {
  width: 90%;
  height: auto;                 /* the <img> carries its intrinsic w/h → no CLS */
  margin-inline: auto;
  transition: transform var(--dur-micro) var(--ease-out);
}
.lg__card:hover .lg__logo-img { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) {
  .lg__logo-img { transition: none; }
  .lg__card:hover .lg__logo-img { transform: none; }
}

.lg__wordmark {
  font-family: var(--font-num);
  font-size: clamp(1.65rem, 1.35rem + 1.4vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #5c5c5c;
  margin-block-start: var(--space-1);
}
/* marker-style pink swash across the glyph feet — the system's accent, flat.
   background-size/position (not a gradient stop) so the band overlaps the
   letters instead of hanging below the line box as an underline. */
.lg__wordmark mark {
  background-color: transparent;
  background-image: linear-gradient(#fe8bac, #fe8bac);
  background-repeat: no-repeat;
  background-size: 100% 0.26em;
  background-position: 0 88%;
  color: inherit;
  padding-inline: 0.08em;
}
/* ---- Error banner (palette-only: pink-soft field, coral mark, ink hairline) ---- */
.lg-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-block-start: var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: var(--color-pink-soft);
  border: var(--border-brutal);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #5c5c5c;
  animation: lg-shake 400ms var(--ease-out) both;
}
.lg-error svg { flex-shrink: 0; color: var(--color-danger); margin-block-start: 0.1rem; }
@keyframes lg-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-0.3rem); }
  75%      { transform: translateX(0.3rem); }
}

/* =========================================================================
   FORM
   ========================================================================= */
.lg-error + .lg__form { margin-block-start: var(--space-5); }
.lg__form { display: flex; flex-direction: column; gap: var(--space-4); margin-block-start: var(--space-6); }

.lg-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.lg-field__label { font-size: var(--text-sm); font-weight: 700; color: #5c5c5c; }
.lg-field__wrap { position: relative; display: flex; align-items: center; min-width: 0; }

.lg-input {
  width: 100%;
  min-width: 0;                               /* an input's intrinsic size must not
                                                 widen the card on small screens */
  padding: var(--space-3) var(--space-4);
  padding-inline-start: 2.9rem;               /* room for the leading icon (RTL: right) */
  border: var(--border-brutal);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: #5c5c5c;
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.4;
  direction: rtl;
  text-align: right;
  outline: none;
  transition: background var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out);
}
.lg-input::placeholder { color: var(--color-ink-mute); font-weight: 500; }
.lg-input:focus,
.lg-input:focus-visible { background: var(--color-surface); box-shadow: 3px 3px 0 0 #5c5c5c; }
.lg-input:-webkit-autofill { -webkit-text-fill-color: #5c5c5c; box-shadow: 0 0 0 100rem var(--color-surface-2) inset; }

/* leading icon (right, RTL lead) — same icon language as .sd-datarow */
.lg-field__icon {
  position: absolute;
  inset-inline-start: var(--space-3);
  width: 1.5rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--color-ink-mute);
  pointer-events: none;
  transition: color var(--dur-micro) var(--ease-out);
}
.lg-field__wrap:focus-within .lg-field__icon { color: #5c5c5c; }

/* password reveal (left, RTL trail) */
.lg-input--pw { padding-inline-end: 2.9rem; }
.lg-eye {
  position: absolute;
  inset-inline-end: var(--space-2);
  width: 2rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  border-radius: 50%;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: background var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.lg-eye:hover { background: var(--color-neutral); color: #5c5c5c; }
.lg-eye:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px #5c5c5c; }
.lg-eye__off { display: none; }
.lg-eye.is-on .lg-eye__on { display: none; }
.lg-eye.is-on .lg-eye__off { display: block; }

/* ---- Submit ---- */
.lg-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  margin-block-start: var(--space-1);
  padding: var(--space-3) var(--space-5);
  background: #fe8bac;
  color: #5c5c5c;
  border: var(--border-brutal);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-brutal);
  font-family: inherit;
  font-size: var(--text-lg);
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out);
}
.lg-submit:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 0 #5c5c5c; }
.lg-submit:active { transform: translate(0, 0); box-shadow: 2px 2px 0 0 #5c5c5c; }
.lg-submit:focus-visible { outline: none; box-shadow: 6px 6px 0 0 #5c5c5c, 0 0 0 3px var(--color-surface), 0 0 0 5px #5c5c5c; }
.lg-submit svg { flex-shrink: 0; transition: transform var(--dur-micro) var(--ease-out); }
.lg-submit:hover svg { transform: translateX(-0.2rem); }   /* RTL: arrow leads leftward */

/* ---- Helper note ---- */
.lg__note {
  margin-block-start: var(--space-4);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-ink-soft);
  line-height: 1.6;
}

/* ---- Footnote under the card ---- */
.lg__footer { font-size: var(--text-xs); font-weight: 600; color: var(--color-ink-mute); font-family: var(--font-num); }

/* =========================================================================
   REDUCED MOTION — keep a quiet fade, drop every travel
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .lg-deco span { animation: none; }
  .lg-error { animation: none; }
  .lg__card:hover .lg__logo,
  .lg-submit:hover,
  .lg-submit:hover svg { transform: none; }
  .lg__logo, .lg-submit, .lg-input, .lg-eye { transition: none; }
}
