/* The components of the design system (ADR 0015; docs/research/design-system.md, section 7.1):
   classes that the Razor components of the library render and that plain HTML may use, such as
   a button that PasskeySubmit renders. Only roles of tokens.css. */

/* Text for screen readers only. */
.rr-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Icon: 20 px with a stroke of 1.75 px, in the colour of the text (section 5.6). */
.rr-icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 1.75;
  vertical-align: middle;
}

/* Page: the content below the top bar, up to 1200 px wide (section 5.2). */
.rr-page {
  width: 100%;
  max-width: 1200px;
  padding: var(--rr-space-5) var(--rr-space-4) var(--rr-space-8);
}

/* Secondary text, such as a date below a name. */
.rr-text-muted {
  color: var(--rr-text-muted);
}

/* Form: fields and actions one below the other, with 12 px between them, as between fields that
   belong together, and no margins of their own (section 5.1). */
.rr-form {
  display: grid;
  gap: var(--rr-space-3);
  max-width: 30rem;
  margin: 0 0 var(--rr-space-5);
}

.rr-form > * {
  margin-block: 0;
}

/* Actions: a row of buttons, as far apart as the pointer asks (section 2.3). */
.rr-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rr-target-gap) var(--rr-space-2);
}

/* Button (Knopf): at least the target size high, the text in one line without hyphens
   (sections 2.3, 4.4 and 5.1). Secondary is the default, primary the one main action of a view
   in the accent, danger a dangerous action in the colour of errors. */
.rr-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rr-space-2);
  min-height: var(--rr-target-size);
  min-width: var(--rr-target-size);
  margin: 0;
  padding: calc(var(--rr-control-padding-block) - 1px) calc(var(--rr-space-4) - 1px);
  border: 1px solid var(--rr-border);
  border-radius: var(--rr-radius-control);
  background: var(--rr-surface-raised);
  color: var(--rr-text);
  font: var(--rr-font-text-md-strong);
  line-height: var(--rr-line-height-control);
  text-align: center;
  text-decoration: none;
  -webkit-hyphens: manual;
  hyphens: manual;
  cursor: pointer;
}

.rr-button:hover {
  background: var(--rr-surface-sunken);
  color: var(--rr-text);
}

.rr-button:active {
  background: var(--rr-surface-selected);
}

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

.rr-button-primary:hover,
.rr-button-primary:active {
  border-color: var(--rr-accent-hover);
  background: var(--rr-accent-hover);
  color: var(--rr-on-accent);
}

.rr-button-danger {
  border-color: var(--rr-error);
  color: var(--rr-error);
}

.rr-button-danger:hover,
.rr-button-danger:active {
  border-color: var(--rr-error);
  background: var(--rr-error);
  color: var(--rr-on-semantic);
}

/* Inactive: never told by the pale colour alone, the element carries disabled (section 3.4). */
.rr-button:disabled,
.rr-button[aria-disabled="true"] {
  border-color: var(--rr-border-subtle);
  background: var(--rr-surface-sunken);
  color: var(--rr-text-disabled);
  cursor: not-allowed;
}

/* Field (Feld): a visible label above the input, the error as text with an icon below it
   (WCAG 3.3.1 and 3.3.2; section 2.2). */
.rr-field {
  display: grid;
  gap: var(--rr-space-1);
  align-content: start;
  min-width: 0;
}

.rr-field-label {
  font: var(--rr-font-text-md-strong);
}

.rr-input {
  width: 100%;
  min-height: var(--rr-target-size);
  margin: 0;
  padding: calc(var(--rr-control-padding-block) - 1px) var(--rr-space-3);
  border: 1px solid var(--rr-border);
  border-radius: var(--rr-radius-control);
  background: var(--rr-surface-raised);
  color: var(--rr-text);
  font: var(--rr-font-text-md);
  line-height: var(--rr-line-height-control);
}

.rr-input::placeholder {
  color: var(--rr-text-muted);
  opacity: 1;
}

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

.rr-input[aria-invalid="true"] {
  border-color: var(--rr-error);
  box-shadow: inset 0 0 0 1px var(--rr-error);
}

.rr-input:disabled {
  border-color: var(--rr-border-subtle);
  background: var(--rr-surface-sunken);
  color: var(--rr-text-disabled);
  cursor: not-allowed;
}

.rr-field-errors:empty {
  display: none;
}

.rr-field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--rr-space-2);
  margin: 0;
  color: var(--rr-error);
  font: var(--rr-font-text-sm);
  font-weight: 600;
}

/* The summary of the errors of a form (ValidationSummary), in the colour of errors. */
.rr-validation-summary {
  margin: 0;
  padding-left: var(--rr-space-5);
  color: var(--rr-error);
  font-weight: 600;
}

/* Alert (Hinweis): icon and text in the semantic colour of its kind, with a bar of 4 px at the
   edge, on a raised surface, never on a tinted one (section 3.5). */
.rr-alert {
  --alert-color: var(--rr-info);
  display: flex;
  align-items: flex-start;
  gap: var(--rr-space-3);
  margin: 0 0 var(--rr-space-4);
  padding: var(--rr-space-3) var(--rr-space-4) var(--rr-space-3) var(--rr-space-3);
  border: 1px solid var(--rr-border-subtle);
  border-left: 4px solid var(--alert-color);
  border-radius: var(--rr-radius-control);
  background: var(--rr-surface-raised);
  color: var(--rr-text);
}

.rr-alert > .rr-icon {
  margin-top: 0.125rem;
  color: var(--alert-color);
}

.rr-alert-body {
  flex: 1;
  min-width: 0;
}

.rr-alert-success {
  --alert-color: var(--rr-success);
}

.rr-alert-warning {
  --alert-color: var(--rr-warning);
}

.rr-alert-error {
  --alert-color: var(--rr-error);
}

.rr-alert-info {
  --alert-color: var(--rr-info);
}

/* Data table (Tabelle): scrolls in its own area at 320 px, its caption does not (WCAG 1.4.10);
   rows as high as the pointer asks, digits of the same width (sections 2.3 and 4.4). */
.rr-data-table-scroll {
  overflow-x: auto;
  margin: 0 0 var(--rr-space-4);
  border: 1px solid var(--rr-border-subtle);
  border-radius: var(--rr-radius-surface);
  background: var(--rr-surface-raised);
}

.rr-data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.rr-data-table caption {
  padding: var(--rr-space-2) var(--rr-space-3);
  color: var(--rr-text-muted);
  font: var(--rr-font-text-sm);
  text-align: left;
}

.rr-data-table th {
  padding: var(--rr-space-2) var(--rr-space-3);
  background: var(--rr-surface-sunken);
  color: var(--rr-text-muted);
  font-weight: 600;
  text-align: left;
}

.rr-data-table td {
  height: var(--rr-row-height);
  padding: var(--rr-space-1) var(--rr-space-3);
  border-top: 1px solid var(--rr-border-subtle);
  vertical-align: middle;
}

/* Numbers in a table stand to the right, with digits of the same width (sections 2.3 and 4.4),
   also in a heading of a column. */
.rr-number,
.rr-data-table th.rr-number {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rr-data-table tbody tr:hover td {
  background: var(--rr-surface-sunken);
}

/* Top bar (Kopfleiste): Röstbraun as the surface of the brand, the logo in its dark version
   and, in the bar, focus and links in Kürbis (sections 5.4 and 6.2, rule 1). */
.rr-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rr-space-2) var(--rr-space-4);
  min-height: 3.5rem;
  padding: var(--rr-space-3) var(--rr-space-4);
  background: var(--rr-surface-brand);
  color: var(--rr-text-on-brand);
}

.rr-topbar :focus-visible {
  outline-color: var(--rr-accent-on-brand);
}

.rr-topbar a {
  color: var(--rr-accent-on-brand);
}

/* The logo with wordmark at least 120 px wide (brand/README.md, "Mindestgröße"); its link is a
   target as high as the pointer asks (decision E11; #376, finding 2). */
.rr-topbar-home {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: var(--rr-target-size);
  border-radius: var(--rr-radius-control);
}

.rr-topbar-home img {
  display: block;
  width: 130px;
  height: 32px;
}

.rr-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rr-target-gap) var(--rr-space-2);
  margin-left: auto;
}

.rr-topbar .rr-button {
  border-color: var(--rr-border);
  background: transparent;
  color: var(--rr-text-on-brand);
}

.rr-topbar .rr-button:hover,
.rr-topbar .rr-button:active {
  background: var(--rr-surface-brand-hover);
  color: var(--rr-text-on-brand);
}

/* A toggle button that is on, such as the switch to the dark view: a border in Kürbis, which
   holds 3:1 on the top bar (WCAG 1.4.11; ContrastPairs). */
.rr-topbar .rr-button[aria-pressed="true"] {
  border-color: var(--rr-accent-on-brand);
  background: var(--rr-surface-brand-hover);
}
