/* ==========================================================================
   Шаблон news.list «ls_avtor_page» — страница автора (/avtor/)
   Все стили ограничены обёрткой .ls-avtor-page, чтобы не влиять на остальной сайт.
   Цвета и шрифт — в духе шаблона TM_LazarovStudio (Montserrat, акцент #d0a75b),
   как в статьях блога (tm_blog/news.detail).
   ========================================================================== */

/* --- Исходные стили шаблона (сохранены) --- */
div.news-list {
	word-wrap: break-word;
}

div.news-list img.preview_picture {
	float: left;
	margin: 0 4px 6px 0;
}

.news-date-time {
	color: #486DAA;
}

/* --- Обёртка страницы автора: настройки через CSS-переменные --- */
.news-list.ls-avtor-page {
	--ls-avtor-max-width: 880px;
	--ls-avtor-side-padding: 20px;
	--ls-avtor-font-size: 17px;
	--ls-avtor-line-height: 1.7;
	--ls-avtor-text-color: #3f3a36;
	--ls-avtor-heading-color: #302928;
	--ls-avtor-muted-color: #686868;
	--ls-avtor-accent: var(--primary-main, #d0a75b);
	--ls-avtor-accent-hover: var(--primary-action, #ffcd43);
	--ls-avtor-border: #eadfcd;
	--ls-avtor-surface: #f9f6f0;
	--ls-avtor-radius: 8px;
	--ls-avtor-flow: 1.1em;

	box-sizing: border-box;
	width: 100%;
	max-width: calc(var(--ls-avtor-max-width) + var(--ls-avtor-side-padding) * 2);
	/* перекрывает div.news-list { margin-top: 55px } из old_style.css */
	margin: clamp(24px, 4vw, 55px) auto var(--mb100, 60px);
	padding: 0 var(--ls-avtor-side-padding);
	color: var(--ls-avtor-text-color);
	font-family: "Montserrat", Arial, sans-serif;

	@media (max-width: 768px) {
		--ls-avtor-side-padding: 16px;
		--ls-avtor-font-size: 16px;
		--ls-avtor-line-height: 1.65;
	}

	@media (max-width: 480px) {
		--ls-avtor-side-padding: 12px;
	}

	/* Элемент списка (раньше был <p>, теперь <div> — внутри есть абзацы и галереи) */
	.ls-avtor-page__item {
		margin: 0 0 2em;

		&:last-child {
			margin-bottom: 0;
		}
	}

	/* Изображение анонса: обтекание на десктопе, на всю ширину на мобильных */
	img.preview_picture {
		max-width: 40%;
		height: auto;
		margin: 0.3em 1.5em 1em 0;
		border-radius: var(--ls-avtor-radius);

		@media (max-width: 600px) {
			float: none;
			max-width: 100%;
			margin: 0 0 1em;
		}
	}

	.ls-avtor-page__name {
		display: inline-block;
		margin-bottom: 0.5em;
		color: var(--ls-avtor-heading-color);
		font-size: clamp(20px, 2.4vw, 26px);
		font-weight: 700;
		line-height: 1.3;
	}

	/* Замена inline style="clear:both" исходного шаблона */
	.ls-avtor-page__clear {
		clear: both;
	}
}

/* ==========================================================================
   Типографика контента (PREVIEW_TEXT / DETAIL_TEXT)
   ========================================================================== */
.ls-avtor-page .ls-avtor-content {
	font-size: var(--ls-avtor-font-size);
	line-height: var(--ls-avtor-line-height);
	overflow-wrap: break-word;

	/* Вертикальный ритм: отступ только между соседними блоками */
	> * + * {
		margin-top: var(--ls-avtor-flow);
	}

	p {
		margin: 0;
		line-height: inherit;
	}

	> * + p {
		margin-top: var(--ls-avtor-flow);
	}

	/* Пустые абзацы визуального редактора не создают лишних отступов */
	> p:empty,
	> div:empty {
		display: none;
	}

	a {
		color: inherit;
		border-bottom: 1px solid var(--ls-avtor-accent);
		text-decoration: none;
		text-decoration-skip-ink: none;

		&:hover {
			color: var(--ls-avtor-accent);
		}
	}

	strong,
	b {
		font-weight: 700;
	}

	/* --- Заголовки h1–h6 --- */
	h1, h2, h3, h4, h5, h6 {
		margin: 1.8em 0 0.6em;
		color: var(--ls-avtor-heading-color);
		font-family: inherit;
		font-weight: 700;
		line-height: 1.25;
		letter-spacing: -0.01em;

		&:first-child {
			margin-top: 0;
		}

		+ * {
			margin-top: 0;
		}
	}

	h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 400; line-height: 1.15; }
	h2 { font-size: clamp(24px, 3vw, 32px); }
	h3 { font-size: clamp(20px, 2.4vw, 25px); }
	h4 { font-size: clamp(18px, 2vw, 21px); }
	h5 { font-size: 1.05em; }
	h6 {
		font-size: 0.9em;
		color: var(--ls-avtor-muted-color);
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}

	/* --- Списки: восстанавливаем маркеры, сброшенные глобальными стилями сайта --- */
	ul,
	ol {
		display: block;
		margin-left: 0;
		padding-left: 1.5em;
		counter-reset: none;
	}

	ul {
		list-style: disc outside;

		ul {
			list-style-type: circle;
		}
	}

	ol {
		list-style: decimal outside;
	}

	/* old_style.css задаёт ol li { display:inline-block; padding-left:50px; ... } и счётчик в ::before */
	li {
		display: list-item;
		position: static;
		width: auto;
		margin: 0;
		padding: 0 0 0 0.25em;
		color: inherit;
		font-size: inherit;
		font-weight: inherit;
		line-height: inherit;
		list-style: inherit;

		&::before {
			content: none;
			display: none;
		}

		+ li {
			margin-top: 0.4em;
		}

		> ul,
		> ol {
			margin-top: 0.4em;
		}

		&::marker {
			color: var(--ls-avtor-accent);
		}
	}

	/* --- Цитаты --- */
	blockquote {
		margin: 1.6em 0;
		padding: 1em 1.4em;
		color: var(--ls-avtor-heading-color);
		font-style: italic;
		background: var(--ls-avtor-surface);
		border-left: 4px solid var(--ls-avtor-accent);
		border-radius: 0 var(--ls-avtor-radius) var(--ls-avtor-radius) 0;

		p + p {
			margin-top: 0.6em;
		}

		cite {
			display: block;
			margin-top: 0.6em;
			color: var(--ls-avtor-muted-color);
			font-size: 0.9em;
			font-style: normal;
		}
	}

	/* --- Изображения и медиа в тексте --- */
	img {
		max-width: 100%;
		height: auto;
		border-radius: var(--ls-avtor-radius);
	}

	> img,
	> p > img:only-child,
	figure {
		margin-block: 1.6em;
	}

	figure img {
		width: 100%;
	}

	figcaption {
		margin-top: 0.5em;
		color: var(--ls-avtor-muted-color);
		font-size: 0.875em;
		text-align: center;
	}

	iframe,
	video {
		display: block;
		max-width: 100%;
		border: 0;
		border-radius: var(--ls-avtor-radius);
	}

	hr {
		height: 1px;
		margin: 2em 0;
		background: var(--ls-avtor-border);
	}

	/* --- Таблицы: на узких экранах таблица сама становится блоком с горизонтальным скроллом --- */
	table {
		width: 100%;
		margin-block: 1.6em;
		border-collapse: collapse;
		border-spacing: 0;
		font-size: 0.92em;
		line-height: 1.5;

		@media (max-width: 768px) {
			display: block;
			max-width: 100%;
			overflow-x: auto;
			-webkit-overflow-scrolling: touch;
		}
	}

	caption {
		padding-bottom: 0.6em;
		color: var(--ls-avtor-muted-color);
		font-size: 0.9em;
		text-align: left;
	}

	th,
	td {
		padding: 0.7em 0.9em;
		text-align: left;
		vertical-align: top;
		border: 1px solid var(--ls-avtor-border);
	}

	th,
	thead td {
		color: var(--ls-avtor-heading-color);
		font-weight: 700;
		background: var(--ls-avtor-surface);
	}

	tbody tr:nth-child(even) {
		background: #fcfaf6;
	}

	/* Обёртка-скролл, если таблица уже вставлена в div в редакторе */
	.table-responsive,
	.table-wrap {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;

		table {
			margin-block: 0;
		}
	}
}

/* ==========================================================================
   Картинка анонса из макроса #PREVIEW_PICTURE# (Fancybox 5)
   ========================================================================== */
.ls-avtor-page .ls-avtor-picture {
	margin-block: 1.8em;
	margin-inline: 0;

	.ls-avtor-picture__link {
		display: block;
		overflow: hidden;
		background: var(--ls-avtor-surface);
		border: 0;
		border-radius: var(--ls-avtor-radius);
		cursor: zoom-in;

		&:focus-visible {
			outline: 2px solid var(--ls-avtor-accent) !important;
			outline-offset: 2px;
		}
	}

	.ls-avtor-picture__img {
		display: block;
		width: 100%;
		max-width: 100%;
		height: auto;
		margin: 0;
		border-radius: 0;
		transition: transform var(--tr25, 0.25s) ease;
	}

	@media (hover: hover) {
		.ls-avtor-picture__link:hover .ls-avtor-picture__img {
			transform: scale(1.02);
		}
	}

	.ls-avtor-picture__caption {
		margin-top: 0.5em;
	}
}

/* ==========================================================================
   Галерея из макроса #КОД_СВОЙСТВА# (Swiper 11 + Fancybox 5)
   Без JS (или до инициализации Swiper) — сетка превью.
   ========================================================================== */
.ls-avtor-page .ls-avtor-gallery {
	--ls-gallery-gap: 12px;
	--ls-gallery-ratio: 4 / 3;
	--ls-gallery-min: 180px;
	--ls-gallery-nav-size: 40px;
	--swiper-theme-color: var(--ls-avtor-accent);
	--swiper-pagination-color: var(--ls-avtor-accent);
	--swiper-pagination-bullet-inactive-color: var(--ls-avtor-heading-color);
	--swiper-pagination-bullet-inactive-opacity: 0.25;
	--swiper-pagination-bullet-size: 8px;

	position: relative;
	margin-block: 1.8em;

	/* Сетка-фолбэк до инициализации Swiper */
	&:not(.is-initialized) .ls-avtor-gallery__wrapper {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(var(--ls-gallery-min), 1fr));
		gap: var(--ls-gallery-gap);
		transform: none;
	}

	&:not(.is-initialized) .ls-avtor-gallery__controls {
		display: none;
	}

	.ls-avtor-gallery__swiper {
		overflow: hidden;
		border-radius: var(--ls-avtor-radius);
	}

	.ls-avtor-gallery__slide {
		height: auto;
	}

	.ls-avtor-gallery__link {
		display: block;
		overflow: hidden;
		aspect-ratio: var(--ls-gallery-ratio);
		background: var(--ls-avtor-surface);
		border: 0;
		border-radius: var(--ls-avtor-radius);
		cursor: zoom-in;

		&:focus-visible {
			outline: 2px solid var(--ls-avtor-accent) !important;
			outline-offset: 2px;
		}
	}

	.ls-avtor-gallery__img {
		display: block;
		width: 100%;
		height: 100%;
		margin: 0;
		object-fit: cover;
		border-radius: 0;
		transition: transform var(--tr25, 0.25s) ease;
	}

	@media (hover: hover) {
		.ls-avtor-gallery__link:hover .ls-avtor-gallery__img {
			transform: scale(1.04);
		}
	}

	/* Панель управления: стрелки по краям, пагинация по центру */
	.ls-avtor-gallery__controls {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 16px;
		margin-top: 14px;
	}

	.ls-avtor-gallery__pagination {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 6px;
		min-width: 0;

		.swiper-pagination-bullet {
			margin: 0;
		}
	}

	.ls-avtor-gallery__nav {
		display: inline-flex;
		flex: 0 0 auto;
		align-items: center;
		justify-content: center;
		width: var(--ls-gallery-nav-size);
		height: var(--ls-gallery-nav-size);
		padding: 0;
		color: #fff;
		background: var(--ls-avtor-accent);
		border: 0;
		border-radius: 50%;
		cursor: pointer;
		transition: background-color var(--tr25, 0.25s), opacity var(--tr25, 0.25s);

		/* Стрелка-шеврон рисуется рамкой псевдоэлемента */
		&::before {
			content: "";
			width: 10px;
			height: 10px;
			border-top: 2px solid currentColor;
			border-right: 2px solid currentColor;
		}

		&:focus-visible {
			outline: 2px solid var(--ls-avtor-heading-color) !important;
			outline-offset: 2px;
		}

		&.swiper-button-disabled {
			opacity: 0.35;
			cursor: default;
		}

		&.swiper-button-lock {
			display: none;
		}
	}

	.ls-avtor-gallery__nav--prev::before {
		margin-left: 4px;
		transform: rotate(-135deg);
	}

	.ls-avtor-gallery__nav--next::before {
		margin-right: 4px;
		transform: rotate(45deg);
	}

	@media (hover: hover) {
		.ls-avtor-gallery__nav:not(.swiper-button-disabled):hover {
			background: var(--ls-avtor-accent-hover);
		}
	}

	/* Если все слайды помещаются (watchOverflow) — панель не нужна */
	.ls-avtor-gallery__controls:has(.swiper-button-lock) {
		display: none;
	}
}
