/* ─── Encapsoul Family Intake — Mobile-First CSS ──────────────────────────── */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:     #1a1a1a;
  --cream:   #f5f0e8;
  --gold:    #c9a84c;
  --gold-dk: #a8893c;
  --white:   #ffffff;
  --muted:   #6b6560;
  --border:  #d9d3c8;
  --error:   #b33a3a;
  --success: #2e7d45;
  --radius:  10px;
  --trans:   0.25s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
}

/* ── Layout ── */
.page-wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.site-header {
  padding: 24px 20px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-transform: uppercase;
}

.brand span {
  color: var(--gold);
}

/* ── Hero ── */
.hero {
  background: var(--ink);
  color: var(--cream);
  padding: 36px 24px 32px;
  text-align: center;
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.hero-headline {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--cream);
}

.hero-sub {
  font-size: 15px;
  color: #c2bcb5;
  line-height: 1.55;
  max-width: 340px;
  margin: 0 auto 24px;
}

.hero-cta {
  display: inline-block;
  background: var(--gold);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: var(--radius);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: background var(--trans), transform var(--trans);
  cursor: pointer;
  border: none;
}

.hero-cta:hover { background: var(--gold-dk); transform: translateY(-1px); }

/* ── Progress Steps ── */
.progress-bar {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  z-index: 1;
}

.step-node::before {
  content: '';
  position: absolute;
  top: 16px;
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--border);
  z-index: -1;
}

.step-node:first-child::before { display: none; }

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  transition: background var(--trans), color var(--trans);
  font-family: sans-serif;
  position: relative;
  z-index: 2;
}

.step-label {
  font-size: 11px;
  color: var(--muted);
  font-family: sans-serif;
  letter-spacing: 0.02em;
  transition: color var(--trans);
}

.step-node.active .step-circle {
  background: var(--gold);
  color: var(--ink);
}

.step-node.active .step-label { color: var(--ink); font-weight: 600; }

.step-node.done .step-circle {
  background: var(--ink);
  color: var(--cream);
}

.step-node.done .step-circle::after {
  content: '✓';
  font-size: 14px;
}

.step-node.done .step-circle span { display: none; }
.step-node.done .step-label { color: var(--ink); }

/* ── Form Wrapper ── */
.form-outer {
  flex: 1;
  padding: 24px 20px 40px;
}

/* ── Step Panels ── */
.step-panel {
  display: none;
  animation: fadeInUp 0.3s ease forwards;
}

.step-panel.active { display: block; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Form Elements ── */
.step-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}

.step-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
  font-family: sans-serif;
}

.field-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
  font-family: sans-serif;
  letter-spacing: 0.01em;
}

label .req { color: var(--gold-dk); margin-left: 2px; }

input[type=text],
input[type=email],
input[type=tel],
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font-size: 16px; /* prevents iOS zoom */
  font-family: sans-serif;
  transition: border-color var(--trans), box-shadow var(--trans);
  -webkit-appearance: none;
  appearance: none;
}

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

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='%231a1a1a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  font-family: sans-serif;
}

/* Side-by-side field layout (DOB/DOD) */
.field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.field-row .field-half {
  flex: 1;
  margin-bottom: 0;
}

input[type=date] {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  font-family: sans-serif;
  transition: border-color var(--trans), box-shadow var(--trans);
  -webkit-appearance: none;
  appearance: none;
}

input[type=date]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.18);
}

.field-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 5px;
  font-family: sans-serif;
  display: none;
}

.field-error.show { display: block; }

input.invalid, select.invalid { border-color: var(--error); }
input.invalid:focus, select.invalid:focus {
  box-shadow: 0 0 0 3px rgba(179,58,58,0.15);
}

/* ── Shake animation for errors ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-6px); }
  30%       { transform: translateX(6px); }
  45%       { transform: translateX(-5px); }
  60%       { transform: translateX(5px); }
  75%       { transform: translateX(-3px); }
  90%       { transform: translateX(3px); }
}

.shake { animation: shake 0.45s ease; }

/* ── Step 2 — Contributors ── */
.contrib-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  font-family: sans-serif;
}

.toggle-btn {
  flex: 1;
  padding: 12px 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--white);
  color: var(--muted);
  border: none;
  transition: background var(--trans), color var(--trans);
}

.toggle-btn.active {
  background: var(--ink);
  color: var(--cream);
}

.contrib-pane { display: none; }
.contrib-pane.active { display: block; }

/* CSV Upload */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--trans), background var(--trans);
  position: relative;
  background: var(--white);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--gold);
  background: #fdf9f1;
}

.upload-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon { font-size: 32px; margin-bottom: 10px; }

.upload-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  font-family: sans-serif;
  margin-bottom: 4px;
}

.upload-sub {
  font-size: 13px;
  color: var(--muted);
  font-family: sans-serif;
}

.upload-sub a {
  color: var(--gold-dk);
  text-decoration: underline;
  cursor: pointer;
}

.csv-preview {
  margin-top: 16px;
  display: none;
}

.csv-preview.show { display: block; }

.csv-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--cream);
  font-size: 13px;
  font-family: sans-serif;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
  font-weight: 600;
}

.csv-count-badge.warn {
  background: #7a5a00;
}

.csv-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: sans-serif;
}

.csv-preview-table th {
  background: #f0ebe2;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  font-size: 11px;
  text-transform: uppercase;
}

.csv-preview-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  color: var(--ink);
}

.csv-preview-table tr:nth-child(even) td { background: #faf7f2; }

/* Manual entry rows */
.manual-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
  align-items: start;
}

.manual-row .full-col { grid-column: 1 / -1; }

.manual-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.row-num {
  font-size: 12px;
  color: var(--muted);
  font-family: sans-serif;
  font-weight: 600;
}

.remove-row {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--trans);
  line-height: 1;
}

.remove-row:hover { color: var(--error); }

.add-row-btn {
  width: 100%;
  padding: 12px;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  color: var(--gold-dk);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  font-family: sans-serif;
  transition: border-color var(--trans), background var(--trans);
}

.add-row-btn:hover { border-color: var(--gold); background: #fdf9f1; }

.manual-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-family: sans-serif;
  padding: 6px 14px;
  border-radius: 20px;
  margin-top: 12px;
  font-weight: 600;
  background: var(--ink);
  color: var(--cream);
}

.manual-count-badge.warn { background: #7a5a00; }

/* Warn message */
.warn-msg {
  background: #fff8e1;
  border: 1px solid #e6c84c;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #6b4f00;
  font-family: sans-serif;
  margin-top: 12px;
  display: none;
}

.warn-msg.show { display: block; }

/* ── Step 3 — Summary & Pay ── */
.summary-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.summary-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.summary-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.summary-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: sans-serif;
  margin-bottom: 8px;
}

.summary-value {
  font-size: 16px;
  color: var(--ink);
  font-family: sans-serif;
}

.summary-value strong { font-weight: 700; }

.price-block {
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.price-amount {
  font-size: 42px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 4px;
}

.price-label {
  font-size: 14px;
  color: #c2bcb5;
  font-family: sans-serif;
}

.price-detail {
  font-size: 13px;
  color: #a09891;
  font-family: sans-serif;
  margin-top: 8px;
}

.guarantee-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0f9f0;
  border: 1px solid #b5d9b5;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
}

.guarantee-icon { font-size: 20px; flex-shrink: 0; }

.guarantee-text {
  font-size: 13px;
  color: #2e5c2e;
  font-family: sans-serif;
  line-height: 1.4;
}

.tos-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  cursor: pointer;
}

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

.tos-check-label {
  font-size: 13px;
  color: var(--muted);
  font-family: sans-serif;
  line-height: 1.4;
  cursor: pointer;
}

.tos-check-label a { color: var(--gold-dk); }

/* ── Buttons ── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px 24px;
  background: var(--gold);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.04em;
  font-family: sans-serif;
  transition: background var(--trans), transform var(--trans), opacity var(--trans);
  text-align: center;
}

.btn-primary:hover:not(:disabled) { background: var(--gold-dk); transform: translateY(-1px); }

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.loading {
  opacity: 0.7;
  cursor: wait;
  position: relative;
}

.btn-primary.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(26,26,26,0.3);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

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

.btn-secondary {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--muted);
  padding: 13px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-family: sans-serif;
  cursor: pointer;
  transition: border-color var(--trans), color var(--trans);
  width: 100%;
  margin-bottom: 12px;
}

.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }

.nav-row {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.nav-row .btn-secondary { flex: 0 0 auto; width: auto; padding: 13px 22px; }
.nav-row .btn-primary   { flex: 1; }

/* ── Error banner ── */
.api-error {
  background: #fff0f0;
  border: 1px solid #f0b0b0;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--error);
  font-family: sans-serif;
  margin-bottom: 16px;
  display: none;
}

.api-error.show { display: block; }

/* ── Footer ── */
.site-footer {
  background: var(--ink);
  color: #a09891;
  text-align: center;
  padding: 20px;
  font-size: 12px;
  font-family: sans-serif;
  line-height: 1.8;
}

.site-footer a { color: #c2bcb5; text-decoration: underline; }

/* ── Responsive ── */
@media (min-width: 480px) {
  .hero-headline { font-size: 32px; }
  .form-outer { padding: 32px 28px 48px; }
}

@media (min-width: 640px) {
  .page-wrap { box-shadow: 0 4px 40px rgba(0,0,0,0.12); }
  body { background: #e8e3db; }
}
