/*
  Learning Flashcards Block - frontend styles
*/

.lf-grid {
  display: grid;
  grid-template-columns: repeat(var(--lf-cols-desktop, 3), minmax(0, 1fr));
  gap: var(--lf-gap, 16px);
}

@media (max-width: 1024px) {
  .lf-grid {
    grid-template-columns: repeat(var(--lf-cols-tablet, 2), minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .lf-grid {
    grid-template-columns: repeat(var(--lf-cols-mobile, 1), minmax(0, 1fr));
  }
}

.lf-card {
  position: relative;
  width: 100%;
  perspective: 1000px;
}

/* When a flip button is enabled, reserve space so it can sit at the bottom inside the card. */
.lf-card.lf-has-button .lf-face {
  padding-bottom: 64px;
}

.lf-card-inner {
  position: relative;
  width: 100%;
  transition: transform 600ms ease;
  transform-style: preserve-3d;
  border-radius: 14px;
}

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

.lf-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.lf-card-front {
  background: var(--lf-front-bg, #ffffff);
}

.lf-card-back {
  transform: rotateY(180deg);
  background: var(--lf-back-bg, #ffffff);
}

/* Face layout */
.lf-face {
  display: flex;
  height: 100%;
  width: 100%;
  padding: 14px;
  gap: 12px;
  box-sizing: border-box;
}

.lf-layout-top { flex-direction: column; }
.lf-layout-bottom { flex-direction: column-reverse; }
.lf-layout-left { flex-direction: row; }
.lf-layout-right { flex-direction: row-reverse; }

.lf-media {
  flex: 0 0 auto;
  max-width: 100%;
}

.lf-layout-left .lf-media,
.lf-layout-right .lf-media {
  width: 42%;
}

.lf-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

.lf-content {
  flex: 1 1 auto;
  min-width: 0;
}

.lf-content p { margin: 0 0 10px; }
.lf-content p:last-child { margin-bottom: 0; }

.lf-caption {
  margin: 8px 0 0;
  font-size: 0.9em;
  opacity: 0.85;
}

.lf-controls {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.lf-flip-btn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  background: var(--lf-btn, #2271b1);
  color: #ffffff;
}

.lf-flip-btn:focus {
  outline: 2px solid rgba(0,0,0,0.25);
  outline-offset: 2px;
}

/* If button color is very light, text may be unreadable. Users can adjust in theme if needed. */

