/* The sign-in, connect and refusal pages, in the OpenGov design system (OGDS):
 * ink monochrome, flat 0px geometry, mono labels, phone layout first.
 * The values are the OGDS tokens (OpenGov frontend/shared/tokens.css).
 * The page policy allows no font source, so the fonts are the reader's own:
 * DM Sans and JetBrains Mono when installed, else the system fonts. */

:root {
  --font-sans: "DM Sans Variable", "DM Sans", -apple-system, system-ui, "Segoe UI",
    Roboto, sans-serif;
  --font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SF Mono",
    Menlo, monospace;

  --color-surface-0: oklch(1 0 0);
  --color-surface-50: oklch(0.975 0.005 260);
  --color-surface-100: oklch(0.945 0.01 260);
  --color-surface-200: oklch(0.91 0.012 260);
  --color-surface-300: oklch(0.82 0.015 260);

  --color-ink: oklch(0.22 0.015 260);
  --color-ink-text: oklch(0.97 0.005 260);
  --color-accent-hover: oklch(0.15 0.01 260);

  --color-text-primary: oklch(0.2 0.01 260);
  --color-text-secondary: oklch(0.42 0.02 260);
  --color-text-muted: oklch(0.52 0.025 260);

  --color-degraded-fg: oklch(0.4 0.14 85);
  --color-degraded-soft: oklch(0.97 0.04 85);
  --color-unreachable-fg: oklch(0.38 0.17 25);
  --color-unreachable-soft: oklch(0.97 0.03 25);

  --page-gutter: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: var(--page-gutter);
  background: var(--color-surface-50);
  color: var(--color-text-primary);
  font: 400 15px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 30rem;
  margin: 0 auto;
  padding: 24px 20px 28px;
  background: var(--color-surface-0);
  border: 1px solid var(--color-surface-200);
  border-top: 3px solid var(--color-ink);
}

@media (min-width: 600px) {
  body {
    padding: 48px var(--page-gutter);
  }

  main {
    padding: 32px 36px 36px;
  }
}

/* Focus ring: one for every control, as in OGDS. */
:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

/* --- page head ------------------------------------------------------------ */

.lang {
  margin: 0 0 20px;
  text-align: end;
  font: 500 12px/1.2 var(--font-mono);
  letter-spacing: 0.04em;
}

.lang a {
  display: inline-block;
  padding: 6px 0;
  color: var(--color-text-secondary);
}

header {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}

/* The host is the eyebrow above the title. */
.host {
  order: -1;
  margin: 0 0 10px;
  font: 500 11px/1.3 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.015em;
}

@media (min-width: 600px) {
  h1 {
    font-size: 28px;
    line-height: 1.18;
  }
}

/* The refusal page has a title and no header. */
main > h1 {
  margin-bottom: 20px;
}

/* A section label: mono, uppercase. */
h2 {
  margin: 0 0 10px;
  font: 500 11px/1.3 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

main > h2 {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--color-surface-100);
}

/* --- the request and its check -------------------------------------------- */

.request {
  margin: 0 0 20px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.5;
  background: var(--color-surface-50);
  border: 1px solid var(--color-surface-200);
  border-inline-start: 3px solid var(--color-ink);
}

.request p {
  margin: 0 0 8px;
}

.request p:last-child {
  margin-bottom: 0;
}

/* The question against a forwarded link: a warning, with a mark as well as
 * a color, because a color alone says nothing to some readers. */
.check {
  position: relative;
  padding: 8px 10px;
  padding-inline-start: 36px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-degraded-fg);
  background: var(--color-degraded-soft);
  border: 1px solid currentColor;
}

.check::before {
  content: "!";
  content: "!" / "";
  position: absolute;
  inset-inline-start: 10px;
  top: 9px;
  width: 18px;
  height: 18px;
  font: 700 12px/18px var(--font-mono);
  text-align: center;
  color: var(--color-degraded-soft);
  background: var(--color-degraded-fg);
}

/* --- messages ------------------------------------------------------------- */

.error {
  position: relative;
  margin: 0 0 20px;
  padding: 10px 12px;
  padding-inline-start: 40px;
  font-weight: 600;
  color: var(--color-unreachable-fg);
  background: var(--color-unreachable-soft);
  border: 1px solid currentColor;
}

.error::before {
  content: "\00d7";
  content: "\00d7" / "";
  position: absolute;
  inset-inline-start: 12px;
  top: 10px;
  width: 18px;
  height: 18px;
  font: 700 14px/18px var(--font-mono);
  text-align: center;
  color: var(--color-unreachable-soft);
  background: var(--color-unreachable-fg);
}

.error:empty {
  display: none;
}

.host,
.hint,
.note {
  overflow-wrap: anywhere;
}

.hint,
.note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.hint {
  margin: 0 0 4px;
}

.note {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--color-surface-100);
}

/* --- the form ------------------------------------------------------------- */

label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: 400 16px/1.4 var(--font-sans);
  color: var(--color-text-primary);
  background: var(--color-surface-0);
  border: 1px solid var(--color-surface-300);
  border-radius: 0;
}

input:hover {
  border-color: var(--color-text-muted);
}

input:focus {
  outline: none;
  border-color: var(--color-ink);
  box-shadow: 0 0 0 1px var(--color-ink);
}

button {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 24px;
  padding: 10px 16px;
  font: 600 15px/1.2 var(--font-sans);
  letter-spacing: 0.01em;
  color: var(--color-ink-text);
  background: var(--color-ink);
  border: 1px solid var(--color-ink);
  border-radius: 0;
  cursor: pointer;
}

button:hover {
  background: var(--color-accent-hover);
}

/* --- the connect page ----------------------------------------------------- */

ol {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

li {
  position: relative;
  margin: 0 0 12px;
  padding-inline-start: 36px;
  counter-increment: step;
}

li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  inset-inline-start: 0;
  top: 1px;
  font: 500 12px/1.6 var(--font-mono);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

code {
  padding: 1px 6px;
  font: 400 13px/1.6 var(--font-mono);
  background: var(--color-surface-50);
  border: 1px solid var(--color-surface-200);
  overflow-wrap: anywhere;
}

/* The service address stands on its own line, ready to copy. */
.request code {
  display: block;
  padding: 10px 12px;
  background: var(--color-surface-0);
}

/* The actions of the connect page: one link styled as the primary button,
 * and secondary copy buttons. A copy button shows only with its script. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

a.button,
button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 10px 16px;
  font: 600 14px/1.2 var(--font-sans);
  text-decoration: none;
  border-radius: 0;
}

a.button {
  color: var(--color-ink-text);
  background: var(--color-ink);
  border: 1px solid var(--color-ink);
}

a.button:hover {
  background: var(--color-accent-hover);
}

button.secondary {
  color: var(--color-ink);
  background: var(--color-surface-0);
  border: 1px solid var(--color-ink);
}

button.secondary:hover {
  background: var(--color-surface-50);
}


/* A command to type: on its own line, ready to copy. */
code.command {
  display: block;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--color-surface-0);
}

li .actions {
  margin-bottom: 0;
}

/* --- the decision on the sign-in page ------------------------------------- */

/* Where the access goes: a forwarded link shows an address the reader does
 * not know. */
.dest {
  font-size: 14px;
}

.dest strong {
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Allow comes first, so Enter in the password field allows. */
.decision {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.decision button {
  margin-top: 0;
}

.decision button.secondary {
  width: 100%;
}
