/* e-Pay Bridge — admin console.
   Typeface: Atkinson Hyperlegible, chosen because its characters cannot be mistaken for one another
   (0/O, 1/l/I), which matters where people copy client secrets and recovery codes. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("../fonts/atkinson-hyperlegible-mono.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colour. Deep water for the frame, mist for the page, brass for everything that is a key. */
  --diepwater: #0f3a4b;
  --diepwater-donker: #0a2c3a;
  --diepwater-lijn: #2b5a6c;
  --stroom: #1b6f8f;
  --mist: #edf2f4;
  --papier: #ffffff;
  --lijn: #d3dde2;
  --lijn-zacht: #e6ecef;
  --inkt: #15252d;
  --inkt-zacht: #54666f;
  --messing: #b8861f;
  --messing-tekst: #7d560a;
  --messing-licht: #fbf4e1;
  --messing-lijn: #e4cf98;
  --groen: #1f8a5b;
  --groen-licht: #e4f3eb;
  --rood: #c2362b;
  --rood-licht: #fbeae8;

  /* On the dark frame. */
  --op-donker: #ffffff;
  --op-donker-zacht: #b9cdd5;
  --sein-goed: #8fdcb7;
  --sein-fout: #ffa598;
  --sein-uit: #6f93a1;

  /* Type scale, ratio 1.25. */
  --stap--1: 0.875rem;
  --stap-0: 1rem;
  --stap-1: 1.25rem;
  --stap-2: 1.5625rem;
  --stap-3: 1.953rem;
  --stap-4: 2.441rem;

  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --breedte: 68rem;
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--stap-0);
  line-height: 1.5;
  color: var(--inkt);
  background: var(--mist);
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
ul {
  margin: 0;
}

a {
  color: var(--stroom);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--diepwater);
}

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

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

/* ---------- Frame ---------- */

.masthead {
  background: var(--diepwater);
  color: var(--op-donker);
}

.masthead :focus-visible {
  outline-color: #ffffff;
}

.masthead__bar {
  max-width: var(--breedte);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 2.5rem;
  min-height: 4.25rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--op-donker);
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark:hover {
  color: var(--op-donker);
}

.brandmark {
  display: block;
  width: auto;
  height: 1.55rem;
}

.wordmark--large {
  gap: 0.9rem;
  font-size: 1.5rem;
}

.wordmark--large .brandmark {
  height: 2.5rem;
}

.nowrap {
  white-space: nowrap;
}

.mainnav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.mainnav a {
  padding: 1.35rem 0.8rem 1.15rem;
  border-bottom: 3px solid transparent;
  color: var(--op-donker-zacht);
  font-weight: 500;
  text-decoration: none;
}

.mainnav a:hover {
  color: var(--op-donker);
}

.mainnav a[aria-current="page"] {
  color: var(--op-donker);
  border-bottom-color: var(--op-donker);
}

.account {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

.account a {
  color: var(--op-donker-zacht);
  text-decoration: none;
}

.account a:hover,
.account a[aria-current="page"] {
  color: var(--op-donker);
}

.page {
  max-width: var(--breedte);
  margin: 0 auto;
  padding: 2.25rem 1.5rem 4rem;
}

.page__head {
  margin-bottom: 1.75rem;
}

.page__head h1,
.gate__form h1 {
  font-size: var(--stap-3);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 64ch;
  margin-top: 0.6rem;
  color: var(--inkt-zacht);
}

/* ---------- The bridge: three piers and the deck between them ---------- */

.span {
  max-width: var(--breedte);
  margin: 0 auto;
  padding: 2.25rem 1.5rem 3rem;
}

.span h1 {
  font-size: var(--stap-4);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
  max-width: 22ch;
}

.span__summary {
  max-width: 60ch;
  margin-top: 0.6rem;
  color: var(--op-donker-zacht);
  font-size: var(--stap-1);
  line-height: 1.4;
}

.span__deck {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  margin-top: 2.75rem;
}

.span__node {
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid var(--sein-uit);
  border-radius: 50%;
  background: var(--diepwater);
}

.span__node[data-state="ok"] {
  border-color: var(--sein-goed);
  background: var(--sein-goed);
}

.span__node[data-state="bad"] {
  border-color: var(--sein-fout);
}

.span__node--bridge {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 0;
  background: var(--messing);
  color: var(--diepwater-donker);
}

.span__node--bridge svg {
  width: 1.5rem;
  height: 1.5rem;
}

.span__segment {
  height: 0;
  border-top: 4px solid var(--sein-uit);
}

.span__segment[data-state="ok"] {
  border-top-color: var(--sein-goed);
}

.span__segment[data-state="bad"] {
  border-top: 4px dashed var(--sein-fout);
}

.span__segment[data-state="off"] {
  border-top: 4px dotted var(--sein-uit);
}

.span__piers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.pier h2 {
  font-size: var(--stap-1);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pier p {
  margin-top: 0.3rem;
  color: var(--op-donker-zacht);
  max-width: 34ch;
}

.pier p strong {
  color: var(--op-donker);
  font-weight: 600;
}

.pier--bridge {
  text-align: center;
}

.pier--bridge p {
  margin-inline: auto;
}

.pier--dsb {
  text-align: right;
}

.pier--dsb p {
  margin-left: auto;
}

.pier .button {
  margin-top: 0.9rem;
}

.pier__problem {
  color: var(--sein-fout) !important;
}

/* The life of the current DSB token: full at the left, empty after five minutes. */
.gauge {
  margin-top: 0.75rem;
}

.gauge__track {
  position: relative;
  height: 0.5rem;
  max-width: 20rem;
  margin: 0 auto;
  border-radius: 0.25rem;
  background: var(--diepwater-lijn);
  overflow: hidden;
}

.gauge__fill {
  height: 100%;
  background: var(--messing-lijn);
  transition: width 1s linear;
}

/* The point at which the bridge fetches a new token: 20% of the life left. */
.gauge__mark {
  position: absolute;
  top: 0;
  left: 20%;
  width: 2px;
  height: 100%;
  background: var(--diepwater);
}

/* ---------- Surfaces ---------- */

.panel {
  background: var(--papier);
  border: 1px solid var(--lijn);
  border-radius: 10px;
  padding: 1.5rem;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel h2 {
  font-size: var(--stap-1);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel--flush {
  padding: 0;
  overflow: hidden;
}

.panel--flush .panel__head {
  padding: 1.25rem 1.5rem 0;
}

.panel__foot {
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--lijn-zacht);
}

.stack > * + * {
  margin-top: 1.5rem;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.5rem;
  align-items: start;
}

/* The wide column first: for a page whose main part is a form. */
.columns--form {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.empty {
  color: var(--inkt-zacht);
  max-width: 52ch;
}

.note {
  color: var(--inkt-zacht);
  font-size: var(--stap--1);
}

.panel__empty {
  padding: 0 1.5rem 1.5rem;
}

.push {
  margin-top: 1.1rem;
}

.push-small {
  margin-top: 0.75rem;
}

/* ---------- Tables ---------- */

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.ledger th {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--lijn);
  color: var(--inkt-zacht);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.ledger td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--lijn-zacht);
  vertical-align: middle;
}

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

.ledger th:first-child,
.ledger td:first-child {
  padding-left: 1.5rem;
}

.ledger th:last-child,
.ledger td:last-child {
  padding-right: 1.5rem;
}

.ledger .nowrap,
.ledger .key {
  white-space: nowrap;
}

.ledger .actions {
  text-align: right;
  white-space: nowrap;
}

.ledger .actions form {
  display: inline;
}

/* A failed entry carries a red rule and red text: the rule is there for scanning a long log. */
.ledger tr.is-failed td:first-child {
  box-shadow: inset 4px 0 0 var(--rood);
}

.ledger tr.is-failed .ledger__message {
  color: var(--rood);
  font-weight: 600;
}

/* Positioned, so that hidden labels inside a wide table are clipped with it
   and do not make the whole page scroll sideways. */
.table-scroll {
  position: relative;
  overflow-x: auto;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  white-space: nowrap;
}

.state::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: currentColor;
}

.state--on {
  color: var(--groen);
}

.state--off {
  color: var(--inkt-zacht);
}

.state--bad {
  color: var(--rood);
}

/* ---------- Keys: anything a person has to copy exactly ---------- */

.key {
  font-family: var(--mono);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.key--boxed {
  display: inline-block;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--messing-lijn);
  border-radius: 6px;
  background: var(--papier);
  font-size: 1rem;
  user-select: all;
}

.keyline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Credentials that are shown once: a slip of paper with a brass edge. */
.slip {
  margin-bottom: 2rem;
  padding: 1.35rem 1.5rem 1.5rem;
  border: 1px solid var(--messing-lijn);
  border-top: 6px solid var(--messing);
  border-radius: 4px 4px 10px 10px;
  background: var(--messing-licht);
}

.slip h2 {
  font-size: var(--stap-1);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.slip__warning {
  max-width: 64ch;
  margin-top: 0.35rem;
  color: var(--messing-tekst);
}

.slip dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.7rem 1.5rem;
  align-items: center;
  margin-top: 1.1rem;
}

.slip dt {
  font-weight: 600;
}

.codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.6rem;
  margin-top: 1.1rem;
  padding: 0;
  list-style: none;
}

/* ---------- Forms ---------- */

.field {
  max-width: 34rem;
  margin-bottom: 1.35rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #b4c3ca;
  border-radius: 6px;
  background: var(--papier);
  color: var(--inkt);
  font: inherit;
}

.field input::placeholder {
  color: #8a9aa2;
}

.field input:focus-visible {
  border-color: var(--stroom);
  outline-offset: 0;
}

.field input.input-validation-error {
  border-color: var(--rood);
}

.field--key input {
  font-family: var(--mono);
}

.field--key input::placeholder {
  font-family: var(--sans);
}

.field__hint {
  margin-top: 0.4rem;
  color: var(--inkt-zacht);
  font-size: var(--stap--1);
}

.field__error {
  display: block;
  margin-top: 0.4rem;
  color: var(--rood);
  font-size: var(--stap--1);
  font-weight: 600;
}

.field__error:empty {
  display: none;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.inline-form input[type="text"] {
  flex: 1 1 16rem;
  max-width: 26rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #b4c3ca;
  border-radius: 6px;
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.button--primary {
  background: var(--diepwater);
  color: var(--op-donker);
}

.button--primary:hover {
  background: var(--diepwater-donker);
  color: var(--op-donker);
}

.button--quiet {
  border-color: #b4c3ca;
  background: var(--papier);
  color: var(--inkt);
}

.button--quiet:hover {
  border-color: var(--inkt-zacht);
  color: var(--inkt);
}

.button--danger {
  border-color: #e0aca6;
  background: var(--papier);
  color: var(--rood);
}

.button--danger:hover {
  border-color: var(--rood);
  color: var(--rood);
}

.button--brass {
  background: var(--messing-lijn);
  color: var(--diepwater-donker);
}

.button--brass:hover {
  background: #f0deac;
  color: var(--diepwater-donker);
}

.button--on-dark {
  border-color: var(--diepwater-lijn);
  background: transparent;
  color: var(--op-donker);
}

.button--on-dark:hover {
  border-color: var(--op-donker-zacht);
  color: var(--op-donker);
}

.button--small {
  padding: 0.4rem 0.7rem;
  font-size: var(--stap--1);
}

.button--wide {
  width: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

/* ---------- Messages ---------- */

.notice {
  max-width: 48rem;
  margin-bottom: 1.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid;
  border-left-width: 5px;
  border-radius: 6px;
}

.notice--ok {
  border-color: #a9d6c0;
  border-left-color: var(--groen);
  background: var(--groen-licht);
  color: #124e33;
}

.notice--bad {
  border-color: #eebcb6;
  border-left-color: var(--rood);
  background: var(--rood-licht);
  color: #861f17;
}

.notice ul {
  padding-left: 1.1rem;
}

.validation-summary-valid {
  display: none;
}

/* ---------- Filter tabs ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--lijn);
}

.tabs a {
  margin-bottom: -1px;
  padding: 0.55rem 0.9rem;
  border-bottom: 3px solid transparent;
  color: var(--inkt-zacht);
  font-weight: 600;
  text-decoration: none;
}

.tabs a:hover {
  color: var(--inkt);
}

.tabs a[aria-current="true"] {
  border-bottom-color: var(--diepwater);
  color: var(--inkt);
}

/* ---------- Steps (setting up two-step verification really is a sequence) ---------- */

.steps {
  padding: 0;
  list-style: none;
  counter-reset: stap;
}

.steps > li {
  position: relative;
  max-width: 44rem;
  padding: 0 0 1.5rem 3rem;
  counter-increment: stap;
}

.steps > li::before {
  content: counter(stap);
  position: absolute;
  left: 0;
  top: -0.15rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--diepwater);
  color: var(--op-donker);
  font-weight: 700;
}

.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(1rem - 1px);
  top: 2.1rem;
  bottom: 0.25rem;
  width: 2px;
  background: var(--lijn);
}

.qr {
  display: block;
  margin: 0.9rem 0;
  padding: 0.5rem;
  border: 1px solid var(--lijn);
  border-radius: 8px;
  background: var(--papier);
}

/* ---------- Sign-in ---------- */

.gate {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
  min-height: 100vh;
}

.gate__side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3rem;
  padding: 2.75rem 3.5rem 2.5rem;
  overflow: hidden;
  background: var(--diepwater);
  color: var(--op-donker);
}

.gate__title {
  max-width: 18ch;
  font-size: var(--stap-4);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gate__subtitle {
  margin-top: 0.75rem;
  color: var(--op-donker-zacht);
  font-size: var(--stap-1);
}

.gate__notice {
  max-width: 44ch;
  color: var(--op-donker-zacht);
  font-size: var(--stap--1);
}

.gate__main {
  display: grid;
  place-items: center;
  padding: 2.5rem 1.5rem;
}

.gate__form {
  width: 100%;
  max-width: 23rem;
}

.gate__form h1 {
  margin-bottom: 0.5rem;
}

.gate__form .lede {
  margin: 0 0 1.75rem;
}

/* ---------- Small screens ---------- */

@media (max-width: 52rem) {
  .columns,
  .columns--form,
  .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .gate {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .gate__side {
    padding: 1.75rem 1.5rem 2rem;
    gap: 2rem;
  }

  .gate__title {
    font-size: var(--stap-3);
  }

  /* Wordmark and account on the first row, the menu on a row of its own. */
  .masthead__bar {
    padding-top: 0.6rem;
    column-gap: 1rem;
  }

  .wordmark {
    flex: 1;
  }

  .mainnav {
    order: 3;
    flex: 1 0 100%;
    margin: 0.25rem -0.6rem 0;
  }

  .mainnav a {
    padding: 0.7rem 0.6rem 0.55rem;
  }

  .account {
    padding: 0;
  }

  .panel__head {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Dates may break onto two lines so that a table fits the screen. */
  .ledger .nowrap {
    white-space: normal;
  }

  .ledger th:first-child,
  .ledger td:first-child {
    padding-left: 1rem;
  }

  .ledger th:last-child,
  .ledger td:last-child {
    padding-right: 1rem;
  }

  .ledger .actions {
    white-space: normal;
  }

  .ledger .actions .button {
    margin: 0.15rem 0;
  }

  /* The bridge turns upright: piers one below the other. */
  .span__deck {
    display: none;
  }

  .span__piers {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin-top: 2rem;
  }

  .pier,
  .pier--bridge,
  .pier--dsb {
    padding: 0 0 1.5rem 1.5rem;
    border-left: 4px solid var(--sein-uit);
    text-align: left;
  }

  .pier[data-state="ok"] {
    border-left-color: var(--sein-goed);
  }

  .pier[data-state="bad"] {
    border-left: 4px dashed var(--sein-fout);
  }

  .pier--bridge p,
  .pier--dsb p,
  .gauge__track {
    margin-left: 0;
  }

  .slip dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }

  .slip dd {
    margin-bottom: 0.6rem;
  }
}

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