/* =========================================================
   Fortéfi relationship vCard — styles
   Palette: deep aubergine ground, champagne accent, ivory text.
   Type:    Fraunces (display) + Inter (body/UI).
   ========================================================= */

:root {
  --plum-900: #160a26;
  --plum-850: #1b0e30;
  --plum-800: #21123c;
  --plum-700: #2c1850;
  --line:        rgba(216, 184, 136, 0.18);
  --line-strong: rgba(216, 184, 136, 0.34);
  --champagne:        #d8b888;
  --champagne-bright: #ecd3a6;
  --ivory:  #f3eee4;
  --muted:  #b1a4c8;
  --danger: #e0857f;

  --r-card: 18px;
  --r-field: 10px;
  --maxw: 560px;

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

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 85% -10%, rgba(108, 58, 168, 0.22), transparent 60%),
    radial-gradient(90% 70% at -10% 110%, rgba(216, 184, 136, 0.10), transparent 55%),
    var(--plum-900);
  color: var(--ivory);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- brand strip ---------- */
.brand {
  width: 100%;
  max-width: var(--maxw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 24px 8px;
}

.brand .wordmark {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ivory);
}

.brand .node-motif { width: 64px; height: 28px; opacity: 0.9; }
.brand .node-motif circle { fill: var(--champagne); }
.brand .node-motif line { stroke: var(--line-strong); stroke-width: 1; }

/* ---------- card ---------- */
.shell {
  width: 100%;
  max-width: var(--maxw);
  padding: 16px 24px 56px;
}

.card {
  position: relative;
  background: linear-gradient(180deg, var(--plum-800), var(--plum-850));
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 34px 30px 30px;
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.8);
  animation: rise 0.6s var(--ease) both;
}

.card .eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--champagne);
  margin: 0 0 14px;
}

.card .name {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.1rem, 7vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.card .role {
  font-size: 1.02rem;
  color: var(--ivory);
  margin: 0;
}

.card .tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 10px 0 0;
  max-width: 42ch;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 26px 0;
  border: 0;
}

/* ---------- contact rows ---------- */
.contact { display: flex; flex-direction: column; gap: 14px; }

.contact a {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ivory);
  text-decoration: none;
  font-size: 0.98rem;
  transition: color 0.18s var(--ease);
}

.contact a:hover { color: var(--champagne-bright); }

.contact .ico {
  flex: 0 0 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--champagne);
}
.contact .ico svg { width: 17px; height: 17px; }

/* ---------- actions ---------- */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border-radius: var(--r-field);
  padding: 13px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease), background 0.18s var(--ease),
              border-color 0.18s var(--ease), opacity 0.18s var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  flex: 1 1 auto;
  background: var(--champagne);
  color: var(--plum-900);
}
.btn-primary:hover { background: var(--champagne-bright); }

.btn-ghost {
  flex: 1 1 auto;
  background: transparent;
  color: var(--ivory);
  border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--champagne); color: var(--champagne-bright); }

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

/* ---------- referral panel ---------- */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 16, 0.72);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}
.panel-backdrop.open { display: flex; }

.panel {
  width: 100%;
  max-width: var(--maxw);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--plum-850);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 26px 24px 32px;
  animation: slideup 0.4s var(--ease) both;
}

@media (min-width: 620px) {
  .panel-backdrop { align-items: center; }
  .panel { border-bottom: 1px solid var(--line); border-radius: 18px; max-height: 88vh; }
}

.panel h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.55rem;
  margin: 0 0 6px;
}
.panel .lede { color: var(--muted); font-size: 0.95rem; margin: 0 0 20px; }

/* honest notice */
.notice {
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 0;
  margin: 0 0 22px;
  overflow: hidden;
}
.notice summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--champagne);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notice summary::-webkit-details-marker { display: none; }
.notice summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.notice[open] summary::after { content: "–"; }
.notice .notice-body {
  padding: 0 16px 16px;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.6;
}
.notice .notice-body p { margin: 0 0 10px; }
.notice .notice-body p:last-child { margin-bottom: 0; }

/* fields */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ivory);
  background: var(--plum-800);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 11px 13px;
  transition: border-color 0.16s var(--ease);
}
.field input::placeholder,
.field textarea::placeholder { color: rgba(177, 164, 200, 0.5); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--champagne);
}
.field textarea { resize: vertical; min-height: 56px; }

.subhead {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--champagne);
  margin: 26px 0 4px;
}
.subhead-hint { font-size: 0.82rem; color: var(--muted); margin: 0 0 14px; }

/* referral row card */
.ref-row {
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 16px 16px 6px;
  margin-bottom: 14px;
  position: relative;
  background: rgba(255, 255, 255, 0.012);
}
.ref-row .ref-index {
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.85rem;
  color: var(--champagne);
  margin-bottom: 10px;
}
.ref-row .remove {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
  transition: color 0.16s var(--ease);
}
.ref-row .remove:hover { color: var(--danger); }
.ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ref-grid .full { grid-column: 1 / -1; }
@media (max-width: 480px) { .ref-grid { grid-template-columns: 1fr; } }

.add-ref {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--champagne);
  border-radius: var(--r-field);
  padding: 12px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.add-ref:hover { border-color: var(--champagne); color: var(--champagne-bright); }
.add-ref:disabled { opacity: 0.4; cursor: not-allowed; }

/* consent */
.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 24px 0 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-field);
}
.consent input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--champagne);
}
.consent label { font-size: 0.88rem; color: var(--ivory); line-height: 1.55; }

/* form messages */
.form-msg { font-size: 0.88rem; margin: 0 0 14px; min-height: 1.2em; }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--champagne-bright); }

.panel-actions { display: flex; gap: 12px; }
.panel-actions .btn { flex: 1 1 auto; }

/* success state */
.done { text-align: center; padding: 18px 4px; }
.done .check {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border: 1px solid var(--champagne);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--champagne);
}
.done h2 { margin-bottom: 8px; }
.done p { color: var(--muted); margin: 0 0 22px; }

/* ---------- footer ---------- */
.foot {
  width: 100%;
  max-width: var(--maxw);
  padding: 0 24px 36px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.foot a { color: var(--champagne); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- source buttons (step 1) ---------- */
.sources { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }

.source-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ivory);
  background: var(--plum-800);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 15px 16px;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.source-btn:hover { border-color: var(--champagne); background: var(--plum-700); }

.source-ico {
  flex: 0 0 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--champagne);
}
.source-ico svg { width: 19px; height: 19px; }

.source-text { display: flex; flex-direction: column; gap: 2px; }
.source-title { font-weight: 600; font-size: 0.95rem; }
.source-sub { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }

/* ---------- pick list (step 2) ---------- */
.pick-count {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--champagne);
  margin: 4px 0 10px;
}

.pick-list {
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 18px;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.14s var(--ease);
}
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: rgba(255, 255, 255, 0.03); }
.pick-item.selected { background: rgba(216, 184, 136, 0.08); }

.pick-item input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--champagne);
}

.pick-meta { display: flex; flex-direction: column; min-width: 0; }
.pick-name { font-size: 0.93rem; font-weight: 500; }
.pick-sub {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pick-empty { padding: 16px; color: var(--muted); font-size: 0.9rem; margin: 0; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slideup { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }

:focus-visible { outline: 2px solid var(--champagne); outline-offset: 2px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
