/*
 * quillflow default theme. Optional: portals with their own design system can skip this file
 * and style the qf-* classes directly, or keep it and override the custom properties.
 * Patterns follow GOV.UK / Det Fælles Designsystem: one question per line, errors above the
 * input, a visible focus ring, an error summary at the top.
 */
qf-form {
  --qf-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --qf-text: #0b0c0c;
  --qf-muted: #505a5f;
  --qf-border: #0b0c0c;
  --qf-background: #ffffff;
  --qf-primary: #00703c;
  --qf-primary-hover: #005a30;
  --qf-secondary: #f3f2f1;
  --qf-error: #d4351c;
  --qf-focus: #ffdd00;
  --qf-radius: 0;
  --qf-gap: 1.5rem;
  --qf-max-width: 40rem;

  display: block;
  max-width: var(--qf-max-width);
  font-family: var(--qf-font);
  font-size: 1.1875rem;
  line-height: 1.4;
  color: var(--qf-text);
}

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

.qf-progress {
  margin: 0 0 0.25rem;
  color: var(--qf-muted);
  font-size: 1rem;
}

.qf-page-title {
  margin: 0 0 var(--qf-gap);
  font-size: 2rem;
  line-height: 1.2;
}

.qf-page-title:focus,
.qf-confirmation__title:focus,
.qf-error-summary:focus {
  outline: 3px solid var(--qf-focus);
  outline-offset: 0;
}

.qf-field,
.qf-note,
.qf-group {
  margin: 0 0 var(--qf-gap);
}

fieldset.qf-field,
fieldset.qf-group {
  min-width: 0;
  padding: 0;
  border: 0;
}

.qf-group__legend {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.qf-label {
  display: block;
  margin-bottom: 0.25rem;
  padding: 0;
  font-weight: 700;
}

.qf-optional {
  font-weight: 400;
  color: var(--qf-muted);
}

.qf-hint {
  margin: 0 0 0.5rem;
  color: var(--qf-muted);
}

.qf-note__text {
  margin: 0;
}

.qf-input,
.qf-select {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.3rem 0.5rem;
  border: 2px solid var(--qf-border);
  border-radius: var(--qf-radius);
  background: var(--qf-background);
  color: inherit;
  font: inherit;
}

.qf-input--number,
.qf-input--date {
  max-width: 14em;
}

.qf-input[readonly] {
  border-style: dashed;
  background: var(--qf-secondary);
}

.qf-input:focus,
.qf-select:focus {
  outline: 3px solid var(--qf-focus);
  outline-offset: 0;
  box-shadow: inset 0 0 0 2px var(--qf-border);
}

/* Errors: red bar on the left, message above the input, red border on the input. */
.qf-field--error,
fieldset.qf-field--error {
  padding-left: 1rem;
  border-left: 5px solid var(--qf-error);
}

.qf-error-message {
  margin: 0 0 0.5rem;
  color: var(--qf-error);
  font-weight: 700;
}

.qf-field--error .qf-input,
.qf-field--error .qf-select {
  border-color: var(--qf-error);
}

.qf-error-summary {
  margin: 0 0 var(--qf-gap);
  padding: 1rem;
  border: 5px solid var(--qf-error);
}

.qf-error-summary__title {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
}

.qf-error-summary__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.qf-error-summary__list li + li {
  margin-top: 0.5rem;
}

.qf-error-summary__list a {
  color: var(--qf-error);
  font-weight: 700;
}

.qf-error-summary__list a:focus {
  outline: 3px solid transparent;
  background: var(--qf-focus);
  box-shadow: 0 4px var(--qf-text);
  color: var(--qf-text);
  text-decoration: none;
}

/* Radios and checkboxes: large targets, the label is clickable. */
.qf-radios__item,
.qf-checkboxes__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.qf-radios__input,
.qf-checkboxes__input {
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  flex: none;
  accent-color: var(--qf-text);
}

.qf-radios__input:focus,
.qf-checkboxes__input:focus {
  outline: 3px solid var(--qf-focus);
  outline-offset: 2px;
}

.qf-radios__label,
.qf-checkboxes__label {
  cursor: pointer;
}

/* Search fields: the suggestion list opens under the input. */
.qf-search {
  position: relative;
}

.qf-search__list {
  position: absolute;
  z-index: 10;
  right: 0;
  left: 0;
  max-height: 18rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border: 2px solid var(--qf-border);
  border-top: 0;
  background: var(--qf-background);
  list-style: none;
  box-shadow: 0 4px 8px rgb(0 0 0 / 15%);
}

.qf-search__list[hidden] {
  display: none;
}

.qf-search__option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.qf-search__option + .qf-search__option {
  border-top: 1px solid #e0e0e0;
}

.qf-search__option:hover,
.qf-search__option--active {
  background: #1d70b8;
  color: #fff;
}

.qf-search__status {
  margin: 0.4rem 0 0;
  color: var(--qf-muted);
  font-size: 1rem;
}

.qf-choices-status,
.qf-status {
  color: var(--qf-muted);
}

.qf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 2rem;
}

.qf-button {
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--qf-radius);
  box-shadow: 0 2px 0 #002d18;
  background: var(--qf-primary);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.qf-button:hover {
  background: var(--qf-primary-hover);
}

.qf-button:focus {
  outline: 3px solid transparent;
  background: var(--qf-focus);
  box-shadow: 0 2px 0 var(--qf-text);
  color: var(--qf-text);
}

.qf-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.qf-button--secondary {
  box-shadow: 0 2px 0 #929191;
  background: var(--qf-secondary);
  color: var(--qf-text);
}

.qf-button--secondary:hover {
  background: #dbdad9;
}

.qf-confirmation {
  padding: 2rem;
  background: var(--qf-primary);
  color: #fff;
  text-align: center;
}

.qf-confirmation__title {
  margin: 0 0 1rem;
  font-size: 2rem;
}

.qf-confirmation__reference {
  margin: 0;
  font-size: 1.5rem;
}

.qf-confirmation__reference strong {
  display: block;
}

.qf-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

@media (max-width: 40rem) {
  qf-form {
    font-size: 1rem;
  }

  .qf-page-title {
    font-size: 1.5rem;
  }
}
