/* =========================================================
   IMAI – MQL onboarding (split screen)
   ========================================================= */

:root {
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ink: #14121f;
  --ink-2: #4a4760;
  --ink-3: #8b889e;
  --line: #e9e7f1;
  --surface: #ffffff;
  --surface-2: #f7f6fb;

  --brand: #7c5cfc;
  --brand-2: #a78bfa;
  --brand-ink: #5b3fe0;
  --brand-soft: #f1edff;

  --visual-bg: #120d2b;

  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font: inherit; color: inherit; }

/* ---------- Layout ---------- */

.mql {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Left: visual ---------- */

.mql_visual {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: var(--visual-bg);
  isolation: isolate;
}

.mql_visual-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 30%;   /* keep the face in frame */
  z-index: -1;
}
.mql_visual-img[src=""] { display: none; }

/* Placeholder art (hidden once a real image is set) */
.mql_visual-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 80% at 0% 0%, #2a1a6b 0%, transparent 60%),
    radial-gradient(100% 70% at 100% 100%, #3b1f7a 0%, transparent 55%),
    var(--visual-bg);
}

.mql_orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .75;
  animation: mqlFloat 18s var(--ease) infinite alternate;
}
.mql_orb.is-1 { width: 46%; aspect-ratio: 1; background: #7c5cfc; top: 12%; left: 8%; }
.mql_orb.is-2 { width: 38%; aspect-ratio: 1; background: #c084fc; bottom: 10%; right: 6%; animation-delay: -6s; }
.mql_orb.is-3 { width: 28%; aspect-ratio: 1; background: #38bdf8; top: 48%; left: 40%; opacity: .45; animation-delay: -12s; }

@keyframes mqlFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6%, -8%, 0) scale(1.12); }
}

/* Readability layer over image / placeholder */
.mql_visual-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* black tint over the photo + deeper fade behind the text */
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .25) 0%, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .85) 100%),
    rgba(0, 0, 0, .45);
}
.mql_visual-overlay::after {           /* subtle grain for depth */
  content: "";
  position: absolute;
  inset: 0;
  opacity: .08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mql_visual-inner {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  height: 100vh;
  height: 100dvh;
  padding: clamp(32px, 4.5vw, 64px);
}

.mql_logo {
  display: block;
  width: 200px;
  height: auto;
  margin: -4px 0 0 -7px;    /* offset the SVG's built-in padding */
}

.mql_intro { max-width: 520px; margin-top: auto; }

.mql_eyebrow {
  margin: 0 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #d9ccff;
}
.mql_eyebrow-icon {
  flex: none;
  width: 18px;
  height: 18px;
  transform-origin: 70% 90%;          /* pivot at the wrist */
  animation: mqlWave 2.4s ease-in-out .6s 2;
}

/* A short hello wave, played twice on load */
@keyframes mqlWave {
  0%, 60%, 100% { transform: rotate(0); }
  10% { transform: rotate(16deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(16deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}

.mql_title {
  margin: 0 0 20px;
  font-size: clamp(34px, 3.6vw, 56px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -.025em;
}

.mql_lead {
  margin: 0;
  max-width: 440px;
  font-size: clamp(15px, 1.1vw, 17px);
  line-height: 1.65;
  font-weight: 300;
  color: rgba(255, 255, 255, .78);
}

.mql_meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 13px;
  color: rgba(255, 255, 255, .7);
}
.mql_meta li { display: inline-flex; align-items: center; gap: 8px; }
.mql_meta-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, .2);
}

/* ---------- Right: panel ---------- */

.mql_panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 5vw, 80px);
  background:
    radial-gradient(60% 40% at 100% 0%, #f4f0ff 0%, transparent 70%),
    var(--surface);
}

.mql_panel-inner {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
}

.mql_top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  margin-bottom: 14px;
}

.mql_back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 6px;
  margin-left: -6px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .2s, color .2s, opacity .25s;
}
.mql_back:hover { background: var(--surface-2); color: var(--ink); }
.mql_back[disabled] { opacity: 0; pointer-events: none; }

.mql_count {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.mql_progress {
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: clamp(36px, 5vh, 56px);
}
.mql_progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .5s var(--ease);
}

/* Question */

.mql_stage { transition: opacity .28s var(--ease), transform .28s var(--ease); }
.mql_stage.is-leaving  { opacity: 0; transform: translateX(-16px); }
.mql_stage.is-entering { opacity: 0; transform: translateX(16px); transition: none; }
.mql_stage.is-back.is-leaving  { transform: translateX(16px); }
.mql_stage.is-back.is-entering { transform: translateX(-16px); }

.mql_question {
  margin: 0 0 8px;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.015em;
}

.mql_hint {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-3);
}
.mql_hint:empty { display: none; }
.mql_question + .mql_hint:empty { margin: 0; }
.mql_question:has(+ .mql_hint:empty) { margin-bottom: 28px; }

.mql_options {
  display: grid;
  gap: 10px;
}

.mql_option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 64px;
  padding: 14px 20px 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  animation: mqlIn .45s var(--ease) forwards;
  transition: border-color .2s, box-shadow .2s, background .2s, transform .2s var(--ease);
}
@media (hover: hover) {
  .mql_option:hover {
    border-color: #cfc5ff;
    box-shadow: 0 8px 24px -12px rgba(92, 63, 224, .35);
    transform: translateY(-1px);
  }
  .mql_option:hover .mql_option-key { border-color: #cfc5ff; color: var(--brand-ink); }
}
.mql_option:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(124, 92, 252, .18);
}
.mql_option.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px var(--brand) inset;
}

@keyframes mqlIn { to { opacity: 1; transform: none; } }

.mql_option-key {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  transition: all .2s;
}
.mql_option.is-selected .mql_option-key {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.mql_option-label { flex: 1; }

.mql_option-check {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--brand);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .2s, transform .25s var(--ease);
}
.mql_option.is-selected .mql_option-check { opacity: 1; transform: none; }

/* Footer */

.mql_footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.mql_skip {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  text-decoration: none;
  transition: color .2s;
}
.mql_skip:hover { color: var(--ink); }

.mql_kbd-hint {
  font-size: 12px;
  color: var(--ink-3);
}

/* Done */

.mql_done { animation: mqlIn .5s var(--ease) forwards; opacity: 0; }
.mql_done-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
}
.mql_cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 14px 22px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s, transform .2s var(--ease);
}
.mql_cta:hover { background: var(--brand-ink); transform: translateY(-1px); }

.mql.is-done .mql_top,
.mql.is-done .mql_progress,
.mql.is-done .mql_footer { display: none; }

/* ---------- Tablet ---------- */

@media (max-width: 1100px) {
  .mql { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .mql_meta { flex-direction: column; }
}

/* ---------- Mobile: stacked, header collapses after Q1 ---------- */

@media (max-width: 767px) {
  .mql { display: block; }

  .mql_visual-inner {
    position: relative;
    height: auto;
    gap: 28px;
    padding: 20px 20px 32px;
    padding-top: max(20px, env(safe-area-inset-top));
  }

  .mql_logo { width: 150px; margin: -3px 0 0 -5px; }
  .mql_eyebrow { margin-bottom: 14px; font-size: 11px; }
  .mql_title { font-size: 30px; margin-bottom: 12px; }
  .mql_lead { font-size: 14px; }
  .mql_meta { display: none; }
  .mql_visual-overlay { background: rgba(0, 0, 0, .62); }

  /* Collapse intro once the user starts answering */
  .mql_intro, .mql_visual-inner {
    transition: all .45s var(--ease);
  }
  .mql_lead, .mql_eyebrow {
    display: block;
    max-height: 200px;
    overflow: hidden;
    transition: max-height .45s var(--ease), opacity .3s, margin .45s var(--ease);
  }
  .mql_eyebrow { display: inline-flex; }
  .mql.is-compact .mql_visual-inner { gap: 12px; padding-bottom: 36px; }
  .mql.is-compact .mql_lead,
  .mql.is-compact .mql_eyebrow { max-height: 0; opacity: 0; margin: 0; }
  .mql.is-compact .mql_title { font-size: 20px; margin: 0; transition: font-size .45s var(--ease); }

  .mql_panel {
    display: block;
    padding: 24px 20px calc(96px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    margin-top: -16px;
    position: relative;
  }

  .mql_progress { margin-bottom: 28px; }
  .mql_question { font-size: 22px; }
  .mql_hint { font-size: 14px; margin-bottom: 20px; }
  .mql_question:has(+ .mql_hint:empty) { margin-bottom: 20px; }

  .mql_option { min-height: 58px; padding: 12px 16px 12px 12px; font-size: 15px; }

  /* Sticky footer so "Skip" is always reachable */
  .mql_footer {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 10;
    margin: 0;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    justify-content: center;
  }
  .mql_kbd-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .mql_option, .mql_done { opacity: 1; transform: none; }
}
