/* Form Styles */

/* Form Styles */


.form-grid-block {
  display: grid;
  grid-template-columns: 1fr;
  /* Force single column */
  max-width: 600px;
  /* Constrain width for readability */
  margin: 0 auto;
  /* Center horizontally */
  gap: 12px;
}

/* Ensure headers inside the single column look good */
/* Ensure headers inside the single column look good */
.form-grid-block .grid__head {
  margin-bottom: 16px;
  /* Reduced from 24px */
}

.form-grid-block .h2 {
  font-size: clamp(24px, 2.5vw, 28px);
  /* Reduced scaling (was 3.5vw, max 32px) */
}

/* Horizontal rule divider between form sections */
.section-divider {
  border: 0;
  border-top: 1px solid var(--hairline-light);
  margin: clamp(32px, 3vw, 40px) auto;
  /* Tighter max margin */
  /* Center vertically and horizontally */
  max-width: 600px;
  /* Match form width */
}

.section--dark .section-divider {
  border-top-color: var(--hairline-dark);
}

/* Form fields spacing */
.form-field {
  margin-bottom: clamp(20px, 2.5vw, 24px);
  /* Tightened significantly */
}

.form-field:last-child {
  margin-bottom: 0;
}

.form-field--textarea .form-label {
  margin-bottom: 12px;
}


.form-hero {
  padding-top: 24px;
  padding-bottom: 24px;
  /* Fixed small padding to pull basic info up */
}

/* Override global section padding for the form container */
#application-form {
  padding-top: 24px;
  /* Matches hero bottom padding for even gap */
  padding-bottom: clamp(60px, 8vw, 100px);
}

.form-hero .form-grid-block {
  padding-top: 0;
  /* Removed manual push, using flow instead */
}

.form-hero .h1 img {
  height: clamp(105px, 12vw, 140px) !important;
}

.form-hero .prose .hero-lede {
  margin-top: 24px;
  /* Gap 2: Match gap between arrow and logo */
  font-size: clamp(20px, 1.5vw, 24px);
  /* Split the difference */
}

.back-link {
  position: relative;
  /* Changed from absolute to flow */
  margin-bottom: 24px;
  /* Gap 1: Space between arrow and logo */
  color: var(--fg);
  opacity: 0.6;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* Align arrow to left */
  width: 48px;
  height: 48px;
}

.back-link:hover {
  opacity: 1;
}

#application-form .form-section:first-child {
  margin-top: clamp(24px, 4vw, 40px);
}


.form-badge {
  display: inline-block;
  margin: 4px 0 10px 0;
  padding: 4px 10px;
  border: 1px solid var(--hairline-light);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--mono);
  color: var(--muted-light);
}

.form-file-status {
  margin: 6px 0 0 0;
  font-size: clamp(16px, 1.15vw, 18px);
  color: var(--muted-light);
  font-family: var(--mono);
}

.form-label {
  display: block;
  font-size: clamp(19px, 1.35vw, 24px);
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 12px;
  font-weight: 500;
}

.section--dark .form-label {
  color: var(--fg);
}

.required {
  color: var(--accent);
}

.form-input,
.form-textarea,
select.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: clamp(19px, 1.35vw, 24px);
  line-height: 1.55;
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--hairline-light);
  border-radius: 4px;
  transition: border-color 0.2s ease-out;
}

.section--dark .form-input,
.section--dark .form-textarea,
.section--dark select.form-input {
  background: rgba(244, 245, 246, 0.05);
  color: var(--fg);
  border-color: var(--hairline-dark);
}

.form-input:focus,
.form-textarea:focus,
select.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input[type="file"] {
  padding: 8px;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 160px;
}

.form-helper {
  margin-top: 6px;
  font-size: clamp(16px, 1.15vw, 18px);
  color: var(--muted-light);
  line-height: 1.5;
}

.section--dark .form-helper {
  color: var(--muted-dark);
}

.form-error {
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: clamp(15px, 1.1vw, 17px);
  color: #ff4444;
  font-weight: 600;
}

.form-radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.form-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: clamp(19px, 1.35vw, 24px);
  line-height: 1.55;
  color: var(--ink);
}

.section--dark .form-radio {
  color: var(--fg);
}

.form-radio input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  font-size: clamp(19px, 1.35vw, 24px);
  line-height: 1.55;
  color: var(--ink);
}

.form-checkbox span {
  max-width: 620px;
}

.section--dark .form-checkbox {
  color: var(--fg);
}

.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.form-actions {
  margin-top: clamp(40px, 6vw, 60px);
  text-align: left;
}

.form-final {
  margin-top: clamp(24px, 4vw, 40px);
  padding-top: clamp(20px, 3vw, 32px);
  border-top: 1px solid var(--hairline-light);
}

.form-submit {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: clamp(20px, 1.5vw, 26px);
  font-weight: 760;
  letter-spacing: -0.01em;
  padding: 14px 32px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease-out;
  border-radius: 4px;
}

.section--light .form-submit {
  border-color: color-mix(in oklab, var(--accent), var(--ink) 12%);
  color: color-mix(in oklab, var(--accent), var(--ink) 12%);
}

.form-submit:hover {
  background: color-mix(in oklab, var(--accent), transparent 92%);
  border-color: var(--accent);
}

.form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.success-message {
  margin-top: clamp(40px, 6vw, 60px);
  padding: clamp(24px, 4vw, 40px);
  background: color-mix(in oklab, var(--accent), transparent 95%);
  border: 2px solid var(--accent);
  border-radius: 4px;
}

.success-message .prose p {
  font-size: clamp(22px, 1.6vw, 28px);
  font-weight: 600;
}

.section--dark .success-message {
  background: color-mix(in oklab, var(--accent), transparent 90%);
}

/* Cloudflare Turnstile */
.cf-turnstile {
  margin: 12px 0 22px 0;
}

.form-divider {
  border: 0;
  border-top: 1px solid var(--hairline-light);
  margin: clamp(20px, 3vw, 28px) 0;
}

/* File input styling improvements */
input[type="file"]::file-selector-button {
  background: var(--accent);
  color: var(--fg);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(16px, 1.15vw, 18px);
  margin-right: 12px;
  transition: background 0.2s ease-out;
}

input[type="file"]::file-selector-button:hover {
  background: color-mix(in oklab, var(--accent), black 10%);
}

.section--dark input[type="file"]::file-selector-button {
  background: var(--accent);
  color: var(--bg);
}

/* Select dropdown styling */
select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23009B48' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

@media (max-width: 980px) {
  .form-radio-group {
    gap: 10px;
  }
}

@media (max-width: 720px) {
  .form-hero {
    padding-top: 12px;
    /* Very tight on mobile */
    padding-bottom: 24px;
  }

  /* Tighten header gaps on mobile */
  .back-link {
    margin-bottom: 12px;
  }

  .form-hero .prose .hero-lede {
    margin-top: 12px;
  }

  .form-section {
    margin-bottom: clamp(48px, 10vw, 72px);
  }

  .form-section__title {
    margin: 8px 0 clamp(20px, 6vw, 32px) 0;
  }

  .form-conditional {
    padding: 14px 14px;
  }

  .form-badge {
    display: block;
    width: fit-content;
  }

  .form-checkbox span {
    max-width: 100%;
  }

  .form-actions {
    text-align: left;
  }

  .form-submit {
    width: 100%;
  }
}