/* app/css/screens-reader.css — reader end card (.rd-*), past exam questions page (.vt-*), formulas page
   Owner: A3. Spec: docs/redesign/plan.md §2.5, §2.9, §2.10; mock-up: docs/redesign/mockups/04-reader.html. */

/* ── 1. Shared Reader Buttons & Pills (Touch Targets ≥ 48px) ─────────────────────────── */
.b-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
}

.b-pills .b-pill,
.rd-pills .b-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 16px;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm, 6px);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.b-pills .b-pill.is-active,
.rd-pills .b-pill.is-active {
  background: var(--ink);
  color: var(--on-ink);
}

.b-btn,
button.b-btn,
a.b-btn,
.proof-toggle-btn,
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  box-sizing: border-box;
  font-weight: 800;
  font-size: 15px;
  border: var(--rule, 2.5px) solid var(--ink);
  border-radius: var(--radius-sm, 6px);
  padding: 10px 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm, 4px 4px 0 var(--ink));
  text-decoration: none;
  cursor: pointer;
}

.b-btn.b-btn--solid,
.btn-primary.b-btn--solid {
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: 4px 4px 0 var(--fill-sand, #e8d6b2);
}

.b-btn.b-btn--block {
  display: flex;
  width: 100%;
}

.exercise-actions .proof-toggle-btn {
  min-height: 48px;
  padding: 8px 14px;
}

/* ── 2. Reader Navigation & Sticky Pills ─────────────────────────────────────────────── */
.rd-pills {
  /* Not sticky (owner, 2026-11-08): pinned under the top bar it was half-covered while scrolling.
     Was: position: sticky; top: var(--topbar-h, …); z-index: 10; */
  position: static;
  background: var(--paper);
  padding: 8px 0;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Section jump tabs (secJump): ONE row with horizontal scroll, right-edge fade mask, thin scrollbar */
.rd-sec-pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle, rgba(128, 128, 128, 0.4)) transparent;
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
  mask-image: linear-gradient(to right, black 85%, transparent 100%);
  padding-bottom: 4px;
}

.rd-sec-pills::-webkit-scrollbar {
  height: 4px;
}

.rd-sec-pills::-webkit-scrollbar-track {
  background: transparent;
}

.rd-sec-pills::-webkit-scrollbar-thumb {
  background: var(--border-subtle, rgba(128, 128, 128, 0.4));
  border-radius: 2px;
}

.rd-sec-pills .b-pill {
  flex-shrink: 0;
  max-width: 85%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* text-overflow does not apply to flex containers, and centring clips both ends: use a block box */
  display: block;
  text-align: left;
  line-height: 24px; /* 10px padding + 2px border on each side keeps the 48px touch target */
}

/* ── 3. End-of-Topic Card (.rd-past) ─────────────────────────────────────────────────── */
.rd-past {
  margin: 36px 0 24px;
}

.rd-past .b-h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.15;
}

.rd-past__meta {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 16px;
}

.rd-past .b-btn {
  min-height: 56px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* ── 4. Reader Footer (.rd-footer) ───────────────────────────────────────────────────── */
.rd-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: var(--rule, 2.5px) solid var(--ink);
  padding-top: 20px;
  margin-top: 32px;
}

.rd-footer .b-btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* ── 5. Past Exam Questions Page (.vt-*) ──────────────────────────────────────────────── */
.vt-head {
  margin-bottom: 20px;
}

.vt-head .vt-source {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  margin: 4px 0 16px;
}

.vt-topic-crumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm, 6px);
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
}

.vt-topic-crumb .b-btn {
  min-height: 48px;
  padding: 8px 16px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* ── 6. KaTeX Math Scroll Container ──────────────────────────────────────────────────── */
/* KaTeX display math scrolls inside its own block, never overflowing the page at 360px */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.katex {
  max-width: 100%;
}

/* ── 7. Mobile & Touch Targets (≥ 48px) ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .vt-topic-crumb {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}
