/* =============================================
   Grenier Group Intake Form — Brand Stylesheet
   Navy #0d2137 · Gold #c9a84c · White #ffffff
   ============================================= */

:root {
  --navy:        #11253f;
  --navy-mid:    #213d62;
  --navy-light:  #2f5686;
  --gold:        #c8a24a;
  --gold-light:  #dec16d;
  --gold-pale:   #fdf6e3;
  --white:       #ffffff;
  --bg-page:     #eef1f5;
  --bg-form:     #ffffff;
  --bg-field:    #f8fafc;
  --border:      #cdd8e3;
  --border-focus:#c9a84c;
  --text:        #0d2137;
  --text-muted:  #4a6280;
  --text-label:  #1a3a5c;
  --section-bar: #c9a84c;
  --success-bg:  #ecfdf5;
  --success-text:#065f46;
  --success-border:#6ee7b7;
  --error-bg:    #fef2f2;
  --error-text:  #991b1b;
  --error-border:#fca5a5;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Raleway', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg-page);
}

/* ---- Page layout ---- */
.page-wrap {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 0 0 48px;
}

.form-container {
  flex: 0 1 720px;
  max-width: 720px;
  width: 100%;
  margin: 0;
  background: var(--bg-form);
  box-shadow: 0 4px 32px rgba(13, 33, 55, 0.13);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- Header: banner image + branded tagline strip ---- */
.form-header {
  flex-shrink: 0;
  line-height: 0;
  position: relative;
}

.top-banner {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Tagline strip that appears below the banner */
.form-header-bar {
  background: var(--navy);
  padding: 14px 28px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1;
}

.form-header-firm {
  font-family: 'Bitter', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-header-tagline {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  color: var(--gold);
  font-style: italic;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* Fallback header (shown when banner image fails to load) */
.form-header-fallback {
  background: var(--navy);
  padding: 28px 28px 22px;
  text-align: center;
}

.form-header-fallback .logo-name {
  font-family: 'Bitter', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.form-header-fallback .logo-name span {
  color: var(--gold);
}

.form-header-fallback .logo-sub {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  color: var(--gold);
  margin-top: 6px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ---- Form body ---- */
.intake-form {
  padding: 28px 30px 36px;
  flex: 1;
}

/* ---- Section dividers ---- */
.form-section {
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid #e8edf2;
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Level indentation */
.form-section.level-1 { margin-left: 0; }

.form-section.level-2 {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 3px solid var(--gold);
}

.form-section.level-3 {
  margin-left: 26px;
  padding-left: 12px;
  border-left: 2px solid var(--gold-light);
}

.form-section.level-4 {
  margin-left: 38px;
  padding-left: 10px;
  border-left: 2px solid #e8d9a0;
}

.form-section[data-conditional]       { display: none; }
.form-section[data-conditional].visible { display: block; }

/* Section headings */
.form-section h2 {
  font-family: 'Bitter', Georgia, serif;
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-label {
  font-family: 'Bitter', Georgia, serif;
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Form intro text ---- */
.form-intro {
  background: var(--gold-pale);
  border-left: 4px solid var(--gold);
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 0.875rem;
  color: var(--navy-mid);
  line-height: 1.5;
}

/* ---- Fields ---- */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-stack .field {
  margin-bottom: 18px;
}

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

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

.field label {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-label);
  letter-spacing: 0.01em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  background: var(--bg-field);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

/* Custom select arrow */
.field select {
  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 1l5 5 5-5' stroke='%230d2137' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18);
  background: #fff;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a0aec0;
  font-style: italic;
  font-size: 0.9rem;
}

/* ---- Checkboxes ---- */
.checkbox-group,
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.checkbox-label,
.radio-group label {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 14px 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--bg-field);
  transition: border-color 0.15s, background 0.15s;
}

.checkbox-label:has(input:checked),
.radio-group label:has(input:checked) {
  border-color: var(--gold);
  background: var(--gold-pale);
  color: var(--navy);
  font-weight: 600;
}

.checkbox-label input,
.radio-group input {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: var(--navy);
}

/* ---- Corporation / Partnership / Trust blocks ---- */
.corp-sections,
.partnership-sections,
.trust-sections {
  margin-top: 14px;
}

.corp-block {
  background: #f7fafd;
  border: 1.5px solid #d4dde8;
  border-top: 3px solid var(--gold);
  border-radius: 8px;
  padding: 16px 16px 12px;
  margin-bottom: 14px;
}

.corp-block h3 {
  font-family: 'Bitter', Georgia, serif;
  margin: 0 0 12px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.corp-block .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.corp-block .field.full-width {
  grid-column: 1 / -1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.field.full-width {
  grid-column: 1 / -1;
}

/* ---- Spouse / address sub-blocks ---- */
.form-stack.spouse-block,
#spouse-section {
  background: #f2f7fc;
  border: 1.5px solid #c8d8ea;
  border-radius: 8px;
  padding: 16px;
  margin-top: 8px;
}

/* ---- Submit area ---- */
.submit-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  border-top: 2px solid var(--navy);
  padding-top: 24px;
  margin-top: 8px;
}

.submit-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--gold-pale);
  border-radius: 8px;
  border: 1.5px solid var(--gold-light);
}

.submit-loading.visible {
  display: flex;
}

.submit-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #e8d9a0;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: submit-spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes submit-spin {
  to { transform: rotate(360deg); }
}

.submit-loading-text {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

.btn-submit {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--gold);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.35);
  align-self: flex-start;
}

.btn-submit:hover {
  background: var(--gold-light);
  box-shadow: 0 4px 14px rgba(201, 168, 76, 0.45);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-submit.loading {
  display: none;
}

/* ---- Result message ---- */
.result {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 7px;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.result.success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1.5px solid var(--success-border);
}

.result.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1.5px solid var(--error-border);
}

/* ---- Footer strip ---- */
.form-footer {
  background: var(--navy);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.form-footer-text {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
}

.form-footer-address {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  font-size: 0.72rem;
  color: var(--gold);
  opacity: 0.85;
  text-align: right;
}

/* ---- Responsive ---- */
@media (max-width: 740px) {
  .intake-form {
    padding: 20px 18px 28px;
  }

  .form-section.level-2 {
    margin-left: 8px;
    padding-left: 10px;
  }

  .form-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .checkbox-label,
  .radio-group label {
    font-size: 0.85rem;
    padding: 6px 10px 6px 8px;
  }

  .btn-submit {
    align-self: stretch;
    text-align: center;
  }
}
