/* ============================================================
   Webcraft Studio — Painting Business Systems Intake
   Design: sophisticated, minimal, editorial agency
   ============================================================ */

:root {
  --paper: #F6F4EF;
  --surface: #FFFFFF;
  --ink: #1B1D1F;
  --ink-soft: #3A3D40;
  --muted: #6B6760;
  --line: #E5E1D8;
  --line-strong: #D6D1C4;
  --accent: #B5451F;
  --accent-dark: #93381A;
  --accent-soft: #F7EDE7;
  --deep: #17191B;
  --success: #2E6B4F;
  --error: #A33A2A;
  --radius-card: 16px;
  --radius-btn: 10px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Sora', 'Helvetica Neue', Arial, sans-serif;
  --shadow-card: 0 1px 2px rgba(27, 29, 31, 0.05), 0 8px 28px rgba(27, 29, 31, 0.07);
  --shadow-lift: 0 2px 4px rgba(27, 29, 31, 0.06), 0 14px 40px rgba(27, 29, 31, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

/* ---------- Top bar & progress ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 244, 239, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.wordmark span { color: var(--accent); }

.topbar-meta {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  min-width: 0;
}

.topbar-meta strong {
  display: block;
  color: var(--ink-soft);
  font-weight: 600;
}

.progress-track {
  height: 3px;
  background: var(--line);
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Layout ---------- */
.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 120px;
}

.screen { display: none; }
.screen.active { display: block; animation: rise 0.4s ease both; }

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

/* ---------- Typography ---------- */
.kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 560;
  letter-spacing: -0.015em;
  line-height: 1.12;
  margin: 0 0 20px;
}

h1 { font-size: clamp(34px, 5.4vw, 54px); }
h2 { font-size: clamp(26px, 4vw, 36px); }

.lede {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0 0 16px;
}

.section-note {
  font-size: 15px;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 36px;
}

/* ---------- Intro screen ---------- */
.intro-rule {
  width: 56px;
  height: 3px;
  background: var(--accent);
  border: 0;
  margin: 28px 0;
}

.intro-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 40px 0 44px;
}

.intro-facts div {
  padding: 18px 18px 18px 0;
  font-size: 14px;
  color: var(--muted);
}

.intro-facts div + div {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.intro-facts strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(181, 69, 31, 0.28);
}

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(147, 56, 26, 0.3); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}

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

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

.btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn.loading .spinner { display: inline-block; }
.btn.loading { pointer-events: none; opacity: 0.85; }

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

/* ---------- Questions ---------- */
.q {
  margin: 0 0 34px;
  scroll-margin-top: 120px;
}

.q-label {
  display: block;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
}

.q-num {
  font-family: var(--font-display);
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  margin-right: 8px;
}

.q-hint {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 14px;
}

.req {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  margin-left: 6px;
}

.q-error {
  display: none;
  color: var(--error);
  font-size: 13.5px;
  margin-top: 10px;
  font-weight: 500;
}

.q.invalid .q-error { display: block; }
.q.invalid .text-input,
.q.invalid .select-input { border-color: var(--error); }

/* ---------- Inputs ---------- */
.text-input,
.select-input,
textarea.text-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  padding: 13px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus,
.select-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(27, 29, 31, 0.08);
}

textarea.text-input { resize: vertical; min-height: 110px; line-height: 1.55; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* ---------- Option cards (single select) ---------- */
.options {
  display: grid;
  gap: 10px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  font-size: 15px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

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

.opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.opt .dot {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  position: relative;
  transition: border-color 0.15s ease;
}

.opt .dot::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.15s ease;
}

.opt.checked {
  border-color: var(--ink);
  background: #FBFAF7;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.opt.checked .dot { border-color: var(--accent); }
.opt.checked .dot::after { transform: scale(1); }

.opt small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ---------- Chips (multi select) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip input { position: absolute; opacity: 0; pointer-events: none; }

.chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.15s ease;
}

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

.chip.checked {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chip.checked::before { background: var(--accent); }

.chip.disabled { opacity: 0.4; cursor: not-allowed; }

.chip-count {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

.chip-count strong { color: var(--accent); }

/* ---------- Scale (1-5) ---------- */
.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.scale .opt {
  flex-direction: column;
  text-align: center;
  padding: 16px 8px 14px;
  gap: 8px;
}

.scale .opt .dot { display: none; }

.scale .opt .num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 560;
  line-height: 1;
}

.scale .opt small { margin: 0; }

/* ---------- Other-specify inputs ---------- */
.other-input { margin-top: 12px; display: none; }
.other-input.visible { display: block; }

/* ---------- Conditional blocks ---------- */
.cond-block {
  border-left: 2px solid var(--accent);
  padding: 6px 0 6px 24px;
  margin: 0 0 36px;
  display: none;
}

.cond-block.visible { display: block; animation: rise 0.35s ease both; }

.cond-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 22px;
}

/* ---------- Step navigation ---------- */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.step-nav .spacer { flex: 1; }

.step-hint { font-size: 13px; color: var(--muted); }

/* ---------- Success ---------- */
.success-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 56px 48px;
  text-align: center;
}

.success-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  margin: 0 auto 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-mark svg { width: 26px; height: 26px; stroke: var(--accent); }

.submit-error {
  display: none;
  background: #FBF0ED;
  border: 1px solid var(--error);
  border-radius: var(--radius-btn);
  color: var(--error);
  font-size: 14.5px;
  padding: 14px 18px;
  margin-top: 20px;
}

.submit-error.visible { display: block; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
}

.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }

.team-link {
  background: none;
  border: none;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.team-link:hover { color: var(--ink); }

.footer-vibe { opacity: 0.5; font-weight: 300; }

/* ---------- Auth modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(23, 25, 27, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.open { display: flex; }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lift);
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
}

.modal-close:hover { color: var(--ink); }

.modal h3 {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 24px;
  margin: 0 0 6px;
}

.modal-sub { font-size: 14px; color: var(--muted); margin: 0 0 24px; }

.modal label { display: block; font-size: 13.5px; font-weight: 600; margin: 0 0 6px; }

.modal .text-input { margin-bottom: 16px; }

.auth-error { color: var(--error); font-size: 13.5px; min-height: 20px; margin: 0 0 12px; }

.auth-alt {
  font-size: 13.5px;
  color: var(--muted);
  margin: 18px 0 0;
  text-align: center;
}

.auth-alt a { color: var(--accent); font-weight: 600; }

.verify-msg {
  display: none;
  text-align: center;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.verify-msg.visible { display: block; }

.verify-msg a { color: var(--accent); font-weight: 600; }

/* ---------- Admin ---------- */
.admin-wrap { max-width: 1200px; margin: 0 auto; padding: 40px 24px 100px; }

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.admin-stats { display: flex; gap: 28px; flex-wrap: wrap; }

.admin-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 22px;
}

.admin-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 560;
  line-height: 1.2;
}

.admin-stat span { font-size: 12.5px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

.sub-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.sub-table th {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #FBFAF7;
}

.sub-table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  vertical-align: middle;
}

.sub-table tbody tr { cursor: pointer; transition: background 0.12s ease; }
.sub-table tbody tr:hover { background: #FBFAF7; }
.sub-table tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 12px;
}

.badge-new { background: #F7EDE7; color: var(--accent); }
.badge-reviewing { background: #FDF3D7; color: #8A6410; }
.badge-proposal { background: #E7F0EA; color: var(--success); }
.badge-closed { background: #EDEDEB; color: var(--muted); }

.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 40px;
  margin-top: 24px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.detail-section { margin-top: 28px; }

.detail-section h4 {
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-grid { display: grid; grid-template-columns: 220px 1fr; gap: 8px 24px; }

.detail-grid dt { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.detail-grid dd { margin: 0; font-size: 14.5px; color: var(--ink); white-space: pre-wrap; }

.status-select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  padding: 9px 18px;
  cursor: pointer;
  margin-bottom: 20px;
}

.back-link:hover { border-color: var(--ink); color: var(--ink); }

.empty-state {
  text-align: center;
  padding: 70px 24px;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .shell { padding: 36px 20px 100px; }
  .topbar-inner { padding: 14px 20px 12px; }
  .field-row { grid-template-columns: 1fr; }
  .intro-facts { grid-template-columns: 1fr; }
  .intro-facts div + div {
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 18px;
  }
  .scale { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .scale .opt { padding: 12px 4px 10px; }
  .scale .opt .num { font-size: 19px; }
  .scale .opt small { font-size: 11px; }
  .step-nav { flex-wrap: wrap; }
  .step-nav .btn { flex: 1 1 auto; }
  .success-card { padding: 40px 24px; }
  .detail-card { padding: 28px 20px; }
  .detail-grid { grid-template-columns: 1fr; gap: 2px; }
  .detail-grid dd { margin-bottom: 12px; }
  .sub-table { display: block; overflow-x: auto; }
}

@media (max-width: 420px) {
  .topbar-meta { font-size: 12px; }
  .chips { gap: 8px; }
  .chip { padding: 9px 14px; font-size: 13.5px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
