:root {
  --red: #BF0A30;
  --red-dark: #8B0D1F;
  --red-light: #E01E3C;
  --blue: #0A2E7A;
  --blue-dark: #031A53;
  --gold: #C8982B;
  --gold-light: #F4D06F;
  --white: #FFFFFF;
  --bg: #F4F6FB;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--gray-900);
  line-height: 1.5;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== HERO ===== */
.hero {
  background:
    linear-gradient(rgba(3, 26, 83, 0.88), rgba(3, 26, 83, 0.94)),
    repeating-linear-gradient(45deg, transparent 0 30px, rgba(255,255,255,0.02) 30px 60px);
  color: white;
  padding: 56px 20px 80px;
  text-align: center;
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 8px;
  background: linear-gradient(to right, var(--red) 0%, var(--red) 33%, var(--white) 33%, var(--white) 66%, var(--blue-dark) 66%, var(--blue-dark) 100%);
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
}

.logo {
  height: 280px;
  max-width: 90%;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,0.35));
}

.hero h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  font-weight: 700;
  margin: 20px 0 10px;
  letter-spacing: 0.5px;
}

.hero .subtitle {
  font-size: clamp(1rem, 1.75vw, 1.15rem);
  opacity: 0.92;
  max-width: 580px;
  margin: 0 auto;
}

/* ===== MAIN / FORM ===== */
main {
  max-width: 780px;
  margin: -48px auto 48px;
  padding: 0 20px;
  position: relative;
  z-index: 2;
}

.intake-form {
  background: var(--white);
  border-radius: 16px;
  padding: 36px;
  box-shadow: 0 16px 48px rgba(3, 26, 83, 0.12), 0 2px 8px rgba(0,0,0,0.04);
  border-top: 6px solid var(--red);
}

.form-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-200);
}

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

.form-section h2 {
  color: var(--blue);
  margin: 0 0 20px;
  font-size: 1.375rem;
  font-family: Georgia, serif;
  position: relative;
  padding-left: 18px;
}

.form-section h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 5px;
  background: linear-gradient(to bottom, var(--red) 0%, var(--red) 50%, var(--blue) 50%, var(--blue) 100%);
  border-radius: 2px;
}

.row {
  display: grid;
  gap: 16px;
}

.row.two {
  grid-template-columns: 1fr 1fr;
}

.row.city-state-zip {
  grid-template-columns: 2fr 100px 120px;
}

.field {
  margin-bottom: 16px;
  min-width: 0;
}

.row .field {
  margin-bottom: 0;
}

.row + .row,
.row + .field,
.field + .row {
  margin-top: 16px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-900);
  font-size: 0.9rem;
}

.req {
  color: var(--red);
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3e%3cpath fill='%230A2E7A' d='M6 8 0 0h12z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.field textarea {
  resize: vertical;
  min-height: 96px;
  font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10, 46, 122, 0.15);
}

.field input:user-invalid {
  border-color: var(--red);
}

/* ===== RADIO BUTTONS ===== */
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

@media (max-width: 520px) {
  .radio-group.three { grid-template-columns: 1fr; }
}

/* ===== CONDITIONAL SECTIONS (intent-driven show/hide) ===== */
.form-section[hidden] { display: none; }

.section-note {
  margin: -4px 0 16px;
  padding: 10px 14px;
  background: #F9FBFF;
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--gray-700);
  line-height: 1.5;
}

.radio-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--white);
  transition: all 0.15s ease;
  user-select: none;
}

.radio-btn:hover {
  border-color: var(--blue);
}

.radio-btn input[type="radio"] {
  accent-color: var(--red);
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
}

.radio-btn:has(input:checked) {
  border-color: var(--red);
  background: rgba(224, 30, 60, 0.06);
  color: var(--red-dark);
  box-shadow: 0 0 0 2px rgba(224, 30, 60, 0.08);
}

/* ===== SUBMIT ===== */
.form-submit {
  margin-top: 36px;
}

.privacy-note {
  font-size: 0.875rem;
  color: var(--gray-700);
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #F9FBFF;
  border-radius: 8px;
  border-left: 4px solid var(--blue);
  line-height: 1.55;
}

.privacy-note strong {
  color: var(--blue);
}

.submit-btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--red-light), var(--red-dark));
  color: white;
  border: none;
  padding: 18px 32px;
  font-size: 1.125rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 16px rgba(191, 10, 48, 0.32), inset 0 1px 0 rgba(255,255,255,0.15);
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}

a.submit-btn, a.submit-btn:visited, a.submit-btn:hover {
  color: white;
  text-decoration: none;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(191, 10, 48, 0.42), inset 0 1px 0 rgba(255,255,255,0.15);
}

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

.submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ===== FOOTER ===== */
footer {
  background: var(--blue-dark);
  color: white;
  padding: 40px 20px;
  border-top: 4px solid var(--red);
}

.footer-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.agent {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent strong {
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.agent span {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.agent a {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.15s;
}

.agent a:hover {
  color: var(--gold-light);
}

.motto {
  text-align: right;
}

.motto em {
  display: block;
  font-family: Georgia, serif;
  font-size: 1.25rem;
  color: var(--gold-light);
  font-style: italic;
}

.motto span {
  display: block;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 3px;
  margin-top: 6px;
  text-transform: uppercase;
}

/* ===== OVERLAY ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 26, 83, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: var(--white);
  padding: 40px 56px;
  border-radius: 14px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.overlay-content p {
  margin: 0;
  color: var(--gray-700);
  font-size: 0.95rem;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--red);
  border-right-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}

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

/* ===== MOBILE ===== */
@media (max-width: 720px) {
  .hero { padding: 40px 16px 64px; }
  .logo { height: 220px; }
  .hero h1 { margin: 16px 0 8px; }
  main { margin: -40px auto 32px; padding: 0 14px; }
  .intake-form { padding: 24px 20px; border-radius: 12px; }
  .form-section h2 { font-size: 1.2rem; }
  .row.two { grid-template-columns: 1fr; gap: 0; }
  .row.two .field + .field { margin-top: 16px; }
  .row.city-state-zip { grid-template-columns: 1fr 90px 110px; }
  .footer-inner { flex-direction: column; text-align: center; gap: 18px; }
  .agent { align-items: center; }
  .motto { text-align: center; }
  .overlay-content { padding: 32px 28px; margin: 0 16px; }
}

@media (max-width: 420px) {
  .row.city-state-zip { grid-template-columns: 1fr; gap: 0; }
  .row.city-state-zip .field + .field { margin-top: 16px; }
}

/* ===== HONEYPOT ===== */
.hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ===== DRAFT BANNER ===== */
.draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #FFF7D6;
  border: 1px solid #F5D76E;
  border-left: 4px solid var(--gold);
  color: #5A4A10;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.draft-banner.hidden { display: none; }

.draft-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-small {
  padding: 7px 14px;
  border: 1.5px solid var(--gray-300);
  background: white;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--gray-700);
  transition: all 0.15s;
}

.btn-small:hover { border-color: var(--gray-500); }

.btn-small.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.btn-small.primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

/* ===== OVERLAY STATES ===== */
.overlay-content {
  max-width: 440px;
}

.overlay-state {
  display: none;
}

.overlay[data-state="sending"] .overlay-state[data-state="sending"],
.overlay[data-state="success"] .overlay-state[data-state="success"],
.overlay[data-state="error"]   .overlay-state[data-state="error"] {
  display: block;
}

.overlay-heading {
  margin: 4px 0 10px;
  font-family: Georgia, serif;
  color: var(--blue);
  font-size: 1.6rem;
}

.overlay-text {
  color: var(--gray-700);
  font-size: 0.97rem;
  margin: 0 0 22px;
  line-height: 1.55;
}

.check-icon,
.error-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 700;
  margin: 0 auto 18px;
  color: white;
  animation: pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.check-icon {
  background: linear-gradient(135deg, #1FA855, #0E7B3B);
  box-shadow: 0 8px 20px rgba(14, 123, 59, 0.35);
}

.error-icon {
  background: linear-gradient(135deg, var(--red-light), var(--red-dark));
  box-shadow: 0 8px 20px rgba(191, 10, 48, 0.35);
}

@keyframes pop {
  0%   { transform: scale(0.3); opacity: 0; }
  70%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.auto-redirect-note {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin: 14px 0 0;
}

.text-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--blue);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  padding: 10px;
  text-decoration: underline;
  margin-top: 6px;
}

.text-btn:hover { color: var(--red); }
