/* ── Flashcards block — shared by the course builder and the lesson player ──
   Two variants: grid (all cards side-by-side) and stack (one card + nav).
   Card config lives in [data-cards] JSON on .fc-block so it survives the
   builder's innerHTML round-trip. */

.fc-block { --fc-accent: #2563eb; }

/* Editor-only chrome is hidden by default; the builder opts back in.
   Keep `display` out of any inline style on these elements — an inline style
   would win over this rule and leak builder chrome into the learner player. */
.fc-editor-only { display: none !important; }
.fc-toolbar { align-items: center; gap: 10px; margin-bottom: 12px; }
.fc-variant-name { font-size: 12px; color: #8896a4; }

.fc-cards { display: grid; gap: 16px; }
.fc-cards.fc-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.fc-cards.fc-stack { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; }

.fc-card {
  position: relative;
  min-height: 230px;
  perspective: 1200px;
  cursor: pointer;
  background: transparent;
}
.fc-cards.fc-stack .fc-card { min-height: 300px; }

.fc-inner {
  position: absolute; inset: 0;
  transition: transform .55s cubic-bezier(.2,.7,.3,1);
  transform-style: preserve-3d;
}
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }

.fc-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: 3px solid var(--fc-accent);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
  padding: 28px 22px;
}
.fc-face.fc-back { transform: rotateY(180deg); }

.fc-text {
  min-height: 100%;
  /* column, not row: rich content (a bullet list, multiple paragraphs from
     Enter, alignment-wrapped divs) is several top-level block children —
     row direction was squeezing each one into a sliver-width flex item,
     breaking text mid-word. align-items:stretch lets each child span the
     full width so its own text-align (left/center/right) still works. */
  display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  font-size: 17px; line-height: 1.5; color: #1e293b;
  text-align: center; word-break: break-word;
}
.fc-text > :first-child { margin-top: 0; }
.fc-text > :last-child { margin-bottom: 0; }
/* The page-wide `* { margin:0; padding:0 }` reset strips the browser's own
   list indent too — same fix as every other rich-text body in blocks.css. */
.fc-text ul, .fc-text ol { margin: 10px 0; padding-left: 26px; text-align: left; }
.fc-text li { margin: 6px 0; }
.fc-cards.fc-stack .fc-text { font-size: 19px; }

.fc-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* Flip affordance */
.fc-flip {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #64748b; font-size: 13px;
  background: rgba(255,255,255,.9);
  pointer-events: none;
}

/* Stack navigation */
.fc-nav {
  display: none;
  align-items: center; justify-content: center; gap: 14px;
  margin-top: 16px;
}
.fc-nav button {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--fc-accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.fc-nav button:disabled { opacity: .35; cursor: not-allowed; }
.fc-bar { flex: 1; max-width: 160px; height: 3px; background: #e2e8f0; border-radius: 2px; overflow: hidden; }
.fc-bar-fill { height: 100%; background: var(--fc-accent); border-radius: 2px; transition: width .25s ease; }
.fc-count { font-size: 12px; font-weight: 600; color: #64748b; white-space: nowrap; }

.fc-empty {
  padding: 34px; text-align: center; color: #94a3b8; font-size: 13px;
  border: 2px dashed #dbe4ea; border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .fc-inner { transition: none; }
}
