/* Shared Connect2 form styles. */
:root {
  --color-primary: var(--brand-primary, #08709e);
  --color-primary-dark: var(--brand-primary-dark, #065c82);
  --color-accent: var(--brand-accent, #58a2b8);
  --color-error: #b00020;
  --color-text: #1f2933;
  --color-muted: #52606d;
  --color-border: #7f8792;
  --color-border-soft: #d9e2ec;
  --color-bg: #ffffff;
  --color-panel: #f7f9fb;
  --color-footer: var(--brand-footer-bg, #221f1f);
  --focus-ring: 3px solid #fdb913;
  --max-width: 980px;
  --radius: 0.5rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--brand-font-family, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  line-height: 1.5;
}

p {
  margin-block: 0 var(--space-3);
}

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

a {
  color: var(--color-primary-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 1000;
  padding: var(--space-3) var(--space-4);
  color: #000;
  background: #fff;
  border: 2px solid #000;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  border-bottom: 1px solid var(--color-border-soft);
  background: #fff;
}

.header-content {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-5);
}

.header-logo img {
  display: block;
  max-width: min(70vw, 520px);
  max-height: 108px;
  height: auto;
}

.return-button {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  color: #fff;
  background: #2f7d59;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.return-button:hover {
  background: #256848;
}

.hero {
  padding: var(--space-5) var(--space-4);
  color: #fff;
  text-align: center;
  background: var(--color-accent);
}

.hero h1 {
  max-width: var(--max-width);
  margin: 0 auto;
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  line-height: 1.2;
  font-weight: 700;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-5);
}

.language-switcher {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.language-switcher label {
  font-weight: 700;
}

.language-switcher select {
  width: auto;
  min-width: 10rem;
}

.instructions {
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  background: var(--color-panel);
  border-left: 5px solid var(--color-accent);
  border-radius: var(--radius);
}

.instructions h2 {
  margin-top: 0;
}

form {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
}

.form-card {
  padding: var(--space-5);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  overflow: hidden;
  min-width: 0;
}

.section-title {
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-3);
  color: var(--color-primary-dark);
  border-bottom: 2px solid var(--color-border-soft);
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  line-height: 1.2;
  font-weight: 750;
}

.subsection {
  min-width: 0;
  padding: var(--space-4);
  margin: var(--space-5) 0 0;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: var(--color-panel);
  overflow: hidden;
}

.subsection>legend {
  padding: 0 var(--space-2);
  color: var(--color-primary-dark);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.25;
  font-weight: 750;
}

fieldset {
  border: 0;
}

.field {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-width: 0;
}

.field-row {
  display: grid;
  gap: var(--space-5);
  align-items: start;
  margin-bottom: var(--space-4);
  min-width: 0;
}

@media (min-width: 760px) {
  .field-row.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-row.three,
  .address-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

label,
.group-label {
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 700;
}

.field.is-required label::after,
.subsection.is-required legend::after,
fieldset.is-required legend::after,
.group-label.is-required::after {
  content: " *";
  color: var(--color-text);
  font-weight: 800;
}

.hint,
.body-copy {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.98rem;
  line-height: 1.45;
  max-width: 100%;
  overflow-wrap: break-word;
}

.required {
  color: var(--color-error);
  font-weight: 800;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 0.75rem;
  color: var(--color-text);
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  line-height: 1.35;
}

select {
  -webkit-appearance: menulist;
  appearance: auto;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input::placeholder {
  color: #727a85;
  opacity: 1;
}

.choice-group {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: #fff;
  min-width: 0;
}

.choice-group.columns {
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .choice-group.columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.choice span,
label {
  overflow-wrap: break-word;
}

.conditional-block {
  padding: var(--space-4);
  margin-top: var(--space-4);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: var(--color-panel);
}

[hidden] {
  display: none !important;
}

.error-summary {
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  border: 2px solid var(--color-error);
  border-radius: var(--radius);
  background: #fff5f7;
}

.error-summary h2 {
  margin-top: 0;
  color: var(--color-error);
  font-size: 1.25rem;
}

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

.field-error {
  margin: 0.35rem 0 0;
  color: var(--color-error, #b42318);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
}

.has-error input,
.has-error select,
.has-error textarea,
.has-error .choice-group {
  border-color: var(--color-error);
  border-width: 2px;
}

.warning {
  padding: var(--space-5);
  margin-top: var(--space-4);
  color: #4f2d00;
  border: 2px solid #b7791f;
  border-radius: var(--radius);
  background: #fff8e6;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4) 0;
}

.submit-button {
  min-width: 13rem;
  padding: 0.85rem 1.25rem;
  color: #fff;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.submit-button:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.submit-button:disabled {
  color: #f2f2f2;
  background: #66707a;
  border-color: #66707a;
  cursor: not-allowed;
}

#submit-status {
  margin: 0;
  color: var(--color-muted);
}

.site-footer {
  margin-top: var(--space-6);
  padding: var(--space-6) var(--space-5);
  color: #fff;
  background: var(--color-footer);
}

.footer-content {
  display: flex;
  gap: var(--space-5);
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-title,
.footer-help {
  margin: 0 0 var(--space-2);
  font-size: 1.35rem;
  font-weight: 650;
}

.footer-title {
  color: var(--color-accent);
}

.footer-help,
.footer-phone-link {
  color: #fdb913;
}

.footer-subtext,
.footer-copyright {
  margin: 0;
  color: #ddd;
  font-size: 0.95rem;
}

.footer-subtext a {
  color: #8fd3e6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0 0 0 0);
}

@media (max-width: 720px) {
  .page {
    padding: var(--space-4);
  }

  .header-content,
  .footer-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .return-button {
    white-space: normal;
  }

  .form-card {
    padding: var(--space-4);
  }

  .subsection {
    padding: var(--space-4);
  }
}


/* Final spacing adjustments */
.form-card+.form-card {
  margin-top: var(--space-5);
}

.conditional-block .field-row {
  row-gap: 2rem;
}

.consent-options {
  margin-top: 1.25rem;
}

.conditional-input {
  margin-top: 1rem;
}

.notes-section {
  margin-top: 2rem;
}

.notes-section .hint {
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.choice-group {
  row-gap: 0.85rem;
}

.choice-group.columns {
  row-gap: 1rem;
  column-gap: 1.5rem;
}

.subsection+.subsection {
  margin-top: 2rem;
}

.field-row+.subsection,
.subsection+.field-row,
.subsection+.field {
  margin-top: 1.5rem;
}

/* More consistent select rendering across Safari/Chrome/Edge */
select {
  min-height: 3rem;
  padding-right: 2.5rem;
  line-height: 1.35;
}

/* Keep native browser select affordance for accessibility and platform familiarity. */
@supports (-webkit-touch-callout: none) {
  select {
    min-height: 3.1rem;
  }
}

@media (max-width: 720px) {
  .conditional-block .field-row {
    row-gap: 1.25rem;
  }

  .subsection+.subsection {
    margin-top: 1.5rem;
  }
}


/* Alignment refinements for longer Spanish labels */
.field-hint-below {
  margin-top: 0.25rem;
}

.contact-permissions .field-row.two {
  align-items: stretch;
}

.contact-permissions .group-label {
  display: block;
  min-height: 3.25rem;
  line-height: 1.35;
}

.contact-permissions .choice-group {
  min-height: 7.4rem;
  align-content: center;
}

/* Keep the required marker with the label and prevent it from appearing alone. */
.required {
  white-space: nowrap;
  display: inline-block;
}

/* For long bilingual checkbox lists, use columns so wrapped labels do not create
   large blank spaces across the opposite column. */
.choice-group.columns {
  display: block;
  column-count: 2;
  column-gap: 2rem;
}

.choice-group.columns .choice {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 0.95rem;
}

.choice-group.columns .choice:last-child {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .contact-permissions .field-row.two {
    grid-template-columns: 1fr;
  }

  .contact-permissions .group-label,
  .contact-permissions .choice-group {
    min-height: 0;
  }

  .choice-group.columns {
    column-count: 1;
  }
}


/* Standardized field guidance + validation layout */

.field {
  display: flex;
  flex-direction: column;
}

.field label,
.field legend {
  margin-bottom: 0.5rem;
}

.field .hint,
.hint {
  margin: 0.35rem 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
}

.field .hint {
  order: 3;
}

rm .field .field-error,
.field-error {
  margin: 0.35rem 0 0;
  color: var(--color-error, #b42318);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
}

.field>input,
.field>select,
.field>textarea {
  order: 2;
}

/* Placeholder styling reserved for format examples only */
::placeholder {
  color: #6b7280;
  opacity: 1;
}

/* Ensure helper text wraps cleanly in Spanish */
.field-error {
  margin: 0.35rem 0 0;
  color: var(--color-error, #b42318);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
}

/* Radio/checkbox groups */
.choice-group {
  margin-top: 0.5rem;
}

/* Keep helper text outside inputs for alignment consistency */
.field-hint-below {
  display: block;
}


button,
input,
select,
textarea {
  font-family: inherit;
}


/* Choice controls: radios and checkboxes */
.choice {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
}

.choice input[type="radio"],
.choice input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  margin: 0;
  order: 0;
}

.choice span {
  flex: 1 1 auto;
  min-width: 0;
  order: 1;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}

.contact-permissions .choice-group {
  align-content: start;
}

.contact-permissions .choice {
  width: auto;
}

/* .contact-permissions .group-label {
  min-height: auto;
} */


/* QA/accessibility hardening */
[hidden] {
  display: none !important;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--color-error);
  border-width: 2px;
}

.error-summary:focus {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.language-switcher:empty {
  display: none;
}


.language-switcher[hidden] {
  display: none !important;
}


/* Shared Return to Top control */
.return-to-top {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 3.25rem;
  min-height: 3.25rem;
  padding: 0.75rem 0.9rem;
  border: 2px solid #ffffff;
  border-radius: 999px;
  color: #ffffff;
  background: var(--brand-primary, var(--color-primary, #08709e));
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.22);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.return-to-top[hidden] {
  display: none !important;
}

.return-to-top:hover {
  background: var(--brand-primary-dark, var(--color-primary-dark, #065c82));
}

.return-to-top:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.return-to-top span[aria-hidden="true"] {
  font-size: 1.25rem;
  line-height: 1;
}

.return-to-top-text {
  font-size: 0.95rem;
}

@media (max-width: 520px) {
  .return-to-top {
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    min-width: 3rem;
    min-height: 3rem;
    padding: 0.7rem;
  }

  .return-to-top-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    clip: rect(0 0 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* Header logo rendering */
.header-logo {
  display: inline-flex;
  align-items: center;
  max-width: min(70vw, var(--brand-logo-max-width, 520px));
}

.header-logo img {
  display: block;
  width: auto;
  max-width: min(70vw, var(--brand-logo-max-width, 520px));
  max-height: var(--brand-logo-max-height, 108px);
  object-fit: contain;
}


/* Shared accessible error pattern. */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-block: 1.15rem;
}

.field>label,
fieldset>legend {
  margin: 0;
  line-height: 1.3;
}

.field-hint {
  margin: -0.1rem 0 0.15rem;
}

.field input,
.field select,
.field textarea {
  margin-top: 0;
}

.field-error {
  margin: 0.25rem 0 0;
  color: var(--color-error, #b42318);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
}

.field-error[hidden] {
  display: none;
}

.has-error input,
.has-error select,
.has-error textarea,
.has-error .choice-group {
  border-color: var(--color-error, #b42318);
}

[aria-invalid="true"] {
  border-color: var(--color-error, #b42318) !important;
  outline: 2px solid transparent;
}

.field-row {
  align-items: start;
}

/* End shared accessible error pattern. */
