/*
Theme Name: HH Test
Description: Тестовое задание: анонсы статей с лайками.
Version: 1.0.0
Requires PHP: 7.4
Text Domain: hh-test
*/

/* ---------- База (mobile first, макет 360) ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: #fff;
	color: #000;
	font-family: "Inter", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

a {
	color: inherit;
	text-decoration: none;
}

h1,
h2,
p {
	margin: 0;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.page {
	display: flex;
	flex-direction: column;
	gap: 50px;
	min-height: 100vh;
	max-width: 1230px;
	margin: 0 auto;
	padding: 30px 15px;
}

.page__main {
	display: flex;
	flex-direction: column;
	gap: 30px;
	flex: 1 0 auto;
}

/* ---------- Шапка, меню, сайдбар, подвал ---------- */

.box {
	background: #f4f4f4;
	padding: 30px;
}

.box__title {
	font-size: 32px;
	font-weight: 400;
	line-height: 38px;
}

.header {
	padding: 15px;
}

.menu {
	background: #d9d9d9;
	padding: 0 10px;
}

.menu__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.menu__link {
	display: block;
	padding: 0 10px;
	font-size: 14px;
	font-weight: 700;
	line-height: 40px;
}

.menu__link:hover,
.menu__link:focus-visible {
	text-decoration: underline;
}

.layout {
	display: flex;
	flex-direction: column;
	gap: 30px;
}

.articles {
	display: flex;
	flex-direction: column;
	gap: 30px;
	min-width: 0;
	padding: 15px;
}

/* ---------- Карточка анонса ---------- */

.card {
	display: flex;
	flex-direction: column;
	background: #fff;
}

.card__thumb {
	flex: none;
	display: block;
	height: 170px;
	background: #d9d9d9;
}

.card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.card__body {
	display: flex;
	flex-direction: column;
	gap: 15px;
	flex: 1 1 auto;
	min-width: 0;
	padding: 20px;
}

.card__title {
	font-size: 18px;
	font-weight: 700;
	line-height: 24px;
}

.card__title a:hover,
.card__title a:focus-visible {
	text-decoration: underline;
}

.card__excerpt {
	color: #888;
	font-size: 14px;
	line-height: 20px;
}

.card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: auto;
}

.card__author {
	font-size: 14px;
	line-height: 22px;
}

/* ---------- Лайки ---------- */

.likes {
	display: flex;
	align-items: center;
	gap: 10px;
}

.likes__btn {
	display: block;
	width: 22px;
	height: 22px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	cursor: pointer;
	transition: opacity .2s, transform .2s;
}

.likes__btn svg {
	display: block;
	width: 22px;
	height: 22px;
}

.likes__btn:hover {
	transform: scale(1.12);
}

.likes__btn:focus-visible {
	outline: 2px solid #000;
	outline-offset: 2px;
}

/* голос отдан — вторая кнопка приглушается */
.likes.is-voted .likes__btn:not(.is-active) {
	opacity: .35;
}

.likes.is-loading .likes__btn {
	pointer-events: none;
}

.likes__count {
	min-width: 24px;
	color: #008000;
	font-size: 18px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
}

.likes__count.is-negative {
	color: #d32f2f;
}

/* ---------- Пагинация ---------- */

.pagination {
	display: flex;
	justify-content: center;
	padding: 0 20px;
	font-family: "Roboto", Arial, sans-serif;
}

.pagination__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 5px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pagination .page-numbers {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 16px;
}

.pagination a.page-numbers:hover,
.pagination a.page-numbers:focus-visible {
	background: #e4e4e4;
}

.pagination .page-numbers.current {
	background: #000;
	color: #fff;
}

.pagination .prev,
.pagination .next {
	min-width: 16px;
	padding: 0;
	font-weight: 700;
}

.pagination .is-disabled {
	opacity: .3;
}

.pagination__word {
	display: none;
}

.pagination__arrow {
	display: block;
	width: 16px;
	height: 16px;
}

.pagination .prev .pagination__arrow {
	transform: scaleX(-1);
}

/* ---------- Планшет (макет 768) ---------- */

@media (min-width: 768px) {
	.header {
		padding: 30px;
	}

	.menu {
		padding: 0 20px;
	}

	.articles {
		padding: 30px;
	}

	.card {
		flex-direction: row;
		align-items: flex-start;
	}

	.card__thumb {
		width: 170px;
		height: 170px;
	}

	.card__body {
		align-self: stretch;
	}

	.card__title {
		font-size: 24px;
		line-height: 28px;
	}

	.card__excerpt,
	.card__author {
		font-size: 18px;
		line-height: 22px;
	}

	.pagination__list {
		gap: 7px;
	}

	.pagination .prev,
	.pagination .next {
		min-width: 60px;
		padding: 0 6px;
	}

	.pagination__word {
		display: inline;
	}

	.pagination__arrow {
		display: none;
	}
}

/* ---------- Десктоп (макет 1440) ---------- */

@media (min-width: 1024px) {
	.page {
		gap: 172px;
	}

	.layout {
		flex-direction: row;
		align-items: flex-start;
	}

	.articles {
		flex: 1 1 auto;
	}

	.sidebar {
		flex: 0 0 293px;
	}
}
