/*
 * psychprofile shared test shell.
 *
 * Structural primitives shared by every test under public/tests/<slug>/.
 * Link this BEFORE the per-test style.css so the test file can override
 * tokens (colours, gradients) while inheriting layout.
 *
 * Per-test style.css is responsible for:
 *   - palette tokens (override :root --test-* variables)
 *   - hero gradient + hero shapes
 *   - primary CTA button gradient (.btn-hero)
 *   - section background blobs
 *   - card pastel rotations (:nth-child)
 *   - heading gradient
 *
 * Everything else lives here.
 */

/* ===== DESIGN TOKENS ===== */
/* Per-test style.css overrides these. Defaults approximate a neutral palette. */
:root {
  --test-primary: #7C5CFC;
  --test-primary-dark: #6344E0;
  --test-primary-light: #F0EBFF;
  --test-accent: #FF6B81;
  --test-accent-light: #FFF0F3;
  --test-dark: #1A1035;
  --test-bg: #FEFEFE;
  --test-surface: #FFFFFF;
  --test-border: #E8E5F0;
  --test-text: #1A1035;
  --test-text-light: #6B6B8D;
  --test-text-muted: #B8B0D0;
  --test-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --test-container: 760px;
  --test-radius: 16px;
  --test-radius-sm: 10px;
  --test-shadow: 0 2px 12px rgba(124, 92, 252, 0.08);
  --test-shadow-lg: 0 8px 32px rgba(124, 92, 252, 0.12);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--test-font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--test-text);
  background: var(--test-bg);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--test-primary); text-decoration: none; }
a:hover { color: var(--test-primary-dark); }

/* ===== LAYOUT PRIMITIVES ===== */
.container { max-width: var(--test-container); margin: 0 auto; padding: 0 1.25rem; }
.hidden { display: none !important; }

/* ===== BUTTON BASE ===== */
/* Per-test style.css supplies the .btn-hero gradient and any variant colours. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.75rem;
  border: 2px solid transparent;
  border-radius: var(--test-radius-sm);
  font-family: var(--test-font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  text-decoration: none;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active { transform: scale(0.97); }

.btn-back {
  background: transparent;
  color: var(--test-text-light);
  border: 2px solid var(--test-border);
}

.btn-back:hover {
  border-color: var(--test-primary);
  color: var(--test-primary);
}

/* ===== SCROLL REVEAL ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tshell-fadeIn 200ms ease;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 16, 53, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--test-surface);
  border-radius: var(--test-radius);
  padding: 2.5rem 2rem;
  max-width: 440px;
  width: calc(100% - 2rem);
  box-shadow: var(--test-shadow-lg);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--test-text-light);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 200ms;
}

.modal-close:hover { background: var(--test-primary-light); }
.modal-content h2 { margin-bottom: 1.25rem; }

/* ===== CONTACT FORM (inside modal) ===== */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-form input,
.contact-form textarea {
  padding: 0.75rem 1rem;
  border: 2px solid var(--test-border);
  border-radius: var(--test-radius-sm);
  font-family: var(--test-font);
  font-size: 1rem;
  background: var(--test-bg);
  transition: border-color 200ms;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--test-primary);
}

.contact-status {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
}

.contact-status.success { color: #1F8B45; }
.contact-status.error { color: #C24A60; }

/* Honeypot: visually hidden but focusable only via tab+specific selector. Bots fill it. */
.hp-field {
  position: absolute !important;
  left: -10000px !important;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ===== SHARED ANIMATION KEYFRAMES ===== */
@keyframes tshell-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Aliases for legacy per-test rules that referenced fadeIn/popIn. */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.5); }
  70% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===== RESPONSE BUTTON TAP HYGIENE ===== */
/* Per-test style.css styles the response button visuals; this keeps iOS from
   adding a 300ms tap delay or firing ghost clicks that bypass the click-gate. */
.response-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ===== RESUME PROMPT ===== */
/* Injected by quiz-engine.js into #landing when a long-session resume record
   exists. Local-only persistence — never sent to any server. Inherits the
   per-test palette via --test-* tokens so each test feels native. */
.quiz-resume-prompt {
  max-width: var(--test-container);
  margin: 24px auto 0;
  padding: 0 20px;
}
.quiz-resume-inner {
  background: var(--test-surface);
  border: 1px solid var(--test-border);
  border-left: 4px solid var(--test-primary);
  border-radius: var(--test-radius);
  box-shadow: var(--test-shadow);
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.quiz-resume-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.quiz-resume-headline {
  font-size: 16px;
  font-weight: 700;
  color: var(--test-text);
  letter-spacing: -0.01em;
}
.quiz-resume-subline { font-size: 14px; color: var(--test-text-light); }
.quiz-resume-actions { display: flex; gap: 10px; flex-shrink: 0; }
.quiz-resume-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--test-radius-sm);
  border: 1px solid var(--test-border);
  background: var(--test-surface);
  color: var(--test-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.quiz-resume-btn:hover { border-color: var(--test-primary); }
.quiz-resume-resume {
  background: var(--test-primary);
  border-color: var(--test-primary);
  color: #fff;
}
.quiz-resume-resume:hover { background: var(--test-primary-dark); border-color: var(--test-primary-dark); color: #fff; }
@media (max-width: 520px) {
  .quiz-resume-inner { flex-direction: column; align-items: stretch; }
  .quiz-resume-actions { justify-content: stretch; }
  .quiz-resume-btn { flex: 1; }
}
