/* MCMS2 — [files] widget: thumbnails, download button, preview window (assets/filelist/filelist.js).
   Loaded before the theme's stylesheet, so themes can change everything; colours via the variables below. */
.mcms-filelist { --mcms-files-accent: currentColor; --mcms-files-bg: #fff; --mcms-files-radius: 6px; }
.mcms-filelist .mcms-file { align-items: center; }
.mcms-file-main { min-width: 0; flex: 1 1 auto; }
.mcms-file-desc { display: inline-block; margin-top: .15em; opacity: .85; }
.mcms-filelist .mcms-file-size { margin-left: auto; }

/* thumbnails (thumbs=yes) */
.mcms-file-thumb { flex: none; display: flex; align-items: center; justify-content: center; width: 64px; height: 64px;
    border-radius: var(--mcms-files-radius); overflow: hidden; text-decoration: none; border: 0 !important; }
.mcms-file-thumb img { width: 64px; height: 64px; object-fit: cover; display: block; margin: 0; padding: 0; border: 0; box-shadow: none;
    border-radius: var(--mcms-files-radius); background: rgba(127, 127, 127, .12); }
.mcms-file-thumb .mcms-file-icon { width: 40px; height: 50px; }
.mcms-file-iconsrc[hidden] { display: none !important; }

/* download button */
.mcms-file-dl { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border-radius: 50%; color: var(--mcms-files-accent); opacity: .7; text-decoration: none !important; border: 0 !important;
    transition: opacity .15s, background-color .15s; }
.mcms-file-dl:hover, .mcms-file-dl:focus-visible { opacity: 1; background: rgba(127, 127, 127, .15); }
.mcms-file-dl svg { display: block; }

/* preview window */
html.mfp-lock { overflow: hidden; }
.mfp { position: fixed; inset: 0; z-index: 10000; display: none; align-items: center; justify-content: center; padding: 3vh 3vw;
    background: rgba(10, 10, 12, .82); }
.mfp.is-open { display: flex; }
.mfp-panel { position: relative; display: flex; flex-direction: column; width: min(1100px, 100%); max-height: 94vh;
    background: #fff; color: #222; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); overflow: hidden;
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.mfp-head { display: flex; align-items: center; gap: .75rem; padding: .6rem .6rem .6rem 1.1rem; border-bottom: 1px solid #e6e6e6; }
.mfp-title { flex: 1; min-width: 0; margin: 0; font: 600 1.05rem/1.3 inherit; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mfp-count { color: #777; font-size: .85rem; white-space: nowrap; }
.mfp-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0;
    border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.mfp-btn:hover, .mfp-btn:focus-visible { background: rgba(0, 0, 0, .08); }
.mfp-btn[hidden] { display: none; }
.mfp-body { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; background: #f3f3f3; }
.mfp-body img { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; margin: 0; padding: 0; border: 0; box-shadow: none; }
.mfp-pdf iframe { display: block; width: 100%; height: 72vh; border: 0; background: #fff; }
.mfp-video video { display: block; max-width: 100%; max-height: 72vh; background: #000; }
.mfp-audio { flex-direction: column; gap: 1rem; padding: 1.5rem; }
.mfp-audio audio { width: min(520px, 100%); }
.mfp-text { align-items: stretch; justify-content: flex-start; }
.mfp-text pre { margin: 0; padding: 1rem 1.2rem; width: 100%; max-height: 72vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
    font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; background: #fff; color: #222; }
.mfp-none { flex-direction: column; gap: 1rem; padding: 2rem 1.5rem; }
.mfp-poster img { max-height: 60vh; box-shadow: 0 4px 18px rgba(0, 0, 0, .18); background: #fff; }
.mfp-icon svg { width: 96px; height: 120px; }
.mfp-msg { margin: 0; max-width: 34rem; text-align: center; color: #555; }
.mfp-foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .75rem 1.1rem; border-top: 1px solid #e6e6e6; }
.mfp-info { flex: 1 1 18rem; min-width: 0; }
.mfp-desc { margin: 0 0 .2rem; white-space: pre-line; }
.mfp-desc[hidden] { display: none; }
.mfp-meta { color: #777; font-size: .85rem; overflow-wrap: anywhere; }
.mfp-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.mfp-action { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 999px; text-decoration: none !important;
    border: 1px solid #cfcfcf; color: #222 !important; background: #fff; font-size: .92rem; }
.mfp-action:hover, .mfp-action:focus-visible { background: #f0f0f0; }
.mfp-dl { background: #222; border-color: #222; color: #fff !important; }
.mfp-dl:hover, .mfp-dl:focus-visible { background: #000; }
.mfp-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, .9); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.mfp-nav:hover, .mfp-nav:focus-visible { background: #fff; }
.mfp-prev { left: .6rem; }
.mfp-next { right: .6rem; }
@media (max-width: 600px) {
    .mfp { padding: 0; }
    .mfp-panel { max-height: 100vh; height: 100%; border-radius: 0; }
    .mfp-body img, .mfp-pdf iframe, .mfp-video video, .mfp-text pre { max-height: none; }
    .mfp-pdf iframe { height: 100%; }
    .mfp-nav { top: 42%; width: 36px; height: 36px; }
    .mfp-prev { left: .3rem; }
    .mfp-next { right: .3rem; }
}
@media (prefers-color-scheme: dark) {
    .mfp-panel { background: #1e1f22; color: #e8e8e8; }
    .mfp-head, .mfp-foot { border-color: #333; }
    .mfp-body { background: #141518; }
    .mfp-text pre { background: #1a1b1e; color: #e8e8e8; }
    .mfp-msg, .mfp-meta, .mfp-count { color: #aaa; }
    .mfp-btn:hover { background: rgba(255, 255, 255, .1); }
    .mfp-action { background: #2a2b2f; color: #e8e8e8 !important; border-color: #444; }
    .mfp-dl { background: #e8e8e8; color: #111 !important; border-color: #e8e8e8; }
    .mfp-nav { background: rgba(40, 41, 45, .92); }
}
