/* The Velvet Contract — Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Cinzel:wght@400;600&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0f0508;
  --surface: #1a0d13;
  --border: #3a1626;
  --accent: #be1547;
  --accent-hover: #d41a52;
  --text: #f0ebe3;
  --muted: #b89a79;
  --gold: #c4a862;
  --green-bg: #16a34a;
  --green-text: #ffffff;
  --amber-bg: #d97706;
  --amber-text: #ffffff;
  --red-bg: #dc2626;
  --red-text: #ffffff;
  --unrated-bg: #1f1018;
  --unrated-text: #b89a79;
  --radius: 8px;
  --radius-sm: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  font-weight: 600;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
.text-muted { color: var(--muted); }

/* Layout */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 560px; margin: 0 auto; padding: 0 1.5rem; }
.page-main { flex: 1; padding: 2rem 0 4rem; }

/* Nav */
.site-nav {
  background: #090209;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 120px;
  padding-bottom: 12px;
}
.nav-logo {
  font-family: 'Cinzel', 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}
.nav-logo:hover { color: var(--text); text-decoration: none; }
.nav-logo-heart { color: var(--accent); font-size: 0.9rem; margin: 0 0.15em; }
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}
.nav-links a { color: var(--muted); font-size: 0.875rem; letter-spacing: 0.03em; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* Footer */
.site-footer {
  background: #090209;
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  text-align: center;
}
.site-footer .disclaimer {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
  font-family: inherit;
  letter-spacing: 0.02em;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--muted); color: var(--text); text-decoration: none; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-issue { background: var(--accent); border-color: var(--accent); }
.btn-issue:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* Alerts */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert-error { background: #3d1515; border: 1px solid #7a2020; color: #f8d7d7; }
.alert-success { background: #0f2d1a; border: 1px solid #2d6a3f; color: #d4edda; }
.alert-warning { background: #2a1a08; border: 1px solid #7a4a10; color: #fde8b8; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.optional { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.875rem;
  font-size: 0.925rem;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(190, 21, 71, 0.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.field-hint { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 0.35rem; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Hero */
.hero { padding: 4rem 0 3rem; }
.hero-heading {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.hero-heading .hero-accent { color: var(--accent); }
.hero-sub { font-size: 1.05rem; color: var(--muted); max-width: 540px; margin-bottom: 2rem; }
.disclaimer-box {
  background: #1a0d13;
  border: 1px solid #4a1528;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 580px;
}
.disclaimer-box strong { color: var(--text); }
.hero-ctas { display: flex; gap: 1rem; flex-wrap: wrap; }

/* How it works */
.how-it-works { padding: 3rem 0; border-top: 1px solid var(--border); }
.how-it-works h2 { margin-bottom: 2rem; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.step-card h3 { margin-bottom: 0.5rem; }
.step-card p { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* Retrieve form */
.retrieve-form { max-width: 420px; }

/* Wizard */
.wizard-header { margin-bottom: 2rem; }
.wizard-header h1 { margin-bottom: 0.5rem; }

.wizard-progress { margin-bottom: 2.5rem; }
.progress-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 0.75rem;
}
.progress-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.5rem;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: default;
}
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--unrated-bg);
  border: 2px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}
.progress-step.active .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.progress-step.completed .step-dot { background: var(--green-bg); border-color: var(--green-bg); color: var(--green-text); }
.step-label { font-size: 0.75rem; color: var(--muted); }
.progress-step.active .step-label { color: var(--text); }

.wizard-step { margin-bottom: 2rem; }
.wizard-step h2 { margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.hidden { display: none !important; }

.wizard-nav {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* Relationship type cards */
.type-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.type-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.type-card:hover { border-color: var(--accent); }
.type-card.selected { border-color: var(--accent); background: #220d17; }
.type-card-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }
.type-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.type-card p { font-size: 0.8rem; color: var(--muted); margin: 0; }

/* Participant fields */
.participant-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  position: relative;
}
.participant-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.participant-label { font-weight: 600; font-size: 0.9rem; }
.btn-remove-participant {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.btn-remove-participant:hover { border-color: var(--red-bg); color: var(--red-text); }
.participant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) { .participant-grid { grid-template-columns: 1fr; } }

/* Tag select */
.tag-select { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-btn {
  background: var(--unrated-bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.tag-btn:hover { border-color: var(--accent); color: var(--text); }
.tag-btn.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Activities */
.activity-category { margin-bottom: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.category-toggle {
  width: 100%;
  background: #140810;
  border: none;
  color: var(--text);
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
}
.category-toggle:hover { background: #1c0e17; }
.category-name { flex: 1; text-align: left; }
.category-chevron { font-size: 0.7rem; transition: transform 0.2s; color: var(--muted); }
.activity-category.collapsed .category-chevron { transform: rotate(-90deg); }
.category-items { padding: 0.5rem 0; }
.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  gap: 1rem;
}
.activity-row:hover { background: rgba(255,255,255,0.02); }
.activity-name { font-size: 0.875rem; flex: 1; }
.activity-pills { display: flex; gap: 0.35rem; }
.activity-pill {
  background: var(--unrated-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 3px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.1s;
  min-width: 28px;
  text-align: center;
}
.activity-pill.pill-green,
.activity-pill.pill-amber,
.activity-pill.pill-red { background: var(--unrated-bg); color: var(--muted); border-color: var(--border); }
.activity-pill.pill-green.active { background: var(--green-bg); color: var(--green-text); border-color: var(--green-bg); }
.activity-pill.pill-amber.active { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-bg); }
.activity-pill.pill-red.active { background: var(--red-bg); color: var(--red-text); border-color: var(--red-bg); }
.activity-pill.pill-green:hover { border-color: #16a34a; color: #16a34a; }
.activity-pill.pill-amber:hover { border-color: #d97706; color: #d97706; }
.activity-pill.pill-red:hover { border-color: #dc2626; color: #dc2626; }
.activity-pill.pill-green.active:hover { background: #15803d; border-color: #15803d; }
.activity-pill.pill-amber.active:hover { background: #b45309; border-color: #b45309; }
.activity-pill.pill-red.active:hover { background: #b91c1c; border-color: #b91c1c; }

/* Inline pills (display) */
.pill { display: inline-block; border-radius: 3px; padding: 0.15rem 0.5rem; font-size: 0.8rem; font-weight: 600; }
.pill-green { background: var(--green-bg); color: var(--green-text); }
.pill-amber { background: var(--amber-bg); color: var(--amber-text); }
.pill-red { background: var(--red-bg); color: var(--red-text); }

/* Contract preview */
.contract-preview {
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
}
.preview-section { margin-bottom: 1rem; }
.preview-section h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; margin-bottom: 0.5rem; }
.preview-row { display: flex; gap: 0.5rem; margin-bottom: 0.25rem; }
.preview-label { color: var(--muted); min-width: 120px; font-size: 0.82rem; }

/* Email list */
.email-list { display: flex; flex-direction: column; gap: 0.5rem; }
.email-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.email-item .email-name { font-weight: 600; }
.email-item .email-addr { color: var(--muted); font-size: 0.82rem; }

/* Consent checkboxes */
.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
}
.consent-check input[type="checkbox"] {
  margin-top: 0.15rem;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.consent-check label { font-size: 0.9rem; cursor: pointer; }

/* Contract view page */
.contract-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.urn-display { }
.urn-display.compact { display: flex; align-items: center; gap: 0.75rem; }
.urn-label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.25rem; }
.urn-value { font-family: 'Courier New', monospace; font-size: 1.375rem; font-weight: 700; letter-spacing: 0.08em; color: var(--accent); }
.contract-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; font-size: 0.8rem; color: var(--muted); }
.status-badge { display: inline-block; border-radius: 3px; padding: 0.2rem 0.6rem; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.status-active { background: #0f2d1a; color: #56cc78; border: 1px solid #2d6a3f; }
.status-draft { background: var(--unrated-bg); color: var(--muted); border: 1px solid var(--border); }
.status-archived { background: #1a0d13; color: #666; border: 1px solid #2a1020; }
.contract-actions { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.contract-body { }
.contract-section { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.contract-section:last-child { border-bottom: none; }
.contract-section h2 { margin-bottom: 1rem; }
.type-badge {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.parties-table { width: 100%; border-collapse: collapse; }
.parties-table th {
  background: #140810;
  text-align: left;
  padding: 0.6rem 0.875rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.parties-table td { padding: 0.7rem 0.875rem; border-bottom: 1px solid var(--border); }
.role-badge {
  display: inline-block;
  background: var(--unrated-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  text-transform: capitalize;
}
.review-date { font-size: 0.875rem; color: var(--muted); margin-top: 0.75rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.tag {
  display: inline-block;
  background: var(--unrated-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text);
}
.safeword-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.safeword-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}
.sw-label { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.25rem; }
.sw-red { color: #e05050; }
.sw-yellow { color: #e0a030; }
.sw-blue { color: #5090e0; }
.notes-text { font-size: 0.9rem; color: var(--muted); white-space: pre-wrap; }
.activity-category-view { margin-bottom: 1.25rem; }
.activity-cat-name { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.activity-pills-view { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.activity-pill-view {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.activity-pill-view .pill-label { font-weight: 400; opacity: 0.75; }
.notes-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
}
.notes-box h4 { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.07em; }
.rules-block { margin-bottom: 1.25rem; }
.rules-block h3 { font-size: 0.875rem; margin-bottom: 0.5rem; color: var(--muted); }
.rules-block p { font-size: 0.9rem; white-space: pre-wrap; }
.signature-section { }
.signature-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.sig-line { border-bottom: 1px solid var(--muted); margin-bottom: 0.4rem; min-width: 220px; height: 28px; }
.sig-name { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.5rem; }
.sig-date { font-size: 0.8rem; color: var(--muted); }
.contract-footer-note {
  background: #090209;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2rem;
}
.contract-footer-note p { margin-bottom: 0.25rem; }

/* URN display on edit page */
.urn-display.compact .urn-value { font-size: 1rem; }

/* Error page */
.error-page { text-align: center; padding: 4rem 2rem; }
.error-code { font-size: 6rem; font-weight: 700; color: var(--accent); opacity: 0.6; margin-bottom: 0.5rem; }
.error-message { font-size: 1.125rem; color: var(--muted); margin-bottom: 2rem; }

/* Responsive */
@media (max-width: 640px) {
  .hero-heading { font-size: 2.25rem; }
  .hero-ctas { flex-direction: column; }
  .contract-header { flex-direction: column; }
  .wizard-progress .step-label { display: none; }
  .step-dot { width: 28px; height: 28px; font-size: 0.75rem; }
  .type-cards { grid-template-columns: 1fr; }
}

/* Logo */
.nav-logo-img {
  height: 80px;
  width: auto;
  display: block;
  opacity: 0.92;
  transition: opacity 0.15s;
}
.nav-logo:hover .nav-logo-img { opacity: 1; }
