/* ============================================================
   Format Converter — gallery.css
   Step 2: thumbnail grid — each selected image as a card with
   remove + rotate controls, plus an "Add more" tile in the grid
   ============================================================ */


/* ══════════════════════════════════════════
   1. GRID
   ══════════════════════════════════════════ */
.fc-format-convert-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}


/* ══════════════════════════════════════════
   2. CARD
   ══════════════════════════════════════════ */
.fc-format-convert-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1.5px solid var(--fc-line);
  animation: fcCardIn 0.22s ease both;
}

@keyframes fcCardIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.fc-format-convert-card__thumbwrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, #e9e9ef 25%, transparent 25%) -8px 0/ 16px 16px,
    linear-gradient(-45deg, #e9e9ef 25%, transparent 25%) -8px 0/ 16px 16px,
    linear-gradient(45deg, transparent 75%, #e9e9ef 75%) -8px 0/ 16px 16px,
    linear-gradient(-45deg, transparent 75%, #e9e9ef 75%) -8px 0/ 16px 16px,
    #fafafd;
  overflow: hidden;
}

/* ── Instant generic icon (shown the moment a file is selected) that
   morphs into the real thumb below once its HEIC decode finishes in
   the background — see js/v1.5.main.js and v1.2.main.js updateThumb(). Only
   one of the two is ever present in a card at a time. Shared with the
   Step-3 pending rows via .fc-format-convert-icon, defined in base.css. ── */
.fc-format-convert-card__thumbwrap .fc-format-convert-icon {
  width: 42%;
  height: 42%;
  color: var(--fc-ink-soft);
  transition: transform 0.2s ease;
}

.fc-format-convert-card__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
  animation: fcThumbIn 0.2s ease both;
}

@keyframes fcThumbIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Overlay controls: remove (top-right) + rotate (bottom-right) ── */
.fc-format-convert-card__remove,
.fc-format-convert-card__rotate {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,26,34,0.55);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 0.15s ease, transform 0.15s ease;
}

.fc-format-convert-card__remove svg,
.fc-format-convert-card__rotate svg {
  width: 15px;
  height: 15px;
}

.fc-format-convert-card__remove {
  top: 6px;
  right: 6px;
}

.fc-format-convert-card__remove:active,
.fc-format-convert-card__rotate:active {
  transform: scale(0.9);
}

.fc-format-convert-card__remove:hover {
  background: var(--fc-error);
}

.fc-format-convert-card__rotate {
  bottom: 6px;
  right: 6px;
}

.fc-format-convert-card__rotate:hover {
  background: var(--fc-brand);
}

/* ── File name / meta ── */
.fc-format-convert-card__name {
  margin: 8px 8px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--fc-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc-format-convert-card__meta {
  margin: 2px 8px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fc-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}


/* ══════════════════════════════════════════
   3. "ADD MORE" TILE — lives inside the same grid
   ══════════════════════════════════════════ */
.fc-format-convert-gallery__add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1.5px dashed var(--fc-line-strong);
  background: var(--fc-bg);
  color: var(--fc-brand-dark);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.fc-format-convert-gallery__add svg {
  width: 22px;
  height: 22px;
  color: var(--fc-brand);
}

.fc-format-convert-gallery__add span {
  font-size: 11.5px;
  font-weight: 700;
}

.fc-format-convert-gallery__add:hover,
.fc-format-convert-gallery__add:active {
  border-color: var(--fc-brand);
  background: var(--fc-brand-soft);
}


/* ══════════════════════════════════════════
   4. DESKTOP ENHANCEMENTS (≥768px)
   ══════════════════════════════════════════ */
@media (min-width: 768px) {
  .fc-format-convert-gallery {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }

  .fc-format-convert-card__remove:hover,
  .fc-format-convert-card__rotate:hover {
    transform: scale(1.08);
  }
}


/* ══════════════════════════════════════════
   5. ACCESSIBILITY
   ══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .fc-format-convert-card {
    animation: none;
  }
  .fc-format-convert-card__thumb {
    animation: none;
  }
}
