/* ==========================================================================
   Attendance page

   A focused task page (absensi.html), not part of the dashboard shell: you
   clock in by face or by the QR at the office, and it tells you where you
   stand. No bottom navigation — there is nowhere else to go from here.

   Requires tokens.css and ui.css.
   ========================================================================== */

.absen {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: var(--space-6);
  min-height: 100dvh;
  padding: var(--space-8) var(--gutter) var(--space-10);
}

/* --- Hero: the board ---------------------------------------------------- */

.absen__hero {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  text-align: center;
}

.absen__clock {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
}

.absen__seconds {
  padding-bottom: 0.6em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-md);
  color: var(--ink-muted);
}

.absen__window {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.absen__window strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 500;
}

/* --- Card -------------------------------------------------------------- */

.absen__card {
  width: 100%;
  max-width: 460px;
}

.absen__divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-faint);
}

.absen__divider::before,
.absen__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.absen__izin {
  display: grid;
  gap: var(--space-3);
}

/* JS toggles this between display:block and display:none, so the wrapper
   itself must not depend on being a grid container. */
#izinReasonWrap {
  margin-top: var(--space-1);
}

#izinHint {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* --- Notices and status ------------------------------------------------
   #pauseNotice and #status are written to by the page module: it toggles
   inline display on the notice, and sets #status.className to
   info | success | error. Those three class names are the contract. */

#pauseNotice {
  display: none;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  max-width: 460px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--warn);
  font-size: var(--text-sm);
}

#status {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--space-2);
  min-height: 1.5em;
  width: 100%;
  max-width: 460px;
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  overflow-wrap: anywhere;
}

/* The icon is drawn by the pseudo-element so the message strings stay plain
   text — no emoji doing an icon's job. */
#status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

#status:empty {
  display: none;
}

#status.info {
  color: var(--info);
}

#status.success {
  color: var(--ok);
  font-weight: 700;
}

#status.error {
  color: var(--danger);
}

/* --- Success stamp -----------------------------------------------------
   Mounted over the card when #status turns success, then removed. */

.absen__stamp {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  pointer-events: none;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

.absen__stamp .ui-lottie {
  --lottie-size: min(58vw, 260px);
}

/* --- Steps (absensi.html) ----------------------------------------------
   The card shows one step at a time: choosing wajah or QR, then that
   method's own steps. The page module toggles hidden. */

.absen-step {
  display: grid;
  gap: var(--space-4);
}

.absen-step[hidden] {
  display: none;
}

/* The step's own gap already spaces the divider; its margin would double it. */
.absen-step > .absen__divider {
  margin: 0;
}

.absen-methods {
  display: grid;
  gap: var(--space-3);
}

.absen-method {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--wash-1);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--dur) var(--ease-out),
    background var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.absen-method:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}

.absen-method:active {
  transform: scale(0.98);
}

.absen-method:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.absen-method__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand-text);
}

.absen-method__text {
  display: grid;
  gap: 2px;
}

.absen-method__text strong {
  font-size: var(--text-md);
  font-weight: 700;
}

.absen-method__text small,
.absen-mode__text small {
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  color: var(--ink-muted);
}

.absen-method__chevron {
  color: var(--ink-faint);
}

/* The way over to the other method, under each method's first step. */
.absen-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.absen-modes {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
}

.absen-mode__text {
  display: grid;
  gap: 2px;
}

.absen-confirm {
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  padding: var(--space-4) 0 var(--space-2);
  text-align: center;
}

.absen-confirm__lead {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.absen-confirm__name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: var(--leading-tight);
  overflow-wrap: anywhere;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .absen-method {
    transition: none;
  }

  .absen-method:active {
    transform: none;
  }
}

/* Where the QR lives, under the scanner. */
.absen-scan-hint {
  text-align: center;
}

.absen-scan-hint a {
  color: var(--brand-text);
  font-weight: 600;
  overflow-wrap: anywhere;
}
