/* ===========================================================================
   Kimberley College password kiosk
   ---------------------------------------------------------------------------
   The design is the absence tracker's, and the tokens below are copied from
   it rather than re-chosen: the lit navy ground, one glass card floating on
   it, Poppins over Open Sans, laurel green for the action, maroon once for
   emphasis. If a colour changes there it should change here.

   What is different is who uses it. The tracker is read at a desk by staff
   all day. This is used standing up, once, by a student who is slightly
   stressed and may be seven. So: one card, one question per screen, controls
   large enough for a touchscreen (nothing interactive under 48px tall), and
   text sizes a step up from the tracker's throughout.

   The same contrast rule holds: glass on the chrome, solid under anything
   that has to be read. The card is 96% opaque for that reason.
   =========================================================================== */

:root {
  --navy: #10284b;
  --navy-800: #0c1d36;
  --navy-300: #8fa3bd;
  --navy-tint: #eaeef3;

  --green: #106452;
  --green-800: #0c4c3e;
  --green-tint: #e6f1ec;

  --maroon: #7c2347;
  --maroon-800: #5f1a35;
  --maroon-tint: #f4e8ed;

  --peri: #566fb8;
  --ink: #1d2433;
  --muted: #55617a;
  --grey-100: #eef0f4;
  --amber-tint: #fdf3e2;
  --amber-ink: #6b4400;

  --sheet: #f3f6fb;
  --line: #d5deec;
  --line-soft: #edf2f9;

  /* #c3d0e6 on the ground's darkest stop is 9.6:1; on its lightest, 4.6:1. */
  --ground-ink: #c3d0e6;

  --font-display: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius-card: 16px;
  --radius: 12px;
  --gutter: 24px;

  /* One curve for everything: quick away from the finger, settling. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --quick: 160ms;

  caret-color: var(--green);
  accent-color: var(--green);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--navy-800);
  background-image:
    radial-gradient(1100px 760px at 6% -6%, rgba(226, 234, 246, 0.9), rgba(226, 234, 246, 0) 58%),
    radial-gradient(900px 700px at 96% 108%, rgba(16, 100, 82, 0.4), transparent 58%),
    linear-gradient(126deg, #33559a 0%, #15315c 46%, #0a1b33 100%);
  background-attachment: fixed;
}

h1,
h2 {
  font-family: var(--font-display);
  color: var(--navy);
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h2 {
  font-size: 1.125rem;
  margin-bottom: 10px;
}

p {
  margin: 0;
}

a {
  color: var(--green-800);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

::selection {
  background: rgba(16, 100, 82, 0.22);
}

:focus-visible {
  outline: 3px solid var(--peri);
  outline-offset: 2px;
  border-radius: 4px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The `hidden` attribute has to win over any display rule below, or the
   Show button and the Caps Lock note appear before the script asks for them. */
[hidden] {
  display: none !important;
}

/* --- the kiosk: one card on the ground ---------------------------------- */

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: var(--gutter);
}

.panel {
  width: min(500px, 100%);
  padding: 36px 34px 34px;
  text-align: center;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    0 32px 64px -32px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* The crest is 400x230; height follows from width so it can never be squashed. */
.panel__crest {
  width: 150px;
  height: auto;
  margin-bottom: 14px;
}

.panel__aside {
  margin-top: 14px;
  font-size: 0.9375rem;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-800);
  margin-bottom: 6px;
}

.lead {
  margin-top: 10px;
  color: var(--muted);
  text-wrap: pretty;
}

.stage__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 18px;
  font-size: 0.875rem;
  color: var(--ground-ink);
  text-align: center;
}

.stage__foot a,
.linkish {
  color: #ffffff;
}

/* A form button that reads as a link. Locking the kiosk is a POST, so it has
   to be a button; it should not look like the main action on the screen. */
.linkish {
  padding: 6px 2px;
  font: inherit;
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}

/* --- the scan screen ---------------------------------------------------- */

.scan {
  position: relative;
  margin-top: 24px;
}

/* A barcode, drawn. Bars of uneven width from one repeating gradient, with a
   beam passing over them - it says "scanner" without an icon font. */
.scan__art {
  position: relative;
  height: 96px;
  margin: 0 auto;
  width: min(280px, 100%);
  border-radius: var(--radius);
  background-color: #ffffff;
  background-image: repeating-linear-gradient(
    90deg,
    var(--navy) 0 3px,
    transparent 3px 7px,
    var(--navy) 7px 9px,
    transparent 9px 14px,
    var(--navy) 14px 19px,
    transparent 19px 22px,
    var(--navy) 22px 23px,
    transparent 23px 29px
  );
  background-size: calc(100% - 44px) calc(100% - 36px);
  background-position: center;
  background-repeat: no-repeat;
  border: 1.5px solid var(--line);
  overflow: hidden;
}

.scan__beam {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 3px;
  border-radius: 3px;
  background: var(--maroon);
  box-shadow: 0 0 14px 2px rgba(124, 35, 71, 0.45);
  animation: beam 2.2s var(--ease-out) infinite alternate;
}

@keyframes beam {
  from {
    transform: translateY(-30px);
  }
  to {
    transform: translateY(30px);
  }
}

.scan__state {
  margin-top: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--green-800);
}

/* Focused, so the scanner types into it; not drawn, so nobody else does. */
.scan__i {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  cursor: default;
}

.field__i--code {
  letter-spacing: 0.3em;
  text-align: center;
}

/* Who the kiosk thinks you are. The one place maroon appears: it is the
   thing a student must actually read before typing a password. */
.who {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 16px 12px 12px;
  border-radius: var(--radius);
  background: var(--maroon-tint);
  color: var(--maroon-800);
  text-align: left;
}

.who__t {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.who b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
}

.who span {
  font-size: 0.9375rem;
}

/* The ID photo. Large enough to recognise a face from across the IT office,
   which is its whole job. The source is 500x625; the 4:5 box is fixed so a
   photo of any other shape is cropped rather than stretched. */
.face {
  flex: none;
  width: 112px;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 0 0 1.5px rgba(124, 35, 71, 0.22);
}

.face--none {
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

code {
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--grey-100);
}

/* --- forms -------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 22px;
  text-align: left;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__l {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.field__h {
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

.field__i {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 12px 16px;
  font-family: inherit;
  /* 18px. Anything under 16px makes iOS zoom the page on focus. */
  font-size: 1.125rem;
  color: var(--ink);
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
}

.field__i:hover {
  border-color: var(--navy-300);
}

.field__i:focus-visible {
  border-color: var(--green);
  outline-offset: 1px;
}

.field__i[aria-invalid='true'] {
  border-color: var(--maroon);
}

/* An input with something fixed on its right: the domain, or Show/Hide.
   The pair shares one border so it reads as a single control. */
.affix {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.affix:hover {
  border-color: var(--navy-300);
}

.affix:focus-within {
  border-color: var(--green);
}

.affix:has([aria-invalid='true']) {
  border-color: var(--maroon);
}

.affix__i {
  flex: 1;
  border: 0;
  background: transparent;
}

.affix__s,
.affix__b {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border: 0;
  border-left: 1.5px solid var(--line-soft);
  border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0;
  background: var(--sheet);
  color: var(--muted);
  font-size: 1rem;
  white-space: nowrap;
}

.affix__b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--navy);
  min-width: 76px;
  justify-content: center;
  cursor: pointer;
}

.affix__b:hover {
  background: var(--navy-tint);
}

.field--staff {
  padding: 14px 16px 16px;
  border-radius: var(--radius);
  background: var(--navy-tint);
}

.rules {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.rules li + li {
  margin-top: 2px;
}

.note {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 1rem;
  text-align: left;
  text-wrap: pretty;
}

.form .note {
  margin-top: 0;
}

.note--bad {
  background: var(--maroon-tint);
  color: var(--maroon-800);
  border-left: 4px solid var(--maroon);
}

.note--warn {
  background: var(--amber-tint);
  color: var(--amber-ink);
  border-left: 4px solid #c98a1a;
}

/* --- buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 18px;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--navy);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--navy-300);
  background: var(--sheet);
}

.btn:active {
  transform: scale(0.98);
}

/* Laurel green does the actions, navy carries the structure. */
.btn--primary {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
  box-shadow: 0 8px 18px -10px rgba(16, 100, 82, 0.9);
}

.btn--primary:hover {
  background: var(--green-800);
  border-color: var(--green-800);
}

.btn--lg {
  width: 100%;
  min-height: 56px;
  font-size: 1.0625rem;
  border-radius: var(--radius);
}

.panel > .btn--lg {
  margin-top: 24px;
}

.btn--sm {
  min-height: 36px;
  padding: 5px 12px;
  font-size: 0.8125rem;
  border-radius: 8px;
}

.btn--danger {
  color: var(--maroon-800);
  border-color: #e3c6d2;
}

.btn--danger:hover {
  background: var(--maroon-tint);
  border-color: var(--maroon);
}

.btn[aria-disabled='true'] {
  opacity: 0.7;
  cursor: progress;
}

/* --- the tick on the last screen ---------------------------------------- */

.tick {
  width: 64px;
  height: 64px;
  margin: 4px auto 16px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
  animation: tick-in 420ms var(--ease-out) both;
}

.tick::after {
  content: '';
  position: absolute;
  left: 23px;
  top: 14px;
  width: 16px;
  height: 28px;
  border: solid #ffffff;
  border-width: 0 5px 5px 0;
  border-radius: 2px;
  transform: rotate(45deg);
}

@keyframes tick-in {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
}

/* --- the staff page ----------------------------------------------------- */

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px var(--gutter) 18px;
  color: #ffffff;
}

.bar__crest {
  width: 104px;
  height: auto;
}

.bar__t {
  flex: 1;
  min-width: 0;
}

.bar__t h1 {
  color: #ffffff;
  font-size: 1.375rem;
}

.bar__t p {
  color: var(--ground-ink);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.sheet {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--gutter) 48px;
  font-size: 0.9375rem;
}

/* Opaque on purpose: this is where the log is read. */
.card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  margin: 0 0 18px;
  box-shadow: 0 1px 2px rgba(16, 40, 75, 0.04), 0 10px 24px -20px rgba(16, 40, 75, 0.3);
  min-width: 0;
}

.card > p + p,
.card > p + form,
.card > form + p,
.card > .row + p {
  margin-top: 12px;
}

.sheet > .note {
  margin: 0 0 18px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.scroll {
  overflow-x: auto;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tbl th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.tbl td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.tbl tr:last-child td {
  border-bottom: 0;
}

.tbl .num {
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

.tbl .wrap,
.wrap {
  overflow-wrap: anywhere;
}

.tbl__act {
  text-align: right;
  padding-right: 0;
}

.pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill--done {
  background: var(--green-tint);
  color: var(--green-800);
}

.pill--due {
  background: var(--maroon-tint);
  color: var(--maroon-800);
}

.pill--held {
  background: var(--amber-tint);
  color: var(--amber-ink);
}

.pill--off {
  background: var(--grey-100);
  color: var(--muted);
}

.pill--stage {
  background: var(--navy-tint);
  color: var(--navy-800);
}

/* --- motion ------------------------------------------------------------- */

.btn,
.field__i,
.affix,
.affix__b {
  transition:
    background-color var(--quick) var(--ease-out),
    border-color var(--quick) var(--ease-out),
    transform var(--quick) var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* --- small screens ------------------------------------------------------ */

@media (max-width: 520px) {
  .panel {
    padding: 28px 20px 24px;
  }

  h1 {
    font-size: 1.5rem;
  }

  /* The domain drops under the box rather than squeezing the username to
     a few characters wide. */
  .affix:has(.affix__s) {
    flex-direction: column;
  }

  .affix__s {
    padding: 8px 16px;
    border-left: 0;
    border-top: 1.5px solid var(--line-soft);
    border-radius: 0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);
  }

  .bar {
    flex-wrap: wrap;
  }
}
