/* =========================================================================
   Edex Psychometric Test — main stylesheet
   Bold, energetic palette (deep purple → gold/coral), glassmorphic cards,
   animated backgrounds and step transitions.
   ========================================================================= */

:root {
  --bg-1: #241141;
  --bg-2: #43266f;
  --bg-3: #6c3fa6;
  --accent: #f3b62b;
  --accent-2: #ff7d5c;
  --success: #33c481;
  --danger: #ff5d6c;
  --ink: #221334;
  --ink-soft: #5b4a78;
  --paper: #ffffff;
  --paper-soft: #f7f3fc;
  --line: #e7defa;
  --white-70: rgba(255, 255, 255, 0.72);
  --white-85: rgba(255, 255, 255, 0.88);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 30px 70px -25px rgba(15, 6, 35, 0.55);
  --shadow-soft: 0 14px 30px -12px rgba(15, 6, 35, 0.35);
  --font-display: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Noto Sans Sinhala', 'Noto Sans Tamil', 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: radial-gradient(120% 120% at 15% -10%, var(--bg-3) 0%, var(--bg-2) 45%, var(--bg-1) 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------------
   Animated background blobs
   --------------------------------------------------------------------- */
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-fx__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
  animation: drift 22s ease-in-out infinite;
}
.bg-fx__blob--1 { width: 480px; height: 480px; background: var(--accent); top: -160px; left: -120px; animation-delay: 0s; }
.bg-fx__blob--2 { width: 420px; height: 420px; background: var(--accent-2); bottom: -180px; right: -100px; animation-delay: -6s; }
.bg-fx__blob--3 { width: 360px; height: 360px; background: #8a5fd1; top: 35%; right: 10%; animation-delay: -12s; opacity: .35; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(30px, -40px) scale(1.08); }
  66%      { transform: translate(-25px, 25px) scale(0.95); }
}

/* ---------------------------------------------------------------------
   Header / brand
   --------------------------------------------------------------------- */
.site-header { position: relative; z-index: 2; padding: 28px clamp(20px, 5vw, 56px) 0; }
.site-header__inner { max-width: 1080px; margin: 0 auto; }
.brand-partnership { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand-partnership__divider { color: rgba(255,255,255,.35); font-size: 15px; font-weight: 300; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand__logo { height: 38px; max-width: 160px; object-fit: contain; display: block; }
.brand__logo--placeholder {
  height: 38px; min-width: 110px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12); color: var(--white-85);
  border: 1px dashed rgba(255,255,255,.4); border-radius: var(--radius-sm);
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
}
.brand__name { color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.brand__name--partner { font-size: 14.5px; color: var(--white-85); font-weight: 500; }

.page-shell { position: relative; z-index: 1; min-height: 70vh; }

.site-footer { position: relative; z-index: 1; text-align: center; padding: 30px 20px 40px; }
.site-footer p { color: rgba(255,255,255,.55); font-size: 13px; }
.site-footer__links { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 10px; }
.site-footer__links a { color: var(--white-70); font-size: 13px; font-weight: 500; }
.site-footer__links a:hover { color: #fff; }
.site-footer__links span { color: rgba(255,255,255,.3); }

/* ---------------------------------------------------------------------
   Reveal-on-load animation
   --------------------------------------------------------------------- */
.reveal { animation: reveal .6s var(--ease) both; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------
   Stage layout
   --------------------------------------------------------------------- */
.stage { max-width: 1080px; margin: 0 auto; padding: 36px clamp(16px, 5vw, 56px) 60px; }

/* Landing page */
.stage--landing { padding-top: clamp(20px, 5vh, 56px); }
.landing-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.landing-card__intro { padding: clamp(28px, 5vw, 56px); color: #fff; }
.eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}
.landing-card__intro h1 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 700; color: #fff; margin-bottom: 16px; }
.landing-card__lede { color: var(--white-85); font-size: 15.5px; line-height: 1.7; }
.landing-card__points { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 12px; }
.landing-card__points li { display: flex; align-items: center; gap: 12px; color: var(--white-85); font-size: 14.5px; }
.landing-card__points .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.form-card { background: var(--paper); padding: clamp(28px, 4vw, 48px); display: flex; flex-direction: column; gap: 18px; }
.form-card h2 { font-size: 22px; color: var(--ink); margin-bottom: 4px; }
.form-card__error {
  background: #fff1f1; color: #c23a45; border: 1px solid #ffd3d6;
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px;
}
.form-card__privacy { font-size: 12.5px; color: var(--ink-soft); text-align: center; }

/* Floating-label fields */
.field { position: relative; }
.field input {
  width: 100%; padding: 18px 16px 8px; font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: var(--radius-md);
  background: var(--paper-soft); color: var(--ink); transition: border-color .2s, background .2s;
}
.field input:focus { outline: none; border-color: var(--bg-3); background: #fff; }
.field input:focus-visible { outline: 2px solid var(--bg-3); outline-offset: 1px; }
.field label {
  position: absolute; left: 16px; top: 17px; font-size: 14.5px; color: var(--ink-soft);
  pointer-events: none; transition: all .18s var(--ease);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 7px; font-size: 11px; color: var(--bg-3); font-weight: 600;
}
.field--dark input { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.field--dark input:focus { background: rgba(255,255,255,.14); border-color: var(--accent); }
.field--dark label { color: rgba(255,255,255,.6); }
.field--dark input:focus + label,
.field--dark input:not(:placeholder-shown) + label { color: var(--accent); }

.lang-field { border: none; padding: 0; margin: 4px 0 0; }
.lang-field legend { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; padding: 0; font-weight: 600; }
.lang-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lang-option {
  position: relative; text-align: center; padding: 12px 6px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--paper-soft); font-size: 14px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; transition: all .18s var(--ease);
}
.lang-option input { position: absolute; opacity: 0; pointer-events: none; }
.lang-option:has(input:checked) {
  border-color: var(--bg-3); background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  color: #fff; box-shadow: var(--shadow-soft);
}
.lang-option:focus-within { outline: 2px solid var(--bg-3); outline-offset: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; border-radius: var(--radius-md); border: none;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), opacity .15s;
}
.btn--block { width: 100%; }
.btn--primary {
  color: #2a1444; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 30px -10px rgba(243, 182, 43, .55);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -10px rgba(243, 182, 43, .65); }
.btn--primary:focus-visible { outline: 2px solid #2a1444; outline-offset: 2px; }
.btn--primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--ghost { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.btn--ghost:hover { background: rgba(255,255,255,.18); }
.btn--secondary { background: #fff; color: var(--bg-3); border: 2px solid var(--bg-3); }
.btn--secondary:hover { background: var(--paper-soft); transform: translateY(-1px); }
.btn--small { padding: 9px 16px; font-size: 13px; }

/* ---------------------------------------------------------------------
   Test shell
   --------------------------------------------------------------------- */
.stage--test { padding-top: 24px; }
.test-shell { max-width: 760px; margin: 0 auto; }

.test-progress { margin-bottom: 22px; }
.test-progress__bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.test-progress__fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .5s var(--ease);
}
.test-progress__label { color: var(--white-85); font-size: 13px; margin-top: 8px; text-align: center; font-weight: 500; }

.test-app {
  background: var(--paper); border-radius: var(--radius-xl); box-shadow: var(--shadow-card);
  padding: clamp(24px, 5vw, 44px); min-height: 320px; position: relative;
}

.loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 60px 0; color: var(--ink-soft); }
.loader__spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--bg-3);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.step { animation: stepIn .42s var(--ease) both; }
@keyframes stepIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

.step__eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--bg-3); margin-bottom: 8px; }
.step__title { font-size: clamp(22px, 3vw, 28px); color: var(--ink); margin-bottom: 6px; }
.step__subtitle { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 26px; line-height: 1.6; }
.intro-counts { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.intro-counts li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.intro-counts li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.intro-counts strong { color: var(--ink); }

/* Likert rows */
.likert-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }
.likert-row {
  border: 1.5px solid var(--line); border-radius: var(--radius-md); padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  transition: border-color .2s;
}
.likert-row.is-answered { border-color: #d6c6f7; background: var(--paper-soft); }
.likert-row__text { font-size: 15px; color: var(--ink); flex: 1 1 260px; line-height: 1.5; }
.likert-options { display: flex; gap: 8px; flex-wrap: wrap; }
.likert-options input { position: absolute; opacity: 0; pointer-events: none; }
.likert-options label {
  position: relative; padding: 9px 14px; border-radius: 99px; border: 1.5px solid var(--line);
  font-size: 13px; font-weight: 500; color: var(--ink-soft); background: #fff; cursor: pointer;
  transition: all .15s var(--ease); user-select: none;
}
.likert-options label:has(input:checked) {
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2)); color: #fff; border-color: var(--bg-3);
}
.likert-options label:focus-within { outline: 2px solid var(--bg-3); outline-offset: 2px; }

.step__actions { display: flex; justify-content: flex-end; gap: 12px; }
.step__hint { color: var(--danger); font-size: 13px; margin-bottom: 14px; min-height: 18px; }

/* Transition / intro screens inside the test app */
.transition-screen { text-align: center; padding: 30px 0 10px; }
.transition-screen__badge {
  width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #2a1444;
  box-shadow: var(--shadow-soft);
}
.transition-screen h2 { font-size: 24px; color: var(--ink); margin-bottom: 10px; }
.transition-screen p { color: var(--ink-soft); font-size: 14.5px; max-width: 440px; margin: 0 auto 28px; line-height: 1.6; }

/* Results / chart */
.result-screen { text-align: center; }
.result-screen h2 { font-size: 24px; color: var(--ink); margin-bottom: 6px; }
.result-screen p.result-screen__lede { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 18px; }
.result-chart-wrap {
  background: var(--paper-soft); border-radius: var(--radius-lg); padding: 20px; margin: 0 auto 24px;
  max-width: 480px;
}
.result-top {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 99px;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2)); color: #fff; font-weight: 600; font-size: 14px;
  margin-bottom: 22px;
}
.result-scores {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 480px;
  margin: 0 auto 24px; text-align: center;
}
.result-score-item {
  background: var(--paper-soft); border-radius: var(--radius-md); padding: 10px 8px;
  border: 1.5px solid var(--line);
}
.result-score-item--top {
  border-color: var(--accent); background: #fffbef;
}
.result-score-cat {
  display: block; font-weight: 800; font-size: 17px; color: var(--bg-3);
}
.result-score-item--top .result-score-cat { color: var(--accent); }
.result-score-name {
  display: block; font-size: 11px; color: var(--ink-soft); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.result-score-val {
  display: block; font-size: 18px; font-weight: 700; color: var(--ink);
}
.result-score-val small { font-size: 11px; color: var(--ink-soft); font-weight: 400; }

/* Document pages (User Guide / Privacy Policy) */
.stage--doc { max-width: 760px; }
.doc-card {
  background: var(--paper); border-radius: var(--radius-xl); box-shadow: var(--shadow-card);
  padding: clamp(28px, 5vw, 48px);
}
.eyebrow--dark { color: var(--bg-3); }
.doc-card h1 { font-size: clamp(24px, 3vw, 30px); color: var(--ink); margin-bottom: 18px; }
.doc-card h2 { font-size: 17px; color: var(--ink); margin: 26px 0 8px; }
.doc-card__lede { color: var(--ink-soft); font-size: 15px; line-height: 1.7; margin-bottom: 22px; }
.doc-card p { color: var(--ink-soft); font-size: 14.5px; line-height: 1.7; margin-bottom: 4px; }
.doc-card__list { color: var(--ink-soft); font-size: 14.5px; line-height: 1.7; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.doc-card__list strong { color: var(--ink); }
.doc-card__hint {
  margin-top: 28px; padding: 14px 16px; background: var(--paper-soft); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink-soft);
}
.doc-card__hint code { background: var(--line); padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }
.doc-card__embed { margin-top: 24px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--line); }
.doc-card__embed embed { width: 100%; height: 70vh; display: block; }

/* Done page */
.stage--done { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.done-card {
  background: var(--paper); border-radius: var(--radius-xl); box-shadow: var(--shadow-card);
  padding: clamp(36px, 6vw, 56px); max-width: 480px; text-align: center;
}
.done-card__icon {
  width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; animation: pop .5s var(--ease) both;
}
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.done-card__icon--success { background: #e6f9ef; color: var(--success); }
.done-card__icon--error { background: #ffecee; color: var(--danger); }
.done-card h1 { font-size: 23px; color: var(--ink); margin-bottom: 14px; }
.done-card p { color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; margin-bottom: 6px; }
.done-card__hint { font-size: 13px; opacity: .85; margin-bottom: 24px; }
.done-card .btn { margin-top: 10px; }

/* Responsive */
@media (max-width: 820px) {
  .landing-card { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .lang-options { grid-template-columns: 1fr; }
  .likert-row { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; }
  .likert-row__text { flex: none; width: 100%; }
  .likert-options { width: 100%; justify-content: space-between; }
  .likert-options label { flex: 1; text-align: center; }
}
