/* Base styles shared by both services. Text first, one accent colour, no decoration. */

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-reading);
  line-height: var(--line-reading);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  line-height: var(--line-heading);
  margin: 0 0 var(--space-3);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--h1);
}

h2 {
  font-size: var(--h2);
}

h3 {
  font-size: var(--h3);
}

p {
  margin: 0 0 var(--space-4);
  max-width: var(--reading-width);
}

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

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

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

.meta {
  color: var(--muted);
  font-size: var(--text-meta);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

/* Form field. */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  max-width: 28rem;
}

.field label {
  font-size: var(--text-ui);
  font-weight: 600;
}

.field input,
.field textarea {
  font: inherit;
  font-size: 16px;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
}

.field textarea {
  min-height: 9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}

.field-error,
.form-error {
  color: var(--danger);
  font-size: var(--text-ui);
}

.notice {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: var(--space-4);
}

/* A registry personal code, shown once to the registrar (ADR 0017). */
.member-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  letter-spacing: 0.08em;
}

.notice--warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: transparent;
}

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

/* Footer: version and commit only (hard rule 12, brief section 11). */
.footer {
  color: var(--muted);
  font-size: var(--text-meta);
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: var(--space-4);
  border-top: 1px solid var(--line-soft);
}

/* Button: four kinds, with a pending state (brief principle 8). */
.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--text-ui);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--motion) var(--ease);
}

.button[disabled],
.button[aria-busy="true"] {
  cursor: default;
}

.button[disabled]:not([aria-busy="true"]) {
  opacity: 0.55;
}

.button--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.button--quiet {
  background: transparent;
  color: var(--accent);
}

.button--danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.spinner {
  width: 1em;
  height: 1em;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
}

@media (forced-colors: active) {
  .button {
    border-color: ButtonText;
  }
}

/* Last, so it wins over display rules of the same specificity (.button, .spinner). */
[hidden] {
  display: none;
}
