/* ==========================================================================
   Signal Matchmaking — Application Form
   Deep charcoal + warm gold, Cormorant Garamond + Switzer
   ========================================================================== */

:root {
  --bg: #111009;
  --bg-alt: #14130c;
  --surface: #1c1a16;
  --surface-raised: #201e18;
  --border: #2e2b24;
  --border-soft: #262319;
  --gold: #c9a05a;
  --gold-bright: #ddb877;
  --gold-dim: rgba(201, 160, 90, 0.35);
  --text-primary: #f3efe6;
  --text-secondary: #b8b2a3;
  --text-muted: #837c6c;
  --error: #d98a6a;
  --success: #9fb08a;

  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Switzer', 'Helvetica Neue', Arial, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient glow background */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(201, 160, 90, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 50% at 100% 100%, rgba(201, 160, 90, 0.05), transparent 60%);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 840px;
  margin: 0 auto;
  padding: 0 24px 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--gold);
}

.brand-mark {
  color: var(--gold);
  flex-shrink: 0;
}

.brand-word {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.header-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

@media (max-width: 600px) {
  .header-tagline { display: none; }
}

/* ---------- Progress ---------- */
.progress-wrap {
  padding: 28px 0 8px;
  position: sticky;
  top: 0;
  background: linear-gradient(var(--bg) 78%, transparent);
  z-index: 5;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.progress-step-label {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-step-name {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--gold-bright);
  font-weight: 500;
}

.progress-track {
  height: 3px;
  background: var(--border-soft);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 14.28%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-bright) 100%);
  border-radius: 3px;
  transition: width 0.5s var(--ease);
}

.progress-names {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.progress-names span {
  transition: color 0.3s var(--ease);
  flex: 1;
  text-align: center;
}
.progress-names span:first-child { text-align: left; }
.progress-names span:last-child { text-align: right; }

.progress-names span.active {
  color: var(--gold-bright);
}
.progress-names span.done {
  color: var(--text-secondary);
}

@media (max-width: 700px) {
  .progress-names { display: none; }
}

/* ---------- Form Stage ---------- */
.form-stage {
  flex: 1;
  position: relative;
  padding-top: 20px;
}

.step {
  display: none;
  animation: stepIn 0.5s var(--ease);
}

.step.active {
  display: block;
}

.step.leaving {
  animation: stepOut 0.28s var(--ease);
}

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

@keyframes stepOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

.step-inner {
  max-width: 640px;
}

.step-inner-wide {
  max-width: 100%;
}

.step-headline {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.12;
  margin: 4px 0 10px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.step-subhead {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 36px;
  max-width: 56ch;
  line-height: 1.6;
}

/* ---------- Fields ---------- */
.field {
  margin-bottom: 26px;
}

.field-row {
  display: flex;
  gap: 20px;
}

.field-row .field {
  flex: 1;
  min-width: 0;
}

.field-narrow {
  flex: 0 0 130px;
}

.range-row {
  align-items: flex-start;
}

.range-sep {
  color: var(--text-muted);
  font-size: 14px;
  padding-top: 12px;
}

@media (max-width: 560px) {
  .field-row {
    flex-direction: column;
    gap: 0;
  }
  .field-narrow {
    flex: 1;
  }
  .range-row {
    flex-direction: row;
    align-items: flex-start;
  }
}

label {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 9px;
  line-height: 1.45;
}

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

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15.5px;
  padding: 13px 15px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
}

textarea.textarea-short {
  min-height: 80px;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--surface-raised);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

input:hover,
textarea:hover,
select:hover {
  border-color: #3c382c;
}

input.invalid,
textarea.invalid,
select.invalid {
  border-color: var(--error);
}

input.invalid:focus,
textarea.invalid:focus,
select.invalid:focus {
  box-shadow: 0 0 0 3px rgba(217, 138, 106, 0.25);
}

.field-error {
  display: none;
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.5;
}

.field-error.visible {
  display: block;
  animation: fadeIn 0.25s var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.field-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

.char-counter {
  text-align: right;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Select styling */
.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

select:invalid,
select option[value=""] {
  color: var(--text-muted);
}

/* File upload */
.file-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.file-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14.5px;
  transition: all 0.2s var(--ease);
  width: 100%;
}

.file-upload-btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: var(--surface-raised);
}

.file-upload-btn svg {
  color: var(--gold);
  flex-shrink: 0;
}

/* ---------- Membership Tier Cards ---------- */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 8px;
}

@media (max-width: 780px) {
  .tier-grid {
    grid-template-columns: 1fr;
  }
}

.tier-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.tier-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.tier-card-inner {
  position: relative;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 24px 26px;
  transition: all 0.25s var(--ease);
  display: flex;
  flex-direction: column;
}

.tier-card:hover .tier-card-inner {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
}

.tier-card input[type="radio"]:checked ~ .tier-card-inner,
.tier-card input[type="radio"]:focus ~ .tier-card-inner {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(201,160,90,0.08), rgba(201,160,90,0.02));
  box-shadow: 0 0 0 1px var(--gold), 0 12px 32px rgba(201,160,90,0.08);
}

.tier-card input[type="radio"]:focus-visible ~ .tier-card-inner {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

.tier-recommended .tier-card-inner {
  border-color: rgba(201,160,90,0.4);
}

.tier-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #1a1509;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
  z-index: 2;
}

.tier-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.tier-price {
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--gold-bright);
  font-weight: 500;
  margin-bottom: 18px;
}

.tier-price span {
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text-muted);
  font-weight: 400;
}

.tier-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  flex: 1;
}

.tier-features li {
  font-size: 14.5px;
  color: var(--text-secondary);
  padding: 8px 0;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 9px;
}

.tier-features li::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

.tier-select-indicator {
  text-align: center;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.25s var(--ease);
}

.tier-card input[type="radio"]:checked ~ .tier-card-inner .tier-select-indicator {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1509;
  font-weight: 700;
}

.tier-card input[type="radio"]:checked ~ .tier-card-inner .tier-select-indicator::after {
  content: ' ✓ Selected';
}

.founding-note {
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  color: var(--gold-bright);
  margin: 28px auto 40px;
  max-width: 60ch;
  line-height: 1.5;
}

.btn-submit {
  display: block;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  background: var(--gold);
  color: #1a1509;
  border: none;
  border-radius: var(--radius-sm);
  padding: 17px 24px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.22s var(--ease);
}

.btn-submit:hover {
  background: var(--gold-bright);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(201,160,90,0.25);
}

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

.submit-note {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 16px 0 0;
}

/* ---------- Nav Controls ---------- */
.form-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(17, 16, 9, 0.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--border-soft);
  max-width: 840px;
  margin: 0 auto;
}

/* Spacer so fixed nav never overlaps step content */
.form-stage {
  padding-bottom: 140px;
}

.btn-back,
.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  padding: 13px 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
}

.btn-back {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-back:hover {
  border-color: var(--gold-dim);
  color: var(--text-primary);
}

.btn-back:disabled,
.btn-back.hidden {
  visibility: hidden;
}

.btn-next {
  background: var(--gold);
  color: #1a1509;
  margin-left: auto;
  font-weight: 700;
}

.btn-next:hover {
  background: var(--gold-bright);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(201,160,90,0.22);
}

.btn-next.hidden {
  display: none;
}

/* ---------- Thank You Screen ---------- */
.thank-you {
  display: none;
  min-height: 60vh;
  align-items: center;
  justify-content: center;
  text-align: center;
  animation: fadeInBig 0.7s var(--ease);
}

.thank-you.visible {
  display: flex;
}

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

.thank-you-inner {
  max-width: 520px;
  padding: 40px 20px;
}

.ty-mark {
  color: var(--gold);
  margin-bottom: 28px;
}

.ty-headline {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.15;
  margin: 0 0 20px;
  color: var(--text-primary);
}

.ty-body {
  font-size: 16.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .app-shell {
    padding: 0 18px 0;
  }
  .step-headline {
    font-size: 30px;
  }
  .step-subhead {
    margin-bottom: 28px;
  }
  .tier-badge {
    top: -12px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
