/* =========================================================================
   Documents — Ҳуҷҷатҳо: слайдер подпунктов + карточки PDF + окно чтения
   ========================================================================= */

.docs-page {
	padding-block: 32px 64px;
	min-height: 55vh;
}

/* ---------- Слайдер подпунктов ---------- */

.docs-slider {
	--docs-gap: 18px;
	--docs-visible: 3;
	margin-bottom: 36px;
}

.docs-slider__nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	margin-bottom: 14px;
}

.docs-slider__arrows {
	display: flex;
	gap: 8px;
}

/* ---------- Поиск (рядом со стрелками) ---------- */

.docs-search {
	display: flex;
	align-items: center;
	flex: 0 1 320px;
	min-width: 0;
	height: 38px;
	background: var(--toj-bg-light);
	border: 1px solid transparent;
	border-radius: 10px;
	transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.docs-search:focus-within {
	background: var(--toj-white);
	border-color: var(--toj-blue);
	box-shadow: 0 0 0 3px rgba(44, 165, 224, 0.15);
}

.docs-search__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.docs-search__input {
	flex: 1;
	min-width: 0;
	height: 100%;
	padding: 0 4px 0 14px;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 14px;
	color: var(--toj-text);
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.docs-search__input::-webkit-search-cancel-button,
.docs-search__input::-webkit-search-decoration {
	display: none;
}

.docs-search__input::placeholder {
	color: var(--toj-text-muted);
}

.docs-search__clear,
.docs-search__submit {
	flex: none;
	width: 34px;
	height: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: none;
	color: var(--toj-text-muted);
	cursor: pointer;
	transition: color .2s ease;
}



.docs-search__submit:hover,
.docs-search__submit:focus-visible {
	color: var(--toj-blue);
}

.docs-results {
	margin: 0 0 18px;
	font-size: 14px;
	color: var(--toj-text-muted);
}

.docs-slider__arrow {
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 10px;
	background: var(--toj-bg-light);
	color: var(--toj-text);
	transition: background .2s ease, color .2s ease, opacity .2s ease;
}

.docs-slider__arrow:hover,
.docs-slider__arrow:focus-visible {
	background: var(--toj-blue);
	color: #fff;
}

.docs-slider__arrow:disabled {
	opacity: .35;
	pointer-events: none;
}

/* Все карточки помещаются — стрелки не нужны */
.docs-slider.is-static .docs-slider__arrows {
	display: none;
}

.docs-slider__viewport {
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
	margin-inline: -4px;
	padding: 6px 4px 14px; /* место под тень и подъём при hover */
}

.docs-slider__viewport::-webkit-scrollbar {
	display: none;
}

.docs-slider__track {
	display: flex;
	gap: var(--docs-gap);
}

.docs-slider__item {
	flex: 0 0 calc((100% - (var(--docs-visible) - 1) * var(--docs-gap)) / var(--docs-visible));
	min-width: 0;
	scroll-snap-align: start;
}

.docs-slide {
	display: flex;
	align-items: center;
	gap: 16px;
	height: 100%;
	min-height: 96px;
	padding: 22px 26px;
	background: var(--toj-white);
	border: 1px solid var(--toj-border);
	border-radius: 16px;
	box-shadow: 0 4px 16px rgba(31, 39, 51, 0.06);
	color: var(--toj-text);
	transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease, background .3s ease, color .3s ease;
}

.docs-slide__icon {
	flex: none;
	width: 50px;
	height: 50px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	background: rgba(44, 165, 224, 0.12);
	color: var(--toj-blue);
	transition: background .3s ease, color .3s ease;
}

.docs-slide__title {
	min-width: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 16px;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.docs-slide:hover,
.docs-slide:focus-visible {
	transform: translateY(-3px);
	border-color: rgba(77, 134, 177, 0.4);
	box-shadow: 0 12px 28px rgba(31, 39, 51, 0.12);
	color: var(--toj-blue);
}

/* Активный подпункт — залит фирменным градиентом */
.docs-slide.is-active,
.docs-slide.is-active:hover {
	background: var(--toj-blue-dark);
	border-color: transparent;
	color: #fff;
	box-shadow: 0 10px 24px rgba(44, 165, 224, 0.38);
	transform: none;
}

.docs-slide.is-active .docs-slide__icon {
	background: rgba(255, 255, 255, 0.22);
	color: #fff;
}

/* ---------- Заголовок страницы ---------- */

.docs-page__head {
	margin-bottom: 24px;
}

.docs-page__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 22px;
	color: var(--toj-text);
}

.docs-page__intro {
	margin-bottom: 24px;
	color: var(--toj-text-muted);
	line-height: 1.7;
}

.docs-swap,
.docs-head {
	transition: opacity .2s ease;
}

.docs-swap.is-loading,
.docs-head.is-loading {
	opacity: .45;
	pointer-events: none;
}

/* ---------- Карточки ---------- */

.docs-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}

.doc-card {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: start;
	gap: 16px;
	padding: 20px;
	background: var(--toj-white);
	border: 1px solid var(--toj-border);
	border-radius: 16px;
	box-shadow: 0 4px 16px rgba(31, 39, 51, 0.06);
	transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}

.doc-card:hover,
.doc-card:focus-within {
	transform: translateY(-4px);
	box-shadow: 0 12px 28px rgba(31, 39, 51, 0.12);
	border-color: rgba(77, 134, 177, 0.35);
}

.doc-card__icon {
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	background: rgba(44, 165, 224, 0.12);
	color: var(--toj-blue);
}

.doc-card__body {
	min-width: 0;
}

.doc-card__title {
	margin: 0 0 8px;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 15px;
	line-height: 1.4;
	color: var(--toj-text);
}

/* Кнопка-заголовок: растягиваем кликабельную зону на всю карточку */
.doc-card__open {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	transition: color .2s ease;
}

.doc-card__open::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 16px;
}

.doc-card__open:focus-visible {
	outline: none;
}

.doc-card:has(.doc-card__open:focus-visible) {
	outline: 2px solid var(--toj-blue);
	outline-offset: 2px;
}

.doc-card:hover .doc-card__open {
	color: var(--toj-blue);
}

.doc-card__text {
	margin: 0;
	font-size: 13px;
	line-height: 1.55;
	color: var(--toj-text-muted);
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Значок скачивания — поверх кликабельной зоны карточки */
.doc-card__dl {
	position: relative;
	z-index: 2;
	width: 42px;
	height: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--toj-bg-light);
	color: var(--toj-blue);
	transition: background .2s ease, color .2s ease, transform .2s ease;
}

.doc-card__dl:hover,
.doc-card__dl:focus-visible {
	background: var(--toj-blue);
	color: #fff;
	transform: scale(1.08);
}

.doc-card--nofile .doc-card__icon {
	background: var(--toj-bg-light);
	color: var(--toj-text-muted);
}

.docs-empty {
	padding: 40px 20px;
	text-align: center;
	color: var(--toj-text-muted);
	background: var(--toj-bg-light);
	border-radius: 14px;
}

.docs-empty a {
	color: var(--toj-blue);
	font-weight: 600;
}

/* ---------- Окно чтения PDF ---------- */

body.doc-modal-open {
	overflow: hidden;
}

.doc-modal {
	position: fixed;
	inset: 0;
	z-index: 10001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.doc-modal[hidden] {
	display: none;
}

.doc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 30, 40, 0.72);
}

.doc-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(1100px, 100%);
	height: min(92vh, 100%);
	background: var(--toj-white);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.doc-modal__bar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px 12px 20px;
	border-bottom: 1px solid var(--toj-border);
	background: var(--toj-white);
}

.doc-modal__title {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 15px;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.doc-modal__btn {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 38px;
	padding: 0 14px;
	border: none;
	border-radius: 10px;
	background: var(--toj-bg-light);
	color: var(--toj-text);
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 13px;
	transition: background .2s ease, color .2s ease;
}

.doc-modal__btn:hover,
.doc-modal__btn:focus-visible {
	background: var(--toj-blue);
	color: #fff;
}

.doc-modal__btn--close {
	width: 38px;
	padding: 0;
	justify-content: center;
}

.doc-modal__frame {
	flex: 1 1 auto;
	width: 100%;
	border: 0;
	background: #525659;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
	.docs-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.docs-slider {
		--docs-visible: 2;
	}
}

@media (max-width: 700px) {
	.docs-page {
		padding-block: 24px 44px;
	}

	.docs-grid {
		grid-template-columns: 1fr;
		gap: 14px;
	}

	.docs-slider {
		--docs-visible: 1;
		--docs-gap: 12px;
	}

	.docs-search {
		flex: 1 1 200px;
	}

	.docs-slide {
		min-height: 80px;
		padding: 16px 18px;
	}

	.doc-card {
		padding: 16px;
		gap: 12px;
	}

	.doc-modal {
		padding: 0;
	}

	.doc-modal__dialog {
		height: 100%;
		border-radius: 0;
	}

	.doc-modal__btn span {
		display: none;
	}

	.doc-modal__btn {
		width: 38px;
		padding: 0;
		justify-content: center;
	}
}