/*
 * joystone.css — Joystone Financial shared design system
 *
 * Covers: variables, reset, typography, layout, buttons, forms,
 * quiz engine components, and utilities.
 *
 * Does NOT cover: tool-specific layout (where sections appear,
 * result score displays, etc.). Those stay in each tool's HTML.
 *
 * Google Fonts loaded via @import below — no separate <link> needed.
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@400;500;600&display=swap');


/* ══════════════════════════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════════════════════════ */

:root {
  /* Brand colors */
  --primary:        #253551;   /* Navy — primary UI, headings, buttons */
  --primary-light:  #344d72;   /* Navy hover state */
  --accent:         #2a2829;   /* Near-black — eyebrows, dividers, emphasis */
  --bg:             #e8e8e3;   /* Warm off-white page background */
  --card:           #ffffff;   /* White — input fields, option cards */
  --text:           #1a1a1a;   /* Primary body text */
  --muted:          #6b6b68;   /* Secondary text, placeholders, labels */
  --border:         #d0d0cb;   /* Input and card borders */
  --selected-bg:    #f0f3f8;   /* Selected option background tint */

  /* Typography */
  --font-serif:     'DM Serif Display', serif;
  --font-sans:      'DM Sans', sans-serif;

  /* Spacing scale */
  --space-xs:   6px;
  --space-sm:   10px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   36px;
  --space-2xl:  60px;

  /* Border radius */
  --radius-sm:  8px;
  --radius-md:  10px;
  --radius-lg:  12px;
  --radius-pill: 100px;

  /* Layout */
  --max-width:  620px;
}


/* ══════════════════════════════════════════════════════════════
   RESET
══════════════════════════════════════════════════════════════ */

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


/* ══════════════════════════════════════════════════════════════
   BASE
══════════════════════════════════════════════════════════════ */

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}


/* ══════════════════════════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════════════════════════ */

#progress-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(37, 53, 81, 0.12);
  z-index: 100;
}

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


/* ══════════════════════════════════════════════════════════════
   STEP CHIP
══════════════════════════════════════════════════════════════ */

#step-chip {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--space-xl);
  margin-bottom: 0;
  min-height: 18px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
}

#step-chip.visible { opacity: 1; }


/* ══════════════════════════════════════════════════════════════
   STAGE CONTAINER
══════════════════════════════════════════════════════════════ */

#stage {
  width: 100%;
  max-width: var(--max-width);
  padding: 28px 24px var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: 0;
}


/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════════ */

.slide-in {
  animation: slideUp 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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


/* ══════════════════════════════════════════════════════════════
   TYPOGRAPHY
══════════════════════════════════════════════════════════════ */

/* Eyebrow label — small all-caps label above headings */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Serif headings */
.headline-xl {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.12;
  color: var(--primary);
}

.headline-xl em {
  font-style: italic;
  color: var(--accent);
}

.headline-lg {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  line-height: 1.2;
  color: var(--primary);
}

.headline-md {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  line-height: 1.3;
  color: var(--primary);
}

/* Body text */
.body-lg {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
}

.body-md {
  font-size: 0.97rem;
  line-height: 1.7;
  color: var(--text);
}

.body-sm {
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--muted);
}


/* ══════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════ */

/* Primary — navy fill, used for main CTAs */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 32px;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover  { background: var(--primary-light); }
.btn-primary:active { transform: scale(0.98); }

.btn-primary svg { transition: transform 0.2s; }
.btn-primary:hover svg { transform: translateX(4px); }

/* Full-width variant */
.btn-primary.full-width {
  width: 100%;
}

/* Ghost — text only, used for back navigation and secondary actions */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.18s;
  text-decoration: none;
}

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


/* ══════════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════════ */

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-xs);
  letter-spacing: 0.03em;
}

.form-group input {
  width: 100%;
  padding: 13px var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.97rem;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group input::placeholder {
  color: var(--border);
}

/* Two-column form row, collapses to single on mobile */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Privacy/trust note below submit */
.form-privacy {
  text-align: center;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}


/* ══════════════════════════════════════════════════════════════
   QUIZ ENGINE — OPTION CARDS
══════════════════════════════════════════════════════════════ */

.options-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: 32px;
}

.opt {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.opt::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
}

.opt:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.opt:hover::before { opacity: 0.03; }

.opt.selected {
  border-color: var(--primary);
  background: var(--selected-bg);
  transform: translateX(4px);
}

.opt.selected::before { opacity: 0.04; }

.opt.pulse {
  animation: optPulse 0.3s ease;
}

@keyframes optPulse {
  0%   { transform: translateX(4px) scale(1); }
  40%  { transform: translateX(4px) scale(1.015); }
  100% { transform: translateX(4px) scale(1); }
}

/* Letter badge inside each option */
.opt-letter {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.opt.selected .opt-letter {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.opt-text {
  font-size: 0.97rem;
  color: var(--text);
  line-height: 1.4;
  font-weight: 400;
}

.opt.selected .opt-text { font-weight: 500; }


/* ══════════════════════════════════════════════════════════════
   STAT PILLS
   Used on start screens to show quick facts (e.g. "10 questions")
══════════════════════════════════════════════════════════════ */

.stat-pills {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--primary);
  white-space: nowrap;
}

.stat-pill svg { flex-shrink: 0; }


/* ══════════════════════════════════════════════════════════════
   DIVIDER ACCENT
   Short decorative rule used above result tier titles
══════════════════════════════════════════════════════════════ */

.divider-accent {
  width: 48px;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius-pill);
}


/* ══════════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════════ */

.hidden          { display: none !important; }
.text-center     { text-align: center; }
.text-muted      { color: var(--muted); }
.text-primary    { color: var(--primary); }
.mt-sm           { margin-top: var(--space-sm); }
.mt-md           { margin-top: var(--space-md); }
.mt-lg           { margin-top: var(--space-lg); }
.mt-xl           { margin-top: var(--space-xl); }
.mb-sm           { margin-bottom: var(--space-sm); }
.mb-md           { margin-bottom: var(--space-md); }
.mb-lg           { margin-bottom: var(--space-lg); }
.mb-xl           { margin-bottom: var(--space-xl); }


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  #stage        { padding: 20px 18px 48px; }
  .form-row     { grid-template-columns: 1fr; }
  .opt          { padding: 14px var(--space-md); }
  .btn-primary.mobile-full { width: 100%; justify-content: center; }
}
