/* PO Maturity Assessment — camada visual. A lógica do quiz vive em script.js. */

/* ===== Design tokens ===== */
:root {
  color-scheme: light dark;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --text: #0b1f35;
  --text-muted: #55677e;
  --border: #e1e7ef;
  --border-strong: #c7d1de;

  --accent: #0a2647;
  --accent-strong: #081b33;
  --accent-soft: rgba(10, 38, 71, 0.08);
  --accent-text: #ffffff;
  --ring: rgba(10, 38, 71, 0.35);
  --ring-soft: rgba(10, 38, 71, 0.14);

  --hl-a: #0a2647;
  --hl-b: #6667e3;

  --glow-a: rgba(10, 38, 71, 0.14);
  --glow-b: rgba(102, 103, 227, 0.1);

  /* cores dos 5 níveis (segmentos, dots, badge) */
  --l1: #dc2626;
  --l2: #ea580c;
  --l3: #b45309;
  --l4: #047857;
  --l5: #4338ca;
  /* variantes seguras para texto pequeno (WCAG AA sobre surface) */
  --l1t: #b91c1c;
  --l2t: #c2410c;
  --l3t: #92400e;
  --l4t: #047857;
  --l5t: #4338ca;
  --on-level: #ffffff;

  --shadow-sm: 0 1px 2px rgba(21, 21, 43, 0.04), 0 4px 12px rgba(21, 21, 43, 0.05);
  --shadow-lg:
    0 2px 4px rgba(21, 21, 43, 0.04),
    0 12px 32px rgba(21, 21, 43, 0.09),
    0 40px 80px -32px rgba(21, 21, 43, 0.16);

  --radius-md: 14px;
  --radius-xl: 24px;

  --font-display: "Plus Jakarta Sans", "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1424;
    --surface: #101b2e;
    --surface-2: #16223a;
    --text: #eef2f8;
    --text-muted: #9fadc2;
    --border: #223252;
    --border-strong: #33456e;

    --accent: #8b93f0;
    --accent-strong: #a7acf6;
    --accent-soft: rgba(139, 147, 240, 0.14);
    --accent-text: #0a1424;
    --ring: rgba(139, 147, 240, 0.32);
    --ring-soft: rgba(139, 147, 240, 0.18);

    --hl-a: #8b93f0;
    --hl-b: #b7bbf8;

    --glow-a: rgba(139, 147, 240, 0.15);
    --glow-b: rgba(10, 38, 71, 0.3);

    --l1: #f87171;
    --l2: #fb923c;
    --l3: #fbbf24;
    --l4: #34d399;
    --l5: #818cf8;
    --l1t: #f87171;
    --l2t: #fb923c;
    --l3t: #fbbf24;
    --l4t: #34d399;
    --l5t: #a5b4fc;
    --on-level: #10102a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.45);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(720px circle at 12% -8%, var(--glow-a), transparent 60%),
    radial-gradient(560px circle at 105% 8%, var(--glow-b), transparent 55%),
    radial-gradient(640px circle at 50% 118%, var(--glow-a), transparent 60%);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-logo {
  height: 32px;
  width: auto;
  display: block;
}

.wrap {
  max-width: 660px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) 20px calc(48px + env(safe-area-inset-bottom));
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

/* ===== Intro ===== */
.intro {
  min-height: calc(100svh - 205px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-inner {
  text-align: center;
  animation: fade-up 0.7s var(--ease-out) both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 22px;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6.4vw, 2.6rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 0 0 18px;
  text-wrap: balance;
}

h1 .hl {
  background: linear-gradient(92deg, var(--hl-a), var(--hl-b));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--hl-a);
}

.lead {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 34em;
  margin: 0 auto 26px;
  text-wrap: pretty;
}

.levels-strip {
  list-style: none;
  margin: 0 auto 32px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
}

.levels-strip li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.levels-strip li + li::before {
  content: "›";
  margin-right: 10px;
  color: var(--border-strong);
  font-weight: 700;
}

.lv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.l1 .lv-dot { background: var(--l1); }
.l2 .lv-dot { background: var(--l2); }
.l3 .lv-dot { background: var(--l3); }
.l4 .lv-dot { background: var(--l4); }
.l5 .lv-dot { background: var(--l5); }

.fineprint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 18px 0 0;
}

.fineprint svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.75;
}

/* ===== Botões ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 15px 30px;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease-out),
    box-shadow 0.18s var(--ease-out),
    background-color 0.18s ease,
    border-color 0.18s ease,
    opacity 0.18s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-text);
  box-shadow: 0 10px 24px -8px var(--ring), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--border-strong);
}

@media (hover: hover) {
  .btn-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -8px var(--ring), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  }

  .btn-ghost:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
  }
}

.btn-lg {
  padding: 17px 34px;
  font-size: 1.05rem;
}

.btn-sm {
  padding: 11px 22px;
  font-size: 0.9rem;
}

.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ===== Quiz ===== */
.quiz {
  padding-top: 8px;
}

.quiz-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  animation: fade-up 0.5s var(--ease-out) both;
}

.icon-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s var(--ease-out);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (hover: hover) {
  .icon-btn:not(:disabled):hover {
    border-color: var(--accent);
    color: var(--accent);
  }
}

.icon-btn:not(:disabled):active {
  transform: scale(0.94);
}

.quiz-progress {
  flex: 1;
  min-width: 0;
}

.progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

#progress-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

#progress-pct {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hl-a), var(--hl-b));
  transition: width 0.5s var(--ease-out);
}

/* Cartão de pergunta */
.question-holder {
  display: grid;
}

.q-card {
  grid-area: 1 / 1;
  margin: 0;
  min-inline-size: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: clamp(20px, 4.5vw, 30px);
}

.q-card:focus {
  outline: none;
}

.q-card legend {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0 0 18px;
}

.q-text {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.12rem, 3.8vw, 1.32rem);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

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

.options.locked {
  pointer-events: none;
}

.option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s var(--ease-out);
}

@media (hover: hover) {
  .option:not(.selected):hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
    transform: translateY(-1px);
  }
}

.option:active {
  transform: scale(0.99);
}

.option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.option-letter {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1.5px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.option-text {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
  padding-top: 3px;
}

.option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--ring-soft);
}

.option.selected .option-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  animation: pop 0.32s var(--ease-out);
}

.quiz-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  min-height: 44px;
}

/* Transições de pergunta */
.q-card.enter-right {
  animation: slide-in-right 0.42s var(--ease-out) both;
}

.q-card.enter-left {
  animation: slide-in-left 0.42s var(--ease-out) both;
}

.q-card.exit-left {
  animation: slide-out-left 0.28s ease both;
  pointer-events: none;
}

.q-card.exit-right {
  animation: slide-out-right 0.28s ease both;
  pointer-events: none;
}

/* ===== Resultado ===== */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  text-align: center;
}

.result-card.l1 { --lv: var(--l1); --lvt: var(--l1t); }
.result-card.l2 { --lv: var(--l2); --lvt: var(--l2t); }
.result-card.l3 { --lv: var(--l3); --lvt: var(--l3t); }
.result-card.l4 { --lv: var(--l4); --lvt: var(--l4t); }
.result-card.l5 { --lv: var(--l5); --lvt: var(--l5t); }

.rv {
  animation: fade-up 0.55s var(--ease-out) both;
  animation-delay: var(--d, 0s);
}

.result-hero {
  padding: clamp(30px, 6vw, 40px) 24px 24px;
  background: var(--accent-soft);
  background: linear-gradient(180deg, color-mix(in srgb, var(--lv) 14%, transparent), transparent 92%);
}

.result-eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.result-badge {
  width: 74px;
  height: 74px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: var(--lv);
  color: var(--on-level);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  box-shadow: 0 14px 30px -12px var(--lv);
  animation: pop-in 0.6s var(--ease-out) 0.1s both;
}

.result-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}

.result-levelnum {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--lvt);
  margin-bottom: 6px;
}

.result-subtitle {
  color: var(--lvt);
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
}

.result-body {
  padding: 22px clamp(20px, 5.5vw, 38px) clamp(26px, 5.5vw, 34px);
}

/* Escala dos 5 níveis */
.scale {
  max-width: 440px;
  margin: 0 auto 26px;
}

.scale-track {
  position: relative;
  display: flex;
  gap: 5px;
  height: 12px;
}

.scale-seg {
  flex: 1;
  border-radius: 999px;
  opacity: 0.25;
  transition: opacity 0.4s ease;
}

.scale-seg.on {
  opacity: 1;
}

.scale-seg.l1 { background: var(--l1); }
.scale-seg.l2 { background: var(--l2); }
.scale-seg.l3 { background: var(--l3); }
.scale-seg.l4 { background: var(--l4); }
.scale-seg.l5 { background: var(--l5); }

.scale-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--lv);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: left 0.9s var(--ease-out) 0.35s;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 10px;
}

.result-desc {
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 18px;
}

.result-score {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  background: color-mix(in srgb, var(--lv) 10%, transparent);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin: 0 0 24px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

@media (min-width: 480px) {
  .result-actions {
    flex-direction: row;
    justify-content: center;
  }
}

/* ===== Animações ===== */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(36px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-36px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slide-out-left {
  to {
    opacity: 0;
    transform: translateX(-36px);
  }
}

@keyframes slide-out-right {
  to {
    opacity: 0;
    transform: translateX(36px);
  }
}

@keyframes pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.06);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ===== Acessibilidade: movimento reduzido ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

/* ===== Ajustes finos mobile ===== */
@media (max-width: 400px) {
  .wrap {
    padding-left: 14px;
    padding-right: 14px;
  }

  .option {
    padding: 12px;
    gap: 10px;
  }

  .btn-lg {
    width: 100%;
  }
}
