/* Component styles for the public form runner */

@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700;800&display=swap');

.hf-stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hf-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: transparent;
  z-index: 50;
}
.hf-progress-fill {
  height: 100%;
  background: var(--brand);
  transition: width var(--transition-step);
}

.hf-frame {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem 2rem;
}
@media (min-width: 768px) {
  .hf-frame { padding: 5rem 3rem; }
}

.hf-card {
  width: 100%;
  max-width: 640px;
}

@keyframes hf-question-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hf-q-anim { animation: hf-question-in var(--transition-step) cubic-bezier(0.22, 1, 0.36, 1) both; }

.hf-q-num {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: .02em;
  margin-bottom: 1rem;
  text-transform: uppercase;
}
.hf-q-num .num { font-variant-numeric: tabular-nums; }

.hf-q-label {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 .5rem;
}
.hf-q-help { color: var(--text-dim); font-size: 1rem; margin: 0 0 1.5rem; }

/* markdown-rendered help text / subtext */
.hf-md p { margin: 0 0 .6em; }
.hf-md > :last-child { margin-bottom: 0; }
.hf-md ul, .hf-md ol { margin: 0 0 .6em; padding-left: 1.4em; }
.hf-md li { margin: .15em 0; }
.hf-md a { color: var(--brand); text-decoration: underline; }
.hf-md code { background: var(--border-soft, rgba(0,0,0,.06)); padding: .1em .35em; border-radius: 4px; font-size: .92em; }
.hf-md blockquote { margin: 0 0 .6em; padding-left: .9em; border-left: 3px solid var(--border); }
.hf-md .hf-md-h { margin: 0 0 .4em; font-size: 1.05em; color: var(--text); }
.hf-splash .hf-md { margin: 0 0 2rem; font-size: 1.15rem; color: var(--text-dim); }
.hf-splash .hf-md p { font-size: inherit; margin: 0 0 .8rem; }

/* terms question: scrollable terms text + signature box */
.hf-terms-body { max-height: 38vh; overflow-y: auto; margin: 0 0 1.25rem; padding: 1rem 1.1rem; border: 1.5px solid var(--border); border-radius: var(--radius, 12px); background: var(--surface); color: var(--text); font-size: .95rem; line-height: 1.55; }
.hf-sign-label { font-size: .9rem; font-weight: 600; color: var(--text-dim); margin-bottom: .4rem; }
.hf-sign-box { position: relative; border: 1.5px solid var(--border); border-radius: var(--radius, 12px); background: #fff; overflow: hidden; }
.hf-sign-canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.hf-sign-ph { position: absolute; left: 1rem; bottom: 1.6rem; color: #9ca3af; font-size: 1.1rem; pointer-events: none; }
.hf-sign-box::after { content: ''; position: absolute; left: 1rem; right: 1rem; bottom: 1.4rem; border-bottom: 1px dashed #cbd5e1; pointer-events: none; }
.hf-sign-actions { display: flex; justify-content: flex-end; margin-top: .35rem; }
.hf-sign-clear { background: none; border: 0; color: var(--text-dim); text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; padding: .2rem; }
.hf-sign-clear:disabled { opacity: .4; cursor: default; text-decoration: none; }
.hf-q-required { color: var(--brand); font-weight: 700; margin-left: .25rem; }

.hf-input, .hf-textarea, .hf-select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1.125rem;
  padding: .9rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.hf-textarea { resize: vertical; min-height: 7rem; line-height: 1.5; }
.hf-input:focus, .hf-textarea:focus, .hf-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}
.hf-input::placeholder, .hf-textarea::placeholder { color: var(--text-faint); }

.hf-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  padding: .85rem 1.6rem;
  border-radius: calc(var(--radius) - 2px);
  border: none;
  transition: transform .12s, box-shadow .15s, background-color .15s;
}
.hf-btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), inset 0 -2px 0 rgba(0,0,0,.08);
}
.hf-btn-primary:hover { background: var(--brand-ink); transform: translateY(-1px); }
.hf-btn-primary:active { transform: translateY(0); }
.hf-btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.hf-btn-ghost {
  background: transparent;
  color: var(--text-dim);
  padding: .6rem 1rem;
}
.hf-btn-ghost:hover { color: var(--brand); }

.hf-btn-row {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.hf-hint { color: var(--text-faint); font-size: .85rem; }
.hf-hint kbd {
  font-family: var(--font-mono);
  font-size: .75rem;
  background: var(--border-soft);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.hf-error { color: var(--danger); font-size: .9rem; margin-top: .5rem; }

/* Choice lists */
.hf-choice-list { display: flex; flex-direction: column; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.hf-choice {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .08s;
}
.hf-choice:hover { border-color: var(--brand); background: var(--brand-soft); }
.hf-choice.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.hf-choice-key {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface);
  flex-shrink: 0;
}
.hf-choice.is-selected .hf-choice-key {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}
.hf-choice-label { flex: 1; font-size: 1.05rem; }

/* Yes/No big buttons */
.hf-yn { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hf-yn-btn {
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  transition: all .12s;
}
.hf-yn-btn:hover, .hf-yn-btn.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-ink);
}

/* Rating */
.hf-rating { display: flex; gap: .5rem; }
.hf-rating-star, .hf-rating-num {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-faint);
  font-weight: 600;
  transition: all .12s;
  cursor: pointer;
}
.hf-rating-num { border-radius: var(--radius); }
.hf-rating-star.is-on, .hf-rating-num.is-on {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.hf-rating-star.is-on svg { fill: white; }
.hf-rating-star:hover, .hf-rating-num:hover { border-color: var(--brand); }

/* Welcome + Thank-you splash */
.hf-splash {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}
.hf-splash h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 1rem;
  color: var(--text);
}
.hf-splash p { font-size: 1.15rem; color: var(--text-dim); margin: 0 0 2rem; }

/* Loader skeleton */
.hf-loader {
  width: 100%;
  text-align: center;
  color: var(--text-faint);
  padding: 4rem 0;
}
.hf-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: hf-spin .8s linear infinite;
  margin: 0 auto;
}
@keyframes hf-spin { to { transform: rotate(360deg); } }

/* Footer */
.hf-footer {
  text-align: center;
  padding: 1rem 1rem 1.5rem;
  color: var(--text-faint);
  font-size: .8rem;
}
.hf-footer a { color: var(--text-faint); text-decoration: none; }
.hf-footer a:hover { color: var(--brand); }

/* Confetti canvas */
#hf-confetti {
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
}

/* Back chevron */
.hf-back {
  position: fixed;
  top: 1rem; left: 1rem;
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .85rem;
  color: var(--text-dim);
  background: var(--surface);
  padding: .4rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  z-index: 40;
  text-decoration: none;
}
.hf-back:hover { color: var(--brand); border-color: var(--brand); }

/* Date input */
input[type="date"].hf-input { padding-right: .5rem; }