/* Qadra Labs — gaya untuk lapisan keterlibatan (engage.js).
   Memakai token warna dari styles.css sehingga otomatis mengikuti tema gelap/terang. */

/* ---------- Label waktu baca (cognitive ease) ---------- */
.read-time { display: inline-flex; align-items: center; gap: 5px; margin-left: 12px; padding: 3px 9px; border-radius: 999px; font-size: 10.5px; letter-spacing: 0.04em; color: var(--muted); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); vertical-align: middle; }
.read-time .ic { width: 12px; height: 12px; }
[data-theme="light"] .read-time { background: rgba(15, 23, 42, 0.04); }

.link-cta { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--cyan); font: inherit; font-size: 13.5px; font-weight: 700; text-decoration: none; cursor: pointer; }
.link-cta .ic { transition: transform .2s var(--ease); }
.link-cta:hover .ic { transform: translateX(3px); }

/* ---------- 1. Sebelum & Sesudah ---------- */
.ba-switch { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 22px; border-radius: 14px; background: rgba(4, 7, 16, 0.7); border: 1px solid var(--line); isolation: isolate; }
.ba-switch button { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 13.5px; font-weight: 700; cursor: pointer; transition: color .25s; }
.ba-switch button[aria-pressed="true"] { color: var(--paper); }
.ba-switch button[data-ba="before"][aria-pressed="true"] .ic { color: var(--danger); }
.ba-switch button[data-ba="after"][aria-pressed="true"] .ic { color: var(--emerald); }
.ba-thumb { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 10px; background: linear-gradient(135deg, rgba(244, 114, 114, 0.18), rgba(244, 114, 114, 0.08)); box-shadow: inset 0 0 0 1px rgba(244, 114, 114, 0.4); transition: transform .45s var(--ease), background .45s, box-shadow .45s; }
.ba-switch:has(button[data-ba="after"][aria-pressed="true"]) .ba-thumb { transform: translateX(100%); background: linear-gradient(135deg, rgba(76, 194, 154, 0.22), rgba(94, 226, 239, 0.12)); box-shadow: inset 0 0 0 1px rgba(76, 194, 154, 0.5); }
[data-theme="light"] .ba-switch { background: rgba(15, 23, 42, 0.05); }

.ba-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.ba-card { position: relative; display: grid; min-height: 248px; border-radius: 20px; cursor: pointer; perspective: 1200px; outline-offset: 4px; -webkit-tap-highlight-color: transparent; }
.ba-face { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 20px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .7s var(--ease), opacity .5s; transition-delay: var(--d, 0ms); }
.ba-face h3 { font-size: 17px; line-height: 1.3; font-weight: 800; letter-spacing: -0.015em; text-wrap: balance; }
.ba-face p { font-size: 13.5px; color: var(--soft); line-height: 1.6; }
.ba-before { background-image: linear-gradient(160deg, rgba(244, 114, 114, 0.1), transparent 55%); border-color: rgba(244, 114, 114, 0.22); }
.ba-before h3 { color: var(--paper); text-decoration: line-through; text-decoration-color: rgba(244, 114, 114, 0); text-decoration-thickness: 2px; transition: text-decoration-color .4s; }
.ba-card:hover .ba-before h3 { text-decoration-color: rgba(244, 114, 114, 0.55); }
.ba-after { transform: rotateY(180deg); background-image: linear-gradient(160deg, color-mix(in srgb, var(--c) 20%, transparent), transparent 60%); border-color: color-mix(in srgb, var(--c) 45%, transparent); box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--c) 60%, transparent); }
.ba-card.is-after .ba-before { transform: rotateY(-180deg); }
.ba-card.is-after .ba-after { transform: rotateY(0deg); }
.ba-tag { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 10px; border-radius: 999px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; }
.ba-tag .ic { width: 13px; height: 13px; }
.ba-tag.bad { color: var(--danger); background: rgba(244, 114, 114, 0.1); border: 1px solid rgba(244, 114, 114, 0.3); }
.ba-tag.good { color: color-mix(in srgb, var(--c) 75%, #fff); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
[data-theme="light"] .ba-tag.good { color: color-mix(in srgb, var(--c) 70%, #000); }
.ba-hint { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.ba-hint .ic { width: 14px; height: 14px; }
.ba-app { margin-top: auto; display: flex; align-items: center; gap: 10px; }
.ba-app img { width: 28px; height: 28px; border-radius: 8px; }
.ba-app .link-cta { color: color-mix(in srgb, var(--c) 70%, var(--paper)); }

/* ---------- 2. Kuis Mitos atau Fakta ---------- */
.quiz { position: relative; max-width: 860px; margin: 0 auto; padding: 26px 28px 28px; overflow: hidden; }
.quiz::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s; }
.quiz.pop-ok::before { opacity: 1; background: radial-gradient(600px circle at 50% 0%, rgba(76, 194, 154, 0.16), transparent 60%); }
.quiz.pop-no::before { opacity: 1; background: radial-gradient(600px circle at 50% 0%, rgba(244, 114, 114, 0.12), transparent 60%); }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }
.quiz-dots { display: flex; gap: 6px; flex: 1; justify-content: center; }
.quiz-dots i { width: 34px; height: 5px; border-radius: 5px; background: var(--line-strong); transition: background .3s, transform .3s; }
.quiz-dots i.now { background: var(--cyan); animation: qdot 1.4s ease-in-out infinite; }
.quiz-dots i.ok { background: var(--emerald); }
.quiz-dots i.no { background: var(--danger); }
@keyframes qdot { 50% { opacity: 0.45; } }
.quiz-score { color: var(--gold-lit); }
.quiz-q { margin: 26px 0 22px; font-size: clamp(19px, 2.4vw, 25px); font-weight: 700; line-height: 1.4; letter-spacing: -0.015em; text-wrap: balance; text-align: center; }
.quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; margin: 0 auto; }
.quiz-choice { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 12px; border-radius: 16px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); cursor: pointer; transition: transform .2s var(--ease), border-color .2s, background .2s, opacity .3s; }
.quiz-choice b { font-size: 17px; }
.quiz-choice small { font-size: 12px; color: var(--muted); }
.quiz-choice:not(:disabled):hover { transform: translateY(-2px); border-color: var(--cyan); background: rgba(94, 226, 239, 0.08); }
.quiz-choice:disabled { cursor: default; opacity: 0.5; }
.quiz-choice.right { opacity: 1; border-color: var(--emerald); background: rgba(76, 194, 154, 0.14); }
.quiz-choice.wrong { opacity: 1; border-color: var(--danger); background: rgba(244, 114, 114, 0.12); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
[data-theme="light"] .quiz-choice { background: rgba(15, 23, 42, 0.03); }
.quiz-fb { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.quiz-fb:not(:empty) { margin-top: 22px; animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.quiz-verdict { width: 100%; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.quiz-verdict > span { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; }
.quiz-verdict.ok > span { color: var(--emerald); }
.quiz-verdict.no > span { color: var(--danger); }
.quiz-verdict p { display: flex; gap: 10px; margin-top: 8px; color: var(--soft); font-size: 14.5px; }
.quiz-verdict p .ic { margin-top: 3px; color: var(--gold); }
.quiz-end { display: flex; align-items: center; gap: 26px; margin-top: 22px; }
.quiz-end h3 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
.quiz-end p { margin-top: 6px; color: var(--soft); font-size: 14.5px; }
.quiz-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.quiz-ring { --p: 0; flex: none; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--emerald) calc(var(--p) * 1%), var(--line-strong) 0); position: relative; }
.quiz-ring::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface-solid); }
.quiz-ring b { position: relative; z-index: 1; font-size: 30px; }
.quiz-ring small { font-size: 14px; color: var(--muted); }

/* ---------- 4. Jejak Baca ---------- */
/* Di desktop, jejak baca ditumpuk di kanan bawah tepat di atas tombol kembali-ke-atas
   agar tidak menutupi awal baris teks yang rata kiri. */
.trail { --p: 0; position: fixed; right: 24px; bottom: 82px; z-index: 50; }
@media (min-width: 1180px) { .trail { right: 22px; } }
.trail-chip { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px 0 6px; border-radius: 16px; border: 1px solid var(--line-strong); background: rgba(10, 16, 32, 0.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--paper); cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); transition: border-color .2s, transform .2s var(--ease); }
.trail-chip:hover { border-color: var(--cyan); }
.trail-ring { position: relative; width: 34px; height: 34px; display: grid; place-items: center; color: var(--cyan); }
.trail-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.trail-ring circle { fill: none; stroke-width: 3; }
.trail-ring .bg { stroke: var(--line-strong); }
.trail-ring .fg { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p)); transition: stroke-dashoffset .8s var(--ease), stroke .4s; }
.trail-ring .ic { width: 15px; height: 15px; }
.trail.done .trail-ring .fg { stroke: var(--gold); }
.trail.done .trail-ring { color: var(--gold); }
.trail-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.trail-txt b { font-size: 13px; }
.trail-txt small { font-size: 10.5px; color: var(--muted); font-weight: 600; }
/* Chip ringkas (cincin progres saja), selebar tombol kembali-ke-atas; detail ada di tooltip & panel. */
.trail-chip { width: 46px; justify-content: center; padding: 0; }
.trail-txt { display: none; }
.trail.bump .trail-chip { animation: bump .6s var(--ease); }
@keyframes bump { 30% { transform: scale(1.08); border-color: var(--cyan); } }
.trail-panel { position: absolute; right: 0; bottom: 56px; width: 260px; max-height: min(70vh, 520px); overflow: auto; padding: 14px; background: var(--surface-solid); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45); animation: rise .3s var(--ease); }
.trail-head { display: flex; flex-direction: column; gap: 2px; padding: 2px 4px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.trail-head b { font-size: 14px; }
.trail-head small { font-size: 12px; color: var(--muted); }
.trail-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.trail-list a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; color: var(--soft); text-decoration: none; font-size: 13px; font-weight: 600; }
.trail-list a:hover { background: rgba(94, 226, 239, 0.08); color: var(--paper); }
.trail-list a i { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1.5px dashed var(--muted); }
.trail-list a .ic { width: 14px; height: 14px; color: var(--emerald); }
.trail-list li.seen a { color: var(--muted); }
html.locked .trail { opacity: 0; pointer-events: none; }
.trail { transition: opacity .25s, transform .25s var(--ease); }
.trail.idle { opacity: 0; pointer-events: none; transform: translateY(10px); }
.trail.idle .trail-chip { visibility: hidden; transition: visibility 0s .25s; }
[data-theme="light"] .trail-chip { background: rgba(255, 255, 255, 0.94); box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14); }
[data-theme="light"] .trail-panel { box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18); }

/* ---------- 5. Langkah Anda Berikutnya ---------- */
.ns { position: relative; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 28px; padding: 36px; overflow: hidden; border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.ns::before { content: ""; position: absolute; right: -120px; top: -160px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%); filter: blur(30px); pointer-events: none; }
.ns h2 { margin-top: 10px; font-size: clamp(26px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.12; text-wrap: balance; }
.ns-lede { margin-top: 12px; color: var(--muted); font-size: 14.5px; max-width: 52ch; }
.ns-pick { display: flex; align-items: center; gap: 16px; margin-top: 22px; padding: 16px; border-radius: 18px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.ns-pick img { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 35%, transparent); }
.ns-pick > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ns-pick small { font-size: 10.5px; letter-spacing: 0.14em; color: color-mix(in srgb, var(--accent) 75%, var(--paper)); }
.ns-pick b { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.ns-pick span { font-size: 13px; color: var(--muted); }
.ns-pick em { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-style: normal; font-size: 12.5px; color: var(--soft); }
.ns-pick em .ic { width: 14px; height: 14px; color: var(--danger); }
.ns-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 20px; }
.ns-assure { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 20px; font-size: 13px; color: var(--muted); }
.ns-assure li { display: inline-flex; align-items: center; gap: 6px; }
.ns-assure .ic { color: var(--emerald); width: 15px; height: 15px; }
.ns-side { position: relative; align-self: start; display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: 20px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
[data-theme="light"] .ns-side { background: rgba(15, 23, 42, 0.03); }
.ns-progress { --p: 0; display: flex; align-items: center; gap: 14px; }
.ns-progress > div:last-child { display: flex; flex-direction: column; gap: 2px; }
.ns-progress b { font-size: 15px; }
.ns-progress small { font-size: 12.5px; color: var(--muted); }
.ns-ring { position: relative; flex: none; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--line-strong) 0); }
.ns-ring::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface-solid); }
.ns-ring b { position: relative; z-index: 1; font-size: 20px; }
.ns-ring small { font-size: 11px; color: var(--muted); }
.ns-unseen { display: flex; flex-wrap: wrap; gap: 8px; }
.ns-unseen .chip { text-decoration: none; padding: 6px 11px; font-size: 12px; }
.ns-unseen .chip .ic { width: 12px; height: 12px; }
.ns-unseen .chip:hover { border-color: var(--cyan); color: var(--paper); }
.ns-share { display: flex; flex-direction: column; gap: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.ns-share b { font-size: 14.5px; }
.ns-share small { font-size: 12.5px; color: var(--muted); }
.ns-share-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- 6. Sapaan pengunjung kembali ---------- */
.resume { position: fixed; left: 50%; top: 92px; z-index: 70; display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 18px; max-width: calc(100% - 24px); background: var(--surface-solid); box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45); transform: translate(-50%, -16px); opacity: 0; transition: transform .4s var(--ease), opacity .4s; }
.resume.show { transform: translate(-50%, 0); opacity: 1; }
.resume > div { display: flex; flex-direction: column; min-width: 0; }
.resume b { font-size: 14px; }
.resume small { font-size: 12.5px; color: var(--muted); }
.resume-x { width: 30px; height: 30px; flex: none; border-radius: 9px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.resume-x:hover { color: var(--paper); border-color: var(--line-strong); }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 140; pointer-events: none; }

/* ---------- Responsif ---------- */
@media (max-width: 1080px) {
  .ba-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 940px) {
  .ns { grid-template-columns: 1fr; padding: 28px 24px; }
}
@media (max-width: 820px) {
  /* Di HP, jejak baca menjadi tombol bulat kecil di kiri bawah, sejajar tombol kembali-ke-atas. */
  .trail { left: 12px; right: auto; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .trail-chip { width: auto; height: 42px; padding: 0 4px; border-radius: 14px; }
  .trail-panel { left: 0; right: auto; bottom: 52px; width: min(280px, calc(100vw - 24px)); }
  .resume { top: 84px; }
}
@media (max-width: 620px) {
  .ba-grid { grid-template-columns: 1fr; gap: 12px; }
  .ba-card { min-height: 0; }
  .ba-face { padding: 18px 16px; }
  .ba-switch { display: grid; width: 100%; }
  .ba-switch button { padding: 10px 8px; font-size: 13px; }
  .quiz { padding: 20px 16px 22px; }
  .quiz-dots i { width: 22px; }
  .quiz-q { margin: 20px 0 18px; }
  .quiz-end { flex-direction: column; text-align: center; gap: 16px; }
  .quiz-end .quiz-acts { justify-content: center; }
  .ns { padding: 24px 18px; }
  .ns-pick { align-items: flex-start; }
  .ns-pick img { width: 52px; height: 52px; }
  .ns-acts .btn { flex: 1 1 100%; }
  .read-time { margin-left: 0; margin-top: 8px; display: flex; width: max-content; }
  .resume { gap: 10px; padding: 10px 10px 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ba-face, .trail-ring .fg, .ba-thumb { transition: none; }
  .quiz-dots i.now, .trail.bump .trail-chip, .quiz-choice.wrong { animation: none; }
}
