/* =========================================================
   File Tools — shared stylesheet for tool pages
   Namespaced with `ft-` / `--ft-` so nothing here can collide
   with the site theme's own CSS (header/nav/footer/etc).
   Mobile-first. Loaded per-page via $pageCSS.
   ========================================================= */

.ft-scope {
  --ft-primary: #4f46e5;
  --ft-primary-dark: #4338ca;
  --ft-primary-light: #818cf8;
  --ft-secondary: #059669;
  --ft-danger: #dc2626;
  --ft-warning: #d97706;
  --ft-info: #2563eb;

  --ft-bg: #ffffff;
  --ft-bg-soft: #f8fafc;
  --ft-bg-mute: #f1f5f9;
  --ft-text: #0f172a;
  --ft-text-soft: #475569;
  --ft-text-mute: #94a3b8;
  --ft-border: #e2e8f0;

  --ft-radius-sm: 6px;
  --ft-radius: 10px;
  --ft-radius-lg: 16px;
  --ft-shadow: 0 1px 3px rgba(15,23,42,.08);
  --ft-shadow-lg: 0 12px 24px -8px rgba(15,23,42,.18);
  --ft-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  color: var(--ft-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

[data-theme="dark"] .ft-scope {
  --ft-bg: #0f172a;
  --ft-bg-soft: #16213a;
  --ft-bg-mute: #1e293b;
  --ft-text: #f1f5f9;
  --ft-text-soft: #cbd5e1;
  --ft-text-mute: #64748b;
  --ft-border: #2a3a53;
}

.ft-scope * { box-sizing: border-box; }

.ft-container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }

/* ---------- Tool head ---------- */
.ft-tool-page { padding: 1.5rem 0 3rem; }

.ft-tool-head { margin-bottom: 1.5rem; }
.ft-tool-head h1 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 .5rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.ft-tool-head h1 i { color: var(--ft-primary); font-size: .9em; }
.ft-tool-head p { color: var(--ft-text-soft); font-size: 1rem; max-width: 70ch; margin: 0; }

@media (min-width: 640px) {
  .ft-tool-head h1 { font-size: 2rem; }
  .ft-tool-head p { font-size: 1.05rem; }
}

.ft-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.ft-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; padding: .3rem .6rem;
  border-radius: 999px; background: var(--ft-bg-mute); color: var(--ft-text-soft);
  border: 1px solid var(--ft-border);
}
.ft-badge i { color: var(--ft-secondary); }

/* ---------- Layout ---------- */
.ft-layout { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 960px) {
  .ft-layout { grid-template-columns: 1fr 300px; align-items: start; gap: 1.75rem; }
}

.ft-panel {
  background: var(--ft-bg-soft);
  border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius-lg);
  padding: 1.1rem;
}
@media (min-width: 640px) { .ft-panel { padding: 1.5rem; } }

.ft-section { margin-bottom: 1.25rem; }
.ft-section:last-child { margin-bottom: 0; }
.ft-section h2, .ft-section h3 {
  font-size: .95rem; font-weight: 700; margin: 0 0 .75rem;
  display: flex; align-items: center; gap: .5rem;
}
.ft-section h2 i, .ft-section h3 i { color: var(--ft-primary); }

.ft-side { display: flex; flex-direction: column; gap: 1rem; }
.ft-card {
  background: var(--ft-bg-soft); border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius-lg); padding: 1.25rem;
}
.ft-card h4 { font-size: .9rem; font-weight: 700; margin: 0 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.ft-card h4 i { color: var(--ft-primary); }
.ft-card ul { margin: 0; padding-left: 1.1rem; font-size: .85rem; color: var(--ft-text-soft); }
.ft-card li { margin-bottom: .4rem; }
.ft-card li:last-child { margin-bottom: 0; }
.ft-card p { font-size: .85rem; color: var(--ft-text-soft); margin: 0; }

/* ---------- Drop zone ---------- */
.ft-drop {
  border: 2px dashed var(--ft-border); border-radius: var(--ft-radius-lg);
  padding: 2.25rem 1.25rem; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ft-drop:hover, .ft-drop.is-drag { border-color: var(--ft-primary); background: rgba(79,70,229,.06); }
.ft-drop i { font-size: 2.25rem; color: var(--ft-primary); margin-bottom: .6rem; display: block; }
.ft-drop strong { display: block; font-size: 1rem; margin-bottom: .25rem; }
.ft-drop span { font-size: .8rem; color: var(--ft-text-mute); }
.ft-drop input[type="file"] { display: none; }

.ft-filelist { margin-top: .75rem; display: flex; flex-direction: column; gap: .4rem; }
.ft-file-row {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--ft-bg); border: 1px solid var(--ft-border); border-radius: var(--ft-radius);
  padding: .55rem .75rem; font-size: .82rem;
}
.ft-file-row .ft-file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-file-row .ft-file-meta { color: var(--ft-text-mute); font-size: .75rem; white-space: nowrap; }
.ft-file-row button { background: none; border: none; color: var(--ft-danger); cursor: pointer; font-size: .95rem; padding: .2rem; }

/* ---------- Forms ---------- */
.ft-label { display: block; font-size: .82rem; font-weight: 600; color: var(--ft-text-soft); margin-bottom: .4rem; }
.ft-input, .ft-select, .ft-textarea {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--ft-border); border-radius: var(--ft-radius);
  background: var(--ft-bg); color: var(--ft-text); font-size: .88rem; font-family: inherit;
}
.ft-textarea { min-height: 160px; font-family: var(--ft-mono); resize: vertical; line-height: 1.5; }
.ft-input:focus, .ft-select:focus, .ft-textarea:focus { outline: none; border-color: var(--ft-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.ft-field { margin-bottom: 1rem; }
.ft-field:last-child { margin-bottom: 0; }
.ft-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 560px) { .ft-row-2 { grid-template-columns: 1fr 1fr; } .ft-row-3 { grid-template-columns: repeat(3,1fr); } }

.ft-check { display: flex; align-items: center; gap: .5rem; font-size: .85rem; cursor: pointer; }
.ft-check input { width: 17px; height: 17px; accent-color: var(--ft-primary); }

.ft-hint { font-size: .76rem; color: var(--ft-text-mute); margin-top: .35rem; }

/* ---------- Buttons ---------- */
.ft-btns { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.ft-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.2rem; border: none; border-radius: var(--ft-radius);
  font-size: .85rem; font-weight: 700; cursor: pointer; transition: transform .1s, box-shadow .1s, opacity .1s;
  font-family: inherit;
}
.ft-btn:active { transform: scale(.98); }
.ft-btn:disabled { opacity: .5; cursor: not-allowed; }
.ft-btn-primary { background: var(--ft-primary); color: #fff; }
.ft-btn-primary:hover:not(:disabled) { background: var(--ft-primary-dark); }
.ft-btn-ghost { background: var(--ft-bg-mute); color: var(--ft-text); border: 1px solid var(--ft-border); }
.ft-btn-ghost:hover:not(:disabled) { background: var(--ft-border); }
.ft-btn-success { background: var(--ft-secondary); color: #fff; }
.ft-btn-danger { background: var(--ft-danger); color: #fff; }
.ft-btn-sm { padding: .45rem .85rem; font-size: .76rem; }
.ft-btn-block { width: 100%; }

/* ---------- Alerts ---------- */
.ft-alert { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--ft-radius); font-size: .84rem; margin-bottom: 1rem; }
.ft-alert i { margin-top: .1rem; }
.ft-alert-info { background: rgba(37,99,235,.08); color: #1e40af; }
[data-theme="dark"] .ft-alert-info { color: #93c5fd; }
.ft-alert-warn { background: rgba(217,119,6,.1); color: #92400e; }
[data-theme="dark"] .ft-alert-warn { color: #fcd34d; }
.ft-alert-danger { background: rgba(220,38,38,.1); color: #991b1b; }
[data-theme="dark"] .ft-alert-danger { color: #fca5a5; }
.ft-alert-success { background: rgba(5,150,105,.1); color: #065f46; }
[data-theme="dark"] .ft-alert-success { color: #6ee7b7; }

/* ---------- Stats ---------- */
.ft-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: .75rem; margin: 1rem 0; }
@media (min-width: 560px) { .ft-stats { grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); } }
.ft-stat { background: var(--ft-bg); border: 1px solid var(--ft-border); border-radius: var(--ft-radius); padding: .85rem; text-align: center; }
.ft-stat-v { font-size: 1.35rem; font-weight: 800; color: var(--ft-primary); line-height: 1.2; word-break: break-word; }
.ft-stat-l { font-size: .72rem; color: var(--ft-text-soft); margin-top: .2rem; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Output / code ---------- */
.ft-output {
  background: var(--ft-bg); border: 1px solid var(--ft-border); border-radius: var(--ft-radius);
  padding: 1rem; font-family: var(--ft-mono); font-size: .82rem; white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow: auto;
}
.ft-output:empty::before { content: 'Results will appear here.'; color: var(--ft-text-mute); font-family: inherit; }

/* ---------- Tables ---------- */
.ft-table-wrap { overflow-x: auto; border: 1px solid var(--ft-border); border-radius: var(--ft-radius); }
.ft-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 480px; }
.ft-table th, .ft-table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--ft-border); white-space: nowrap; }
.ft-table th { background: var(--ft-bg-mute); font-weight: 700; position: sticky; top: 0; }
.ft-table tr:last-child td { border-bottom: none; }
.ft-table td.ft-wrap { white-space: normal; word-break: break-word; }

/* ---------- Progress ---------- */
.ft-progress { height: 8px; background: var(--ft-bg-mute); border-radius: 999px; overflow: hidden; margin: .75rem 0; }
.ft-progress-bar { height: 100%; background: var(--ft-primary); width: 0%; transition: width .25s; }

/* ---------- Tabs ---------- */
.ft-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--ft-border); }
.ft-tab {
  padding: .55rem .9rem; font-size: .82rem; font-weight: 600; color: var(--ft-text-soft);
  background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px;
}
.ft-tab.is-active { color: var(--ft-primary); border-bottom-color: var(--ft-primary); }
.ft-tabpanel { display: none; }
.ft-tabpanel.is-active { display: block; }

/* ---------- Pills / highlights ---------- */
.ft-pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; padding: .18rem .55rem; border-radius: 999px; }
.ft-pill-ok { background: rgba(5,150,105,.12); color: #059669; }
.ft-pill-warn { background: rgba(217,119,6,.12); color: #d97706; }
.ft-pill-bad { background: rgba(220,38,38,.12); color: #dc2626; }
mark.ft-hl { background: rgba(220,38,38,.25); color: inherit; border-radius: 3px; padding: 0 .1rem; }

/* ---------- Canvas / image preview ---------- */
.ft-canvas-wrap { position: relative; border: 1px solid var(--ft-border); border-radius: var(--ft-radius); overflow: auto; background: var(--ft-bg-mute); max-height: 60vh; }
.ft-canvas-wrap canvas { display: block; max-width: 100%; cursor: crosshair; touch-action: none; }

/* ---------- Toast ---------- */
.ft-toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%) translateY(20px);
  background: var(--ft-text); color: var(--ft-bg); padding: .7rem 1.1rem; border-radius: var(--ft-radius);
  box-shadow: var(--ft-shadow-lg); font-size: .85rem; display: flex; align-items: center; gap: .5rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 9999; max-width: 90vw;
}
.ft-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ft-toast i { color: #34d399; }
.ft-toast.ft-toast-error i { color: #f87171; }

/* ---------- Long-form SEO content block ---------- */
.ft-info { margin-top: 2.5rem; max-width: 80ch; }
.ft-info h2 { font-size: 1.3rem; font-weight: 800; margin: 1.75rem 0 .75rem; }
.ft-info h2:first-child { margin-top: 0; }
.ft-info p { color: var(--ft-text-soft); margin-bottom: .9rem; font-size: .95rem; }
.ft-info ul, .ft-info ol { color: var(--ft-text-soft); margin: 0 0 .9rem 1.2rem; font-size: .95rem; }
.ft-info li { margin-bottom: .4rem; }
.ft-faq-item { border-bottom: 1px solid var(--ft-border); padding: .9rem 0; }
.ft-faq-item:last-child { border-bottom: none; }
.ft-faq-item summary { font-weight: 700; cursor: pointer; font-size: .95rem; }
.ft-faq-item p { margin: .6rem 0 0; }

/* ---------- Misc ---------- */
.ft-flex-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.ft-muted { color: var(--ft-text-mute); }
.ft-mt { margin-top: 1rem; }
.ft-hidden { display: none !important; }
.ft-spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; display: inline-block; animation: ft-spin .7s linear infinite;
}
@keyframes ft-spin { to { transform: rotate(360deg); } }

/* =========================================================
   Motion system — applies across every tool automatically
   since they all share this one stylesheet. Subtle, fast,
   professional. Respects prefers-reduced-motion.
   ========================================================= */

@keyframes ftFadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ftFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes ftPopIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes ftRowIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: translateX(0); } }
@keyframes ftPulseRing { 0% { box-shadow: 0 0 0 0 rgba(79,70,229,.35); } 70% { box-shadow: 0 0 0 10px rgba(79,70,229,0); } 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0); } }
@keyframes ftShimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes ftCheckPop { 0% { transform: scale(0) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.25) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes ftBounceIn { 0% { opacity: 0; transform: translate(-50%, 24px) scale(.9); } 60% { opacity: 1; transform: translate(-50%, -4px) scale(1.02); } 100% { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes ftSpinGrow { 0% { transform: rotate(0deg) scale(1); } 50% { transform: rotate(180deg) scale(.85); } 100% { transform: rotate(360deg) scale(1); } }
@keyframes ftFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes ftUnderlineGrow { from { width: 0; } to { width: 100%; } }

.ft-scope .ft-tool-head { animation: ftFadeInUp .5s ease both; }
.ft-scope .ft-tool-head h1 i { display: inline-block; }
.ft-scope .ft-tool-head:hover h1 i { animation: ftFloat 1.4s ease-in-out infinite; }

.ft-scope .ft-panel { animation: ftFadeInUp .45s ease both .05s; }
.ft-scope .ft-side > * { animation: ftFadeInUp .45s ease both; }
.ft-scope .ft-side > *:nth-child(1) { animation-delay: .1s; }
.ft-scope .ft-side > *:nth-child(2) { animation-delay: .18s; }
.ft-scope .ft-side > *:nth-child(3) { animation-delay: .26s; }

/* Results / output areas: animate in the instant they stop being ft-hidden.
   CSS keyframe animations replay automatically whenever an element goes
   from display:none back to visible, so no JS hook is required. */
.ft-scope #results:not(.ft-hidden),
.ft-scope .ft-section,
.ft-scope .ft-stats,
.ft-scope .ft-table-wrap,
.ft-scope .ft-output:not(:empty),
.ft-scope #no-exif:not(.ft-hidden),
.ft-scope #none-found:not(.ft-hidden),
.ft-scope #parse-warning:not(.ft-hidden) {
  animation: ftFadeInUp .4s cubic-bezier(.22,.8,.3,1) both;
}

.ft-scope .ft-alert { animation: ftPopIn .35s cubic-bezier(.3,1.4,.4,1) both; }

.ft-scope .ft-stat { animation: ftPopIn .4s cubic-bezier(.3,1.4,.4,1) both; transition: transform .15s ease, box-shadow .15s ease; }
.ft-scope .ft-stat:hover { transform: translateY(-2px); box-shadow: var(--ft-shadow); }
.ft-scope .ft-stat:nth-child(1) { animation-delay: .02s; } .ft-scope .ft-stat:nth-child(2) { animation-delay: .06s; }
.ft-scope .ft-stat:nth-child(3) { animation-delay: .10s; } .ft-scope .ft-stat:nth-child(4) { animation-delay: .14s; }
.ft-scope .ft-stat:nth-child(5) { animation-delay: .18s; } .ft-scope .ft-stat:nth-child(6) { animation-delay: .22s; }

.ft-scope tbody tr { animation: ftRowIn .32s ease both; }
.ft-scope tbody tr:nth-child(1) { animation-delay: .01s; } .ft-scope tbody tr:nth-child(2) { animation-delay: .035s; }
.ft-scope tbody tr:nth-child(3) { animation-delay: .06s; } .ft-scope tbody tr:nth-child(4) { animation-delay: .085s; }
.ft-scope tbody tr:nth-child(5) { animation-delay: .11s; } .ft-scope tbody tr:nth-child(6) { animation-delay: .135s; }
.ft-scope tbody tr:nth-child(7) { animation-delay: .16s; } .ft-scope tbody tr:nth-child(8) { animation-delay: .185s; }
.ft-scope tbody tr:nth-child(n+9) { animation-delay: .2s; }
.ft-scope tbody tr { transition: background .15s ease; }
.ft-scope .ft-table tbody tr:hover { background: var(--ft-bg-mute); }

.ft-scope .ft-file-row { animation: ftRowIn .3s ease both; transition: transform .12s ease, box-shadow .12s ease; }
.ft-scope .ft-file-row:hover { transform: translateX(2px); box-shadow: var(--ft-shadow); }

.ft-scope .ft-card { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.ft-scope button.ft-card:hover, .ft-scope a.ft-card:hover { transform: translateY(-3px); box-shadow: var(--ft-shadow-lg); border-color: var(--ft-primary-light); }

/* Buttons: springy press, icon nudge on hover */
.ft-scope .ft-btn { transition: transform .12s cubic-bezier(.3,1.4,.4,1), box-shadow .15s ease, background .15s ease, opacity .15s ease; }
.ft-scope .ft-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 10px -4px rgba(15,23,42,.25); }
.ft-scope .ft-btn:active:not(:disabled) { transform: translateY(0) scale(.96); }
.ft-scope .ft-btn-primary:hover:not(:disabled) i { animation: ftFloat .6s ease-in-out; }
.ft-scope .ft-btn i { transition: transform .15s ease; }

/* Drop zone: lively on drag-over, icon bounces on hover */
.ft-scope .ft-drop { transition: border-color .2s ease, background .2s ease, transform .15s ease; }
.ft-scope .ft-drop:hover i { animation: ftFloat 1.2s ease-in-out infinite; }
.ft-scope .ft-drop.is-drag { animation: ftPulseRing 1.1s ease-out infinite; transform: scale(1.01); }

/* Progress bars: smooth fill everywhere; animated stripe only on active
   loading bars (id="progress"/"snap-progress"), never on static display
   meters like password strength or milestone % so those don't shimmer forever. */
.ft-scope .ft-progress-bar { transition: width .3s cubic-bezier(.3,.9,.4,1); }
.ft-scope .ft-progress-bar#progress,
.ft-scope .ft-progress-bar#snap-progress {
  background-image: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.35) 50%, rgba(255,255,255,0) 100%), linear-gradient(90deg, var(--ft-primary), var(--ft-primary));
  background-size: 200% 100%, 100% 100%;
  animation: ftShimmer 1.4s linear infinite;
}

/* Pills: pop in, gentle hover lift where clickable */
.ft-scope .ft-pill { animation: ftPopIn .3s cubic-bezier(.3,1.4,.4,1) both; transition: transform .1s ease; }
.ft-scope .ft-pill[style*="cursor:pointer"]:hover,
.ft-scope .ft-pill[style*="cursor: pointer"]:hover { transform: scale(1.06); }
.ft-scope .ft-pill-ok i, .ft-scope .ft-alert-success i { animation: ftCheckPop .4s cubic-bezier(.3,1.4,.4,1) both; }

/* Toast: bouncier entrance */
.ft-toast { animation: none; }
.ft-toast.is-show { animation: ftBounceIn .4s cubic-bezier(.3,1.3,.4,1) both; }

/* Spinner: a touch more character than a plain spin */
.ft-spinner { animation: ftSpinGrow .9s ease-in-out infinite; }

/* Tabs: underline grows in on activate */
.ft-tab.is-active { position: relative; }
.ft-tab.is-active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ft-primary); animation: ftUnderlineGrow .25s ease both; }

/* Canvas / image preview: soft reveal */
.ft-scope .ft-canvas-wrap, .ft-scope img { animation: ftFadeIn .4s ease both; }

/* Inputs: focus glow eases in rather than snapping */
.ft-scope .ft-input, .ft-scope .ft-select, .ft-scope .ft-textarea { transition: border-color .15s ease, box-shadow .2s ease; }

/* mark highlight: soft pop when newly rendered */
.ft-scope mark.ft-hl { animation: ftPopIn .25s ease both; }

/* Number ticker support (paired with the auto count-up script in tools-core.js) */
.ft-scope .ft-stat-v.ft-counting { font-variant-numeric: tabular-nums; }

/* Brief highlight flash on freshly-inserted rows/cards (paired with tools-core.js) */
.ft-scope .ft-just-updated { animation: ftRowFlash .9s ease; }
@keyframes ftRowFlash {
  0% { background-color: rgba(79,70,229,.16); }
  100% { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .ft-scope, .ft-scope * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* =========================================================
   Index / directory page (file-tools/index.php)
   ========================================================= */
.ft-index-hero { text-align: center; padding: 2rem 0 1.5rem; animation: ftFadeInUp .5s ease both; }
.ft-index-hero h1 { font-size: 1.8rem; font-weight: 800; margin: 0 0 .6rem; }
.ft-index-hero p { color: var(--ft-text-soft); max-width: 60ch; margin: 0 auto 1.25rem; font-size: 1rem; }
@media (min-width: 640px) { .ft-index-hero h1 { font-size: 2.4rem; } }

.ft-search-wrap { max-width: 480px; margin: 0 auto 1rem; position: relative; }
.ft-search-wrap i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--ft-text-mute); }
.ft-search-input {
  width: 100%; padding: .85rem 1rem .85rem 2.6rem; border-radius: 999px; border: 1px solid var(--ft-border);
  background: var(--ft-bg); color: var(--ft-text); font-size: .95rem;
}
.ft-search-input:focus { outline: none; border-color: var(--ft-primary); box-shadow: 0 0 0 4px rgba(79,70,229,.12); }

.ft-index-stats { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.ft-index-stats span { font-size: .85rem; color: var(--ft-text-soft); }
.ft-index-stats strong { color: var(--ft-primary); font-weight: 800; }

.ft-cat-pills { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-bottom: 2rem; }
.ft-cat-pills a {
  padding: .5rem 1rem; border-radius: 999px; background: var(--ft-bg-mute); color: var(--ft-text);
  font-size: .82rem; font-weight: 700; text-decoration: none; border: 1px solid var(--ft-border); transition: all .15s ease;
}
.ft-cat-pills a:hover { background: var(--ft-primary); color: #fff; border-color: var(--ft-primary); transform: translateY(-2px); }

.ft-cat-section { margin-bottom: 2.5rem; scroll-margin-top: 1.5rem; }
.ft-cat-section h2 {
  font-size: 1.3rem; font-weight: 800; margin: 0 0 1rem; display: flex; align-items: center; gap: .6rem;
  padding-bottom: .6rem; border-bottom: 2px solid var(--ft-border);
}
.ft-cat-section h2 i { color: var(--ft-primary); }
.ft-cat-section h2 .ft-cat-count { margin-left: auto; font-size: .78rem; font-weight: 600; color: var(--ft-text-mute); border: none; padding: 0; }

.ft-tool-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .ft-tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .ft-tool-grid { grid-template-columns: repeat(3, 1fr); } }

.ft-tool-card {
  display: flex; gap: .85rem; padding: 1.1rem; background: var(--ft-bg-soft); border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius-lg); text-decoration: none; color: inherit; transition: all .15s ease;
}
.ft-tool-card:hover { border-color: var(--ft-primary-light); box-shadow: var(--ft-shadow-lg); transform: translateY(-3px); }
.ft-tool-card .ft-tool-card-icon {
  width: 42px; height: 42px; border-radius: var(--ft-radius); background: rgba(79,70,229,.1); color: var(--ft-primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.ft-tool-card h3 { font-size: .92rem; font-weight: 700; margin: 0 0 .3rem; }
.ft-tool-card p { font-size: .8rem; color: var(--ft-text-soft); margin: 0; line-height: 1.4; }
.ft-tool-card.ft-filtered-out { display: none; }

.ft-no-results { text-align: center; padding: 3rem 1rem; color: var(--ft-text-mute); display: none; }
.ft-no-results.is-visible { display: block; }

/* Related-tools block, injected at the bottom of every tool page */
.ft-related { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 1px solid var(--ft-border); }
.ft-related h2 { font-size: 1.1rem; font-weight: 800; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }
.ft-related h2 i { color: var(--ft-primary); }
.ft-related-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 640px) { .ft-related-grid { grid-template-columns: repeat(3, 1fr); } }
.ft-related-card {
  display: flex; align-items: center; gap: .6rem; padding: .85rem; background: var(--ft-bg-soft); border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius); text-decoration: none; color: inherit; font-size: .85rem; font-weight: 600; transition: all .15s ease;
}
.ft-related-card:hover { border-color: var(--ft-primary-light); transform: translateX(3px); }
.ft-related-card i { color: var(--ft-primary); flex-shrink: 0; }
