/* ---------------------------------------------------------------
   Contact Form — BEM-style optional stylesheet
   All classes are namespaced under `.cf-form` to avoid collisions
   with the host site. Override or replace as needed.
   --------------------------------------------------------------- */

.cf-form {
  --cf-color-text: #1a1a1a;
  --cf-color-muted: #6b7280;
  --cf-color-border: #d1d5db;
  --cf-color-border-focus: #2563eb;
  --cf-color-bg: #ffffff;
  --cf-color-error: #dc2626;
  --cf-color-success: #059669;
  --cf-color-primary: #2563eb;
  --cf-color-primary-hover: #1d4ed8;
  --cf-radius: 6px;
  --cf-gap: 16px;
  --cf-font: inherit;

  font-family: var(--cf-font);
  color: var(--cf-color-text);
  display: block;
  width: 100%;
  max-width: 100%;
  position: relative;
}

.cf-form__fields {
  display: flex;
  flex-direction: column;
  gap: var(--cf-gap);
}

.cf-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cf-form__field--checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.cf-form__label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.cf-form__required {
  color: var(--cf-color-error);
  margin-left: 2px;
}

.cf-form__input {
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--cf-color-text);
  background: var(--cf-color-bg);
  border: 1px solid var(--cf-color-border);
  border-radius: var(--cf-radius);
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.cf-form__input:focus {
  outline: none;
  border-color: var(--cf-color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.cf-form__input--textarea {
  resize: vertical;
  min-height: 120px;
}

.cf-form__input--select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.cf-form__radios {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cf-form__radio,
.cf-form__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.cf-form__error {
  color: var(--cf-color-error);
  font-size: 13px;
  line-height: 1.4;
  min-height: 0;
}
.cf-form__error:empty {
  display: none;
}

.cf-form__field--invalid .cf-form__input {
  border-color: var(--cf-color-error);
}
.cf-form__field--invalid .cf-form__input:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .15);
}

.cf-form__turnstile {
  margin-top: var(--cf-gap);
  display: flex;
}

.cf-form__actions {
  margin-top: var(--cf-gap);
}

.cf-form__submit {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--cf-color-primary);
  border: 0;
  border-radius: var(--cf-radius);
  padding: 11px 22px;
  cursor: pointer;
  transition: background-color .15s ease, opacity .15s ease;
}
.cf-form__submit:hover:not(:disabled) {
  background: var(--cf-color-primary-hover);
}
.cf-form__submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.cf-form__status {
  margin-top: var(--cf-gap);
  font-size: 14px;
  line-height: 1.5;
}
.cf-form__status--success {
  color: var(--cf-color-success);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--cf-radius);
  padding: 12px 14px;
}
.cf-form__status--error {
  color: var(--cf-color-error);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--cf-radius);
  padding: 12px 14px;
}

/* Standalone page wrapper (only used when form.php is loaded directly) */
.cf-form-page {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
.cf-form-page h1 {
  margin: 0 0 24px;
  font-size: 28px;
}

@media (prefers-color-scheme: dark) {
  .cf-form {
    --cf-color-text: #f3f4f6;
    --cf-color-muted: #9ca3af;
    --cf-color-border: #374151;
    --cf-color-bg: #1f2937;
  }
  .cf-form__status--success {
    background: rgba(16, 185, 129, .1);
    border-color: rgba(16, 185, 129, .3);
  }
  .cf-form__status--error {
    background: rgba(220, 38, 38, .1);
    border-color: rgba(220, 38, 38, .3);
  }
}
