/* ═══════════════════════════════════════════════
   Wrap-up Flip Cards — Full Width Horizontal
   ═══════════════════════════════════════════════ */

/* Full-width vertical stack */
.wrapup-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 8px;
}

/* Outer container */
.flip-card {
  perspective: 1400px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  width: 100%;
  min-height: 240px;           /* minimum card height — grows if content needs more */
}

/* Inner wrapper — rotates on flip */
.flip-card-inner {
  position: relative;
  width: 100%;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
  border-radius: 14px;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

/* Both sides — horizontal row layout */
.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  padding: 20px 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: flex-start;      /* top-aligned — better with taller cards */
  gap: 16px;
  overflow: hidden;
}

/* Front */
.flip-card-front {
  background: white;
  border: 2px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}

/* Back */
.flip-card-back {
  background: var(--accent, var(--m1));
  color: white;
  transform: rotateY(180deg);
  border: 2px solid transparent;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

/* Number badge — left column, fixed width */
.fc-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  background: var(--accent-l, var(--m1-l));
  color: var(--accent, var(--m1));
  border-radius: 50%;
  font-size: .85rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-bottom: 0;             /* was used in column layout */
}

/* Question text — middle column, takes all remaining space */
.fc-question {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
  flex: 1;
  min-width: 0;                 /* allow text to wrap */
}

/* Flip hint — right column, fixed */
.fc-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 0;                /* was used in column layout */
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.75;
  flex-shrink: 0;
  white-space: nowrap;
}

.fc-hint-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-l, var(--m1-l));
  color: var(--accent, var(--m1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  flex-shrink: 0;
}

/* Back: answer content block — takes all space */
.fc-answer-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Answer label */
.fc-answer-label {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 5px;
}

/* Answer text */
.fc-answer {
  font-size: .9rem;
  line-height: 1.6;
  opacity: .96;
  word-wrap: break-word;
  overflow-y: auto;            /* scroll if answer is very long */
}

/* Back flip hint — right side */
.fc-back-hint {
  font-size: .7rem;
  opacity: .6;
  flex-shrink: 0;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  align-self: center;
  margin-top: 0;
  text-align: right;
}

/* Hover effect */
.flip-card:not(.flipped):hover .flip-card-front {
  border-color: var(--accent, var(--m1));
  box-shadow: 0 5px 20px rgba(0,0,0,.08);
  transform: translateY(-1px);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

/* Sizer — measures answer content height */
.flip-card-sizer {
  visibility: hidden;
  position: absolute;
  width: calc(100% - 120px);   /* account for num badge + hint columns */
  padding: 16px 0;
  box-sizing: border-box;
  pointer-events: none;
  font-size: .9rem;
  line-height: 1.6;
}

/* RTL support */
[lang="he"] .flip-card-front,
[lang="he"] .flip-card-back {
  flex-direction: row-reverse;
}
[lang="he"] .fc-question,
[lang="he"] .fc-answer {
  direction: rtl;
  text-align: right;
}
[lang="he"] .fc-hint,
[lang="he"] .fc-back-hint {
  direction: rtl;
}

/* Mobile */
@media (max-width: 520px) {
  .flip-card-front,
  .flip-card-back {
    padding: 14px 16px;
    gap: 10px;
  }
  .fc-question { font-size: .88rem; }
  .fc-answer   { font-size: .85rem; }
}
