/* HW Publisher - images in page content (site + editor preview) */

.hwimg
{
	margin: 6px 0 14px 0;
	padding: 0;
	max-width: 100%;
	box-sizing: border-box;
}

.hwimg a
{
	display: block;
	line-height: 0;
}

/* The theme gives images in lists and paragraphs side margins
   (".entry-summary li img { margin: 0 25px }") - inside a figure the image must fill it exactly */
.inside-article .hwimg img,
.inside-article .hwimg a
{
	margin: 0 !important;
	max-width: 100%;
}

.hwimg img
{
	display: block;
	width: 100%;
	height: auto;
	border-radius: 2px;
}

.hwimg figcaption
{
	font-size: 0.82em;
	line-height: 1.35;
	color: #666;
	margin-top: 5px;
	text-align: center;
	font-style: italic;
}

/* Floated left / right */
.hwimg-left
{
	float: left;
	clear: left;
	margin: 6px 22px 14px 0;
}

.hwimg-right
{
	float: right;
	clear: right;
	margin: 6px 0 14px 22px;
}

.hwimg-left.hwimg-s, .hwimg-right.hwimg-s { width: 180px; }
.hwimg-left.hwimg-m, .hwimg-right.hwimg-m { width: 240px; }
.hwimg-left.hwimg-l, .hwimg-right.hwimg-l { width: 360px; }

/* Centered block */
.hwimg-center
{
	clear: both;
	margin: 18px auto 22px auto;
}

.hwimg-center.hwimg-s { width: 50%; }
.hwimg-center.hwimg-m { width: 75%; }
.hwimg-center.hwimg-l { width: 100%; }

/* Gallery of small thumbnails */
.hwgallery
{
	clear: both;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 16px 0 20px 0;
}

.hwgallery .hwimg
{
	margin: 0;
	width: 180px;
}

.hwgallery .hwimg img
{
	height: 135px;
	object-fit: cover;
}

/* Title image - first paragraph of the article containing only the image, floated right.
   Covers the new markup (img.hwimg-title) and the older hand made one
   (<p><img style="float: right;" width="120"></p>). The selectors are prefixed with
   .inside-article so they beat the theme rule ".entry-summary p img { margin: 0 25px }". */
.inside-article img.hwimg-title,
.inside-article p:has(> img:only-child[style*="right"]) > img
{
	float: right;
	margin: 0 0 10px 20px !important;
	object-fit: cover;
}

.inside-article img.hwimg-title-frame
{
	box-sizing: content-box;
	border: 1px solid #b0b0b0;
	padding: 0;
}

/* The paragraph holding the title image takes no space, so the perex starts at the image top */
.inside-article p.hwtitle-p,
.inside-article p:has(> img.hwimg-title:only-child),
.inside-article p:has(> img:only-child[style*="right"])
{
	margin: 0 !important;
	padding: 0 !important;
	height: 0;
	line-height: 0;
}

/* Floats must not leak out of the article box (list of articles, older articles without hwclear) */
.inside-article .entry-header::after,
.inside-article .entry-summary::after
{
	content: "";
	display: table;
	clear: both;
}

/* End of text flow around floated images */
.hwclear
{
	clear: both;
	height: 0;
	overflow: hidden;
}

/* Mobile - floats would make the text column too narrow */
@media (max-width: 600px)
{
	.hwimg-left, .hwimg-right
	{
		float: none;
		margin: 12px auto 16px auto;
	}

	.hwimg-left.hwimg-s, .hwimg-right.hwimg-s,
	.hwimg-left.hwimg-m, .hwimg-right.hwimg-m,
	.hwimg-left.hwimg-l, .hwimg-right.hwimg-l
	{
		width: 80%;
	}

	.hwimg-center.hwimg-s, .hwimg-center.hwimg-m
	{
		width: 100%;
	}

	.hwgallery .hwimg
	{
		width: calc(50% - 6px);
	}
}
