/* ==========================================================================
   style.css — Design tokens + candidate-facing pages
   (index.html, assessment.html, result.html)

   Design direction: corporate recruitment tool that should feel like a
   modern online exam, not a marketing page. Cool, restrained palette;
   a grotesk display face paired with a workhorse body face; a monospace
   face reserved for anything numeric/data (assessment IDs, scores,
   dates) so those read as measured facts rather than prose.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap");

:root {
  /* Palette */
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-sunken: #F1F3F6;
  --ink: #101828;
  --ink-soft: #475467;
  --ink-faint: #98A2B3;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;

  --primary: #2B4C7E;
  --primary-dark: #1D3557;
  --primary-tint: #E9EEF6;

  --teal: #0F766E;
  --teal-tint: #E6F4F2;
  --amber: #B45309;
  --amber-tint: #FBF1E4;
  --red: #B42318;
  --red-tint: #FCEBEA;

  /* Type */
  --font-display: "Sora", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-raised: 0 4px 12px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.55;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -0.01em;
}

.text-mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: 0.01em; }
.text-soft { color: var(--ink-soft); }
.text-faint { color: var(--ink-faint); }

a { color: var(--primary); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------
   Top bar (shared)
   -------------------------------------------------------------------- */
.app-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.app-topbar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-topbar .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
}

.app-topbar .brand-sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --------------------------------------------------------------------
   Disclaimer banner
   -------------------------------------------------------------------- */
.disclaimer-banner {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.disclaimer-banner .glyph {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------
   Landing page (index.html)
   -------------------------------------------------------------------- */
.landing-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

.landing-title {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.landing-subtitle {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 22px;
}

.landing-intro {
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin-bottom: 28px;
}

.start-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px;
}

.start-card h2 {
  font-size: 1.05rem;
  margin-bottom: 18px;
}

.form-label {
  font-weight: 500;
  font-size: 0.86rem;
  color: var(--ink);
}

.form-control, .form-select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 500;
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.resume-banner {
  background: var(--amber-tint);
  border: 1px solid #F0DCB8;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------
   Assessment flow (assessment.html)
   -------------------------------------------------------------------- */
.assessment-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* Signature element: the "ledger" — one tick per question, filled in as
   the candidate answers. Encodes real progress, not decoration. */
.progress-rail {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}

.tick {
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  transition: background 0.25s ease;
}

.tick.answered { background: var(--teal); }
.tick.current { background: var(--primary); }

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
}

/* Kept for compatibility / alternate progress display */
.progress-bar-track {
  display: none;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 40px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.question-card.fade-in {
  opacity: 1;
  transform: translateY(0);
}

.question-counter {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
}

.question-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 18px;
}

.question-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 30px;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.98rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-tint);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--primary);
}

.open-answer {
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.98rem;
  width: 100%;
  resize: vertical;
}
.open-answer:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
  outline: none;
}

.assessment-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}

.assessment-nav .btn {
  min-width: 120px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
}

/* --------------------------------------------------------------------
   Result page (result.html)
   -------------------------------------------------------------------- */
.result-wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 80px 20px;
  text-align: center;
}

.result-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--teal-tint);
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.result-id-chip {
  display: inline-block;
  font-family: var(--font-mono);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.85rem;
  margin: 16px 0 8px;
}

/* Trait bars (shared with admin detail view via buildTraitBarElement) */
.trait-bar-row {
  text-align: left;
  margin-bottom: 18px;
}
.trait-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.trait-bar-label {
  font-weight: 600;
  font-size: 0.92rem;
}
.trait-bar-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
}
.trait-bar-track {
  height: 8px;
  background: var(--surface-sunken);
  border-radius: 4px;
  overflow: hidden;
}
.trait-bar-fill {
  height: 100%;
  border-radius: 4px;
}
.trait-bar-note {
  font-size: 0.84rem;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

.level-high, .trait-bar-value.level-high { color: var(--teal); }
.level-moderate, .trait-bar-value.level-moderate { color: var(--amber); }
.level-low, .trait-bar-value.level-low { color: var(--red); }

.trait-bar-fill.level-high { background: var(--teal); }
.trait-bar-fill.level-moderate { background: var(--amber); }
.trait-bar-fill.level-low { background: var(--red); }

/* --------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------- */
@media (max-width: 576px) {
  .question-card { padding: 26px 20px; }
  .question-text { font-size: 1.15rem; }
  .start-card { padding: 24px 20px; }
  .progress-rail { grid-template-columns: repeat(20, 1fr); gap: 2px; }
  .assessment-nav .btn { min-width: 96px; padding: 10px 14px; }
}
