/* ============================================================
   Format Converter — base.css
   Classes  : fc-format-convert-*
   Approach : Mobile-first (base = mobile, @media min-width = desktop)
   Brand    : #42B5A4 (teal) — protected across every UI state
   Contains : tokens, reset, header, stepper, panels, buttons, toast
   ============================================================ */


/* ══════════════════════════════════════════
   0. BASE / RESET / BRAND TOKENS
   ══════════════════════════════════════════ */
.fc-format-convert-wrap,
.fc-format-convert-wrap * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* ── Brand color tokens — defined on :root (not scoped to
     .fc-format-convert-wrap) so that elements rendered OUTSIDE
     the main wrapper — like the toast notification, which is a
     sibling of <main>, not a descendant — still inherit them.
     A scoped custom property is invisible to non-descendants;
     that gap was exactly why the toast previously rendered with
     no background color and unreadable white-on-white text. ── */
  --fc-brand: #42B5A4;
  --fc-brand-dark: #2E8577;
  --fc-brand-soft: #E8F8F6;

  --fc-ink: #1a1a22;
  --fc-ink-soft: #55555f;
  --fc-line: #e4e4ee;
  --fc-line-strong: #c4c4d4;
  --fc-bg: #f5f5fa;
  --fc-error: #c0392b;
}

.fc-format-convert-wrap {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  touch-action: manipulation;
  overscroll-behavior-y: contain;
}


/* ══════════════════════════════════════════
   1. HEADER
   ══════════════════════════════════════════ */
.fc-format-convert-header {
  text-align: center;
  margin-bottom: 24px;
}

.fc-format-convert-header__title {
  font-weight: 800;
  font-size: clamp(1.65rem, 6.5vw, 2.4rem);
  letter-spacing: -0.9px;
  color: var(--fc-ink);
  margin: 0 0 8px;
}

.fc-format-convert-header__title strong {
  font-weight: 900;
  color: var(--fc-brand);
}

.fc-format-convert-header__subtitle {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--fc-ink-soft);
  line-height: 1.6;
  margin: 0;
}

.fc-format-convert-header__note {
  font-size: 12.5px;
  font-weight: 500;
  color: #8a8a96;
  line-height: 1.5;
  margin: 8px 0 0;
}

.fc-format-convert-header__subtitle b {
  font-weight: 800;
  color: var(--fc-ink);
}

.fc-format-convert-header__subtitle a {
  color: var(--fc-brand-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--fc-brand-soft);
  text-underline-offset: 2px;
}

.fc-format-convert-header__subtitle a:hover {
  text-decoration-color: currentColor;
}


/* ══════════════════════════════════════════
   2. STEPPER
   ══════════════════════════════════════════ */
.fc-format-convert-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
}

.fc-format-convert-stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.fc-format-convert-stepper__dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #9999a2;
  background: #fff;
  border: 1.5px solid var(--fc-line);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.fc-format-convert-stepper__step.is-active .fc-format-convert-stepper__dot {
  background: var(--fc-brand);
  border-color: var(--fc-brand);
  color: #fff;
}

.fc-format-convert-stepper__step.is-done .fc-format-convert-stepper__dot {
  background: var(--fc-brand-soft);
  border-color: var(--fc-brand);
  color: var(--fc-brand);
}

.fc-format-convert-stepper__dot--export {
  width: auto;
  border-radius: 9999px;
  padding: 0 16px;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.fc-format-convert-stepper__label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fc-ink-soft);
}

.fc-format-convert-stepper__line {
  width: 28px;
  height: 2px;
  background: var(--fc-line);
  margin-top: -18px;
}


/* ══════════════════════════════════════════
   3. PANELS
   ══════════════════════════════════════════ */
.fc-format-convert-panel {
  display: none;
}

.fc-format-convert-panel.is-active {
  display: block;
  animation: fcFadeIn 0.28s ease both;
}

@keyframes fcFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ══════════════════════════════════════════
   4. ACTION BUTTONS (shared across all 3 steps)
   ══════════════════════════════════════════ */
.fc-format-convert-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.fc-format-convert-btn {
  flex: 1;
  height: 48px;
  border-radius: 9999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 15.5px;
  border: 1.5px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.fc-format-convert-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fc-format-convert-btn--primary {
  background: var(--fc-brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(66,181,164,0.28);
}

.fc-format-convert-btn--primary:active {
  transform: scale(0.98);
}

.fc-format-convert-btn--ghost {
  background: #fff;
  border-color: var(--fc-line);
  color: var(--fc-ink);
}

.fc-format-convert-btn--ghost:active {
  background: var(--fc-bg);
}

/* Secondary = "download one by one" — sits between ghost and primary,
   brand-tinted outline so it doesn't compete with the primary ZIP action */
.fc-format-convert-btn--secondary {
  background: var(--fc-brand-soft);
  border-color: var(--fc-brand-soft);
  color: var(--fc-brand-dark);
}

.fc-format-convert-btn--secondary:active {
  background: #d9f2ee;
}


/* ══════════════════════════════════════════
   5. TOAST
   ══════════════════════════════════════════ */
.fc-format-convert-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--fc-ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 9999px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  max-width: 90vw;
  text-align: center;
}

.fc-format-convert-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.fc-format-convert-toast.is-error {
  background: var(--fc-error);
}


/* ══════════════════════════════════════════
   6. DESKTOP ENHANCEMENTS (≥768px)
   ══════════════════════════════════════════ */
@media (min-width: 768px) {
  .fc-format-convert-wrap {
    padding: 40px 24px 72px;
  }

  .fc-format-convert-header__subtitle {
    font-size: 16px;
  }

  .fc-format-convert-stepper {
    gap: 10px;
    margin-bottom: 36px;
  }

  .fc-format-convert-stepper__line {
    width: 56px;
  }

  .fc-format-convert-btn--ghost:hover {
    border-color: var(--fc-ink);
  }

  .fc-format-convert-btn--primary:hover {
    box-shadow: 0 4px 16px rgba(66,181,164,0.36);
  }

  .fc-format-convert-btn--secondary:hover {
    background: #d9f2ee;
  }

  .fc-format-convert-actions {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  .fc-format-convert-actions--export {
    max-width: 560px;
  }
}


/* ══════════════════════════════════════════
   7. ACCESSIBILITY
   ══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .fc-format-convert-panel.is-active {
    animation: none;
  }
}


/* ══════════════════════════════════════════
   8. GENERIC FILE ICON (shared: gallery cards + export rows)
   Stands in for a real thumbnail wherever a HEIC file hasn't
   been decoded yet — see js/utils.js fileIconSvg() and the note
   in js/main.js on why decoding is deferred to conversion time.
   ══════════════════════════════════════════ */
.fc-format-convert-icon {
  display: block;
  flex-shrink: 0;
}
