/* Behavioral Signals — VP Product screening (modern / mobile-optimized) */
:root {
  --bg-deep: #050810;
  --bg: #080c18;
  --bg-elevated: #0c1224;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.055);
  --border: rgba(0, 212, 190, 0.2);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --accent: #00d4be;
  --accent-deep: #00a896;
  --accent-dim: rgba(0, 212, 190, 0.12);
  --accent-glow: rgba(0, 212, 190, 0.45);
  --text: #f1f5f9;
  --text-muted: #8b9cb0;
  --danger: #f87171;
  --warn: #fbbf24;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-display: "DM Serif Display", Georgia, serif;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-sm: 11px;
  --radius-full: 9999px;
  --tap: 48px;
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 8px 32px -8px var(--accent-glow);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 90% 60% at 50% -25%, rgba(0, 212, 190, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 95% 30%, rgba(56, 189, 248, 0.05), transparent),
    radial-gradient(ellipse 45% 35% at 5% 75%, rgba(0, 212, 190, 0.06), transparent),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(0, 212, 190, 0.12);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: #5ee9d8;
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(5, 8, 16, 0.72);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top, 0);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.875rem 1rem 0.75rem;
}

.logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.logo-row img {
  height: clamp(28px, 8vw, 36px);
  width: auto;
  max-width: min(260px, 88vw);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.waveform {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 30px;
  opacity: 0.9;
}

.waveform span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(0, 212, 190, 0.35));
  animation: wave 1.2s ease-in-out infinite;
}

.waveform span:nth-child(1) {
  height: 40%;
  animation-delay: 0s;
}
.waveform span:nth-child(2) {
  height: 70%;
  animation-delay: 0.1s;
}
.waveform span:nth-child(3) {
  height: 100%;
  animation-delay: 0.2s;
}
.waveform span:nth-child(4) {
  height: 55%;
  animation-delay: 0.3s;
}
.waveform span:nth-child(5) {
  height: 85%;
  animation-delay: 0.4s;
}
.waveform span:nth-child(6) {
  height: 45%;
  animation-delay: 0.5s;
}
.waveform span:nth-child(7) {
  height: 75%;
  animation-delay: 0.6s;
}
.waveform span:nth-child(8) {
  height: 60%;
  animation-delay: 0.7s;
}

@keyframes wave {
  0%,
  100% {
    transform: scaleY(0.45);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.title-block {
  margin-top: 0.65rem;
}

.title-block h1 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 4.2vw, 1.7rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0 0 0.4rem;
  line-height: 1.22;
  text-wrap: balance;
}

.title-block .subtitle {
  color: var(--text-muted);
  font-size: clamp(0.875rem, 3vw, 0.92rem);
  margin: 0;
  max-width: 46ch;
  line-height: 1.45;
  font-weight: 500;
}

.progress-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 0.9rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-label strong {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.progress-bar-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--accent) 0%, #34d9c8 50%, #5ee9d8 100%);
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 24px rgba(0, 212, 190, 0.45);
}

.restore-banner {
  display: none;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
}

.restore-banner.is-visible {
  display: block;
}

.restore-banner-inner {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
}

main.form-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
}

#screeningForm {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.section-panel {
  display: none;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-panel.is-active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: panelEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

.section-panel.is-exit {
  opacity: 0;
  transform: translateY(-8px);
}

.section-intro {
  margin-bottom: 1.5rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-intro h2 {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  font-weight: 400;
  margin: 0 0 0.5rem;
  color: var(--text);
  line-height: 1.28;
  letter-spacing: 0.01em;
}

.section-intro p {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(0.9rem, 2.8vw, 0.95rem);
  line-height: 1.55;
}

.field {
  margin-bottom: 1.35rem;
}

.field label.primary {
  display: block;
  font-weight: 600;
  font-size: clamp(0.9rem, 2.8vw, 0.95rem);
  margin-bottom: 0.5rem;
  color: var(--text);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.field .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.75rem 0.95rem;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  min-height: var(--tap);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

input::placeholder,
textarea::placeholder {
  color: rgba(139, 156, 176, 0.65);
}

input:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(0, 212, 190, 0.55);
  box-shadow:
    0 0 0 3px var(--accent-dim),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

textarea {
  min-height: 11rem;
  resize: vertical;
  padding-top: 0.9rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 0.85rem;
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.option-item:hover {
  background: var(--surface-hover);
  border-color: rgba(0, 212, 190, 0.22);
}

.option-item:active {
  background: rgba(255, 255, 255, 0.06);
}

.option-item input {
  margin-top: 0.15rem;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.option-item span {
  font-size: clamp(0.9rem, 2.6vw, 0.95rem);
  line-height: 1.45;
}

.field-error {
  display: none;
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.4rem;
}

.field-error.is-visible {
  display: block;
}

.submit-error {
  width: 100%;
  margin-bottom: 0.5rem;
  text-align: center;
}

.submit-error:not(.is-visible) {
  display: none;
}

.submit-error.is-visible {
  display: block;
  color: var(--danger);
  font-size: 0.9rem;
}

.field.has-error input,
.field.has-error textarea {
  border-color: rgba(248, 113, 113, 0.55);
}

.word-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  text-align: right;
}

.word-count.is-warn {
  color: var(--warn);
}

.word-count.is-over {
  color: var(--danger);
}

.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1.25rem;
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.12s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-back {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
}

.btn-back:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-next,
.btn-submit {
  color: #041016;
  background: linear-gradient(135deg, #2ee6cf 0%, var(--accent) 42%, var(--accent-deep) 100%);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.btn-next:hover:not(:disabled),
.btn-submit:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 10px 36px -10px var(--accent-glow);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Confirmation page */
.confirm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem 1.25rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  text-align: center;
}

.confirm-card {
  max-width: 520px;
  width: 100%;
  padding: 2rem 1.35rem;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

.confirm-card h1 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  font-weight: 400;
  margin: 0 0 1rem;
  line-height: 1.3;
}

.confirm-card p {
  color: var(--text-muted);
  margin: 0 0 1rem;
  font-size: clamp(0.9rem, 2.8vw, 0.95rem);
  line-height: 1.55;
}

.confirm-card .accent-link {
  font-weight: 600;
}

/* Desktop: floating step card */
@media (min-width: 641px) {
  .section-panel.is-active {
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 50%, transparent 100%);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
  }

  .section-intro {
    border-bottom-color: rgba(255, 255, 255, 0.07);
  }
}

/* —— Mobile layout —— */
@media (max-width: 640px) {
  .progress-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .progress-label strong {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
  }

  #progressTitle {
    font-size: 0.8125rem;
    line-height: 1.45;
    text-transform: none;
    letter-spacing: 0.03em;
    color: rgba(241, 245, 249, 0.94);
    font-weight: 500;
  }

  .waveform {
    display: none;
  }

  .logo-row {
    justify-content: flex-start;
  }

  main.form-shell {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
  }

  .section-panel.is-active {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1rem 1rem;
    box-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.55);
  }

  .section-intro {
    margin-top: -0.15rem;
    border-bottom-color: rgba(255, 255, 255, 0.07);
  }

  .field {
    margin-bottom: 1.25rem;
  }

  .form-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    margin-top: 0;
    padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    background: rgba(5, 8, 16, 0.88);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.45);
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: stretch;
    gap: 0.65rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .btn {
    flex: 1;
    min-width: 0;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .btn-back {
    flex: 0 0 auto;
    min-width: 5.5rem;
    max-width: 40%;
  }

  .btn-next,
  .btn-submit {
    flex: 1 1 auto;
    font-weight: 600;
  }

  .submit-error {
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
  }
}

@media (min-width: 641px) {
  .header-inner {
    padding: 1.1rem 1.25rem 0.85rem;
  }

  main.form-shell {
    padding: 1.5rem 1.25rem 4rem;
  }

  input[type="text"],
  input[type="email"],
  textarea {
    padding: 0.65rem 0.9rem;
    min-height: 2.75rem;
    font-size: 1rem;
  }

  textarea {
    min-height: 9rem;
  }

  .option-item {
    padding: 0.55rem 0.65rem;
    min-height: unset;
    border-radius: var(--radius-sm);
  }

  .option-item input {
    width: auto;
    height: auto;
    margin-top: 0.2rem;
  }

  .btn {
    min-height: unset;
    padding: 0.72rem 1.35rem;
    border-radius: var(--radius-sm);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .section-panel.is-active {
    animation: none;
  }

  .waveform span {
    animation: none;
  }

  .progress-bar-fill {
    transition: none;
  }

  .btn:active:not(:disabled) {
    transform: none;
  }
}
