/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * Copyright © 2026 Marcel Rymenhout and IniqDash contributors */
/* ==========================================================================
   Image Widget V1. The picture fills the widget's own box: cover (crop) or contain (whole
   picture), with a focal position. Caption and placeholder scale with MaisonFit (--fit).
   ========================================================================== */
.im {
  position: relative;
  container: im / size;
  --fit-ref-w: 300; --fit-ref-h: 200; --fit-min: .7px; --fit-max: 1.3px;
  margin: 0;
  min-width: 0; min-height: 40px;
  overflow: hidden;
  border-radius: var(--radius-device);
  color: var(--text-primary);
  font-family: var(--font);
}
.im[data-surface="true"] { background: #15171c; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 0 12px 26px -16px rgba(0, 0, 0, .75); }
.im__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--im-pos, 50% 50%); display: block; user-select: none; -webkit-user-drag: none; }
.im[data-fit-mode="contain"] .im__img { object-fit: contain; }
.im[data-img="none"] .im__img, .im[data-img="loading"] .im__img { visibility: hidden; }
.im__ph { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: calc(6 * var(--fit)); color: var(--text-muted); font-size: max(11px, calc(12 * var(--fit))); }
.im__ph svg { width: calc(30 * var(--fit)); height: calc(30 * var(--fit)); }
.im[data-img="none"] .im__ph { display: flex; }
.im__cap { position: absolute; left: 0; right: 0; bottom: 0; display: none; padding: calc(20 * var(--fit)) calc(14 * var(--fit)) calc(10 * var(--fit)); font-size: max(11px, calc(14 * var(--fit))); font-weight: var(--iq-fw-subtitle);
  background: linear-gradient(180deg, transparent, rgba(5, 6, 8, .72)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.im[data-caption="true"] .im__cap:not(:empty) { display: block; }
.im[data-fit-arr="mini"] .im__cap, .im[data-fit-arr="mini"] .im__ph span { display: none !important; }
.im__next { opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.im__next.im__in { opacity: 1; }
.im[data-img="none"] .im__next { display: none; }
@media (prefers-reduced-motion: reduce) { .im__next { transition: none; } }
