/* Alpha Academy Cambodia — Grade 12 probability exercises
   ---------------------------------------------------------------------------
   Everything on grade-12-probability-exercise.html that style.css does not
   already own. Class names are namespaced pb* — the shared stylesheet owns
   .card, .chip, .tag and friends.

   The markup is produced by assets/js/probability-exercise.js.             */

.pb-wrap { max-width: 980px; margin-inline: auto; padding-inline: var(--gutter); }
.pb-hide { display: none !important; }

/* Khmer text needs the Khmer stack first, or the Latin face wins and the
   subscripts sit wrong. */
.pb-km {
  font-family: "Kantumruy Pro", "Noto Sans Khmer", "Khmer OS Battambang",
               "Khmer OS", var(--font-sans);
  line-height: 2.05;
}

/* ============================================================== toolbar */
.pb-bar {
  position: sticky; top: 77px; z-index: 20;
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: var(--r-md); padding: .65rem .8rem;
  box-shadow: var(--shadow-xs); margin-bottom: 1.4rem;
}
.pb-search { position: relative; flex: 1 1 220px; min-width: 0; }
.pb-search input {
  width: 100%; font: inherit; font-size: .92rem; min-height: 44px;
  padding: .55rem .9rem .55rem 2.5rem; border-radius: var(--r-pill);
  border: 1px solid var(--ink-200); background: var(--surface-2); color: var(--ink-900);
}
.pb-search input:focus { outline: 0; border-color: var(--brand-500); box-shadow: var(--ring); }
.pb-search svg {
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--ink-400); pointer-events: none;
}
.pb-btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: .85rem;
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
  min-height: 44px; padding: .5rem 1rem; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--ink-200); color: var(--ink-700);
  transition: all .15s var(--ease);
}
.pb-btn:hover { border-color: var(--brand-400); color: var(--brand-600); }
.pb-btn svg { width: 16px; height: 16px; }
.pb-btn--primary { background: var(--grad-brand); border: 0; color: #fff; box-shadow: var(--shadow-xs); }
.pb-btn--primary:hover { filter: brightness(1.06); color: #fff; }
.pb-toggle[aria-pressed="true"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.pb-stats {
  display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; align-items: center;
  font-size: .82rem; color: var(--ink-500); margin: 0 0 1.2rem;
}
.pb-stats b { color: var(--brand-600); }
.pb-progress {
  flex: 1 1 160px; height: 7px; border-radius: 99px; background: var(--ink-100);
  overflow: hidden; min-width: 120px;
}
.pb-progress i { display: block; height: 100%; width: 0;
  background: var(--grad-brand); transition: width .4s var(--ease); }

/* ================================================================ cards */
.pb-list { display: flex; flex-direction: column; gap: 1rem; }

.pb-card {
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: var(--r-lg); padding: clamp(1rem, 2.6vw, 1.5rem);
  box-shadow: var(--shadow-xs); transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.pb-card:hover { box-shadow: var(--shadow-sm); }
.pb-card.is-done { border-color: var(--success-500); background: var(--surface-2); }
.pb-card.is-hidden { display: none; }

.pb-head { display: flex; align-items: flex-start; gap: .8rem; }
.pb-num {
  flex: none; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--brand-50); color: var(--brand-600);
  font-weight: 700; font-size: 1.05rem;
  font-family: "Kantumruy Pro", "Noto Sans Khmer", var(--font-sans);
}
.pb-card.is-done .pb-num { background: var(--success-500); color: #fff; }
.pb-q { flex: 1; min-width: 0; font-size: 1rem; color: var(--ink-900); }

.pb-done {
  appearance: none; cursor: pointer; flex: none;
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--ink-200); color: var(--ink-400);
  transition: all .15s var(--ease);
}
.pb-done svg { width: 19px; height: 19px; }
.pb-done:hover { border-color: var(--success-500); color: var(--success-500); }
.pb-done[aria-pressed="true"] {
  background: var(--success-500); border-color: var(--success-500); color: #fff;
}

.pb-parts { list-style: none; margin: .9rem 0 0; padding: 0 0 0 calc(40px + .8rem);
  display: flex; flex-direction: column; gap: .5rem; }
.pb-parts li { display: flex; gap: .55rem; align-items: flex-start; font-size: .95rem; }
.pb-parts .k {
  flex: none; min-width: 1.7em; font-weight: 700; color: var(--brand-600);
  font-family: "Kantumruy Pro", "Noto Sans Khmer", var(--font-sans);
}
.pb-parts .t { flex: 1; min-width: 0; color: var(--ink-700); }
.pb-sub { list-style: none; margin: .45rem 0 0; padding: 0 0 0 1rem;
  display: flex; flex-direction: column; gap: .35rem; }
.pb-sub li { font-size: .92rem; }
.pb-sub .k { color: var(--ink-400); min-width: 1.4em; }

.pb-empty { text-align: center; color: var(--ink-400); font-size: .95rem; padding: 3rem 0; }

@media (max-width: 640px) {
  .pb-parts { padding-left: 0; }
  .pb-num { width: 34px; height: 34px; font-size: .95rem; }
  .pb-bar { top: 70px; }
}

/* ======================================================= author credit */
.pb-author {
  margin-top: 2.6rem; text-align: center;
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: var(--r-lg); padding: clamp(1.4rem, 4vw, 2.2rem);
  box-shadow: var(--shadow-sm);
}
.pb-author img {
  width: 118px; height: 118px; border-radius: 50%; object-fit: cover;
  margin: 0 auto .9rem; display: block;
  border: 4px solid var(--surface); box-shadow: var(--shadow-md);
  outline: 2px solid var(--brand-100);
}
.pb-author .role {
  font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-400); display: block; margin-bottom: .25rem;
}
.pb-author .name { font-size: 1.15rem; font-weight: 700; color: var(--ink-900);
  font-family: "Kantumruy Pro", "Noto Sans Khmer", var(--font-display); }
.pb-author .meta { font-size: .84rem; color: var(--ink-500); margin: .5rem 0 0; line-height: 1.9; }
.pb-author .meta a { color: var(--brand-600); }
.pb-author hr { margin: 1.1rem auto; width: 70px; border: 0; border-top: 1px solid var(--ink-200); }
.pb-author .org { font-size: .9rem; font-weight: 700; color: var(--brand-600); }
.pb-author .src { display: block; font-size: .76rem; color: var(--ink-400); margin-top: .5rem; }

/* ================================================================ print */
@media print {
  .site-header, .site-footer, .float-actions, .pb-bar, .cta-band,
  .page-hero, .wave, .pb-done, .skip-link, section.section + section.section { display: none !important; }
  .pb-card { break-inside: avoid; box-shadow: none; border-color: #bbb; margin-bottom: .6rem; }
  .pb-card.is-hidden { display: none !important; }
  .pb-author { break-inside: avoid; box-shadow: none; border-color: #bbb; }
  body { background: #fff; }
}
