/* ─────────────────────────────────────────────────────────────────────────
   TrusteeFriend Intake Form — Design Tokens + Styles
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Color palette */
  --gold:        #c9a85e;
  --gold-deep:   #a68745;
  --gold-soft:   #e8d9b4;
  --ink:         #1a1a1a;
  --ink-soft:    #4a4a4a;
  --ink-muted:   #7a7a7a;
  --paper:       #fafaf7;
  --paper-deep:  #f0ede4;
  --card:        #ffffff;
  --rule:        #e8e6df;
  --rule-soft:   #f3f1ea;
  --danger:      #b91c1c;
  --danger-soft: #fef2f2;
  --shadow-sm:   0 1px 3px rgba(26, 26, 26, 0.05);
  --shadow-md:   0 4px 20px rgba(26, 26, 26, 0.06);
  --shadow-lg:   0 25px 50px -12px rgba(26, 26, 26, 0.18);

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background-color: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}
.brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-tag {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Layout */
.form-container {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-4);
}
.form-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--rule);
  padding: var(--space-7) var(--space-7) var(--space-5);
}
@media (max-width: 640px) {
  .form-card { padding: var(--space-5); }
  .form-container { padding: var(--space-5) var(--space-3); }
}

/* Progress bar */
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}
.step-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.step-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-deep);
}
.progress-track {
  height: 4px;
  background: var(--rule-soft);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-deep) 100%);
  border-radius: 2px;
  width: 12%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Warnings */
.warning-banner {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: var(--space-4);
  border-radius: 8px;
  margin-bottom: var(--space-5);
  font-size: 14px;
}

/* Steps */
.step {
  display: none;
  animation: stepIn 0.35s ease;
}
.step.active {
  display: block;
}
@keyframes stepIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.step-heading {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 var(--space-3);
  color: var(--ink);
}
.step-intro {
  color: var(--ink-soft);
  margin-bottom: var(--space-6);
  font-size: 15px;
  line-height: 1.65;
}

/* Field groups */
.field-group {
  margin-bottom: var(--space-5);
}
.field-group:last-child { margin-bottom: 0; }
.field-group label.field-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: var(--space-2);
  color: var(--ink);
}
.field-group .field-hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: var(--space-2);
  line-height: 1.5;
}

/* Inputs */
.field-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input:hover { border-color: var(--ink-muted); }
.field-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 94, 0.15);
}
.field-input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}
textarea.field-input {
  min-height: 100px;
  resize: vertical;
  font-family: var(--font-body);
}
select.field-input {
  appearance: none;
  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 fill='%237a7a7a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Radio / checkbox */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.radio-row {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 15px;
}
.radio-row:hover {
  border-color: var(--gold);
  background: var(--rule-soft);
}
.radio-row input[type="radio"],
.radio-row input[type="checkbox"] {
  margin: 0 var(--space-3) 0 0;
  accent-color: var(--gold-deep);
  width: 18px;
  height: 18px;
}
.radio-row input[type="radio"]:checked ~ * { color: var(--ink); }
.radio-row:has(input:checked) {
  border-color: var(--gold);
  background: rgba(201, 168, 94, 0.06);
}

/* Repeating sections (children, assets, bequests) */
.repeater-block {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  background: var(--rule-soft);
}
.repeater-block legend,
.repeater-block .repeater-label {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--gold-deep);
  margin-bottom: var(--space-3);
  padding: 0;
}

/* Navigation */
.form-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--rule);
}
.btn {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: -0.005em;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover:not(:disabled) {
  background: var(--gold-deep);
}
.btn-secondary {
  background: var(--card);
  color: var(--ink);
  border-color: var(--rule);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--ink);
}

/* Footer */
.page-footer {
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
  padding: var(--space-6) var(--space-4);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  background: var(--card);
  padding: var(--space-7) var(--space-7) var(--space-6);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 28rem;
  width: calc(100% - 2rem);
  transform: scale(0.95) translateY(8px);
  transition: transform 0.25s ease;
}
.modal-overlay.visible .modal-card {
  transform: scale(1) translateY(0);
}
.modal-card h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 var(--space-3);
  color: var(--ink);
  letter-spacing: -0.02em;
}
.modal-card p {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}
.error-heading {
  color: var(--danger) !important;
}
.modal-status {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-muted);
  opacity: 0;
  transition: opacity 0.4s ease;
  min-height: 1.5em;
}
.modal-status.visible { opacity: 1; }

/* Spinner */
.spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-5);
  border: 4px solid var(--rule);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Animated dots after "Plan Loading" */
.dots {
  display: inline-block;
  width: 1.5em;
  text-align: left;
}
.dots::after {
  content: '';
  animation: dot-cycle 1.4s steps(4, end) infinite;
}
@keyframes dot-cycle {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}
