/**
 * Shared form styles (library keido_edge/uform) - September 2026 handoffs
 * ("User Edit Form", "Contact Form"): ruled sections with uppercase
 * labels, lightly filled inputs, a black primary button.
 *
 * Used by:
 * - public webform pages (/form/contact): keido_edge_preprocess_page()
 *   wraps the page in .k-uform.k-uform--page, and the webform-section /
 *   webform-confirmation templates print the section heads and the
 *   success state;
 * - the account edit form: keido_user_dashboard's account_form library
 *   depends on this one and adds the password, picture and admin rules.
 *
 * NOT wrapped in @layer: keido_edge's form.css sits in @layer components
 * and app.scss is unlayered, so this file has to be unlayered to win.
 * Every class is prefixed k-uform.
 */

.k-uform {
  --k-uform-ink: #141414;
  --k-uform-muted: #756f62;
  --k-uform-placeholder: #a39d90;
  --k-uform-fill: #fbfaf8;
  --k-uform-border: #ebe8e1;
  --k-uform-red: #c8321e;
  --k-uform-link: #b3391c;
  --k-uform-gutter: 24px;

  max-width: 960px;
  padding: 32px 0 96px;
  font-family: var(--font-ui, "Public Sans", Helvetica, Arial, sans-serif);
  color: var(--k-uform-ink);
  -webkit-font-smoothing: antialiased;
}

/* A standalone form page (webforms): centred, carrying its own gutter. */
.k-uform--page {
  box-sizing: border-box;
  margin: 0 auto;
  padding: 32px var(--k-uform-gutter) 96px;
}

.k-uform a {
  color: var(--k-uform-link);
}
.k-uform a:hover {
  color: var(--k-uform-ink);
}

/* ---- Masthead ------------------------------------------------------ */

.k-uform__masthead {
  padding-bottom: 36px;
  margin-bottom: 40px;
  border-bottom: 2px solid var(--k-uform-ink);
}
.k-uform__title {
  margin: 36px 0 8px;
  font-family: inherit;
  font-size: 44px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--k-uform-ink);
}
.k-uform__subline {
  margin: 0;
  max-width: 620px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--k-uform-muted);
  text-wrap: pretty;
}
.k-uform__subline p {
  margin: 0;
}

/* Breadcrumb in the masthead: 15px, ink links underlined. */
.k-uform__masthead .k-breadcrumb {
  font-size: 15px;
  line-height: 1.4;
  color: var(--k-uform-muted);
}
.k-uform__masthead .k-bc-item:not(:last-child)::after {
  padding: 0 10px;
}
.k-uform__masthead .k-bc-item a {
  color: var(--k-uform-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.k-uform__masthead .k-bc-item [aria-current="page"] {
  color: var(--k-uform-muted);
}

/* ---- Sections ------------------------------------------------------ */

.k-uform__body {
  display: flex;
  flex-direction: column;
  gap: 56px;
}
.k-uform__section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
/* Webform sections are siblings in the form, not in a .k-uform__body. */
.k-uform .webform-section + .webform-section {
  margin-top: 56px;
}
.k-uform__head {
  display: flex;
  align-items: center;
  gap: 20px;
}
.k-uform__eyebrow,
.k-uform__label,
.k-uform .form-item > label:not(.option),
.k-uform fieldset > legend {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--k-uform-muted);
}
.k-uform__eyebrow {
  margin: 0;
  font-family: inherit;
  white-space: nowrap;
}
.k-uform__rule {
  flex: 1;
  height: 1px;
  background: var(--k-uform-ink);
}
.k-uform__required-note {
  font-size: 14px;
  color: var(--k-uform-muted);
  white-space: nowrap;
}
.k-uform__required-note > span,
.k-uform .form-item > label.form-required::after {
  color: var(--k-uform-red);
}

.k-uform__pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px 32px;
}

/* ---- Form items ---------------------------------------------------- */

/* keido_edge's form.css scopes webform rules to the content block; the
   max-width, grid and margin resets here undo them. */
.k-uform form.webform-submission-form {
  display: block;
  max-width: none;
  margin: 0;
  background: none;
}
.k-uform .form-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: none;
  margin: 0;
}
.k-uform .form-item > label {
  display: block;
  margin: 0;
}
.k-uform label.form-required::after {
  content: " *";
  color: var(--k-uform-red);
  background: none;
  width: auto;
  height: auto;
}
/* "(optional)" inside an uppercase label. */
.k-uform .k-uform__optional {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.k-uform .description {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--k-uform-muted);
  text-wrap: pretty;
}
.k-uform .description a {
  text-decoration: underline;
}
/* Webform nests the help in a second div, which form.css sizes by id. */
.k-uform .description > .webform-element-description {
  margin: 0;
  font-size: inherit;
  color: inherit;
}

.k-uform input.form-text,
.k-uform input.form-email,
.k-uform input.form-tel,
.k-uform input.form-date,
.k-uform input.form-time,
.k-uform select.form-select {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  font: inherit;
  font-size: 17px;
  line-height: normal;
  color: var(--k-uform-ink);
  background-color: var(--k-uform-fill);
  border: 1px solid var(--k-uform-border);
  border-radius: 0;
  box-shadow: none;
  outline: none;
  box-sizing: border-box;
}
.k-uform textarea.form-textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  padding: 16px 18px;
  font: inherit;
  font-size: 17px;
  line-height: 1.5;
  color: var(--k-uform-ink);
  background: var(--k-uform-fill);
  border: 1px solid var(--k-uform-border);
  border-radius: 0;
  box-shadow: none;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
}
.k-uform input.form-text:focus,
.k-uform input.form-email:focus,
.k-uform input.form-tel:focus,
.k-uform input.form-date:focus,
.k-uform input.form-time:focus,
.k-uform select.form-select:focus,
.k-uform textarea.form-textarea:focus {
  border-color: var(--k-uform-ink);
  background-color: #fff;
  outline: none;
  box-shadow: none;
}
/* form.css paints a :invalid tel red while typing; validation here runs
   on submit. */
.k-uform input.form-tel:not(:placeholder-shown):invalid:not(.error) {
  border-color: var(--k-uform-border);
  background-color: var(--k-uform-fill);
  box-shadow: none;
}
.k-uform input.form-tel:not(:placeholder-shown):invalid:not(.error):focus {
  border-color: var(--k-uform-ink);
  background-color: #fff;
}
.k-uform input::placeholder,
.k-uform textarea::placeholder {
  color: var(--k-uform-placeholder);
  opacity: 1;
}
.k-uform input:-webkit-autofill {
  -webkit-text-fill-color: var(--k-uform-ink);
  box-shadow: 0 0 0 1000px var(--k-uform-fill) inset;
}

.k-uform select.form-select {
  padding-right: 44px;
  appearance: none;
  -webkit-appearance: none;
  /* 7px chevron, 1.5px strokes, 20px from the right. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.25l5 5 5-5' fill='none' stroke='%23141414' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 12px 8px;
}
/* Muted until an option is picked. */
.k-uform select.form-select:has(> option[value=""]:checked) {
  color: var(--k-uform-muted);
  opacity: 1;
}
.k-uform select.form-select option {
  color: var(--k-uform-ink);
}

/* Checkboxes and radios: black, not Claro blue. */
.k-uform input.form-checkbox,
.k-uform input.form-radio {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--k-uform-ink);
}
.k-uform .form-type-checkbox,
.k-uform .form-type-radio {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}
.k-uform .form-type-checkbox > label.option,
.k-uform .form-type-radio > label.option {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  color: var(--k-uform-ink);
  cursor: pointer;
}
.k-uform .form-disabled > label.option {
  color: var(--k-uform-muted);
  cursor: default;
}

/* A checkbox with help (or an error) under the label: a heading-weight
   label, the help indented to line up with it in column two. */
.k-uform .form-type-checkbox:has(> .description, > .form-item--error-message) {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 6px 14px;
  align-items: start;
}
.k-uform .form-type-checkbox:has(> .description, > .form-item--error-message) > input {
  margin-top: 2px;
}
.k-uform .k-uform__option > label.option {
  font-size: 17px;
  font-weight: 600;
}
.k-uform .form-type-checkbox > .description,
.k-uform .form-type-checkbox > .form-item--error-message {
  grid-column: 2;
}

/* Fieldsets. */
.k-uform fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.k-uform fieldset > legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 14px;
}
.k-uform fieldset > legend + * {
  clear: both;
}
.k-uform .fieldset-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* stable9's radios wrapper carries no class, hence the :has(). */
.k-uform .form-checkboxes,
.k-uform .form-radios,
.k-uform .fieldset-wrapper > div:has(> .form-type-radio) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 32px;
}

/* ---- Errors -------------------------------------------------------- */

/* inline_form_errors prints the message under the input. Where a field
   also has help, the message replaces it ("Select the area…" becomes
   "Choose the option…"), so the help is hidden while the error shows. */
.k-uform input.error,
.k-uform select.error,
.k-uform textarea.error,
.k-uform .form-item--error input.form-text,
.k-uform .form-item--error textarea {
  border-color: var(--k-uform-red);
  background-color: var(--k-uform-fill);
  box-shadow: none;
}
.k-uform input.error:focus,
.k-uform select.error:focus,
.k-uform textarea.error:focus {
  border-color: var(--k-uform-red);
  background-color: #fff;
}
/* form.css rings every input in an errored item; not the checkbox. */
.k-uform .form-item--error input.form-checkbox {
  background: none;
  box-shadow: none;
}
.k-uform .form-item--error-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--k-uform-red);
}
.k-uform .form-item--error-message a {
  color: inherit;
  text-decoration: underline;
}
.k-uform .form-item:has(> .form-item--error-message) > .description {
  display: none;
}

/* ---- Actions ------------------------------------------------------- */

.k-uform__actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 56px 0 0;
  padding-top: 32px;
  border-top: 2px solid var(--k-uform-ink);
}
.k-uform__actions input.form-submit,
.k-uform .k-uform__button {
  display: inline-flex;
  align-items: center;
  height: 52px;
  padding: 0 32px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: var(--k-uform-ink);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-decoration: none;
  transform: none;
  cursor: pointer;
}
.k-uform__actions input.form-submit:hover,
.k-uform__actions input.form-submit:focus-visible,
.k-uform .k-uform__button:hover,
.k-uform .k-uform__button:focus-visible {
  color: #fff;
  background: #333;
}
.k-uform__actions input.form-submit:focus-visible,
.k-uform .k-uform__button:focus-visible {
  outline: 2px solid var(--k-uform-ink);
  outline-offset: 2px;
}
.k-uform__actions-note {
  font-size: 14px;
  color: var(--k-uform-muted);
}
.k-uform .k-uform__link {
  font-size: 15px;
  color: var(--k-uform-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---- Confirmation (webform, inline) -------------------------------- */

.k-uform__sent {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px 0;
}
.k-uform__sent-message {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.k-uform__sent-message > * {
  margin: 0;
}
.k-uform .k-uform__sent-title {
  margin: 0;
  font-family: inherit;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--k-uform-ink);
}
.k-uform__sent-text {
  font-size: 17px;
  line-height: 1.5;
  color: var(--k-uform-muted);
}
.k-uform__sent-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* ---- Narrow -------------------------------------------------------- */

@media (max-width: 520px) {
  .k-uform__pair,
  .k-uform .form-checkboxes,
  .k-uform .form-radios,
  .k-uform .fieldset-wrapper > div:has(> .form-type-radio) {
    grid-template-columns: 1fr;
  }
  .k-uform__title {
    font-size: 34px;
  }
  .k-uform .k-uform__sent-title {
    font-size: 26px;
  }
  .k-uform {
    --k-uform-gutter: 16px;
  }
}
