/* ==========================================================================
   Avarith Learn — app.css
   Shell demo (dikunci topik "Atur duit"): .onb .gen .grove .node .blurt .dash
   Tenang, 1 kolom, token Learn. Semua animasi hormatin prefers-reduced-motion.
   Markup dirender demo.js ke #demo-root. Sheet in-demo pakai .blurt-sheet.
   ========================================================================== */

/* --- Kanvas demo: 1 kolom, tenang, ada nafas --- */
.demo-root {
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(28px, 5vw, 56px) 24px 88px;
  min-height: calc(100vh - var(--nav-h));
}

/* Screen fade masuk (halus, sekali per transisi). */
.demo-screen {
  animation: demo-in var(--dur) var(--ease) both;
}
@keyframes demo-in {
  from { opacity: 0; transform: translateY(var(--rise)); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   DASH — header topik (dipakai di grove & node)
   ========================================================================== */
.dash {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 22px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--hair);
}
.dash__label {
  font-size: var(--eyebrow);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.dash__topic {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
}
.dash__meter {
  margin-left: auto;
  min-width: 168px;
  text-align: right;
}
.dash__meter-num {
  font-size: var(--small);
  color: var(--muted);
  margin-bottom: 6px;
}
.dash__meter-num b { color: var(--accent); font-weight: 600; }
.dash__track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--hair);
  overflow: hidden;
}
.dash__fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--fill);
  transition: width 700ms var(--ease);
}

/* ==========================================================================
   ONBOARDING — satu kartu terkunci "Atur duit" (search dihapus)
   ========================================================================== */
.onb { text-align: center; padding-top: clamp(16px, 4vw, 40px); }
.onb__title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  margin-bottom: 12px;
}
.onb__sub {
  color: var(--muted);
  max-width: 46ch;
  margin: 0 auto 40px;
}

/* Kartu topik terkunci — satu-satunya pilihan (chip lain gaada di DOM). */
.onb__card {
  max-width: 440px;
  margin-inline: auto;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: left;
}
.onb__card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.onb__seed { width: 44px; height: 44px; flex: none; }
.onb__card-title {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 500;
}
.onb__lock {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--tiny);
  color: var(--muted);
}
.onb__lock svg { width: 14px; height: 14px; }
.onb__card-sub {
  color: var(--muted);
  font-size: var(--small);
  margin-bottom: 24px;
}
.onb__start { width: 100%; }

/* ==========================================================================
   GENERATING — "Avarith lagi nyemai peta" (seedbed tenang)
   ========================================================================== */
.gen {
  text-align: center;
  padding-top: clamp(48px, 12vh, 120px);
}
.gen__seedbed {
  display: inline-flex;
  gap: 12px;
  margin-bottom: 28px;
}
.gen__seed {
  width: 12px;
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--sage);
  animation: gen-pulse 1.2s var(--ease) infinite;
}
.gen__seed:nth-child(2) { animation-delay: 0.2s; }
.gen__seed:nth-child(3) { animation-delay: 0.4s; }
.gen__seed:nth-child(4) { animation-delay: 0.6s; }
@keyframes gen-pulse {
  0%, 100% { transform: translateY(0); background: var(--sage); }
  50%      { transform: translateY(-6px); background: var(--fill); }
}
.gen__title {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 8px;
}
.gen__sub { color: var(--muted); font-size: var(--small); }

/* ==========================================================================
   GROVE — kebun: 4–6 node pohon, ring soil = % mastery, prasyarat = akar
   ========================================================================== */
.grove__intro {
  color: var(--muted);
  font-size: var(--small);
  margin-bottom: 26px;
  max-width: 52ch;
}

.grove__garden {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

/* Satu pohon = satu button (klik → workspace). --m = mastery utk warna daun. */
.tree {
  --leaf: color-mix(in oklab, var(--sage), var(--fill) calc(var(--m) * 1%));
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 14px 16px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  text-align: center;
  color: var(--ink);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease),
              border-color 160ms var(--ease);
}
.tree:not(:disabled):hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--sage);
}
.tree__svg { width: 96px; height: auto; }
.tree__crown-lo { fill: color-mix(in oklab, var(--leaf), #3f513b 22%); }
.tree__crown    { fill: var(--leaf); }
.tree__crown-hi { fill: color-mix(in oklab, var(--leaf), #ffffff 20%); }
.tree__trunk    { fill: #7B6A50; }
.tree__trunk-lo { fill: #5F5540; }
.tree__ring-track { stroke: var(--hair); }
.tree__ring-fill  { stroke: var(--accent); transition: stroke-dashoffset 700ms var(--ease); }

.tree__name {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.15;
}
.tree__mastery { font-size: var(--tiny); color: var(--muted); }

/* Node rekomendasi berikutnya — 1 penanda tenang, bukan glow. */
.tree--next { border-color: var(--accent); }
.tree__badge {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--card);
  background: var(--fill);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

/* Node terkunci — prasyarat (akar) belum kuat. */
.tree:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  background: transparent;
  border-style: dashed;
}
.tree__req {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--tiny);
  color: var(--muted);
}
.tree__req svg { width: 12px; height: 12px; }

/* ==========================================================================
   NODE — workspace: lesson artikel + blurting hero
   ========================================================================== */
.node__back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-weight: 500;
  font-size: var(--small);
  margin-bottom: 24px;
}
.node__back:hover { text-decoration: underline; }

.node__title {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 500;
  margin-bottom: 10px;
}

.node__lesson {
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 28px 30px;
  margin-bottom: 28px;
}
.node__lesson-eyebrow {
  font-size: var(--eyebrow);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.node__lesson h4 {
  font-family: var(--font-head);
  font-size: var(--h3);
  font-weight: 500;
  margin: 20px 0 8px;
}
.node__lesson p { margin-bottom: 12px; }
.node__lesson p:last-child { margin-bottom: 0; }
.node__lesson.is-collapsed { display: none; }

.node__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: var(--small);
  margin-bottom: 28px;
}
.node__toggle:hover { color: var(--ink); }

/* ==========================================================================
   BLURT — hero recall: textarea + tanda nyantol/kurang-presisi/kelewat
   ========================================================================== */
.blurt {
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 28px 30px;
}
.blurt__eyebrow {
  font-size: var(--eyebrow);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.blurt__prompt {
  font-family: var(--font-head);
  font-size: var(--h3);
  font-weight: 500;
  margin-bottom: 6px;
}
.blurt__hint {
  color: var(--muted);
  font-size: var(--small);
  margin-bottom: 18px;
}
.blurt__input {
  display: block;
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--hair);
  border-radius: var(--r-btn);
  padding: 16px 18px;
  resize: vertical;
  min-height: 130px;
  transition: border-color 160ms var(--ease);
}
.blurt__input:focus-visible { outline: none; border-color: var(--accent); }
.blurt__input::placeholder { color: var(--sage); }
.blurt__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}
.blurt__count { font-size: var(--tiny); color: var(--muted); }

/* Hasil penilaian (unhide sesudah cek). */
.blurt__result { margin-top: 26px; }
.blurt__score {
  font-family: var(--font-head);
  font-size: var(--h3);
  font-weight: 500;
  margin-bottom: 4px;
}
.blurt__score b { color: var(--accent); }
.blurt__delta {
  font-size: var(--small);
  color: var(--muted);
  margin-bottom: 18px;
}
.blurt__delta b { color: var(--accent); font-weight: 600; }

.blurt__chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chip {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: var(--small);
  padding: 10px 14px;
  border-radius: var(--r-btn);
  line-height: 1.4;
}
.chip__tag {
  flex: none;
  font-size: var(--tiny);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chip--nyantol { background: rgba(78, 138, 87, 0.10); }
.chip--nyantol .chip__tag { color: var(--accent); }
.chip--kurang { background: rgba(157, 191, 138, 0.16); }
.chip--kurang .chip__tag { color: #6f8a5c; }
.chip--kelewat {
  border: 1px dashed var(--hair);
  color: var(--muted);
}
.chip--kelewat .chip__tag { color: var(--muted); }

/* ==========================================================================
   BLURT-SHEET — ask utama in-demo (muncul tepat sesudah blurt)
   Kelas terpisah dari .sheet landing biar ga tabrakan sama waitlist.js.
   ========================================================================== */
.blurt-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.blurt-sheet[hidden] { display: none; }
.blurt-sheet__overlay {
  position: absolute;
  inset: 0;
  background: rgba(63, 81, 59, 0.35);
  animation: sheet-fade var(--dur) var(--ease) both;
}
.blurt-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: 0 12px 40px rgba(63, 81, 59, 0.22);
  padding: 32px 30px 26px;
  animation: sheet-rise var(--dur) var(--ease) both;
}
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.blurt-sheet__seed { width: 40px; height: 40px; margin-bottom: 16px; }
.blurt-sheet__title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 18px;
}
.blurt-sheet__title b { color: var(--accent); }
.blurt-sheet__row {
  display: flex;
  gap: 10px;
}
.blurt-sheet__input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--hair);
  border-radius: var(--r-btn);
  padding: 12px 14px;
}
.blurt-sheet__input:focus-visible { outline: none; border-color: var(--accent); }
.blurt-sheet__error {
  color: #b0503f;
  font-size: var(--small);
  margin-top: 10px;
}
.blurt-sheet__later {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--small);
}
.blurt-sheet__later:hover { color: var(--ink); text-decoration: underline; }
.blurt-sheet__success {
  text-align: center;
}
.blurt-sheet__success svg { width: 40px; height: 40px; margin: 0 auto 14px; }
.blurt-sheet__success h3 {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 8px;
}
.blurt-sheet__success p { color: var(--muted); font-size: var(--small); }

/* --- Reduced motion: matiin transisi/animasi khusus shell --- */
@media (prefers-reduced-motion: reduce) {
  .demo-screen,
  .blurt-sheet__overlay,
  .blurt-sheet__panel { animation: none; }
  .dash__fill,
  .tree__ring-fill { transition: none; }
}
