/* ==========================================================================
   PCOHAS — login screen: "Daftari"
   --------------------------------------------------------------------------
   The card is a leaf of exercise-book paper: a red margin rule down the left,
   ruled lines that the input fields are written on, and an office date stamp
   pressed into the corner. The field behind it is ink-purple, ruled for the
   student/parent door and gridded like a mark sheet for the staff door.

   Two doors, one substrate:
     body.lg--user   students & parents   green accent, rows, warm paper
     body.lg--staff  staff & admin        purple accent, grid, cool paper

   COMPATIBILITY: no color-mix(), no CSS nesting, no oklch() — same rule as
   tokens.css, a meaningful share of users are on older Android WebView.
   ========================================================================== */

.lg {
  /* The brand half of this scale comes from the college's own colour, derived
     server-side and emitted on :root by layout/theme_vars.php. The literal
     after each comma is the palette this design was drawn against, so the file
     still renders correctly on its own if that block is ever missing. */
  --lg-ink:        #1b0e18;
  --lg-ink-2:      #574c55;
  --lg-paper:      #fbf7f1;
  --lg-brand:      var(--ss-primary,       #832b6c);
  --lg-brand-hover:var(--ss-primary-hover, #6d2459);
  --lg-brand-dark: var(--ss-primary-dark,  #521a43);
  --lg-green:      var(--ss-green,         #7dbd42);
  --lg-green-text: var(--ss-green-text,    #4d7d22);
  --lg-margin:     #c0453a;
  --lg-rule:       rgba(27, 14, 24, .13);
  --lg-rule-live:  var(--ss-primary,       #832b6c);
  --lg-stamp:      var(--ss-primary,       #832b6c);

  --lg-field-a:    var(--ss-ground-1,      #46173a);
  --lg-field-b:    var(--ss-ground-2,      #170a13);
  --lg-glow:       var(--ss-ground-glow,   #6a2255);
  --lg-weave:      rgba(255, 255, 255, .06);
  --lg-weave-size: 30px;

  --lg-display: "Bricolage Grotesque", "Archivo", "Helvetica Neue", system-ui, sans-serif;
  --lg-body:    "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --lg-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  margin: 0;
  min-height: 100vh;
  background: var(--lg-field-b);
  color: var(--lg-ink);
  font-family: var(--lg-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* The two doors differ by substrate, not by hue: students get an exercise
   book's ruled rows on warm paper, staff get a mark sheet's grid on cool. Both
   now carry the college's colour — the green used to be the other half of the
   identity, and is a success colour only since the palette became derivable. */
.lg--user {
  --lg-paper:      #fbf7f1;
}

.lg--staff {
  --lg-field-a:    var(--ss-ground-1-deep,  #2a0f23);
  --lg-field-b:    var(--ss-ground-2-deep,  #120810);
  --lg-paper:      #faf8fa;
  --lg-weave-size: 26px;
}

/* -- the field ----------------------------------------------------------- */

.lg-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 90% at 78% 4%, var(--lg-glow) 0%, transparent 55%),
    linear-gradient(155deg, var(--lg-field-a) 0%, var(--lg-field-b) 72%);
}

.lg-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, var(--lg-weave) 0 1px, transparent 1px var(--lg-weave-size));
  -webkit-mask-image: radial-gradient(75% 65% at 50% 45%, #000 0%, rgba(0, 0, 0, .15) 100%);
  mask-image: radial-gradient(75% 65% at 50% 45%, #000 0%, rgba(0, 0, 0, .15) 100%);
}

/* the staff door is a mark sheet: rows and columns */
.lg--staff .lg-bg::after {
  background-image:
    repeating-linear-gradient(0deg, var(--lg-weave) 0 1px, transparent 1px var(--lg-weave-size)),
    repeating-linear-gradient(90deg, var(--lg-weave) 0 1px, transparent 1px var(--lg-weave-size));
}

/* -- shell --------------------------------------------------------------- */

.lg-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  padding: 40px 24px;
  box-sizing: border-box;
}

.lg-shell--split {
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
}

/* -- paper --------------------------------------------------------------- */

.lg-paper {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  max-width: 434px;
  box-sizing: border-box;
  padding: 34px 32px 26px 60px;
  background: var(--lg-paper);
  border-radius: 2px 8px 8px 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .7),
    0 1px 2px rgba(0, 0, 0, .3),
    0 34px 64px -24px rgba(0, 0, 0, .68);
  animation: lg-rise .55s cubic-bezier(.2, .7, .3, 1) both;
}

/* the margin rule */
.lg-paper::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 44px;
  width: 1px;
  background: var(--lg-margin);
  opacity: .5;
}

/* the binding edge */
.lg-paper::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: linear-gradient(90deg, rgba(27, 14, 24, .16), rgba(27, 14, 24, 0));
  border-radius: 2px 0 0 2px;
}

@keyframes lg-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* -- header -------------------------------------------------------------- */

.lg-logo {
  display: block;
  max-height: 46px;
  max-width: 190px;
  width: auto;
  margin-bottom: 22px;
}

.lg-eyebrow {
  margin: 0 0 7px;
  font-family: var(--lg-mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--lg-ink-2);
}

.lg-eyebrow b {
  font-weight: 500;
  color: var(--lg-rule-live);
}

.lg-title {
  margin: 0 0 22px;
  font-family: var(--lg-display);
  font-size: 30px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--lg-ink);
}

/* -- alerts -------------------------------------------------------------- */

.lg-alert {
  margin: 0 0 16px;
  padding: 10px 13px;
  border-left: 3px solid;
  border-radius: 0 4px 4px 0;
  font-size: 13.5px;
  line-height: 1.45;
}

.lg-alert--bad {
  background: #fdf2f4;
  border-color: #c81e40;
  color: #8c1230;
}

.lg-alert--good {
  background: #f1f8e9;
  border-color: var(--lg-green);
  color: #37611a;
}

/* -- fields: written on the rule ----------------------------------------- */

.lg-field {
  position: relative;
  margin-bottom: 26px;
}

.lg-field__label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--lg-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--lg-ink-2);
  transition: color .18s;
}

.lg-field input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 2px 0 9px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--lg-body);
  font-size: 16px;
  line-height: 1.4;
  color: var(--lg-ink);
}

.lg-field input::placeholder { color: rgba(27, 14, 24, .3); }

/* autofill paints its own blue over the paper — put the paper back */
.lg-field input:-webkit-autofill,
.lg-field input:-webkit-autofill:hover,
.lg-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--lg-ink);
  -webkit-box-shadow: inset 0 0 0 100px var(--lg-paper);
  box-shadow: inset 0 0 0 100px var(--lg-paper);
  transition: background-color 9999s linear;
}
.lg-field input:focus { outline: 0; }

/* Focus is the line going live under the writing, plus the label taking the
   accent — an outline box on top of that would say the same thing twice.
   Forced-colors users get a real outline, since the rule colour is dropped. */
@media (forced-colors: active) {
  .lg-field input:focus {
    outline: 2px solid Highlight;
    outline-offset: 3px;
  }
}

/* the ruled line runs on through the margin, the way it does on real paper.
   It sits in flow directly under the input so a field error pushes below it,
   never between the writing and its line. */
.lg-field__rule {
  position: relative;
  display: block;
  height: 1px;
  margin-left: -18px;
  background: var(--lg-rule);
}

.lg-field__rule::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--lg-rule-live);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s cubic-bezier(.2, .7, .3, 1);
}

.lg-field input:focus ~ .lg-field__rule::after { transform: scaleX(1); }
.lg-field input:focus ~ .lg-field__label,
.lg-field:focus-within .lg-field__label { color: var(--lg-rule-live); }

.lg-field--pass input { padding-right: 40px; }

.lg-peek {
  position: absolute;
  right: -6px;
  top: 16px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lg-ink-2);
  cursor: pointer;
  border-radius: 4px;
}

.lg-peek:hover { color: var(--lg-ink); }
.lg-peek:focus-visible { outline: 2px solid var(--lg-rule-live); outline-offset: 1px; }
.lg-peek svg { width: 18px; height: 18px; }
.lg-peek .lg-peek__off { display: none; }
.lg-peek[aria-pressed="true"] .lg-peek__off { display: block; }
.lg-peek[aria-pressed="true"] .lg-peek__on { display: none; }

.lg-err {
  display: block;
  margin-top: 7px;
  font-size: 12.5px;
  line-height: 1.4;
  color: #b01737;
}

.lg-err p { margin: 0; }
.lg-err:empty { display: none; }

/* -- captcha ------------------------------------------------------------- */

.lg-captcha {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 26px;
}

.lg-captcha__img {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lg-captcha__img img {
  display: block;
  height: 46px;
  width: auto;
  border: 1px solid var(--lg-rule);
  border-radius: 3px;
}

.lg-captcha .lg-field { flex: 1; margin-bottom: 0; }

.lg-refresh {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lg-ink-2);
  cursor: pointer;
  border-radius: 4px;
}

.lg-refresh:hover { color: var(--lg-rule-live); }
.lg-refresh:focus-visible { outline: 2px solid var(--lg-rule-live); outline-offset: 1px; }
.lg-refresh svg { width: 15px; height: 15px; }

/* -- the button presses ---------------------------------------------------
   Same gesture as the stamp: something comes down and leaves a mark. */

.lg-btn {
  display: block;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 4px;
  background: var(--lg-brand);
  color: var(--ss-primary-foreground, #fff);
  font-family: var(--lg-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--lg-brand-dark), 0 10px 22px -12px rgba(83, 26, 68, .9);
  transition: background .18s, transform .12s, box-shadow .12s;
}

.lg-btn:hover { background: var(--lg-brand-hover); }
.lg-btn:focus-visible { outline: 2px solid var(--lg-ink); outline-offset: 3px; }

.lg-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--lg-brand-dark), 0 6px 14px -12px rgba(83, 26, 68, .9);
}

/* -- foot ---------------------------------------------------------------- */

.lg-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

.lg-links {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-bottom: 4px;
}

.lg-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  line-height: 1;
  color: var(--lg-ink-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color .18s, border-color .18s;
}

.lg-link:hover,
.lg-link:focus-visible {
  color: var(--lg-rule-live);
  border-bottom-color: var(--lg-rule-live);
  text-decoration: none;
}

.lg-link svg { width: 13px; height: 13px; flex: 0 0 auto; }

/* -- the stamp: the one loud thing ---------------------------------------- */

.lg-stamp {
  flex: 0 0 auto;
  max-width: 148px;
  padding: 6px 11px;
  border: 2px solid currentColor;
  outline: 1px solid currentColor;
  outline-offset: 2px;
  color: var(--lg-stamp);
  opacity: .5;
  transform: rotate(-5.5deg);
  mix-blend-mode: multiply;
  pointer-events: none;
  text-align: center;
  font-family: var(--lg-mono);
  font-size: 8.5px;
  line-height: 1.35;
  letter-spacing: .13em;
  text-transform: uppercase;
  animation: lg-press .34s cubic-bezier(.2, .8, .3, 1) .62s both;
}

.lg-stamp__name {
  display: block;
  font-weight: 500;
  word-break: break-word;
}

.lg-stamp__date {
  display: block;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid currentColor;
  letter-spacing: .16em;
}

@keyframes lg-press {
  from { opacity: 0; transform: rotate(-5.5deg) scale(1.28); }
  to   { opacity: .5; transform: rotate(-5.5deg) scale(1); }
}

/* -- notice board --------------------------------------------------------- */

.lg-board {
  flex: 1 1 0;
  min-width: 0;
  max-width: 520px;
  color: #fff;
  animation: lg-rise .55s cubic-bezier(.2, .7, .3, 1) .12s both;
}

.lg-board__head {
  margin: 0 0 4px;
  font-family: var(--lg-mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
}

.lg-board__title {
  margin: 0 0 24px;
  font-family: var(--lg-display);
  font-size: 34px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.03em;
  color: #fff;
}

.lg-board__list {
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .28) transparent;
}

.lg-board__list::-webkit-scrollbar { width: 4px; }
.lg-board__list::-webkit-scrollbar-track { background: rgba(255, 255, 255, .07); }
.lg-board__list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .3); border-radius: 4px; }

.lg-note { padding: 18px 0; border-top: 1px solid rgba(255, 255, 255, .14); }
.lg-note:first-child { padding-top: 0; border-top: 0; }

.lg-note__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 7px;
  font-family: var(--lg-display);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.01em;
  color: #fff;
}

.lg-note__title::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--lg-green);
  transform: translateY(-2px);
}

.lg--staff .lg-note__title::before { background: var(--lg-rule-live); }

.lg-note__body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .66);
}

.lg-note__body a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .4);
}

.lg-note__body a:hover { border-bottom-color: #fff; }

/* -- responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
  .lg-shell,
  .lg-shell--split {
    flex-direction: column;
    justify-content: flex-start;
    gap: 40px;
    padding: 32px 20px 44px;
  }

  .lg-paper { margin: 0 auto; }
  .lg-board { width: 100%; max-width: 434px; margin: 0 auto; }
  .lg-board__title { font-size: 26px; }
  .lg-board__list { max-height: none; overflow: visible; padding-right: 0; }
}

@media (max-width: 420px) {
  .lg-paper { padding: 28px 22px 22px 46px; }
  .lg-paper::before { left: 32px; }
  .lg-title { font-size: 26px; }
  .lg-foot { flex-direction: column; align-items: flex-start; gap: 22px; }
  .lg-stamp { align-self: flex-end; }
  .lg-captcha { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-paper,
  .lg-board,
  .lg-stamp { animation: none; }
  .lg-stamp { opacity: .5; transform: rotate(-5.5deg); }
  .lg-field__rule::after,
  .lg-btn { transition: none; }
}

/* -- bursar verification sheet (staff door only) --------------------------
   A second slip of paper laid over the first — same substrate, no new idiom. */

.lg-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(11, 5, 10, .72);
  animation: lg-fade .2s ease both;
}

.lg-modal[hidden] { display: none; }

.lg-modal__sheet {
  position: relative;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
  padding: 30px 30px 28px 52px;
  background: var(--lg-paper);
  border-radius: 2px 8px 8px 2px;
  box-shadow: 0 40px 70px -26px rgba(0, 0, 0, .8);
  animation: lg-rise .32s cubic-bezier(.2, .7, .3, 1) both;
}

.lg-modal__sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 36px;
  width: 1px;
  background: var(--lg-margin);
  opacity: .5;
}

.lg-modal__title {
  margin: 0 0 10px;
  font-family: var(--lg-display);
  font-size: 23px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--lg-ink);
}

.lg-modal__note {
  margin: 0 0 24px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--lg-ink-2);
}

@keyframes lg-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-modal,
  .lg-modal__sheet { animation: none; }
}

/* -- lede: what happens after you submit ---------------------------------
   The login card needs no explanation; every other card in the flow does. */

.lg-lede {
  margin: -14px 0 24px;
  max-width: 36ch;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--lg-ink-2);
}

/* -- ticked choice: who is asking ----------------------------------------
   A register asks you to tick a box, so the radios are boxes to tick. */

.lg-choice {
  margin: 0 0 26px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.lg-choice legend {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
}

.lg-ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lg-tick {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px 9px 12px;
  border: 1px solid var(--lg-rule);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  color: var(--lg-ink);
  cursor: pointer;
  transition: border-color .18s;
}

.lg-tick:hover { border-color: rgba(27, 14, 24, .32); }

.lg-tick input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}

.lg-tick__box {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(27, 14, 24, .32);
  border-radius: 3px;
  /* The tick sits on --lg-rule-live once checked, so it follows the same
     foreground the buttons use rather than assuming white works. */
  color: var(--ss-primary-foreground, #fff);
  transition: background .16s, border-color .16s;
}

.lg-tick__box svg {
  width: 11px;
  height: 11px;
  opacity: 0;
  transition: opacity .16s;
}

.lg-tick input:checked ~ .lg-tick__box {
  background: var(--lg-rule-live);
  border-color: var(--lg-rule-live);
}

.lg-tick input:checked ~ .lg-tick__box svg { opacity: 1; }
.lg-tick input:checked ~ .lg-tick__text { font-weight: 600; }

.lg-tick input:focus-visible ~ .lg-tick__box {
  outline: 2px solid var(--lg-rule-live);
  outline-offset: 3px;
}

/* -- stacked ticks --------------------------------------------------------
   The chip row works for two short options side by side. A parent choosing
   between children is picking from full names and course titles, so those
   stack full width and read as a list. */

.lg-ticks--stack {
  display: block;
}

.lg-ticks--stack .lg-tick {
  display: flex;
  width: 100%;
  margin-bottom: 8px;
  padding: 13px 15px 13px 13px;
  line-height: 1.4;
  text-align: left;
}

.lg-ticks--stack .lg-tick:last-child { margin-bottom: 0; }

.lg-tick__who {
  display: block;
  font-weight: 600;
}

.lg-tick__where {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--lg-ink-2);
}
