/* ===== Variabili ===== */
.imt-vid {
	--imt-yellow: #e0a82e;
	--imt-yellow-dark: #c99320;
	--imt-text: #222;
	--imt-radius: 20px;
	--imt-shadow: 0 12px 30px rgba(0, 0, 0, .12);
	font-family: "Montserrat", sans-serif;
	color: var(--imt-text);
}
.imt-vid *, .imt-vid *::before, .imt-vid *::after { box-sizing: border-box; }

/* ===== Filtri ===== */
.imt-vid-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.imt-vid .imt-vid-filter { font-family: inherit; border: 0; margin: 0; cursor: pointer; background: #fff; color: var(--imt-text); padding: 8px 16px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; box-shadow: 0 2px 6px rgba(0, 0, 0, .06); transition: .2s; }
.imt-vid .imt-vid-filter:hover,
.imt-vid .imt-vid-filter:focus { background: #f1f1f1; color: var(--imt-text); }
.imt-vid .imt-vid-filter.is-active { background: var(--imt-yellow); color: #fff; }

/* ===== Griglia ===== */
.imt-vid-grid { display: grid; gap: 28px; }
.imt-vid-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.imt-vid-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* ===== Card ===== */
.imt-vid .imt-vid-card { display: flex; flex-direction: column; background: #fff; border-radius: var(--imt-radius); box-shadow: var(--imt-shadow); overflow: hidden; color: var(--imt-text); text-decoration: none; transition: transform .25s, box-shadow .25s; }
.imt-vid .imt-vid-card:hover,
.imt-vid .imt-vid-card:focus-visible { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0, 0, 0, .16); color: var(--imt-text); }
.imt-vid-card[hidden] { display: none !important; }

.imt-vid-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #111; overflow: hidden; }
.imt-vid-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s; }
.imt-vid-card:hover .imt-vid-thumb img { transform: scale(1.05); }
.imt-vid-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .35), transparent 55%); }

.imt-vid-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; background: var(--imt-yellow); display: flex; align-items: center; justify-content: center; z-index: 1; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); transition: transform .25s, background .25s; }
.imt-vid-play svg { width: 28px; height: 28px; fill: #fff; margin-left: 3px; }
.imt-vid-card:hover .imt-vid-play { transform: translate(-50%, -50%) scale(1.1); background: var(--imt-yellow-dark); }

.imt-vid-pill { position: absolute; top: 14px; right: 14px; z-index: 1; background: #555; color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; }
.imt-vid-title { display: block; padding: 18px 22px 22px; font-size: 16px; font-weight: 600; line-height: 1.35; text-transform: uppercase; }

/* ===== Paginazione ===== */
.imt-vid-pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 32px; }
.imt-vid-pager[hidden] { display: none; }
.imt-vid .imt-vid-page { min-width: 42px; height: 42px; padding: 0 12px; margin: 0; border: 0; border-radius: 10px; background: #fff; color: var(--imt-text); font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .06); transition: .2s; }
.imt-vid .imt-vid-page:hover:not(:disabled),
.imt-vid .imt-vid-page:focus:not(:disabled) { background: #f1f1f1; color: var(--imt-text); }
.imt-vid .imt-vid-page.is-active,
.imt-vid .imt-vid-page.is-active:hover { background: var(--imt-yellow); color: #fff; }
.imt-vid .imt-vid-page:disabled { opacity: .35; cursor: default; }

.imt-vid-empty-front { background: #fff; border-radius: var(--imt-radius); padding: 40px; text-align: center; font-weight: 600; margin: 0; }

/* ===== Popup ===== */
.imt-vid-modal { position: fixed; inset: 0; z-index: 99999; background: rgba(0, 0, 0, .9); display: none; align-items: center; justify-content: center; padding: 70px 20px 20px; font-family: "Montserrat", sans-serif; }
.imt-vid-modal.is-open { display: flex; }
.imt-vid-modal-box { position: relative; width: min(1100px, 100%, calc((100vh - 180px) * 16 / 9)); }
.imt-vid-modal-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; }
.imt-vid-modal-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.imt-vid-modal-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.imt-vid-modal-title { color: #fff; font-weight: 600; font-size: 16px; text-transform: uppercase; }

.imt-vid-modal .imt-vid-modal-yt { display: inline-flex; align-items: center; gap: 8px; background: #e0a82e; color: #fff; text-decoration: none; font-weight: 700; text-transform: uppercase; font-size: 13px; padding: 12px 20px; border-radius: 8px; transition: background .2s; }
.imt-vid-modal .imt-vid-modal-yt:hover,
.imt-vid-modal .imt-vid-modal-yt:focus { background: #c99320; color: #fff; }
.imt-vid-modal-yt svg { width: 16px; height: 16px; fill: currentColor; }

.imt-vid-modal .imt-vid-modal-close { position: absolute; top: -54px; right: 0; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.imt-vid-modal .imt-vid-modal-close:hover,
.imt-vid-modal .imt-vid-modal-close:focus { background: #e0a82e; color: #111; }

html.imt-vid-noscroll { overflow: hidden; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
	.imt-vid-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
	.imt-vid-grid.cols-3,
	.imt-vid-grid.cols-2 { grid-template-columns: 1fr; gap: 20px; }
	.imt-vid-play { width: 56px; height: 56px; }
	.imt-vid-modal-bar { flex-direction: column; align-items: flex-start; }
}
/* ===== Margini interni nel foglio grigio ===== */
.imt-vid { padding: 50px 50px 60px; }
@media (max-width: 1024px) { .imt-vid { padding: 36px 30px 44px; } }
@media (max-width: 640px)  { .imt-vid { padding: 24px 16px 30px; } }

/* ===== Anteprime: riempiono il riquadro 16:9 (taglia le bande nere di YouTube) ===== */
.imt-vid .imt-vid-thumb img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-width: none; object-fit: cover; }
