/*
 * GKBI card finder.
 *
 * Hand-written, no framework, no external font or asset host — the only
 * third-party origin the page touches is Google's reCAPTCHA.
 *
 * The palette is taken from the GKBI seal: navy from the lettering, blue from
 * the ark, red from the cross, yellow from the outer ring. Yellow and red are
 * used as accents only; neither carries body text, so contrast stays AA.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;

  /* Brand, taken straight from the seal. */
  --gkbi-navy: #14226b;
  --gkbi-navy-dark: #0d1747;
  --gkbi-blue: #2e7bd6;
  --gkbi-red: #d8102c;
  --gkbi-yellow: #ffd400;

  /* Light theme surfaces. */
  --bg: #f2f5fc;
  --bg-accent: #e4ebf9;
  --surface: #ffffff;
  --surface-sunken: #f7f9ff;
  --border: #dbe2f2;
  --border-strong: #b9c4e0;
  --text: #161a2b;
  --text-muted: #545b75;

  --primary: var(--gkbi-navy);
  --primary-hover: var(--gkbi-navy-dark);
  --primary-text: #ffffff;
  --focus: var(--gkbi-blue);

  --danger: #b3122a;
  --danger-bg: #fdeced;
  --danger-border: #f3bec5;
  --success: #12694a;
  --success-bg: #e8f6f0;

  /* Spacing scale. */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --shadow: 0 1px 2px rgb(16 24 64 / 6%), 0 8px 28px rgb(16 24 64 / 8%);
  --shadow-lift: 0 2px 6px rgb(16 24 64 / 10%), 0 18px 44px rgb(16 24 64 / 14%);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono",
    Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0d1a;
    --bg-accent: #121935;
    --surface: #151a30;
    --surface-sunken: #1b2140;
    --border: #2a3157;
    --border-strong: #3b4478;
    --text: #e9ecf8;
    --text-muted: #a2aac9;

    --primary: #3d6fe0;
    --primary-hover: #5285ef;
    --primary-text: #ffffff;
    --focus: var(--gkbi-yellow);

    --danger: #ff9aa6;
    --danger-bg: #34121a;
    --danger-border: #6b2130;
    --success: #74d9b0;
    --success-bg: #102c24;

    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 28px rgb(0 0 0 / 45%);
    --shadow-lift: 0 2px 6px rgb(0 0 0 / 45%), 0 18px 44px rgb(0 0 0 / 55%);
  }
}

/* ------------------------------------------------------------------ base */

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

/*
 * The step machine toggles `hidden`, but an author `display` declaration beats
 * the user-agent `[hidden] { display: none }` rule at equal specificity. This
 * keeps `hidden` authoritative wherever it is set.
 */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1100px 460px at 50% -180px, var(--bg-accent), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: var(--primary);
}

:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.page {
  width: min(100% - 2rem, 40rem);
  margin-inline: auto;
  padding-block: var(--sp-6) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* ------------------------------------------------------------------ hero */

.hero {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
}

.hero__logo {
  width: clamp(88px, 24vw, 124px);
  height: auto;
  filter: drop-shadow(0 6px 18px rgb(16 24 64 / 18%));
}

.hero__eyebrow {
  margin-top: var(--sp-2);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero__title {
  position: relative;
  font-size: clamp(1.45rem, 5.5vw, 2rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  padding-bottom: var(--sp-3);
}

/* A short bar in the seal's yellow, echoing the outer ring. */
.hero__title::after {
  content: "";
  position: absolute;
  inset-inline: 50%;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 999px;
  translate: -50% 0;
  background: linear-gradient(90deg, var(--gkbi-yellow), var(--gkbi-red));
}

.hero__lead {
  max-width: 34rem;
  color: var(--text-muted);
  text-wrap: pretty;
}

/* ----------------------------------------------------------------- panel */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(var(--sp-4), 5vw, var(--sp-6));
}

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

.step__title {
  font-size: 1.1875rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.step__lead {
  margin-top: calc(var(--sp-3) * -1);
  color: var(--text-muted);
  text-wrap: pretty;
}

.note {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-wrap: pretty;
}

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

.form {
  display: grid;
  gap: var(--sp-4);
}

.field {
  display: grid;
  gap: var(--sp-2);
}

.field__label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.field__input {
  width: 100%;
  padding: 0.8125rem var(--sp-4);
  font: inherit;
  color: var(--text);
  background: var(--surface-sunken);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.field__input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.field__input:hover {
  border-color: var(--primary);
}

.field__input:focus {
  background: var(--surface);
  border-color: var(--primary);
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 1px;
}

/* The NIK is read back digit by digit off a printed card. */
.field__input--numeric {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  letter-spacing: 0.14em;
}

.field__input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field__hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.field__error {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--danger);
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

.button {
  --button-bg: transparent;
  --button-fg: var(--text);

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 3rem;
  padding: 0.6875rem var(--sp-5);
  font: inherit;
  font-weight: 600;
  color: var(--button-fg);
  background: var(--button-bg);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.62;
}

.button--primary {
  --button-bg: var(--primary);
  --button-fg: var(--primary-text);

  width: 100%;
  box-shadow: 0 1px 2px rgb(16 24 64 / 18%);
}

.button--primary:hover:not(:disabled) {
  --button-bg: var(--primary-hover);

  box-shadow: var(--shadow-lift);
}

.button--ghost {
  --button-fg: var(--text-muted);

  min-height: 2.5rem;
  padding-inline: var(--sp-4);
  border-color: var(--border);
}

.button--ghost:hover:not(:disabled) {
  --button-fg: var(--text);
  --button-bg: var(--surface-sunken);
}

.actions .button--primary {
  width: auto;
  flex: 1 1 15rem;
}

.button--download::before {
  content: "";
  width: 1.05rem;
  height: 1.05rem;
  background: currentcolor;
  /* Download glyph: arrow into a tray. */
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3v10m0 0 4-4m-4 4-4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>')
    center / contain no-repeat;
}

/* Spinner only occupies space while the button is busy. */
.button__spinner {
  display: none;
  width: 1.05rem;
  height: 1.05rem;
  border: 2.5px solid color-mix(in srgb, currentcolor 35%, transparent);
  border-top-color: currentcolor;
  border-radius: 50%;
  animation: spin 640ms linear infinite;
}

.button.is-busy .button__spinner {
  display: block;
}

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

/* ---------------------------------------------------------------- banner */

.banner {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  margin-bottom: var(--sp-5);
  padding: var(--sp-4);
  font-size: 0.9375rem;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  text-wrap: pretty;
}


.banner__icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1875rem;
  background: currentcolor;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="none" stroke="black" stroke-width="2"/><path d="M12 7.5v5.5" stroke="black" stroke-width="2" stroke-linecap="round"/><circle cx="12" cy="16.5" r="1.25"/></svg>')
    center / contain no-repeat;
}

.banner__body {
  display: grid;
  gap: var(--sp-1);
}

.banner__title {
  font-weight: 700;
}


/* Informational variant, used for the "contact Staf Sinode" message. */
.banner--info {
  color: var(--text);
  background: var(--surface-sunken);
  border-color: var(--border-strong);
}

.banner--info .banner__icon {
  color: var(--gkbi-blue);
}

/* --------------------------------------------------------------- success */

.success-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  color: var(--success);
  background: var(--success-bg);
  display: grid;
  place-items: center;
}

.success-mark::after {
  content: "";
  width: 1.5rem;
  height: 1.5rem;
  background: currentcolor;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m5 13 4.5 4.5L19 7" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg>')
    center / contain no-repeat;
}

/* ---------------------------------------------------------------- picker */

.picker {
  width: min(100% - 2rem, 32rem);
  padding: clamp(var(--sp-4), 5vw, var(--sp-6));
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
}

.picker::backdrop {
  background: rgb(9 12 28 / 55%);
  backdrop-filter: blur(2px);
}

.picker__title {
  font-size: 1.1875rem;
  font-weight: 650;
}

.picker__intro {
  margin-top: var(--sp-2);
  font-size: 0.9375rem;
  color: var(--text-muted);
  text-wrap: pretty;
}

.picker__list {
  display: grid;
  gap: var(--sp-2);
  margin-block: var(--sp-4);
}

.picker__option {
  width: 100%;
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  font: inherit;
  text-align: start;
  color: inherit;
  background: var(--surface-sunken);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.picker__option:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.picker__name {
  font-weight: 650;
  letter-spacing: 0.01em;
}

.picker__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.picker__meta-value {
  font-family: var(--font-mono);
}

.picker__badge {
  justify-self: start;
  margin-top: var(--sp-1);
  padding: 0.125rem var(--sp-2);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 999px;
}

/* ---------------------------------------------------------------- footer */

.footer {
  display: grid;
  gap: var(--sp-2);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-wrap: pretty;
}

.footer__org {
  font-weight: 600;
  color: var(--text);
}

.footer__recaptcha {
  font-size: 0.75rem;
  opacity: 0.85;
}

/* The badge is hidden, so the attribution text above is mandatory. */
.grecaptcha-badge {
  visibility: hidden;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
